ADFSFiler 151 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > s.ADFSFiler

;;----------------------------------------------------------------------------
;; ADFS Filer module
;;
;; Change List
;; -----------
;;  5-Apr-88    0.05    Change list added
;;  5-Apr-88    0.06    Taken over by NRaine
;; 11-Apr-88            Changed iconbar handle to -2 (Wimp changed)
;; 11-Apr-88            Implement disc menu (obtained from iconbar)
;; 12-Apr-88            Implement Format, Backup, Verify
;; 13-Apr-88            Ask Filer to close directories in namedisc/dismount
;; 13-Apr-88            Move Wimp offsets into Hdr.WimpSpace
;; 14-Apr-88            Change floppy menu so discname is read later
;; 22-Apr-88            Errors during initialisation should avoid looping
;; 22-Apr-88    0.07    If ADFS not present, don't give error (no icons)
;; 17-May-88            Remove cancel box from error reports
;; 17-May-88            Add L, D or E options to format menu
;; 17-May-88    0.08    Close down previous incarnation when starting up
;; 17-May-88    0.08    Use Desktop_ADFSFiler command to stop wally user
;; 19-May-88    0.09    Change RMA usage so block is only allocated on Startup
;; 26-May-88            Use %Dir and %Back to avoid problems with aliases
;; 26-May-88    0.10    Put validation string into NameDisc menu entry
;; 31-May-88    0.11    Remove "..." from disc menus
;; 21-Jun-88    0.12    Change to use Wimp_SpriteOp rather than BaseOfSprites
;; 27-Jun-88    0.13    Change background colour of iconbar icons to 0
;;  7-Jul-88            Fix bug: TEQVCP in  used r1 incorrectly
;;  8-Jul-88            Change menu colours to suit GBartram's defaults
;; 19-Jul-88    0.14    Use ADFS_DescribeDisc instead of *%Dir/*%Back
;; 18-Aug-88    0.15    Improve error message on Desktop_ADFSFiler
;; 25-Aug-88    0.16    Change 'format floppy' menu to remove "Arthur"
;;  1-Sep-88    0.17    Allow "," in namedisc strings
;; 20-Oct-88            Change to use new formatMake procedures
;;  1-Jun-89    0.18    Report errors in *NameDisc properly
;; 31-Jul-89    0.19    Check for zero drives (don't start up)
;; 31-Jul-89    0.20    Display disc name underneath hard disc icons
;; 31-Jul-89    0.21    When renaming hard discs, keep icon in same place
;;  6-Oct-89    0.22    Error while reading hard disc name => use drive number
;; 31-Oct-89    0.23    Implement interactive help
;;  2-Nov-89    0.24    Use MessageTrans module to get interactive help
;;  3-Nov-89    0.25    Use MessageTrans_MakeMenus to set up menu tree
;;  5-Dec-89            Dismount source disc after *Backup
;;  5-Dec-89    0.26    Provide backup submenu if multiple floppy drives
;;  9-Dec-89    0.27    Allow alias substitution for menu commands
;; 19-Feb-90    0.28    Use new ResourceFS mechanism
;; 26-Feb-90    0.29    Use WimpPriority_HardDiscs/FloppyDiscs
;; 27-Feb-90            Use Wimp_StartTask when formatting etc.
;;              0.30    Changed aliases to "ADFS_xxx"
;; 10-Sep-90    0.31    Changes * command for free space display to remove
;;                      the ':' for the FreeSpace module.
;; 08-Apr-91    0.32    Added messages list and Pass 300 to Wimp_Initialise.
;; 11-Apr-91    0.33    Added interactive format & verify support.
;; 31-May-91    0.34    Added support for 4 hard discs
;; 31-May-91    0.35    Re-done format/verify
;;  1-Jun-91    0.36    Fixed bug , re-build format menu if first time menu is opened.
;; 28-Aug-91    0.46    Changed to use showfree without alias
;; 30-Aug-91    0.47    Dismount disc after format before verify.
;; 08-Sep-91    0.49    Dismount backup destination after describe disc and give
;;                      disc record each write track operation.
;;                      Disable clicks on iconbar during format and backup
;;                      On incompatible *ALWAYS* put insert dest message in hole.
;;                      Put .$ on end of Filer_OpenDir command
;; 16-Sep-91    0.50    Re do identify format to use Service_IdentifyFormat. Fixes
;;                        address exception lurking in old implementation and causes
;;                        other formats to be recognised other than those on the menu.
;; 22-Oct-91    0.51    Improve desktop backup to not read unused parts of the disc.
;;                      Prevent help from going address exception after wandering over
;;                        the foreign formats submenu.
;;                      Move messages and templates to resourcefs
;;                      Provide a help message for the current format dialogue box.
;;                      Cause any disc error to give disc not formatted innthe dialogue box.
;;                      Fix Backup's handling of errors.
;;                      Fix format's disc name field to only accept 2 character or more of the
;;                        right type.
;;                      Reduce workspace requirement.
;;                      Complete the internationalisation.
;;                      Check format busy before getting disc name
;;              0.52    When format name box has the caret, hot keys (eg. F12) now work (fixes G-RO-7910).
;;                      "OK" not required in messages displayed when disc format/verify/backup succeeds.
;;                      When a disc with defects is desktop formatted to D or L format then at the
;;                        end of the verify stage, when the defects can't be mapped out, the verify
;;                        simulates a desktop verify and reports "Failed. ?? defects found" (fixes
;;                        bug G-RO-9894).
;; 12-Dec-91    0.53    Shortened some message tokens and removed some which were unused.
;; 23-Jan-92    0.54    Disc in source drive was always stamped even if backup was to another
;;                        drive (this caused problems when the source disc was protected).
;;                      Fixed nasty bug where ADFS_DiscOp could be told to read from/write to
;;                        the wrong drive during a twin drive backup.
;;                      Got rid of annoying green/red bits left in progress bar.
;;                      Completed internationalisation (remaining errors moved to Messages).
;;                      Replaced some help tokens which should not have been removed.
;;                      Added non-interactive disc operations (Format, Backup, Verify, Free).
;; 30-Jan-92    0.55    Now allocates the correct amount of memory for the format template instead
;;                        of using a fixed size buffer.
;;                      If laying down the disc structure when formatting fails, ADFSFiler no
;;                        longer tries to format past the end of the disc.
;;                      Now dismounts the disc when the format window is closed (avoid getting
;;                        stuck in "Unrecognised format..." messages on valid discs).
;;                      Fixed horrible purple and green error text in 256 colour modes.
;; 03-Feb-92    0.56    Adjust service call entry for changed Service_MessageFileClosed.
;; 20-Feb-92    0.57    Only dismount the disc when the window is closed if in a formatting state.
;;                      Handle upcalls about possible disc changes correctly (fixes RP-0462).
;;                      Fixed verify code which counted a track every time a known defect was found
;;                        which meant that much of the disc could be left unverified (fixes RP-0616).
;;                      Disc must always be dismounted before starting a format unless it
;;                        is unformatted (fixes bug RP-0169).
;; 06-Mar-92    0.58    If formatting a track fails (eg. due to protected disc) then try to format the
;;                        track again instead of skipping it when the format is continued (fixes RP-1501).
;; 12-Mar-92    0.59    Fixed bug reintroduced in version 0.57 which prevented unformatted disc
;;                        being formatted (fixes bug A-RO-7243 again).
;; 24-Mar-92  0.60 OSS  Fixed template memory allocations - RP-0920. Fixed
;;                      RMA rot on RMKill/RMTidy. Removed hard limits on
;;                      number of entries in format menus (allocate Tables
;;                      as required not fixed size up front). Added
;;                      validation string to disc name field in format
;;                      window in Templates file (same as for menu).
;;                      Stopped Verify losing about 1K RMA if no disk in
;;                      drive. Grey out "Other formats" menu entry if there
;;                      are no other formats - prevents crash on opening
;;                      empty menu. Call Wimp_DeleteWindow when the window
;;                      is no longer in use (more RMA rot!). Kill active
;;                      backup task if we are killed (and only permit one
;;                      backup at once). Bump backup wimp slot to 8K if it
;;                      is zero - prevents crash. Fix bug with passing ROM
;;                      pointer in R5 to Wimp_LoadTemplate.
;; 23-Apr-92  0.61 SMC  Stop Format/Backup windows being "paused" by UpCall after completion,
;;                        fixes (G-RO-9641).
;; 22-Jul-93  0.62 ECN  Stop it from zeroing the format menu width
;; 16-Sep-93  0.65 SMC  Verify now pauses after every defect including on last disc sector.
;;                      Backup with 0K apps memory free no longer gives data abort.
;;                      Reports of 1 defect are now singular rather than plural.
;;                      Menu now updated before being re-opened after ADJUST click.
;; 22-Sep-93  0.66 amg  Change the colour combination used for reporting defects - the
;;                      original combination of red and cream only left the Font Manager
;;                      with Green as an intermediate colour - which doesn't look so good!
;; 09-nov-93  0.67 FB   Added Sparrow Spec.:
;;                        new entry SHARE in the main menu;
;;                        not/protected/unprotected share type submenu;
;;                        functions to call ShareD_Create/StopShare SWIs;
;;                        ADFS CMOS (Byte &6B) check at installing time;
;;                        Read/Write CMOS bits functions.
;; 09-nov-93  0.68 RM  Moved ResourceFS_RegisterFiles to after the SetVarVal
;;                     in ADFSFiler_Init.
;; 10-Dec-93  0.69 SMC Restored tokens VENDS and FENDS in Messages file.
;;                     Backup now tries to get enough memory to do the op in one go.
;;                     Help for shaded menu items sorted out.
;;                     Adjust click on verify hard disc menu item now shades whole menu.
;; 14-Dec-93  0.70 SMC Now catches error &1089A (unformatted) in IdentifyDisc.
;; 19-Aug-94  0.71 SMC Now looks up command help/syntax messages.
;; 31-Aug-94  0.72 SMC Don't backup to discs with defects.
;; 28-Oct-94  0.73 SMC Sorted out message tokenisation.
;; 02-Nov-94  0.74 amg Change verify to cope with >512Mb discs
;; 10-Jan-95  0.76 SBP Change GetMediaName to avoid Ambiguous disc name on desktop boot (fatal,
;;                     boot fails and drops out of wimp to cli)
170 171 172 173
;; 28-May-97  0.85 RML Trap datasave messages and allow file saves to the iconbar icon
;;                     (resulting in saves to the root directory).
;; 08-Sep-97  0.86 RML Generate a Message_FilerDevicePath in response to Message_FilerSelection.
;; 26-Mar-98  0.87 RML Added Ursula service call table.
Neil Turton's avatar
Neil Turton committed
174 175
;;----------------------------------------------------------------------------

Ben Avison's avatar
Ben Avison committed
176 177 178 179
 [ :LNOT: :DEF: SCSI
        GBLL    SCSI
SCSI    SETL    {FALSE}
 ]
180 181 182 183 184
 [ :LNOT: :DEF: SDFS
        GBLL    SDFS
SDFS    SETL    {FALSE}
 ]

185
        GBLL    HotPlug
186
HotPlug SETL    (SCSI :LOR: SDFS) :LAND: {TRUE}
Ben Avison's avatar
Ben Avison committed
187

Kevin Bracey's avatar
Kevin Bracey committed
188
        AREA    |!!!Module|, CODE, READONLY
Neil Turton's avatar
Neil Turton committed
189 190 191 192 193 194

Module_BaseAddr

        GET     Hdr:ListOpts
        GET     Hdr:Macros
        GET     Hdr:System
Robert Sprowson's avatar
Robert Sprowson committed
195
        GET     Hdr:Services
Neil Turton's avatar
Neil Turton committed
196
        GET     Hdr:ModHand
197
        GET     Hdr:OsBytes
Neil Turton's avatar
Neil Turton committed
198 199 200 201 202 203 204 205 206 207 208 209 210
        GET     Hdr:CMOS
        GET     Hdr:FSNumbers
        GET     Hdr:HighFSI
        GET     Hdr:NewErrors
        GET     Hdr:Wimp
        GET     Hdr:WimpSpace
        GET     Hdr:Messages
        GET     Hdr:Sprite
        GET     Hdr:VduExt
        GET     Hdr:Variables
        GET     Hdr:Proc
        GET     Hdr:MsgTrans
        GET     Hdr:MsgMenus
211 212 213
      [ SDFS
        GET     Hdr:SDFS
      |
Ben Avison's avatar
Ben Avison committed
214 215 216
      [ SCSI
        GET     Hdr:SCSIFS
      |
Neil Turton's avatar
Neil Turton committed
217
        GET     Hdr:ADFS
218
      ]
Ben Avison's avatar
Ben Avison committed
219
      ]
Neil Turton's avatar
Neil Turton committed
220 221 222 223 224 225 226
        GET     Hdr:Territory
        GET     Hdr:FileCore
        GET     Hdr:MultiFS
        GET     Hdr:UpCall
        GET     Hdr:ResourceFS
        GET     Hdr:ShareD
        GET     Hdr:ExtraLong
227
        GET     Hdr:Hourglass
Neil Turton's avatar
Neil Turton committed
228

Ben Avison's avatar
Ben Avison committed
229
        GET     VersionASM
Neil Turton's avatar
Neil Turton committed
230 231 232 233

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Neil Turton's avatar
Neil Turton committed
234 235
                GBLL    StrongARM
StrongARM       SETL    {TRUE}
Neil Turton's avatar
Neil Turton committed
236 237

                GBLL    givehelp
Ben Avison's avatar
Ben Avison committed
238
givehelp        SETL    {TRUE}
Neil Turton's avatar
Neil Turton committed
239 240 241 242 243 244 245 246 247 248

                GBLL    tokenhelp       ; needed for international help
tokenhelp       SETL    {TRUE}

                GBLL    bodgedisc
bodgedisc       SETL    {TRUE}          ; needed for old FileCore modules

                GBLL    chkbkpdefects
chkbkpdefects   SETL    {TRUE}          ; SMC: don't allow backup to disc with defects

249 250 251
                GBLL    DragsToIconBar  ; RML: Are drags from save boxes/filer windows to our icon allowed?
DragsToIconBar  SETL    {TRUE}

252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
                GBLS    SWIPrefix
                GBLS    FSTitle
                GBLA    FSNumber
 [ SDFS
SWIPrefix       SETS    "SDFS"
FSTitle         SETS    "SDFS"
FSNumber        SETA    fsnumber_SDFS
 |
 [ SCSI
SWIPrefix       SETS    "SCSIFS"
FSTitle         SETS    "SCSI"
FSNumber        SETA    fsnumber_SCSIFS
 |
SWIPrefix       SETS    "ADFS"
FSTitle         SETS    "ADFS"
FSNumber        SETA    fsnumber_adfs
 ]
 ]

Neil Turton's avatar
Neil Turton committed
271 272
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

273
        GET     Hdr:NdrDebug
Neil Turton's avatar
Neil Turton committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291

        GBLL    debug
debug   SETL    {FALSE}

        GBLS    get1
        GBLS    get2
        GBLS    get3
      [ debug
get1    SETS    " GET Hdr:Debug"
get2    SETS    " GET Hdr:HostFS"
get3    SETS    " GET Hdr:HostDebug"
      ]
$get1
$get2
$get3

; +++++++++++++++++++ to load new templates and messages ++++++++++++++++++++++

Ben Avison's avatar
Ben Avison committed
292 293 294 295
 [ :LNOT: :DEF: standalone
        GBLL    standalone
standalone  SETL    {FALSE}
 ]
Neil Turton's avatar
Neil Turton committed
296 297 298 299 300 301 302 303 304 305 306 307

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                GBLL    Host_Debug
Host_Debug      SETL    {TRUE}

        MACRO
$Lab    DebugIt $Cond
        GBLL    debug$Lab
debug$Lab       SETL    debug :LAND: $Cond
        MEND

308 309 310 311 312 313 314
task    DebugIt {FALSE}
xx      DebugIt {FALSE}
fo      DebugIt {FALSE}
bkp     DebugIt {FALSE}
fom     DebugIt {FALSE}
id      DebugIt {FALSE}
ag      DebugIt {FALSE}
Neil Turton's avatar
Neil Turton committed
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376

        GBLL hostvdu
hostvdu SETL {TRUE}

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Register names
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

; sp            RN      r13             ; FD stack
; wp            RN      r12

scy             RN      r11
scx             RN      r10
y1              RN      r9
x1              RN      r8
y0              RN      r7
x0              RN      r6
cy1             RN      r5              ; Order important for LDMIA
cx1             RN      r4
cy0             RN      r3
cx0             RN      r2

; r0,r1 not named

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Macro definitions
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        MACRO
        max     $a, $b
        CMP     $a, $b
        MOVLT   $a, $b
        MEND

        MACRO
        min     $a, $b
        CMP     $a, $b
        MOVGT   $a, $b
        MEND

        MACRO
$label  FixDCB  $n, $string
        ASSERT  ((:LEN:"$string")<$n)
$label  DCB     "$string"
        LCLA    cnt
cnt     SETA    $n-:LEN:"$string"
        WHILE   cnt>0
        DCB     0
cnt     SETA    cnt-1
        WEND
        MEND

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Constants
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

TAB     *       9
LF      *       10
CR      *       13
space   *       32
delete  *       127

377 378 379 380 381 382 383 384
bignum          *       &0FFFFFFF

initbrx         *       100
initbry         *       1024-80

brxoffset       *       64
bryoffset       *       64

Neil Turton's avatar
Neil Turton committed
385 386
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Constant to tick Share entry
387
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Neil Turton's avatar
Neil Turton committed
388 389 390

shareoptions_share     *    1:SHL:0      ; for sparrow

391
 [ :LNOT: SDFS
Ben Avison's avatar
Ben Avison committed
392 393 394 395 396
 [ SCSI
; +++++++++++ SCSIFiler CMOS

SCSI_CMOS_Byte  *       &D0
 |
Neil Turton's avatar
Neil Turton committed
397 398 399
; +++++++++++ ADFSfiler CMOS

ADFS_CMOS_bits  *       &6B              ; for sparrow
Ben Avison's avatar
Ben Avison committed
400
 ]
401
 ]
Neil Turton's avatar
Neil Turton committed
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Data structure offsets
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

; format of icon description blocks

                ^       -1
icb_validation  #       1               ; "S" for validation string
icb_drivetype   #       12              ; first byte is "h" or "f"
icb_drivenumber #       3               ; ":n",0

; format of disc name blocks

                ^       0
drv_number      #       3               ; ":n",0
drv_namelen     #       1               ; length of ":discname"
drv_iconblock   #       4
drv_name        #       24              ; ":discname",0
drv_size        #       0
drv_shift       *       5
        ASSERT  drv_size = (1 :SHL: drv_shift)
        ASSERT  (drv_iconblock :AND: 3) = 0

len_colon       *       0               ; don't include ":" in discname
427
len_mediaprefix *       :LEN:"$FSTitle::"-len_colon
Neil Turton's avatar
Neil Turton committed
428

429 430 431 432 433 434 435 436 437 438
 [ HotPlug
; format of drive added/removed queue block
                ^       0
darq_next       #       4               ; pointer to next block in RMA
darq_number     #       1               ; drive number
darq_added      #       1               ; nonzero for drive added, zero for drive removed
                #       2
darq_size       *       :INDEX: @
 ]

Neil Turton's avatar
Neil Turton committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Workspace allocation
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

                ^       0, wp
mytaskhandle    #       4               ; id so we can kill ourselves
FilerHandle     #       4               ; id so we can contact Filer
privateword     #       4
wimpversion     #       4               ; version number of Wimp
        [ givehelp
messagedata     #       4               ; points to fdesc block (if allocated)
        ]
backup_block    #       4               ; Address of any active backup block

mousedata       #       0
mousex          #       4
mousey          #       4
buttonstate     #       4
windowhandle    #       4
iconhandle      #       4

menuhandle      #       4
menudir         #       4
menufileblock   #       4
menufilename    #       4

share_option    #       4                ; options for share menu and submenu

windowx         #       4
windowy         #       4

relmousex       #       4
relmousey       #       4

sectorop        #       4                ; flag indicating whether ADFS can do sector ops

                AlignSpace
ram_menustart   #       0
m_floppydisc    #       m_headersize + mi_size*7
m_backup        #       m_headersize + mi_size*4
m_namedisc      #       m_headersize + mi_size*1
m_sharedisc     #       m_headersize + mi_size*3      ; for sparrow
ram_menuend     #       0

mb_namedisc     #       11               ; 10 bytes text + 1 byte terminator
                #       1                ; align

mb_tempdisc     #       12               ; (for Sparrow) stores discname for ShareD_CreateShare

nfloppies       #       4
oldescape       #       4

ndrives         *       8                ; allow for drives 0..7
iconbaricons    #       ndrives*4        ; associate icon handle with index
discnames       #       ndrives*drv_size ; associate index with drive spec.

495
matchedindex    #       4                ; index of last icon matched
Neil Turton's avatar
Neil Turton committed
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522

; OSS These hold the "Current format" and "Other formats" strings in the
; Messages file, and hence impose limits of 31 characters. I have thus
; added an appropriate comment to the Messages file
CurrentFormatTextLength *       32
CurrentFormatText       #       CurrentFormatTextLength
OtherFormatsTextLength  *       32
OtherFormatsText        #       OtherFormatsTextLength
OtherFormatsMenu        #       4

; OSS Pointer to entire indirected data for current format window, allocated
; as a seperate RMA block.
CurrentFormatBufferInd          #       4
CurrentFormatBufferAddress      #       4   ; Passed to Service_IdentifyDisc
CurrentFormatIdentifyLength     #       4   ; OSS Length of BufferAddress
CurrentFormat_handle            #       4   ; Window handle

; OSS Pointers to tables of data for format menus, allocated in the RMA.
; This is in fact one RMA block (NativeTabePtr) and OthersTablePtr points
; into the middle of it.
NativeTablePtr                  #       4
OthersTablePtr                  #       4

FormatState             #       4
FormatList              #       4
FormatWindows           #       4
FormatMenu              #       4
Neil Turton's avatar
Neil Turton committed
523 524 525
  [ StrongARM
SAdummy                 #       16     ;dynamic SWI code no longer used
  |
Neil Turton's avatar
Neil Turton committed
526
SWICode                 #       16
Neil Turton's avatar
Neil Turton committed
527
  ]
528 529 530 531 532 533
 [ HotPlug
darq                    #       4      ; drive added/removed queue
menuopen                #       4      ; nonzero => our menu is open
backupmenudrivenumbers  #       ((?m_backup)-m_headersize)/mi_size
        AlignSpace
 ]
Neil Turton's avatar
Neil Turton committed
534 535 536 537 538 539
DiscRecord              #       &100

                AlignSpace 64

dirnamebuffer   #       &100

540 541 542 543
filenamebuffer  #       &100

userdata_size   *       &200
userdata        #       userdata_size
Neil Turton's avatar
Neil Turton committed
544 545 546 547 548 549 550 551

stackbot        #       &200

stacktop        #       0


ADFSFiler_WorkspaceSize *  :INDEX: @

552
 ! 0, "$FSTitle.Filer workspace is ":CC:(:STR:(:INDEX:@)):CC:" bytes"
Neil Turton's avatar
Neil Turton committed
553 554


555
driveno *       m_floppydisc + m_title + :LEN:"$FSTitle:"
Neil Turton's avatar
Neil Turton committed
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579


; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Module header
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 ASSERT (.=Module_BaseAddr)

        DCD     ADFSFiler_Start        -Module_BaseAddr
        DCD     ADFSFiler_Init         -Module_BaseAddr
        DCD     ADFSFiler_Die          -Module_BaseAddr
        DCD     ADFSFiler_Service      -Module_BaseAddr
        DCD     ADFSFiler_TitleString  -Module_BaseAddr
        DCD     ADFSFiler_HelpString   -Module_BaseAddr
        DCD     ADFSFiler_CommandTable -Module_BaseAddr
        DCD     0
        DCD     0
        DCD     0
        DCD     0
 [ International_Help <> 0 :LAND: tokenhelp
        DCD     str_messagefile        -Module_BaseAddr
 |
        DCD     0
 ]
Kevin Bracey's avatar
Kevin Bracey committed
580
        DCD     ADFSFiler_ModuleFlags  -Module_BaseAddr
Neil Turton's avatar
Neil Turton committed
581

582 583 584 585
 [ debug
        InsertNDRDebugRoutines
 ]

Neil Turton's avatar
Neil Turton committed
586 587 588 589 590 591 592 593
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Initialise the various aliases used for formatting etc.

                ^       0
stk_buffer1     #       &40
stk_buffer2     #       &40
stk_total       #       0

Kevin Bracey's avatar
Kevin Bracey committed
594
ADFSFiler_Init  Entry "r1-r5"
Neil Turton's avatar
Neil Turton committed
595 596 597

; initialise ADFSFiler$Path if not already done

Ben Avison's avatar
Ben Avison committed
598
      [ standalone
Neil Turton's avatar
Neil Turton committed
599
        ADRL    R0,ResourceFSFiles
600
        SWI     XResourceFS_RegisterFiles
Neil Turton's avatar
Neil Turton committed
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
        EXIT    VS
      ]

        ADR     R0, Path
        MOV     R2, #-1
        MOV     R3, #0
        MOV     R4, #VarType_Expanded
        SWI     XOS_ReadVarVal          ; returns R2=0 if doesn't exist
        CMP     R2, #0                  ; clears V as well!


        ADREQ   R0, Path
        ADREQ   R1, PathDefault
        MOVEQ   R2, #?PathDefault
        MOVEQ   R3, #0
        MOVEQ   R4, #VarType_String
        SWIEQ   XOS_SetVarVal

Kevin Bracey's avatar
Kevin Bracey committed
619
        EXIT
Neil Turton's avatar
Neil Turton committed
620

Jeffrey Lee's avatar
Jeffrey Lee committed
621
Path            DCB     "$FSTitle.Filer$$Path"
Neil Turton's avatar
Neil Turton committed
622
                DCB     0
623
PathDefault     DCB     "Resources:$$.Resources.$FSTitle.Filer."
Neil Turton's avatar
Neil Turton committed
624 625 626
                DCB     0
                ALIGN

Ben Avison's avatar
Ben Avison committed
627
      [ standalone
Neil Turton's avatar
Neil Turton committed
628
ResourceFSFiles
629
      [ SDFS
630 631 632
        ResourceFile    $MergedMsgs,             Resources.SDFSFiler.Messages
        ResourceFile    Resources.SDFS.<UserIF>, Resources.SDFSFiler.Sprites
        ResourceFile    LocalRes:Templates,      Resources.SDFSFiler.Templates
633
      |
Ben Avison's avatar
Ben Avison committed
634 635
      [ SCSI
        ResourceFile    $MergedMsgs,        Resources.SCSIFiler.Messages
636 637 638
        ResourceFile    Resources.Zip,      Resources.SCSIFiler.Sprites
        ResourceFile    Resources.Zip22,    Resources.SCSIFiler.Sprites22
        ResourceFile    Resources.Zip11,    Resources.SCSIFiler.Sprites11
Ben Avison's avatar
Ben Avison committed
639 640 641
      |
        ResourceFile    $MergedMsgs,        Resources.ADFSFiler.Messages
        ResourceFile    LocalRes:Templates, Resources.ADFSFiler.Templates
642
      ]
Ben Avison's avatar
Ben Avison committed
643
      ]
Neil Turton's avatar
Neil Turton committed
644 645 646 647 648
        DCD 0
      ]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ADFSFiler_HelpString
Ben Avison's avatar
Ben Avison committed
649 650 651
      [ SCSI
Module_Version SETA Module_Version + 112 - 94
      ]
652
        DCB     "$FSTitle.Filer"
Neil Turton's avatar
Neil Turton committed
653
        DCB     TAB
Ben Avison's avatar
Ben Avison committed
654 655 656 657 658 659 660 661 662 663
        GBLA    Module_VersionUnits
        GBLA    Module_VersionTenths
Module_VersionTenths SETA Module_Version/10
Module_Version SETA Module_Version - Module_VersionTenths*10
Module_VersionUnits SETA Module_VersionTenths/10
Module_VersionTenths SETA Module_VersionTenths - Module_VersionUnits*10
        DCB     48+$Module_VersionUnits, ".", 48+$Module_VersionTenths, 48+$Module_Version
        DCB     " ($Module_Date)", 0

 [ International_Help = 0 :LOR: :LNOT: tokenhelp
664 665 666 667
Desktop_$FSTitle.Filer_Help
        DCB   "The $FSTitle.Filer provides the $FSTitle icons on the icon bar, and "
        DCB   "uses the Filer to display $FSTitle directories.",13,10
        DCB   "Do not use *Desktop_$FSTitle.Filer, use *Desktop instead.",0
Ben Avison's avatar
Ben Avison committed
668

669
Desktop_$FSTitle.Filer_Syntax  DCB   "Syntax: *Desktop_"       ; drop through!
Ben Avison's avatar
Ben Avison committed
670
 |
671 672 673
 [ SCSI :LOR: SDFS
Desktop_$FSTitle.Filer_Help          DCB     "HSFLDSK", 0
Desktop_$FSTitle.Filer_Syntax        DCB     "SSFLDSK", 0
Ben Avison's avatar
Ben Avison committed
674
 |
675 676
Desktop_$FSTitle.Filer_Help          DCB     "HAFLDSK", 0
Desktop_$FSTitle.Filer_Syntax        DCB     "SAFLDSK", 0
Ben Avison's avatar
Ben Avison committed
677
 ]
Neil Turton's avatar
Neil Turton committed
678 679
 ]

680
ADFSFiler_TitleString     DCB   "$FSTitle.Filer", 0
Neil Turton's avatar
Neil Turton committed
681 682 683 684 685 686
                          ALIGN

ADFSFiler_CommandTable      ; Name     Max min

ADFSFiler_StarCommand
 [ tokenhelp
687
        Command Desktop_$FSTitle.Filer,     3, 0, International_Help
Neil Turton's avatar
Neil Turton committed
688
 |
689
        Command Desktop_$FSTitle.Filer,     3, 0, 0
Ben Avison's avatar
Ben Avison committed
690
 ]
Neil Turton's avatar
Neil Turton committed
691 692 693
        DCB     0                       ; End of table
        ALIGN

Kevin Bracey's avatar
Kevin Bracey committed
694 695
ADFSFiler_ModuleFlags DCD ModuleFlag_32bit

Neil Turton's avatar
Neil Turton committed
696 697 698
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Had *command to enter ADFSFiler, so start up via module handler

699
Desktop_$FSTitle.Filer_Code Entry
Neil Turton's avatar
Neil Turton committed
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741

        LDRB    r14,[r0]
       [ debug
        DREG    r14,"char "
       ]
        CMP     r14,#32
        TEQGE   r14,r14
        MOVEQ   r2,r0
        BEQ     %FT00

        LDR     r14, [r12]
        CMP     r14, #0
        BLE     %FT01

        LDR     r14, [r14, #:INDEX:mytaskhandle]
        CMP     r14, #0
        MOV     r2,r0
00
        MOVEQ   r0, #ModHandReason_Enter
        ADREQ   r1, ADFSFiler_TitleString
        SWIEQ   XOS_Module
01
        BL      MkCantStartError
        EXIT

MkCantStartError
        MOV     r8, lr
        ADR     r0, ErrorBlock_CantStartADFSFiler
        MOV     r1, #0
        MOV     r2, #0
        ADR     r4, ADFSFiler_TitleString
        MOV     r5, #0
        MOV     r6, #0
        MOV     r7, #0
        SWI     XMessageTrans_ErrorLookup
        MOV     pc, r8

ErrorBlock_CantStartADFSFiler
        DCD     0
        DCB     "UseDesk", 0
        ALIGN

742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Table of service calls we want

        ASSERT  Service_StartFiler > Service_Reset
        ASSERT  Service_StartedFiler > Service_StartFiler
        ASSERT  Service_FilerDying > Service_StartedFiler
        ASSERT  Service_MessageFileClosed > Service_FilerDying
        ASSERT  Service_ResourceFSStarting > Service_MessageFileClosed

ServiceTable
        DCD     0
        DCD     ServiceUrsula - Module_BaseAddr
        DCD     Service_Reset
        DCD     Service_StartFiler
        DCD     Service_StartedFiler
        DCD     Service_FilerDying
        DCD     Service_MessageFileClosed
Ben Avison's avatar
Ben Avison committed
760
      [ standalone
761 762 763 764 765 766
        DCD     Service_ResourceFSStarting
      ]
        DCD     0
        DCD     ServiceTable - Module_BaseAddr


Neil Turton's avatar
Neil Turton committed
767 768 769 770
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ADFSFiler_Service ROUT

771 772 773 774 775 776 777 778
        MOV     r0, r0                  ; Indicates there is a service call table

        ; Fast rejection code
        TEQ     r1, #Service_Reset
        TEQNE   r1, #Service_StartFiler
        TEQNE   r1, #Service_StartedFiler
        TEQNE   r1, #Service_FilerDying
        TEQNE   r1, #Service_MessageFileClosed
Ben Avison's avatar
Ben Avison committed
779
      [ standalone
780 781
        TEQNE   r1, #Service_ResourceFSStarting
      ]
Kevin Bracey's avatar
Kevin Bracey committed
782
        MOVNE   pc, lr
783 784 785

ServiceUrsula

Neil Turton's avatar
Neil Turton committed
786 787 788 789 790 791 792 793 794 795 796 797
        TEQ     r1, #Service_Reset
        BEQ     ADFSFiler_Service_Reset

        TEQ     r1, #Service_MessageFileClosed
        BEQ     ADFSFiler_Service_MessageFileClosed

        TEQ     r1, #Service_FilerDying
        BEQ     ADFSFiler_Service_FilerDying

        TEQ     r1, #Service_StartFiler
        BEQ     ADFSFiler_Service_StartFiler

Ben Avison's avatar
Ben Avison committed
798
      [ standalone
Neil Turton's avatar
Neil Turton committed
799 800 801 802 803 804
        TEQ     r1, #Service_ResourceFSStarting
        BNE     %FT10
        Push    "r0-r3,lr"
        ADRL    r0, ResourceFSFiles
        MOV     lr, pc
        MOV     pc, r2
Kevin Bracey's avatar
Kevin Bracey committed
805
        Pull    "r0-r3,pc"
Neil Turton's avatar
Neil Turton committed
806 807 808 809 810 811
10
      ]

        TEQ     r1, #Service_StartedFiler
        MOVNE   pc, lr

Kevin Bracey's avatar
Kevin Bracey committed
812
ADFSFiler_Service_StartedFiler Entry
Neil Turton's avatar
Neil Turton committed
813 814 815 816 817 818 819 820

        LDR     r14, [r12]              ; cancel 'don't start' flag
        CMP     r14, #0
        MOVLT   r14, #0
        STRLT   r14, [r12]

        EXIT

Kevin Bracey's avatar
Kevin Bracey committed
821
ADFSFiler_Service_StartFiler Entry "r2,r3,r6"
Neil Turton's avatar
Neil Turton committed
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854

        LDR     r2, [r12]
        CMP     r2, #0
        EXIT    NE                      ; don't claim service unless = 0

        MOV     r6, r0                  ; Filer task handle
        MOV     r0, #ModHandReason_Claim
        LDR     r3, =ADFSFiler_WorkspaceSize
        SWI     XOS_Module
        MOVVS   r2, #-1                 ; avoid looping
        STR     r2, [r12]
      [ debug
        DREG    r12
      ]

        MOVVC   r0, #0
      [ givehelp
        STRVC   r0, [r2, #:INDEX:messagedata]
      ]
        STRVC   r0, [r2, #:INDEX:FormatList]
        STRVC   r0, [r2, #:INDEX:FormatState]
        STRVC   r0, [r2, #:INDEX:FormatWindows]
        STRVC   r0, [r2, #:INDEX:mytaskhandle]
        STRVC   r12, [r2, #:INDEX:privateword]
        STRVC   r6, [r2, #:INDEX:FilerHandle]

; OSS A few more blocks need zeroing.
        STRVC   r0, [r2, #:INDEX:CurrentFormatBufferInd]
        STRVC   r0, [r2, #:INDEX:NativeTablePtr]
        STRVC   r0, [r2, #:INDEX:OthersTablePtr]
        STRVC   r0, [r2, #:INDEX:FormatMenu]
        STRVC   r0, [r2, #:INDEX:backup_block]

855 856
      [ HotPlug
        STRVC   r0, [r2, #:INDEX:darq]
857
        STRVC   r0, [r2, #:INDEX:menuopen]
858 859
      ]

Neil Turton's avatar
Neil Turton committed
860 861 862 863 864 865 866 867 868
        MOV     r0,#UpCallV
        ADRL    R1,UpcallHandler
        SWI     XOS_Claim

        ADRVCL  r0, ADFSFiler_StarCommand
        MOVVC   r1, #0                  ; Claim service

        EXIT

Kevin Bracey's avatar
Kevin Bracey committed
869
ADFSFiler_Service_MessageFileClosed Entry "r0,r1,r12"
Neil Turton's avatar
Neil Turton committed
870 871 872

        LDR     r12, [r12]              ; are we active?
        CMP     r12, #0
Kevin Bracey's avatar
Kevin Bracey committed
873
        EXIT    LE
Neil Turton's avatar
Neil Turton committed
874 875 876 877 878

        LDRB    r1, driveno+1           ; grab the drive number
        BL      CopyMenus               ; re-open message file etc.
        STRB    r1, driveno+1           ; and put it back in

Kevin Bracey's avatar
Kevin Bracey committed
879
        EXIT
Neil Turton's avatar
Neil Turton committed
880

Kevin Bracey's avatar
Kevin Bracey committed
881
ADFSFiler_Service_Reset Entry "r0-r11"
Neil Turton's avatar
Neil Turton committed
882 883 884 885 886 887 888 889 890 891 892

        LDR     r2, [r12]               ; cancel 'don't start' flag
        CMP     r2, #0
        MOVLT   r2, #0
        STRLT   r2, [r12]

        MOVGT   wp, r2
        MOVGT   r0, #0                  ; Wimp has already gone bye-bye
        STRGT   r0, mytaskhandle
        BLGT    freeworkspace

Kevin Bracey's avatar
Kevin Bracey committed
893
        EXIT                            ; Sorry, but no can do errors here
Neil Turton's avatar
Neil Turton committed
894 895 896

; ******************************************************************************

Kevin Bracey's avatar
Kevin Bracey committed
897
ADFSFiler_Die Entry "r0-r11"
Neil Turton's avatar
Neil Turton committed
898

899 900
      [ standalone
        ADRL    r0, ResourceFSFiles
Neil Turton's avatar
Neil Turton committed
901 902
        SWI     XResourceFS_DeregisterFiles
      ]
903
        B       %FT10
Neil Turton's avatar
Neil Turton committed
904 905 906 907 908 909 910 911 912 913 914 915 916

ADFSFiler_Service_FilerDying ALTENTRY
10

        LDR     wp, [r12]

        MOV     r0,#UpCallV
        ADRL    R1,UpcallHandler
        MOV     R2,R12
        SWI     XOS_Release

        BL      freeworkspace

Kevin Bracey's avatar
Kevin Bracey committed
917 918
        CLRV                            ; Sorry, but no can do errors here
        EXIT
Neil Turton's avatar
Neil Turton committed
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985

; ******************************************************************************

        ALIGN
w_format        DCB     "Format",0
                DCD     0,0,0
        ALIGN
w_currentformat DCB     "Current",0
                DCD     0,0,0
        ALIGN

; ******************************************************************************

; Corrupts r0-r11

; OSS r10 is our LR, and r11 is used by the backup task closedown for its LR.

freeworkspace ROUT
        CMP     wp, #0                  ; clears V
        MOVLE   pc, lr

        MOV     r10, lr                 ; can't use stack on exit if USR mode

        LDR     r8, backup_block
        TEQ     r8, #0
        BLNE    bkp_task_closedown      ; Close down the backup task.

        LDR     r0, mytaskhandle
        CMP     r0, #0
        LDRGT   r1, taskidentifier
        SWIGT   XWimp_CloseDown         ; ignore errors from this

; OSS Need to free the format list (lists all formats available)
        BL      FreeFormatList

      [ givehelp
        BL      deallocatemessagedata   ; well actually we can until we free
      ]                                 ; the workspace block!

; OSS Need to free up the list of active format/verify windows.
        MOV     r0, #ModHandReason_Free
        LDR     R4,FormatWindows
01
        MOVS    R2,R4
        BEQ     %FT02
        LDR     R4,[R4]                 ; Next block in chain.
        SWI     XOS_Module              ; Free block.
        B       %BT01
02

; OSS Free the buffer for the "current format" window indirected data.
        LDR     r2, CurrentFormatBufferInd
        SWI     XOS_Module              ; ignore errors

        MOV     r2, r12
        LDR     r12, privateword
        MOV     r14, #0                 ; reset flag word anyway
        STR     r14, [r12]
        MOV     r0, #ModHandReason_Free
        SWI     XOS_Module

        MOV     pc, r10

taskidentifier
        DCB     "TASK"                  ; Picked up as a word
        ALIGN

986
      [ SCSI :LOR: SDFS
987
iconspritescmd
988
        DCB     "IconSprites $FSTitle.Filer:Sprites",0
989 990 991
        ALIGN
      ]

Neil Turton's avatar
Neil Turton committed
992 993
MessagesList    DCD     Message_HelpRequest
                DCD     Message_MenuWarning
994 995 996
      [ DragsToIconBar
                DCD     Message_DataSave
                DCD     Message_DataLoad
997 998 999
      ]
      [ HotPlug
                DCD     Message_MenusDeleted
Neil Turton's avatar
Neil Turton committed
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
      ]
                DCD     0

        LTORG

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


CloseDownAndExit ROUT

        BL      freeworkspace
        SWI     OS_Exit

; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; OSS New function to copy template name onto the stack and then call
; Wimp_LoadTemplate since the wimp may over-write the name. We were
; lucky to get away with this previously.

; In    r1 -> user block to put template
;       r2 -> core to put indirected icons for template
;       r3 -> end of this core
;       r4 -> font reference array
;       r5 -> name of relevant entry
;       r6 = position to search from

Kevin Bracey's avatar
Kevin Bracey committed
1026
load_template Entry , 16                ; 16 bytes of stack for name
Neil Turton's avatar
Neil Turton committed
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
        MOV     lr, sp
        Push    "r1, r2"
        MOV     r1, lr
        MOV     r2, r5
        BL      strcpy
        MOV     r5, r1                  ; And use this name instead
        Pull    "r1, r2"
        SWI     XWimp_LoadTemplate
        EXIT

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;                   ADFSFiler application entry point
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ErrorAbort
        MOV     r1, #2_010              ; 'Cancel' button
        BL      ReportError             ; stack is still valid here

Abort
        BL      freeworkspace           ; exits with r12 --> private word
        MOV     r0, #-1
        STR     r0, [r12]               ; marked so doesn't loop

        SWI     OS_Exit

UpcallHandler   ROUT                    ; Pause all format windows if disc might have changed.

        TEQ     r0,#UpCall_MediaSearchEnd
1055 1056 1057 1058 1059 1060 1061 1062
      [ HotPlug
        TEQNE   r0,#UpCall_DriveAdded
        TEQNE   r0,#UpCall_DriveRemoved
        MOVNE   PC,LR

        TEQ     r0,#UpCall_MediaSearchEnd
        BNE     DriveAddedRemoved
      |
Kevin Bracey's avatar
Kevin Bracey committed
1063
        MOVNE   PC,LR
1064
      ]
Neil Turton's avatar
Neil Turton committed
1065 1066 1067 1068 1069 1070

        Push    "r0-r4,LR"

        LDR     r0,FormatWindows
01
        TEQ     r0,#0
Kevin Bracey's avatar
Kevin Bracey committed
1071
        Pull    "r0-r4,PC",EQ
Neil Turton's avatar
Neil Turton committed
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083

        LDR     r1,[r0,#fw_state]
        TEQ     r1,#FormatState_Paused
        TEQNE   r1,#FormatState_OK
        TEQNE   r1,#FormatState_SetPause
        STRNE   r1,[r0,#fw_savedstate]
        MOVNE   r1,#FormatState_SetPause
        STRNE   r1,[r0,#fw_state]

        LDR     r0,[r0,#fw_next]
        B       %BT01

1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
 [ HotPlug
DriveAddedRemoved
        Push    "r0-r3,LR"
        ; Check it's one of ours
        LDRB    r0, [r1, #3]!
        LDRB    r2, [r1, #-1]!
        BIC     r0, r0, #&20
        BIC     r2, r2, #&20
        ORR     r0, r2, r0, LSL #8
        LDRB    r2, [r1, #-1]!
        BIC     r2, r2, #&20
        ORR     r0, r2, r0, LSL #8
        LDRB    r2, [r1, #-1]!
        BIC     r2, r2, #&20
        ORR     r0, r2, r0, LSL #8
        LDR     r2, adfscolon
        TEQ     r0, r2
        LDREQB  r0, [r1, #4]!
        TEQEQ   r0, #':'
        LDREQB  r0, [r1, #1]!
        TEQEQ   r0, #':'
        Pull    "r0-r3,PC", NE
        LDRB    r1, [r1, #1]
        SUB     r1, r1, #'0'
        CMP     r1, #ndrives
        Pull    "r0-r3,PC",CS
        ; Claim new block
        MOV     r0, #ModHandReason_Claim
        MOV     r3, #darq_size
        SWI     XOS_Module
        Pull    "r0-r3,PC", VS
        ; Add to end of list to keep events in correct order
        ADR     r0, darq - darq_next
01      LDR     r3, [r0, #darq_next]
        TEQ     r3, #0
        MOVNE   r0, r3
        BNE     %BT01
        STR     r3, [r2, #darq_next]
        STR     r2, [r0, #darq_next]
        Pull    "r0"
        TEQ     r0, #UpCall_DriveAdded
        ORREQ   r1, r1, #&100
        STR     r1, [r2, #darq_number]
        Pull    "r1-r3,PC"
 ]

Neil Turton's avatar
Neil Turton committed
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
ADFSFiler_Start ROUT

        LDR     wp, [r12]

        CMP     wp, #0
        BLLE    MkCantStartError
        SWIVS   OS_GenerateError

        ADRL    sp, userdata+&100
        SWI     XOS_GetEnv

      [ debug
        DLINE   "Desktop_ADFSFiler"
        DSTRING r0,"Args "
      ]

        ADD     r1,r0,#9
        ADRL    r0,ADFSBackup_Args
        ADR     r2,userdata
        MOV     r3,#256
        SWI     OS_ReadArgs
       [ debug
        BVC     %FT91
        ADD     r14,r0,#4
        DSTRING r14,"ERROR: "
91
       ]
        LDR     r14,[r2]
       [ debug
        DREG    r14,"Backup flag "
       ]
        TEQ     r14,#0
        BNE     ADFSBackup_Code

        ADRL    sp, stacktop            ; Stack is now valid

        LDR     r0, mytaskhandle        ; close any previous incarnation
        CMP     r0, #0
        LDRGT   r1, taskidentifier
        SWIGT   XWimp_CloseDown         ; ignore errors from this

        MOV     r0, #300                ; We know about wimp 3.00 and have a messages list.
        LDR     r1, taskidentifier
        BL      MkBannerIn_userdata
        ADRVC   r3, MessagesList
        SWIVC   XWimp_Initialise
        STRVC   r0, wimpversion
        STRVC   r1, mytaskhandle

        BVS     ErrorAbort

1181
      [ SCSI :LOR: SDFS
1182 1183 1184 1185
        ADR     R0, iconspritescmd      ; wimpinitialised,so will add my sprites
        SWI     XOS_CLI
      ]

Neil Turton's avatar
Neil Turton committed
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
        ADR     R1,iconbaricons         ; initialise all icon handles to -1
        MOV     R2,#ndrives
        MOV     R14,#-1
01      STR     R14,[R1],#4             ; this helps with AddToIconBar,
        SUBS    R2,R2,#1                ; in that it can replace icons too
        BNE     %BT01

        BLVC    SetUpIconBar
        BLVC    CopyMenus               ; copy menus into ram
        BVS     ErrorAbort              ; frees workspace but marks it invalid

1197
      [ :LNOT: HotPlug
Neil Turton's avatar
Neil Turton committed
1198 1199 1200
        LDR     R14,iconbaricons        ; close down if no drives
        CMP     R14,#-1
        BEQ     Abort
1201
      ]
Neil Turton's avatar
Neil Turton committed
1202

1203 1204 1205 1206
      [ SDFS
        ADRL    R1,str_templatefile_sdfs
        SWI     XWimp_OpenTemplate
      |
1207 1208 1209 1210 1211 1212 1213
      [ SCSI
        ; ADFSFiler may not be present on all systems - so check for a copy of the templates in SCSIFiler's resources before falling back on the ADFSFiler copy that's traditionally used
        ADRL    R1,str_templatefile_scsi
        SWI     XWimp_OpenTemplate
        ADRVSL  R1,str_templatefile
        SWIVS   XWimp_OpenTemplate
      |
Neil Turton's avatar
Neil Turton committed
1214 1215
        ADRL    R1,str_templatefile
        SWI     XWimp_OpenTemplate
1216
      ]
1217
      ]
Neil Turton's avatar
Neil Turton committed
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300
        BVS     ErrorAbort

; OSS Ask the Wimp how much memory we need for this window.
        MOV     r1,#-1
        MOV     r4,#-1
        ADR     r5,w_currentformat
        MOV     r6,#0
        BL      load_template           ; get size required for template
        BVS     TemplateErrorAbort

; OSS Check that the userdata is big enough for the window definition.
        MOV     r0, #?userdata
        CMP     r0, r1
        BLO     user_data_too_small_error

; OSS Claim memory for the inderected data.
        MOV     r0,#ModHandReason_Claim
        MOV     r3,r2
        SWI     XOS_Module
        BVS     TemplateErrorAbort
        STR     r2,CurrentFormatBufferInd

; OSS Now load the template and create the window - the main window buffer
; is in userdata as it can be thrown away as soon as the window has been
; created.
        ADR     r1,userdata
        ADD     r3,r2,r3                ; Add size to pointer to give limit
        MOV     r4,#-1
        ADR     r5,w_currentformat
        MOV     r6,#0
        BL      load_template
        SWIVC   XWimp_CreateWindow
        STRVC   r0,CurrentFormat_handle
        BVS     TemplateErrorAbort

        SWI     XWimp_CloseTemplate
        BVS     ErrorAbort

        ADR     r1,userdata
        LDR     r0,CurrentFormat_handle
        STR     r0,[r1]
        MOV     r0,#0
        STR     r0,[r1,#4]
        SWI     XWimp_GetIconState
        BVS     ErrorAbort
        LDR     r0,[r1,#28]
        STR     r0,CurrentFormatBufferAddress
; OSS Remember actual real length of buffer too.
        LDR     r0,[r1,#36]
        STR     r0,CurrentFormatIdentifyLength

        B       %FT01

ErrorBlock_UserDataTooSmall
        DCD     0
        DCB     "UsrData",0
        ALIGN

user_data_too_small_error
        ADR     r0, ErrorBlock_UserDataTooSmall
        BL      lookuperror
; *** Drop through ***

TemplateErrorAbort
        Push    "r0"
        SWI     XWimp_CloseTemplate
        Pull    "r0"
        SETV
        B       ErrorAbort
01
; .............................................................................
; The main polling loop!

repollwimp ROUT

 [ False
        MOVVS   r1, #2_011              ; 'Ok' and 'Cancel' buttons
 |
        MOVVS   r1, #2_001              ; 'Ok' button
 ]
        BLVS    ReportError
        BVS     ErrorAbort              ; error from reporterror!

1301 1302 1303 1304 1305
      [ HotPlug
        LDR     r0, =pollword_enable + pointerchange_bits + null_bit
                                        ; enable pollwords, disable null events and pointer
        ADR     r3, darq
      |
Neil Turton's avatar
Neil Turton committed
1306 1307
        MOV     r0, #pointerchange_bits + null_bit
                                        ; disable null events and pointer
1308
      ]
Neil Turton's avatar
Neil Turton committed
1309 1310 1311 1312 1313 1314 1315 1316 1317
        ADR     r1, userdata            ; entering/leaving window events
        LDR     R14,FormatState
        CMP     R14,#0
        BICNE   r0,r0,#null_bit         ; We need null events if formatting
        SWI     XWimp_Poll
        BVS     repollwimp

; In    r1 -> wimp_eventstr

1318
        ADR     lr, repollwimp
Neil Turton's avatar
Neil Turton committed
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
        CMP     r0, #Open_Window_Request
        BNE     %FT01
        SWI     XWimp_OpenWindow
        B       repollwimp
01
        CMP     r0,#Close_Window_Request
        BNE     %FT01
        SWI     XWimp_CloseWindow
        B       Format_CloseWindow
01
        CMP     r0,#Null_Reason
        BEQ     Format_NullEvent

        CMP     r0, #Mouse_Button_Change
        BEQ     event_mouse_click

        CMP     r0, #Key_Pressed
1336 1337 1338 1339 1340
        BNE     %FT01
        LDR     r0, [r1, #24]
        SWI     XWimp_ProcessKey
        B       repollwimp
01
Neil Turton's avatar
Neil Turton committed
1341 1342 1343 1344 1345 1346 1347
        CMP     r0, #Menu_Select
        BEQ     event_menu_select

        CMP     r0, #User_Message
        CMPNE   r0, #User_Message_Recorded
        BEQ     event_user_message

1348 1349 1350 1351 1352
      [ HotPlug
        CMP     r0, #PollWord_NonZero
        BEQ     event_pollword_nonzero
      ]

Neil Turton's avatar
Neil Turton committed
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
        B       repollwimp

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; event_mouse_click
; =================

; In    r1 -> wimp_eventstr
;             [r1, #0]  pointer x
;             [r1, #4]          y
;             [r1, #8]  new button state
;             [r1, #12] window handle (-1 if background/icon bar)
;             [r1, #16] icon handle (-1 if none)

; Out   all regs may be corrupted - going back to PollWimp

Kevin Bracey's avatar
Kevin Bracey committed
1369
event_mouse_click Entry
Neil Turton's avatar
Neil Turton committed
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437

        LDMIA   r1, {r0-r4}             ; set mousex, mousey, buttonstate
        ADR     r14, mousedata          ; windowhandle, iconhandle
        STMIA   r14, {r0-r4}
 [ debug
 dreg r2, "mouse_click: buttonstate ",cc,Word
 dreg r0, ", x ",cc,Integer
 dreg r1, ", y ",cc,Integer
 dreg r3, ", window ",,Word
 ]

        CMP     r3, #iconbar_whandle    ; window handle of icon bar
        BNE     Format_MouseClick

        TST     r2, #button_left :OR: button_right ; select or adjust ?
        BNE     click_select_iconbar

        TST     r2, #button_middle      ; menu ?
        BNE     click_menu_iconbar

        EXIT

FilerOpenDirCommand     DCB     "%Filer_OpenDir ",0

; .............................................................................
; We get here if the user has double-clicked on a FS icon

; In    lr stacked, Proc_RegList = "lr" for EXIT
;       all regs trashable

click_select_iconbar ROUT

        BL      matchdriveicon          ; r1 -> drive spec, eg. :0
        EXIT    NE

        LDRB    r8, [r1, #1]

; check for busy doing format, backup etc
        SUB     r8, r8, #"0"
        LDR     lr, FormatState
        MOV     lr, lr, LSR r8
        TST     lr, #1
        EXIT    NE

        BLVC    GetMediaName            ; r1 -> media name
        EXIT    VS
        EXIT    NE                      ; user chickened out!

; Try to open dir using Filer

        Push    "r1"
        ADR     r1,userdata
        ADRL    r2,FilerOpenDirCommand
        BL      strcpy_advance
        Pull    "r2"
        BL      strcpy_advance
        ADR     r2, dotdollar
        BL      strcpy_advance
        ADR     r0,userdata
       [ debug
        DSTRING r0,"Command is "
       ]
        SWI     XOS_CLI
        EXIT

; In    r0 = message action
;       r1 -> media name

Kevin Bracey's avatar
Kevin Bracey committed
1438
messagetoFiler Entry
Neil Turton's avatar
Neil Turton committed
1439 1440 1441 1442 1443

        SUB     sp, sp, #256            ; make temp frame for message
        STR     r0, [sp, #message_action]
        MOV     r2, r1
        ADD     r1, sp, #message_data
1444
        MOV     r14, #FSNumber
Neil Turton's avatar
Neil Turton committed
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
        STR     r14, [r1], #4
        MOV     r14, #0                 ; bitset = 0
        STR     r14, [r1], #4
        BL      strcpy_advance
        ADR     r2, dotdollar
        BL      strcpy_advance
        ADD     r1, r1, #1
        ADR     r2, dollar
        BL      strcpy_advance
        ADD     r1, r1, #1
        TST     r1, #3                  ; word aligned end ?
        ADDNE   r1, r1, #3              ; round up to word size
        BICNE   r1, r1, #3
        SUB     r1, r1, sp
        STR     r1, [sp, #message_size]
        MOV     r0, #User_Message_Recorded
        MOV     r1, sp
 [ debugtask
 ADD r14, r1, #message_data+8
 dstring r14, "passing dirname to Filer: "
 ]
        LDR     r2, FilerHandle        ; send it to the Filer
 [ debugtask
 BEQ %FT00
 dreg r2, "Filer task handle "
00
 ]
        SWI     XWimp_SendMessage
        ADD     sp, sp, #256            ; free temp frame
        EXIT


dotdollar       DCB     "."             ; share $ with ...
dollar          DCB     "$", 0          ; directory title
                ALIGN


; Offsets of fields in a message block

                ^       0
message_size    #       4
message_task    #       4               ; thandle of sender - filled in by Wimp
message_myref   #       4               ; filled in by Wimp
message_yourref #       4               ; filled in by Wimp
message_action  #       4
message_hdrsize *       @
message_data    #       0               ; words of data to send

; .............................................................................
; In    lr stacked, Proc_RegList = "lr" for EXIT
;       all regs trashable

click_menu_iconbar ROUT

        BL      matchdriveicon                  ; r1 -> drive name (eg. :0)
        EXIT    NE

        LDRB    r8, [r1, #1]
        BL      update_menu_iconbar

        ADR     r1, m_floppydisc
        BL      CreateMenu
        EXIT

update_menu_iconbar
; In:   r8 = drive specifier eg. "0","4","5" etc.
Kevin Bracey's avatar
Kevin Bracey committed
1511
        Entry
Neil Turton's avatar
Neil Turton committed
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544

 [ debug
        DREG    r8,"drive specifier "
 ]

        TEQ     r8, #"4"
        TEQNE   r8, #"5"
        TEQNE   r8, #"6"
        TEQNE   r8, #"7"
        BEQ     %FT02                           ; Jump to 02 if winny

        ; Shade Share if not winnie
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
        ORR     r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags

        ; Shade name disc, dismount, format, backup, verify and free if currently being formatted/verified
        SUB     r8,r8,#"0"
        LDR     r5,FormatState
        MOV     r6,#1
        MOV     r6,r6, ASL r8
        AND     r5,r5,r6
        CMP     r5,r6

        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_namedisc+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_namedisc+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_dismount+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_dismount+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_format+mi_iconflags
1545
      [ SCSI :LOR: SDFS ; always shade the format item
Ben Avison's avatar
Ben Avison committed
1546 1547
        ORR     r14, r14, #is_shaded
      |
Neil Turton's avatar
Neil Turton committed
1548 1549
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
Ben Avison's avatar
Ben Avison committed
1550
      ]
Neil Turton's avatar
Neil Turton committed
1551 1552
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_format+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_backup+mi_iconflags
1553 1554 1555
      [ SCSI :LOR: SDFS ; always shade the backup item
        ORR     r14, r14, #is_shaded
      |
Neil Turton's avatar
Neil Turton committed
1556 1557
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
1558
      ]
Neil Turton's avatar
Neil Turton committed
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_backup+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_verify+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_verify+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_free+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_free+mi_iconflags

        LDR     r14,share_option                ; for floppy: only winnies can be shared
        EOR     r14,r14,#shareoptions_share
        STR     r14,share_option
        LDR     r0,share_option
        TST     r0,#shareoptions_share
        LDR     r14,m_floppydisc+m_headersize+mi_size*mo_fl_share+0
        BIC     r14,r14,#1
        STR     r14,m_floppydisc+m_headersize+mi_size*mo_fl_share+0

        MOV     r5, #0                          ; don't read discname if floppy
        STRB    r5, mb_namedisc

        B       %FT03                           ; Jump over next chunk of code: it's only for winnies

02
        ADR     r1, driveno
        BL      GetMediaName                    ; r1 -> disc name (for m_namedisc)
Kevin Bracey's avatar
Kevin Bracey committed
1586 1587
        EXIT    VS
        EXIT    NE                              ; user chickened out!
Neil Turton's avatar
Neil Turton committed
1588

1589
        ADD     r2, r1, #:LEN:"$FSTitle::"
Neil Turton's avatar
Neil Turton committed
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636
        ADR     r1, mb_namedisc
        BL      strcpy

        ; always shade format and backup for winnies
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_format+mi_iconflags
        ORR     r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_format+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_backup+mi_iconflags
        ORR     r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_backup+mi_iconflags

        SUB     r8,r8,#"0"
        LDR     r5,FormatState
        MOV     r6,#1
        MOV     r6,r6, ASL r8
        AND     r5,r5,r6
        CMP     r5,r6

        ; Shade verify,share,name disc,free,dismount if currently being verified
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_namedisc+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_namedisc+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_dismount+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_dismount+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_verify+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_verify+mi_iconflags
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_free+mi_iconflags
        ORREQ   r14, r14, #is_shaded
        BICNE   r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_free+mi_iconflags

        MOV     r0, #ModHandReason_LookupName    ; call OS_Module 18 to check if ShareD
        ADR     r1, Sharemodule                  ; module has been loaded; if not, then
        SWI     XOS_Module                       ; shade share entry in the ADFS menu

        LDRVS   r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
        ORRVS   r14, r14, #is_shaded
        STRVS   r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
Kevin Bracey's avatar
Kevin Bracey committed
1637
        EXIT    VS
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648

      [ SCSI
        TEQ     r8, #4                          ; Only have CMOS for SCSI drive 4
        BEQ     %FT03
      ]
      [ SCSI :LOR: SDFS
        ; Shade share
        LDR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
        ORR     r14, r14, #is_shaded
        STR     r14, m_floppydisc+m_headersize+mi_size*mo_fl_share+mi_iconflags
      ]
Neil Turton's avatar
Neil Turton committed
1649
03
1650
      [ :LNOT: SDFS
Neil Turton's avatar
Neil Turton committed
1651
        BL      scan_CMOS                        ; check current state of CMOS
1652
      ]
Kevin Bracey's avatar
Kevin Bracey committed
1653
        EXIT
Neil Turton's avatar
Neil Turton committed
1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664

Sharemodule     DCB     "ShareFS"                ; module for sparrow share module
                DCB     0
                ALIGN

; Entry:  R4 = icon handle (in icon bar)
; Exit:   R1 --> drive spec for this drive
;         Static variables set up:
;               [matchedindex] = index of this icon
;               [driveno+1]b = drive number

Kevin Bracey's avatar
Kevin Bracey committed
1665
matchdriveicon  Entry "r2"
Neil Turton's avatar
Neil Turton committed
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696

        MOV     r2, #ndrives
        ADR     r1, iconbaricons
01
        LDR     r14, [r1], #4
        TEQ     R14, r4
        RSBEQ   r2, r2, #ndrives
        STREQ   r2, matchedindex            ; needed for namedisc

        ASSERT  drv_number = 0
        ADREQ   r1, discnames + drv_number
        ADDEQ   r1, r1, r2, LSL #drv_shift
        LDREQB  r14, [r1, #drv_number+1]    ; initialise drive number (for menu)
        STREQB  r14, driveno+1
        EXIT    EQ
        SUBS    r2, r2, #1
        BNE     %BT01
        ADR     r0, err_noicon
        BL      lookuperror
        EXIT

err_noicon
        DCD     0
        DCB     "UnkIcon",0
        ALIGN


; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; A menu is created with the title above the x,y values you feed it, with the
; top left hand corner being at the x,y position

Kevin Bracey's avatar
Kevin Bracey committed
1697
CreateMenu Entry "r2, r3"
Neil Turton's avatar
Neil Turton committed
1698 1699 1700 1701 1702 1703

        STR     r1, menuhandle
        LDR     r2, mousex
        SUB     r2, r2, #4*16
        MOV     r3, #96 + 7*44        ; bodge to clear icon bar
        SWI     XWimp_CreateMenu
1704 1705 1706
      [ HotPlug
        STR     pc, menuopen
      ]
Neil Turton's avatar
Neil Turton committed
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744
        EXIT

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

rom_menustart ; Note - must be defined in the same order as the ram menus

m_floppydisc    Menu    "T00"                   ; must be "ADFS::n"
mo_fl_namedisc  Item    "M01",m_namedisc
mo_fl_dismount  Item    "M02"
mo_fl_format    Item    "M03",,N                ; floppies only
mo_fl_backup    Item    "M04"                   ; floppies only
mo_fl_share     Item    "M05",m_sharedisc
mo_fl_verify    Item    "M06"
mo_fl_free      Item    "M07"

m_backup        Menu    "T04"                   ; this menu is optional
mo_fl_backup0   Item    "M14"                   ; (only supplied if >1 floppy)
mo_fl_backup1   Item    "M24"
mo_fl_backup2   Item    "M34"
mo_fl_backup3   Item    "M44"

m_namedisc      Menu    "T01"
mo_nm_newname   Item    "M11",,W

m_sharedisc     Menu    "T02"
mo_fl_notsh     Item    "M12"
mo_fl_prot      Item    "M22"
mo_fl_unprot    Item    "M32"

                DCB     0                       ; terminator

mv_namedisc     DCB     "A~$&%@\\^:.#*""| ", 0  ; disallow funny chars

OtherFormatsToken       DCB     "OForms",0
CurrentFormatToken      DCB     "CFormat",0
UnknownFormatToken      DCB     "UKForm",0
UnformattedToken        DCB     "UFormed",0
EmptyToken              DCB     "NoDisc",0
1745
FileCorePercentFSTitle  DCB     "FileCore%$FSTitle",0
Ben Avison's avatar
Ben Avison committed
1746
TwoDiscsSameName        DCB     "2Same",0
Neil Turton's avatar
Neil Turton committed
1747 1748 1749 1750
                ALIGN

; .............................................................................

Kevin Bracey's avatar
Kevin Bracey committed
1751
CopyMenus Entry "r1-r3"
Neil Turton's avatar
Neil Turton committed
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772

        ADR     r1, mb_namedisc                 ; fill in writeable fields now
        ADR     r2, mv_namedisc
        MOV     r3, #?mb_namedisc
        ADR     r14, m_namedisc + m_headersize + 0*mi_size + mi_icondata
        STMIA   r14, {r1-r3}

        BL      allocatemessagedata             ; if not already done

        LDRVC   r0, messagedata
        ADRVC   r1, rom_menustart
        ADRVC   r2, ram_menustart
        MOVVC   r3, #ram_menuend-ram_menustart
        SWIVC   XMessageTrans_MakeMenus
        EXIT    VS

        MOV     r0, #(?mb_namedisc-1)*16+12     ; modify menu width for namedisc
        LDR     r14, m_namedisc + m_itemwidth
        CMP     r0, r14
        STRGT   r0, m_namedisc + m_itemwidth

1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814
      [ HotPlug
        LDR     r0, nfloppies                   ; counter
        CMP     r0, #1
        BLS     %FT09                           ; skip processing if 0 or 1 floppies
        Push    "r4,r6-r10"
        ADR     r1, m_backup + m_headersize     ; source item pointer
        MOV     r2, r1                          ; destination item pointer
        MOV     r3, #0                          ; drive number
        ADR     r4, backupmenudrivenumbers

01      ADR     r6, iconbaricons
        ADRL    r7, discnames + drv_number + 1
        MOV     r8, #ndrives
02      LDR     r14, [r6], #4
        CMP     r14, #-1
        LDRB    r14, [r7], #drv_size
        BEQ     %FT03                           ; skip missing icons
        SUB     r14, r14, #'0'
        TEQ     r14, r3                         ; found icon for this drive number?
        BEQ     %FT04
03      SUBS    r8, r8, #1
        BNE     %BT02                           ; try next icon
        ADD     r1, r1, #mi_size                ; not found, so skip this source item
        ADD     r3, r3, #1
        B       %BT01

        ASSERT  mi_size = 24
04      LDMIA   r1!, {r6-r10,r14}
        STMIA   r2!, {r6-r10,r14}
        STRB    r3, [r4], #1
        ADD     r3, r3, #1
        SUBS    r0, r0, #1
        BNE     %BT01                           ; look for other drives

        LDR     r14, [r2, #-mi_size + mi_itemflags]
        ORR     r14, r14, #mi_it_lastitem
        STR     r14, [r2, #-mi_size + mi_itemflags]

        Pull    "r4,r6-r10"
        CMP     pc, #0                          ; set HI condition for next bit
09
      |
Neil Turton's avatar
Neil Turton committed
1815 1816 1817 1818 1819 1820 1821 1822
        ADR     r1, m_backup + m_headersize + mi_itemflags
        LDR     r0, nfloppies
        SUBS    r0, r0, #1                      ; LT => no floppies, EQ => only 1
        ASSERT  mi_size = 24
        ADDGE   r0, r0, r0, LSL #1
        LDRGE   r14, [r1, r0, LSL #3]
        ORRGE   r14, r14, #mi_it_lastitem
        STRGE   r14, [r1, r0, LSL #3]
1823
      ]
Neil Turton's avatar
Neil Turton committed
1824

1825 1826
        ADRHI   r14, m_backup                   ; only have submenu if >1 drive
        STRHI   r14, m_floppydisc + m_headersize + mi_size*mo_fl_backup + mi_submenu
Neil Turton's avatar
Neil Turton committed
1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842

        ; Ensure submenu non-empty to get submenu arrow
        MOV     r14, #4
        STR     r14, m_floppydisc + m_headersize + mi_size*mo_fl_format + mi_submenu

        EXIT

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; event_menu_select
; =================

; In    r1 -> wimp_eventstr

; Out   all regs may be corrupted - going back to PollWimp

Kevin Bracey's avatar
Kevin Bracey committed
1843
event_menu_select Entry
Neil Turton's avatar
Neil Turton committed
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854

        MOV     r2, r1                  ; r2 -> menu selection list
        LDR     r1, menuhandle          ; r1 = menu handle
        BL      DecodeMenu
;
        ADRVC   r1,userdata             ; check for right-hand button
        SWIVC   XWimp_GetPointerInfo
        EXIT    VS

        LDR     R14,userdata+8          ; get button state
        TST     R14,#&01
1855 1856 1857 1858
      [ HotPlug
        MOVEQ   R14, #0
        STREQ   R14, menuopen
      ]
Kevin Bracey's avatar
Kevin Bracey committed
1859 1860 1861 1862 1863 1864
        EXIT    EQ

        LDRB    r8, driveno+1
        BL      update_menu_iconbar     ; update menu to gray out any items necessary
        LDR     R1, menuhandle
        SWI     XWimp_CreateMenu        ; here we go again!
Neil Turton's avatar
Neil Turton committed
1865 1866 1867 1868 1869 1870 1871 1872

        EXIT

; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

; In     r1 = menu handle
;        r2 -> list of selections

Kevin Bracey's avatar
Kevin Bracey committed
1873
DecodeMenu Entry
Neil Turton's avatar
Neil Turton committed
1874 1875 1876

decodelp
        Push    "r1,r2"
1877
        MOV     r0, #OsByte_ReadCMOS
Neil Turton's avatar
Neil Turton committed
1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959
        MOV     r1, #FileSwitchCMOS
        SWI     XOS_Byte
        ANDVC   r3, r2, #InteractiveCopyCMOSBit         ; r3 = 0 if interactive, 4 if not
        MOVVS   r3, #0                                  ; default to interactive
        Pull    "r1,r2"
      [ debug
        dreg    r3,"Interactive flag = "
      ]

        LDR     r14, [r2], #4            ; r1 = selection no
        ADD     pc, pc, r14, LSL #2
        EXIT

        B       go_fl_namedisc
        B       go_fl_dismount
        B       go_fl_format
        B       go_fl_backup
        B       go_fl_share
        B       go_fl_verify
        B       go_fl_free

error_namedisc  DCD     1
                DCB     "TooShrt",0
                ALIGN

go_fl_namedisc
        LDR     r14, [r2], #4           ; must select submenu
        TEQ     r14, #0
        EXIT    NE

        LDRB    r14, mb_namedisc        ; check that new name is >= 2 chars
        CMP     r14, #32
        LDRHSB  r14, mb_namedisc+1
        CMPHS   r14, #32
        ADRLO   r0, error_namedisc
        BLLO    lookuperror
        EXIT    VS
        ADR     r1, driveno             ; re-read media name
        BL      GetMediaName_nochecks   ; can be duplicate
        EXIT    VS

        BL      checkambiguous
        EXIT    NE                      ; some other error

        LDRVC   r0, =Message_FilerCloseDir
        BLVC    messagetoFiler          ; only close if NOT ambiguous already
      ; CLRV

        ADRL    r3, namedisc
        BL      copycommand
        ADR     r2, mb_namedisc
        BL      strcpy
        ADR     r0, userdata
 [ debug
 dstring r0, "namedisc: "
 ]
        SWI     XOS_CLI
        EXIT    VS

; if this is a hard disc icon, change the name underneath it

        LDR     r4, matchedindex

        ADR     r1, discnames + drv_iconblock
        LDR     r1, [r1, r4, LSL #drv_shift]    ; r1 -> icon block
        LDRB    r14, [r1, #icb_drivetype]
        TEQ     r14, #"f"                       ; don't change floppy icon!
        BLNE    AddToIconBar                    ; replace with new icon

        ADRVC   r1, driveno             ; don't allow this to clash!
        BLVC    GetMediaName            ; delete old/new disc
        EXIT

go_fl_dismount
        ADR     r1, driveno             ; re-read media name
        BL      GetMediaName_nochecks   ; r1 -> "adfs::discname"
        BLVC    dismountit

; OSS Added code to tell ADFS to power-eject the disc.

        LDRVCB  r1, driveno+1
        SUBVC   r1, r1, #"0"
1960
        MOVVC   r0, #MiscOp_Eject
1961
        SWIVC   X$SWIPrefix._MiscOp
Neil Turton's avatar
Neil Turton committed
1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016

        EXIT

        LTORG

go_fl_format
        ; Find out which format (by menu entry) (in (r5,r6))
        LDR     r5, [r2]
        CMP     r5, #0
        LDRGE   r6, [r2, #4]
        MOVLT   r5, #1          ; Default is first native format.
        MOVLT   r6, #-1
      [ debugfom
        dreg    r5,"Format (Menu entry): "
        dreg    r6,"Submenu entry "
      ]

        LDR     R14,FormatState
        CMP     R14,#0
        Push    "PC",EQ
        BEQ     BuildFormatMenu
        MOV     r0,r0

        CMP     r5,#0
        Pull    "PC",EQ

        CMP     r6,#-1
        LDRNE   r14,OthersTablePtr
        MOVNE   r6,r6,ASL #2
        LDRNE   r5,[r14,r6]
        SUBEQ   r5,r5,#1
        LDREQ   r14,NativeTablePtr
        MOVEQ   r5,r5,ASL #2
        LDREQ   r5,[r14,r5]
        CMP     r5,#0
        Pull    "PC",EQ

        CMP     r3, #0                          ; check for interactive/non-interactive
        LDRNE   r4, [r5, #EnumFormats_Flags]    ; if non-interactive then ensure we have a format descriptor for *format
        TSTNE   r4, #EnumFormats_HasFormatParam
      [ debugfom
        dreg    r3,"Interactive flag = "
        dreg    r4,"EnumFormat_Flags = "
      ]
        BEQ     Format_GoFormat         ; Do interactive format

        ; Non-interactive *Format
        ADR     r3, format
        BL      copycommand

        LDR     r2, [r5, #EnumFormats_FormatParam]
        BL      strcpy_advance

        B       noninteractive_command

2017 2018 2019
 [ HotPlug
                ALIGN   ; we need the next string to be word aligned
 ]
2020
adfscolon       DCB     "$FSTitle:",0   ; no aliases any more !
Neil Turton's avatar
Neil Turton committed
2021 2022 2023
namedisc        DCB     "Namedisc n ",0
dismount        DCB     "Dismount n ",0                         ; NB space still needed
format          DCB     "Format :n ",0
2024
desk_backup     DCB     "Desktop_$FSTitle.Filer -Backup n ",0   ; NB ':' not accepted here
Neil Turton's avatar
Neil Turton committed
2025 2026
backup          DCB     "Backup n ",0                           ; NB ':' not accepted here
verify          DCB     "Verify :n ",0
2027
desk_free       DCB     "ShowFree -FS $FSTitle n ",0            ; No : to allow showfree to work.
Neil Turton's avatar
Neil Turton committed
2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042
free            DCB     "Free n ",0                             ; NB ':' not accepted here
                ALIGN

go_fl_backup
        LDR     r4, [r2], #4            ; copy submenu index as copycommand craps on buffer
        MOV     r5, r3

        ADR     r1, driveno             ; stop ambiguous disc names
        BL      GetMediaName            ; name generated in [dirnamebuffer]
        EXIT    VS
        EXIT    NE

        Push    "r1"                    ; r1 -> disc name

        CMP     r5, #0
Kevin Bracey's avatar
Kevin Bracey committed
2043 2044 2045 2046 2047 2048 2049 2050
        BNE     %FT02
        ADR     r3, desk_backup
        BL      copycommand1
        B       %FT03
02
        ADR     r3, backup
        BL      copycommand
03
Neil Turton's avatar
Neil Turton committed
2051
        CMP     r4, #0                  ; submenu => destination drive
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067
      [ HotPlug
        ADRGE   r14, backupmenudrivenumbers
        LDRGEB  r3, [r14, r4]
        BGE     %FT01

        LDRB    r3, driveno+1           ; choose most appropriate drive
        SUB     r3, r3, #'0'
        LDR     r14, nfloppies
        CMP     r14, #1                 ; if 1 drive, it must be the same
        BLE     %FT01
        LDRB    r14, backupmenudrivenumbers+0
        TEQ     r3, r14                 ; otherwise choose another one
        LDREQB  r3, backupmenudrivenumbers+1
        MOVNE   r3, r14
01      ADD     r3, r3, #'0'
      |
Neil Turton's avatar
Neil Turton committed
2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078
        ADDGE   r3, r4, #"0"
        BGE     %FT01

        LDRB    r3, driveno+1           ; choose most appropriate drive
        LDR     r14, nfloppies
        CMP     r14, #1                 ; if 1 drive, it must be the same
        BLE     %FT01
        TEQ     r3, #"0"                ; otherwise choose another one
        MOVEQ   r3, #"1"
        MOVNE   r3, #"0"
01
2079
      ]
Neil Turton's avatar
Neil Turton committed
2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122
        STRB    r3, [r1], #1
        MOV     r14, #0
        STRB    r14, [r1]

        CMP     r5, #0                  ; check for interactive/non-interactive
        Pull    "r1",NE
        BNE     noninteractive_command
        BL      interactive_command

        Pull    "r1"                    ; r1 -> source disc name
        BL      dismountit              ; dismount source disc

        EXIT

go_fl_verify
        CMP     r3, #0                  ; check for interactive/non-interactive
        BEQ     Format_GoVerify

        ADR     r1, driveno             ; stop ambiguous disc names
        BL      GetMediaName
        EXIT    VS
        EXIT    NE
        ADR     r3, verify
        BL      copycommand
        B       noninteractive_command

go_fl_free
        MOV     r4, r3
        ADR     r1, driveno             ; stop ambiguous disc names
        BL      GetMediaName
        EXIT    VS
        EXIT    NE
        CMP     r4, #0
        ADREQ   r3, desk_free
        ADRNE   r3, free
        BL      copycommand

        CMP     r4, #0                  ; check for interactive/non-interactive
        BNE     noninteractive_command
        BL      interactive_command
        EXIT

go_fl_share     ; Tick the entry
2123
     [ :LNOT: SDFS
Neil Turton's avatar
Neil Turton committed
2124 2125 2126 2127 2128 2129 2130
        LDR     r4, [r2], #4
        CMP     r4, #mo_fl_notsh             ; check if 'not shared' has being selected
        BEQ     unset_share
        CMP     r4, #mo_fl_prot              ; check if 'protected' has being selected
        BEQ     set_share_options_prot
        CMP     r4, #mo_fl_unprot            ; check if 'unprotected' has being selected
        BEQ     set_share_options_unprot
2131
      ]
Neil Turton's avatar
Neil Turton committed
2132 2133
        EXIT

Kevin Bracey's avatar
Kevin Bracey committed
2134
interactive_command Entry
Neil Turton's avatar
Neil Turton committed
2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165
        ADR     r0, userdata
      [ debug
        DSTRING r0,"Interactive command is : "
        DREG    r13,"r13 is "
      ]
        SWI     XWimp_StartTask                 ; needs a new domain
      [ debug
        DREG   r13,"New Task started"
      ]
        EXIT

noninteractive_command
        ADRL    r0, userdata+(?adfscolon)-1
        SWI     XWimp_CommandWindow
        EXIT    VS
        ADR     r0, userdata
      [ debug
        dstring r0, "Non-interactive command is : "
      ]
        SWI     XOS_CLI
        BVC     %FT01

        SWI     XOS_NewLine
        ADD     r0, r0,#4
        SWI     XOS_Write0
        SWI     XOS_NewLine
01
        MOV     r0, #0
        SWI     XWimp_CommandWindow
        EXIT

Kevin Bracey's avatar
Kevin Bracey committed
2166
dismountit_byname       Entry "r1"
Neil Turton's avatar
Neil Turton committed
2167 2168 2169 2170 2171

        ADRL    r3, dismount
        BL      copycommand
        SUB     r1, r1, #2              ; r1 -> original drive number
        LDR     r2, [sp]                ; r2 -> "adfs::discname"
2172
        ADD     r2, r2, #:LEN:"$FSTitle::" ; r2 -> discname
Neil Turton's avatar
Neil Turton committed
2173 2174 2175 2176 2177 2178 2179 2180
        BL      strcpy
        ADR     r0, userdata
 [ debug
 dstring r0, "dismountit: "
 ]
        SWI     XOS_CLI
        EXIT