home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
diskmanager
/
overfiler_1
/
!OverFiler
/
0_07
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-12-03
|
86KB
|
1,639 lines
>OverFiler:0_07
Allow objects to be dragged to FileCore icon filer
David G Jones, 1994
This software is PD, do what you will with it.
$; " (Error code ";
); ")":
prog$ = "OverFiler"
vers$ = "0.07"
date$ = "30 Nov 1994"
command$="Desktop_" + prog$
cUpdate% = 100 :
Number of centiseconds between testing
0bl$ =
(0): cr$ =
(13): nl$ =
(10) +
"Service_Reset = &27
XService_StartWimp = &49 :
Use *Wimp versions so we start up after all Filers
%Service_StartedWimp = &4A :
"Service_WimpSaveDesktop = &5C
Layout of OverDrive for one drive
" A% = 0
LOD_Icon% = A%: A% += 4:
Current icon number in icon bar window
:OD_Drive% = A%: A% += 4:
Drive number [0 - 7]
KOD_Task% = A%: A% += 4:
Task handle of original owner of icon
AOD_Flags% = A%: A% += 4:
Word. Details of bits below
YOD_Sequence% = A%: A% += 4:
Sequence number of accessing Poll changed for drive
6OD_IWidth% = A%: A% += 4:
Icon width in EC
8OD_SWidth% = A%: A% += 4:
Sprite width in EC
:OD_FSNumber% = A%: A% += 4:
Filing system number
TOD_DescribeDisc% = A%: A% += 4:
SWI "Xfs_DescriveDisc" instruction for this FS
!TOD_MiscOp% = A%: A% += 4:
SWI "Xfs_MiscOp" instruction for this FS
"8OD_FSName% = A%: A% +=12:
Filing system name
#HOD_IName% = A%: A% +=12:
Icon name, either :0, or disc name
$7OD_ISprite% = A%: A% +=12:
"S" + sprite name
%?OD_IPriority% = A%: A% += 4:
Icon priority on icon bar
&MOD_OldIcon% = A%: A% += 4:
Original icon number from original task
'cOD_OldIconData% = A%: A% +=36:
Actual data to recreate original icon (+4 for fiddling space)
OD_PollChanged% = A%: A% += 4: REM Store actual word returned by FileCore_MiscOp
)DOD_Next% = A%: A% += 4:
Pointer to next drive. 0 = end
OD_Size% = A%
Details of OD_Flags% word
-PFlags_Directory% = 1<< 0 :
Display drive directory if new disc inserted
.PFlags_Poll% = 1<< 1 :
Whether drive should be tested every Update%
/8Flags_Hard% = 1<< 2 :
Drive is a Hard disc
0ZFlags_SprCorrupt% = 1<< 3 :
Can't find a sprite for the drive so just use standard
1TFlags_Added% = 1<< 4 :
Drive added, but details not yet known by WIMP
2TFlags_Removed% = 1<< 5 :
Drive removed, but details not yet known by WIMP
3cFlags_FullProcess% = 1<< 6 :
Ensure that a suitable name, etc is written into icon this poll
4DFlags_DiscCorrupt% = 1<< 7 :
Current disc in drive is corrupt
52Flags_Empty% = 1<< 8 :
Drive is empty
6GFlags_ModeSame% = 1<< 9 :
If there has NOT been a mode change
7dFlags_FinalRemove% = 1<< 10 :
Drive removed, and original icon reinserted within original task
8DFlags_Priority% = 1<< 11 :
Priority value explicitly stated
9DFlags_SprOverload% = 1<< 12 :
A sprite was explicitly supplied
:bFlags_Click% = 1<< 13 :
Update icon display when icon is clicked (ie reverse of -Poll)
;XFlags_NoIcon% = 1<< 14 :
There actually was not such an original icon defined
Set out of Data. If changed see .ProtoDT
>( A% = 0
?ADT_TaskHandle% = A%:A% += 4:
OverFiler task handle
@_DT_DrivesPending% = A%:A% += 4:
!= 0 means Add/Remove waiting for WIMP to come back
AHDT_Drives% = A%:A% += 4:
Pointer to first Drive entry
BZDT_HelpTask% = A%:A% += 4:
Task handle from sender of Message_HelpRequest
C_DT_FilerSelect_Column% = A%:A% += 4:
End column of selection from Message_FilerSelection
D_DT_FilerSelect_Row% = A%:A% += 4:
End row of selection from Nessage_FilerSelection
EfDT_DataLoad% = A%:A% += 4:
-2 DataSave; -1 No select; 0 First in select; +ve select X
FaDT_UpdateIcon% = A%:A% += 16:
Suitale blank Wimp_UpdateIcon block to redraw an icon
GJDT_InlineSWI% = A%:A% += 8:
Area for a SWI X & mov pc, r14
HMDT_WimpPollRoutine% = A%:A% += 4:
Address of current Wimp_Poll loop
IiDT_CloseDownRoutine% = A%:A% += 4:
Address of routine we should execute application in emergency
JcDT_FilerAction_Reason% = A%:A% += 4:
Reason code we are going to send to our FileAction task
KJDT_FilerAction_Task% = A%:A% += 4:
Task handle for our FileAction
L;DT_XEigfactor% = A%:A% += 4:
Current modes X
M[DT_Trapfscv% = A%:A% += 12:
Used for generating changed discs filing system
NaDT_Space% = A%:A% +=256:
For Wimp_Poll and general sandpit area for playing in
OW A% +=128:
Space for a few register saves in the stack
DT_Stack% = A%
DT_Size% = A%
OS_WriteI = &100
T!XOS_WriteI = &100
(1 << 17)
assembly
"OS_File", 10, prog$, &FFA,, code, O%
assembly
rDrive = 10
code 16383
pass% = 4
O% = code: P% = 0
[ OPT pass%
`! equd start
a& equd initialize
b$ equd finalize
c' equd serviceCall
d' equd titleString
e& equd helpString
f$ equd keyWords
equd 0
equd 0
equd 0
equd 0
l-.titleString equs prog$ +bl$: align
md.helpString equs prog$+
(9)+vers$+" ("+date$+") David G Jones (Public Domain)"+bl$: align
.keyWords
p/.startUpName equs command$+bl$: align
q' equd startUpComm
equd 0
s' equd startUpHelp
t' equd startUpHelp
u4.addName equs prog$+"_Add" +bl$: align
v# equd addComm
w' equd &0000080003
x# equd addHelp
y# equd addHelp
z7.drivesName equs prog$+"_Drives" +bl$: align
{& equd drivesComm
equd 0
}& equd drivesHelp
~& equd drivesHelp
7.removeName equs prog$+"_Remove" +bl$: align
& equd removeComm
' equd &0000020002
& equd removeHelp
& equd removeHelp
.keyWords_end equd 0
g equd 0 ; So we can use startUpHelp as an error block
.startUpHelp equs "The "+prog$+" allows files to be dragged over FileCore drive icons. Drive icons also reflect discs in drive."+nl$
N equs "Do not use *"+command$+", use *Desktop instead."+nl$
6 equs "Syntax: *Desktop_"+prog$+bl$
align
/.startUpComm stmfd r13!, {r0 - r2, r14}
! mov r2, r0
O mov r0, #3 ; Command mode or not
. swi "XWimp_ReadSysInfo"
. ldmVSfd r13!, {r0 - r2, pc}
P teq r0, #0 ; Is the wimp running?
H adrEQ r0, startUpHelp ; >No So barf
- swiEQ "OS_GenerateError"
* adr r1, titleString
H mov r0, #2 ; Enter module
' swi "XOS_Module"
. ldmfd r13!, {r0 - r2, pc}
n.addHelp equs "OverFiler_Add will replace a FileCore filer icon bar icon with a super version." +nl$
equs "Syntax: *OverFiler_Add <drive> <FSname> <iconnumber> [-Directory] [-Poll] [-Priority <priority>] [-Sprite <name>] [-Click]" +bl$
align
n.addReadArgs equs "drive/E/A,fs/A,icon/E/A,directory/S,poll/S,priority/E/K,sprite/K,click/S" +bl$: align
2.addComm stmfd r13!, {r9, rDrive, r14}
% ldr r12, [r12]
Y ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Head of drive chain
; process command arguments
! mov r1, r0
* adr r0, addReadArgs
. add r2, r12, #DT_Space%
# mov r3, #256
) swi "XOS_ReadArgs"
*; Create new block of memory for drive
G movVC r0, #6 ; Claim block
( movVC r3, #OD_Size%
' swiVC "XOS_Module"
' bVS addComm_exit
% mov rDrive, r2
q mov r0, #0 ; Ensure drive is terminated correctly (even though not
W str r0, [rDrive, #OD_Next%] ; connect in drive chain yet)
; Read in arguments
` mov r9, #Flags_Added% + Flags_FullProcess% + Flags_ModeSame%;*r9 == Flags
H ldr r0, [r12, #0 +DT_Space%] ; Drive number
% add r0, r0, #1
# bL loadWord
d cmp r1, #7 ; FileCore drives are in the range [0 - 7]
X adrHI r0, addComm_err0 ; Illegal drive number so barf
' bHI addComm_fail
3 str r1, [rDrive, #OD_Drive%]
V cmp r1, #4 ; Is it a floppy/hard drive?
% rsb r0, r1, #7
I movLT r1, #&60000000 ; >Floppy drive
G movGE r1, #&70000000 ; >Hard drive
\ orrGE r9, r9, #Flags_Hard% ; Remember it aswell
h add r1, r1, r0 ; Order icons with Priority group on their dri
7 str r1, [rDrive, #OD_IPriority%]
B ldr r0, [r12, #4 +DT_Space%] ; FSname
2 add r1, rDrive, #OD_FSName%
! bl strcpy
G ldr r0, [r12, #8 +DT_Space%] ; Icon number
% add r0, r0, #1
# bl loadWord
2 str r1, [rDrive, #OD_Icon%]
5 str r1, [rDrive, #OD_OldIcon%]
E ldr r0, [r12, #12 +DT_Space%] ; Directory
! teq r0, #0
4 orrNE r9, r9, #Flags_Directory%
@ ldr r0, [r12, #16 +DT_Space%] ; Poll
! teq r0, #0
/ orrNE r9, r9, #Flags_Poll%
I ldr r0, [r12, #20 +DT_Space%] ; Icon priority
! teq r0, #0
3 orrNE r9, r9, #Flags_Priority%
% addNE r0, r0, #1
# blNE loadWord
7 strNE r1, [rDrive, #OD_IPriority%]
G ldr r0, [r12, #24 +DT_Space%] ; Sprite name
! teq r0, #0
5 orrNE r9, r9, #Flags_SprCorrupt%
6 orrNE r9, r9, #Flags_SprOverload%
6 addNE r1, rDrive, #OD_ISprite% +1
! blNE strcpy
A ldr r0, [r12, #28 +DT_Space%] ; Click
! teq r0, #0
0 orrNE r9, r9, #Flags_Click%
8; Now initialize rest of structure to default values
! mov r0, #0
2 str r0, [rDrive, #OD_Task%]
6 str r0, [rDrive, #OD_Sequence%]
4 str r0, [rDrive, #OD_IWidth%]
4 str r0, [rDrive, #OD_SWidth%]
T str r0, [rDrive, #OD_FSNumber%] ; No FS number (presently)
E str r0, [rDrive, #OD_DescribeDisc%]; Excessive
E str r0, [rDrive, #OD_MiscOp%] ; Excessive
3 str r0, [rDrive, #OD_IName%]
3 add r1, rDrive, #OD_ISprite%
f mov r0, #
("S"): strB r0, [r1], #1 ; Set first char to 'S' for Spite name command
] tst r9, #Flags_SprCorrupt% ; Has the user set the sprite name?
f addEQ r0, rDrive, #OD_FSName% ; >No So generate ours from FS and tail 'i'
! blEQ strcpy
3 ldrEQ r0, [rDrive, #OD_Drive%]
* addEQ r0, r0, #
("0")
) strEQB r0, [r1], #1
d movEQ r0, #
("i"):strEQB r0, [r1], #1; Set initially disc to be inserted in drive
6 movEQ r0, # 0 :strEQB r0, [r1]
3 str r9, [rDrive, #OD_Flags%]
9; Setup to tell WIMP about all our devilish going ons
8 ldr r0, [r12, #DT_DrivesPending%]
% add r0, r0, #1
8 str r0, [r12, #DT_DrivesPending%]
1;Now connect this drive up in the drive chain
1 ldr r0, [r12, #DT_Drives%]
! teq r0, #0
5 strEQ rDrive, [r12, #DT_Drives%]
' bEQ addComm_exit
/ add r1, r12, #DT_Drives%
5 ldr r2, [rDrive, #OD_OldIcon%]
1.loop ldr r3, [r0, #OD_OldIcon%]
! cmp r2, r3
' bLE addComm_addB
, add r1, r0, #OD_Next%
. ldr r0, [r0, #OD_Next%]
! teq r0, #0
bNE loop
' str rDrive, [r1]
1.addComm_exit ldmfd r13!, {r9, rDrive, pc}
'.addComm_addB str rDrive, [r1]
2 str r0, [rDrive, #OD_Next%]
1 ldmfd r13!, {r9, rDrive, pc}
P.addComm_err0 equd 0: equs "Drive must be within range [0 - 7]" +bl$: align
Y; Any errors encountered which lead to the new proto drive entry having to be deleted
!.addComm_fail mov r1, r0
@ mov r0, #7 ; Free
% mov r2, rDrive
' swi "XOS_Module"
! movVC r0, r1
K swiVC "XOS_GenerateError" ; Ensure Vbit set
1 ldmfd r13!, {r9, rDrive, pc}
c.drivesHelp equs "OverFiler_Drives displays all the drives which have been taken over." +nl$
8 equs "Syntax: *OverFiler_Drives" +bl$
align
F.drivesHeader equs " D FS Icon .NCOPRMECFRASHPD" +bl$: align
..drivesComm stmfd r13!, {rDrive, r14}
% ldr r12, [r12]
O mov r3, #9 ;*r3 == Tab character
V add r4, r12, #DT_Space% ;*r4 => Output string buffer
O mov r5, #
(" ") ;*r5 == Space character
5 ldr rDrive, [r12, #DT_Drives%]
% teq rDrive, #0
- ldmEQfd r13!, {rDrive, pc}
>; Write a hopefully helpful header string outlining fields
!+ adr r0, drivesHeader
"' swi "XOS_Write0"
#( swiVC "XOS_NewLine"
$J mov r0, #32 ;.Draw separator
%..loop swiVC XOS_WriteI +
("-")
&% subS r0, r0, #1
bGT loop
(( swiVC "XOS_NewLine"
)- ldmVSfd r13!, {rDrive, pc}
* ; Now print each drive entry
+%.loop teq rDrive, #0
,F ldmEQfd r13!, {rDrive, pc} ; ***Exit***
-! mov r1, r4
.3 ldr r2, [rDrive, #OD_Flags%]
/, tst r2, #Flags_Added%
0S movNE r0, #
("+"):strNEB r0, [r1], #1; Drive waiting to be added
1V tst r2, #Flags_Removed% ; /\Not mutually exlcusive\/
2U movNE r0, #
("-"):strNEB r0, [r1], #1; Drive waiting to be removed
3= tst r2, #Flags_Removed% + Flags_Added%
4^ movEQ r0, # 31 :strEQB r0, [r1], #1; No executive action wainting drive
5H ldr r0, [rDrive, #OD_Drive%] ; Drive number
6# mov r2, #128
71 swi "XOS_ConvertCardinal1"
8' strVCB r5, [r1], #1
9C addVC r0, rDrive, #OD_FSName% ; FS name
:! blVC strcpy
;' strVCB r3, [r1], #1
<d ldrVC r0, [rDrive, #OD_OldIcon%] ; Old icon number (for original Filer app)
=1 swiVC "XOS_ConvertCardinal1"
>' strVCB r5, [r1], #1
?O ldrVC r0, [rDrive, #OD_Icon%] ; Current icon number
@1 swiVC "XOS_ConvertCardinal1"
A' strVCB r3, [r1], #1
BO ldrVC r0, [rDrive, #OD_Flags%] ; Current drive flags
C/ swiVC "XOS_ConvertBinary2"
D! movVC r0, r4
EZ movVC r1, #0 ; Use internal RiscOS dictionary
FM movVC r2, #0 ; No special string
G, swiVC "XOS_PrettyPrint"
H( swiVC "XOS_NewLine"
I6 ldrVC rDrive, [rDrive, #OD_Next%]
bVC loop
K, ldmfd r13!, {rDrive, pc}
.removeHelp equs "OverFiler_Remove allows single drive entries to be forgotten. Icon will be replaced by the original version." +nl$
NI equs "Syntax: *Overfiler_Remove <drive> <FSname>" +bl$
align
Q5.removeReadArgs equs "drive/E/A,fs/A" +bl$: align
S&.removeComm stmfd r13!, {r14}
TG ldr r12, [r12] ; r12 => Data
U! mov r1, r0
V- adr r0, removeReadArgs
W. add r2, r12, #DT_Space%
X# mov r3, #256
Y) swi "XOS_ReadArgs"
Z% ldmVSfd r13!, {pc}
[: ldr r0, [r2, #0]
\% add r0, r0, #1
]# bL loadWord
^V mov r4, r1 ;*r4 == desired Drive number
_Q ldr r1, [r2, #4] ;*r1 => desired FS name
`M ldr r2, [r12, #DT_Drives%] ;*r2 => Drive entry
aX.loop teq r2, #0 ; Is this a valid drive entry?
b[ bEQ removeComm_fail ; >No ***Exit*** @Drive not found
cR ldr r3, [r2, #OD_Next%] ;*r3 => Next Drive entry
d/ ldr r0, [r2, #OD_Drive%]
eQ teq r0, r4 ; Correct drive number?
f. addEQ r0, r2, #OD_FSName%
g! blEQ strcmp
h! movNE r2, r3
bNE loop
; now delete the drive
k/ ldr r0, [r2, #OD_Flags%]
l2 orr r0, r0, #Flags_Removed%
m/ str r0, [r2, #OD_Flags%]
n8 ldr r0, [r12, #DT_DrivesPending%]
o% add r0, r0, #1
p8 str r0, [r12, #DT_DrivesPending%]
q% ldmfd r13!, {pc}
.removeComm_fail
s. adr r0, removeComm_err0
tK swi "XOS_GenerateError" ; Ensure Vbit set
u% ldmfd r13!, {pc}
vW.removeComm_err0 equd 0: equs "Could not find suitable drive to remove" +bl$: align
x1.serviceCall teq r1, #Service_StartWimp
y3 teqNE r1, #Service_StartedWimp
z- teqNE r1, #Service_Reset
{7 teqNE r1, #Service_WimpSaveDesktop
|" movNES pc, r14
~1 teq r1, #Service_StartWimp
$ bEQ startWimp
3 teq r1, #Service_StartedWimp
& bEQ startedWimp
- teq r1, #Service_Reset
' bEQ serviceReset
7 teq r1, #Service_WimpSaveDesktop
* bEQ wimpSaveDesktop
" movS pc, r14
*.startWimp stmfd r13!, {r2, r14}
% ldr r12, [r12]
5 ldr r2, [r12, #DT_TaskHandle%]
! teq r2, #0
! mvnEQ r2, #0
5 strEQ r2, [r12, #DT_TaskHandle%]
.
adrl("EQ", 0, startUpName)
! movEQ r1, #0
* ldmfd r13!, {r2, pc}^
*.startedWimp stmfd r13!, {r2, r14}
% ldr r12, [r12]
5 ldr r2, [r12, #DT_TaskHandle%]
! cmn r2, #1
! movEQ r2, #0
5 strEQ r2, [r12, #DT_TaskHandle%]
* ldmfd r13!, {r2, pc}^
*.serviceReset stmfd r13!, {r2, r14}
% ldr r12, [r12]
! mov r2, #0
5 str r2, [r12, #DT_TaskHandle%]
* ldmfd r13!, {r2, pc}^
.wimpSaveDesktop
7 stmfd r13!, {r0 - r6, rDrive, r14}
% ldr r12, [r12]
M mov r5, r2 ;*r5 == File handle
( adr r0, SD_OFPath
. add r1, r12, #DT_Space%
C mov r2, #
("/") ; / == *Run
' strB r2, [r1], #1
# mov r2, #255
! mov r3, #0
Z mov r4, #3 ; Want expanded string on return
+ swi "XOS_ReadVarVal"
% addVC r1, r1, r2
% adrVC r0, SD_Run
! blVC strcpy
N movVC r0, #10 ; Linefeed character
( strVCB r0, [r1], #1
K addVC r3, r2, #1 + 4 + 1 ; Number of chars
. addVC r2, r12, #DT_Space%
! movVC r1, r5
] movVC r0, #2 ; Write bytes from current position
% swiVC "XOS_GBPB"
/ bVS wimpSaveDesktop_fail
3; Set up command to regenerate each drive entry
Y ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Current drive entry
O mov r6, #
(" ") ;*r6 == Space character
%.loop teq rDrive, #0
7 ldmEQfd r13!, {r0 - r6, rDrive, pc}^
: add r1, r12, #DT_Space%
_ ldr r4, [rDrive, #OD_Flags%] ;*r4 == Flags for current drive entry
' adr r0, SD_OFAdd
! bl strcpy
H ldrB r0, [rDrive, #OD_Drive%] ; Drive number
* add r0, r0, #
("0")
' strB r0, [r1], #1
' strB r6, [r1], #1
N add r0, rDrive, #OD_FSName% ; Filing system name
! bl strcpy
' strB r6, [r1], #1
K ldr r0, [rDrive, #OD_OldIcon%] ; Old icon number
" mov r2, #16
0 swi "XOS_ConvertInteger2"
/ bVS wimpSaveDesktop_fail
K tst r4, #Flags_Poll% ; Poll the drive?
& adrNE r0, SD_Poll
! blNE strcpy
L tst r4, #Flags_Click% ; Poll the drive?
' adrNE r0, SD_Click
! blNE strcpy
M tst r4, #Flags_Directory% ; Open directories?
+ adrNE r0, SD_Directory
! blNE strcpy
L tst r4, #Flags_SprOverload% ; Explicit Sprite?
( adrNE r0, SD_Sprite
! blNE strcpy
6 add r0, rDrive, #OD_ISprite% +1
! blNE strcpy
N tst r4, #Flags_Priority% ; Explicit Priority?
* adrNE r0, SD_Priority
! blNE strcpy
] movNE r0, #
("&") ; Tell system that it is a Hex number
' strNEB r0, [r1], #1
7 ldrNE r0, [rDrive, #OD_IPriority%]
, swiNE "XOS_ConvertHex8"
N movVC r0, #10 ; Linefeed character
' strVCB r0, [r1], #1
. addVC r2, r12, #DT_Space%
W subVC r3, r1, r2 ; Length of generated command
] movVC r0, #2 ; Write bytes from current position
! movVC r1, r5
% swiVC "XOS_GBPB"
6 ldrVC rDrive, [rDrive, #OD_Next%]
bVC loop
.wimpSaveDesktop_fail
O add r13, r13, #8 ; Ignore saved r0, r1
L mov r1, #0 ; We have an error
7 ldmfd r13!, {r2 - r6, rDrive, pc}^
0.SD_OFPath equs "OverFiler$Path" +bl$
0.SD_Run equs "!Run" +bl$
0.SD_OFAdd equs "OverFiler_Add " +bl$
0.SD_Poll equs " -Poll" +bl$
0.SD_Directory equs " -Directory" +bl$
0.SD_Sprite equs " -Sprite " +bl$
0.SD_Priority equs " -Priority " +bl$
0.SD_Click equs " -Click" +bl$
ALIGN
,; Last ditch attempt to find task handle
; Entry rDrive
-.searchFT_filer equs " Filer" +bl$: align
8.searchForTask stmfd r13!, {r0 - r1, r3 - r5, r14}
. add r1, r12, #DT_Space%
2 add r0, rDrive, #OD_FSName%
! bl strcpy
- adr r0, searchFT_filer
! bl strcpy
! mov r0, #0
2.searchFT0 add r1, r12, #32 +DT_Space%
" mov r2, #16
8 swi "XTaskManager_EnumerateTasks"
! movVS r2, #0
' bVS searchFT_end
! cmp r0, #0
! movLT r2, #0
' bLT searchFT_end
7 ldr r2, [r12, #4 +32 +DT_Space%]
. add r3, r12, #DT_Space%
'.loop ldrB r4, [r2], #1
' ldrB r5, [r3], #1
! teq r4, r5
$ bNE searchFT0
" cmp r4, #32
bGE loop
7 ldr r2, [r12, #0 +32 +DT_Space%]
8.searchFT_end ldmfd r13!, {r0 - r1, r3 - r5, pc}^
Z.drive0_err equd 0: equs "Could not find Filer in charge of this drive" +bl$: align
C.drive1_err equd 0: equs "No such filing system" +bl$: align
V; This startup a new drive within the WIMP *rDrive => drive entry , r9
!(; Exit r0 *Corrupted* Vset if error
"/.driveStart stmfd r13!, {r1 - r8, r14}
#.;Get full details of icon we are replacing
$. add r1, r12, #DT_Space%
%K mvn r0, #1 ; Icon bar window
&' str r0, [r1, #0]
'5 ldr r0, [rDrive, #OD_OldIcon%]
(' str r0, [r1, #4]
)/ swi "XWimp_GetIconState"
*Q add r0, r1, #8 ; => Start of Icon data
+V ldmia r0, {r1 - r8} ; Load 32 bytes of icon data
,7 add r0, rDrive, #OD_OldIconData%
-f stmia r0, {r1 - r8} ; Store them so we can recreate icon in full
.I; Find task handle of the drive filer we are replacing
/. add r1, r12, #DT_Space%
0D mov r0, #0 : str r0, [r1, #12] ; your_ref
1Z mov r0, #19 ;*r0 == User_Message_Acknowledge
2X mvn r2, #1 ;*r2 == icon bar window handle
35 ldr r3, [rDrive, #OD_OldIcon%]
4. swi "XWimp_SendMessage"
5* bVS driveStart_exit
65 ldr r3, [r12, #DT_TaskHandle%]
7! teq r3, r2
8e teqNE r2, #0 ; Did a task actually have control of icon?
92 strNE r2, [rDrive, #OD_Task%]
:1 orrEQ r9, r9, #Flags_NoIcon%
;U mvnNE r0, #1 ; == icon bar window handle
<5 ldrNE r2, [rDrive, #OD_OldIcon%]
=' stmNEia r1, {r0, r2}
>- swiNE "XWimp_DeleteIcon"
?* blVS driveStart_exit
@( blEQ searchForTask
A@ strEQ r2, [rDrive, #OD_Task%] ; >Yes
BZ teqEQ r2, #0 ; Has owner task been found yet?
Cd adrEQ r0, drive0_err ; >No Aarggh just warn user of the problem
D# blEQ retError
E\; Gets FS number (almost possibly manipulating FSname into correct form, ie add tail FS)
F_.driveStart1 mov r0, #13 ; Check for presence of filing system
G2 add r1, rDrive, #OD_FSName%
HX mov r2, #0 ; String termination condition
I* swi "XOS_FSControl"
J* bVS driveStart_exit
KT teq r2, #0 ; Was filing system found?
LX adrEQ r0, drive1_err ; >No So prime for error barf
M. swiEQ "XOS_GenerateError"
NK bEQ driveStart_exit ; ***Exit***
O6 strNE r1, [rDrive, #OD_FSNumber%]
P7; get swi numbers for Xfs_MiscOp & Xfs_DescribeDisc
Q0.driveStart2 add r1, r12, #DT_Space%
Rd ldr r2, drive1_swi ;*r2 == swiAL proto section of instruction
SR mov r0, #
("X") ; Want error returning swi
T' strB r0, [r1], #1
U2 add r0, rDrive, #OD_FSName%
V! bl strcpy
Wf ldrB r0, [r1, #-2] ; Append 'FS' if not already included at end
XD teq r0, #
("F") ; of FS name
Y( ldrNEB r0, [r1, #-1]
Z& teqNE r0, #
("S")
[9 movNE r0, #
("F"): strNEB r0, [r1], #1
\9 movNE r0, #
("S"): strNEB r0, [r1], #1
]d mov r3, r1 ;*r3 => start of swi specific name section
; swi Xfs_DescribeDisc
_( adr r0, drive1_DD
`! bL strcpy
a. add r1, r12, #DT_Space%
b4 swi "XOS_SWINumberFromString"
c, ldrVS r0, drive1_DDfail
d% orrVC r0, r0, r2
e: str r0, [rDrive, #OD_DescribeDisc%]
; swi Xfs_MiscOp
g( adr r0, drive1_MO
h! mov r1, r3
i! bL strcpy
j. add r1, r12, #DT_Space%
k4 swi "XOS_SWINumberFromString"
l, ldrVS r0, drive1_MOfail
m% orrVC r0, r0, r2
n4 str r0, [rDrive, #OD_MiscOp%]
pcmov r0, pc: bic r0, r0, #1 << 28: teqP pc, r0 ; Clear Vbit from all our above fiddlings
r&; Calculate width of drives sprite
s% bL spriteSize
u.; Replace original drive icon with our own
vb movS r0, #0 ; Set EQ - relevant icon deleted already
wQ bL iconRebirth ; Replace with our icon
xF.driveStart_exit ldmfd r13!, {r1 - r8, pc} ; ***Exit***
.drive1_swi swi 0
{,.drive1_DD equs "_DescribeDisc" +bl$
|-.drive1_MO equs "_MiscOp" +bl$: align
}*.drive1_DDfail swi "XOS_GenerateError"
.drive1_MOfail mov r3, #0
/.wimpError add r13, r12, #DT_Stack%
$ mov r1, #%011
' adr r2, TaskName
- swi "Wimp_ReportError"
K teq r1, #1 ; Ok to continue?
? bNE error_cd ; >No
; ldr r14, [r12, #DT_WimpPollRoutine%]
] teq r14, #0 ; Has a wimp_Poll loop been set up?
P movNE pc, r14 ; >Yes So return to it
C; Attempt to exist application in the safest way
<.error_cd ldr r14, [r12, #DT_CloseDownRoutine%]
p teq r14, #0 ; Has a suitable application exit routine been set up?
Z swiEQ "OS_Exit" ; >No Default system ***Exit***
N mov pc, r14 ; >Yes Go on to that
/.retError stmfd r13!, {r0 - r2, r14}
$ mov r1, #%011
' adr r2, TaskName
- swi "Wimp_ReportError"
K teq r1, #1 ; Ok to continue?
Q ldmEQfd r13!, {r0 - r2, pc}^ ; Ensure Vbit still set
# b error_cd
$.initialize ldr r0, [r12]
] teq r0, #0 ; Is this the result of a RMA tidy?
N movNE pc, r14 ; >Yes So ***Exit***
& stmfd r13!, {r14}
H mov r0, #6 ; Claim memory
( mov r3, #DT_Size%
' swi "XOS_Module"
f strVC r2, [r12] ; Store the reference to our block of memory
` adrVC r1, ProtoDT ; Initialize critical sections of DaTa
\ ldmVCia r1!, {r0, r3 - r6, r12, r14} ; Copy DT_TaskHandle - DT_DataLoad
7 stmVCia r2!, {r0, r3 - r6, r12, r14}
N ldmVCia r1!, {r3 - r6} ; Copy DT_UpdateIcon
- stmVCia r2!, {r3 - r6}
h ldmVCia r1!, {r3 - r6} ; DT_InlineSWI% , WimpPollRoutine, ExitRoutine
- stmVCia r2!, {r3 - r6}
F ldmfd r13!, {pc} ; ***Exit***
&; This destroys our nice DT_% defs
E.ProtoDT equd 0: equd 0: equd 0: equd 0: equd 0: equd 0: equd -1
, equd -2: equd 0: equd 0: equd 0
1 equd 0: mov pc, r14: equd 0: equd 0
'.finalize stmfd r13!, {r14}
G ldr r12, [r12] ;*r12 => DaTa
6 ldr r0, [r12, #DT_TaskHandle%]
W teq r0, #0 ; Was Wimp_Initialize called?
$ ldrGT r1, TASK
- swiGT "XWimp_CloseDown"
C movGT r0, #&1D ; UpCallV
.
adrl("GT", 1, trapupcall)
# movGT r2, r12
) swiGT "XOS_Release"
H movGT r0, #&0F ; OS_FSControl
,
adrl("GT", 1, trapfscv)
# movGT r2, r12
. swiGT "XOS_Release"
0; reset task handle in case we are restarted
e mov r1, #0 ; Initialize task handle in case we restart
6 str r1, [r12, #DT_TaskHandle%]
+; free all our drive entries (if fatal)
] teq r10, #0 ; Is this a non-fatal finalization?
h ldmEQfd r13!, {pc}^ ; >Yes So leave drive entries intact***Exit***
G mov r0, #7 ; Free memory
M ldr r2, [r12, #DT_Drives%] ;*r2 => Drive entry
Y teq r2, #0 ; Are there any drives entries?
h ldmEQfd r13!, {pc}^ ; >No So ignore ***Exit***
G mov r4, #0 ; Reset value
1 str r4, [r12, #DT_Drives%]
[.loop ldr r3, [r2, #OD_Next%] ;*r3 => next Drive entry in chain
c str r4, [r2, #OD_Next%] ; Just a precaution incase gone cyclic...
' swi "XOS_Module"
! movS r2, r3
bNE loop
& ldmfd r13!, {pc}^
\; Simply removes the icon from the icon bar and sets up Filter to recreate original icon
/.driveRemove stmfd r13!, {r1 - r4, r14}
3 add r1, r12, #DT_UpdateIcon%
2 ldr r0, [rDrive, #OD_Icon%]
' str r0, [r1, #4]
- swi "XWimp_DeleteIcon"
+ bVS driveRemove_fail
2 ldr r3, [rDrive, #OD_Task%]
R teq r3, #0 ; Does task still exist?
? bEQ driveRemove_fail ; >No
a tst r9, #Flags_NoIcon% ; Was there originally an icon present?
? bNE driveRemove_fail ; >No
'; Setup PostFilter to recreate icon
' adr r0, TaskName
1 adr r1, filterRecreateIcon
% mov r2, rDrive
/ ldr r4, Filter_EventMask
7 swi "XFilter_RegisterPostFilter"
+ bVS driveRemove_fail
Z; Signal PostFilter to do its job (through Message_Quit which Task will never receive)
. add r1, r12, #DT_Space%
" mov r0, #20
' str r0, [r1, #0]
! mov r0, #0
( str r0, [r1, #12]
( str r0, [r1, #16]
! mov r2, r3
H mov r0, #17 ; User_Message
. swi "XWimp_SendMessage"
e strVC r12, [rDrive, #OD_OldIconData% + 32]; Slight fiddle - corrupted on RM_Tidy
b ldmVCfd r13!, {r1 - r4, pc} ; Houston we are ready to go! ***Exit***
1; Signal has failed so ignore icon recreation
' adr r0, TaskName
1 adr r1, filterRecreateIcon
% mov r2, rDrive
2 ldr r3, [rDrive, #OD_Task%]
/ ldr r4, Filter_EventMask
9 swi "XFilter_DeRegisterPostFilter"
.driveRemove_fail
^ orr r9, r9, #Flags_FinalRemove% ; Pretend we have recreated old icon
g mov r1, #0 ; Blank out task handle so we dont attempt to
Z str r1, [rDrive, #OD_Task%] ; delete non-existant PostFilter
F ldmfd r13!, {r1 - r4, pc} ; ***Exit***
0.Filter_EventMask equd %10011111111111111111
; Entry r12 => Drive entry
.filterRecreateIcon
/ stmfd r13!, {r2 - r9, r14}
O ldr r2, [r1, #16] ; Load message action
Q teq r2, #0 ; Is this Message_Quit?
b ldmNEfd r13!, {r2 - r9, pc}^ ; >No ***Exit*** @Waiting for our signal
4 add r0, r12, #OD_OldIconData%
( ldmia r0, {r2 - r9}
K mvn r0, #4 ; Icon bar window
, stmia r1, {r0, r2 - r9}
4 ldr r0, [r12, #OD_IPriority%]
- swi "XWimp_CreateIcon"
0 ldr r0, [r12, #OD_Flags%]
[ orr r0, r0, #Flags_FinalRemove% ; Mark we have recreated old icon
0 str r0, [r12, #OD_Flags%]
; ldr r0, [r12, #OD_OldIconData% + 32]
h ldr r2, [r0, #DT_DrivesPending%] ; Mark that we are waiting to operate on drive
% add r2, r2, #1
7 str r2, [r0, #DT_DrivesPending%]
G mvn r0, #0 ; Claim event
/ ldmfd r13!, {r2 - r9, pc}^
D; Remove drive from chain, and remove its icon from the icon bar
Y; Entry r2 => Last drive entry ;r3 => Next drive entry ;rDrive => Current drive entry
.driveFinalRemove
/ stmfd r13!, {r1 - r4, r14}
Y teq r2, #0 ; Is this the first drive entry
d strNE r3, [r2, #OD_Next%] ; >No Last drive points to Next drive now
c strEQ r3, [r12, #DT_Drives%] ; >Yes Store next at head of drives chain
I; Deregister PostFilter to recreate original icon (if actually setup)
2 ldr r3, [rDrive, #OD_Task%]
! teq r3, #0
' adrNE r0, TaskName
1 adrNE r1, filterRecreateIcon
% movNE r2, rDrive
!/ ldrNE r4, Filter_EventMask
"9 swiNE "XFilter_DeRegisterPostFilter"
#&; Free the Drive entry memory used
$@ mov r0, #7 ; Free
%% mov r2, rDrive
&' swi "XOS_Module"
'R mov rDrive, #0 ; Register loss of drive
(- ldmfd r13!, {r1 - 4, pc}
*8; Start up any drives that just happen to be waiting
.processDrivesPending
,7 stmfd r13!, {r0 - r3, rDrive, r14}
-R ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Drive entry
.R mov r2, #0 ;*r2 => Last Drive entry
/Y.loop teq rDrive, #0 ; Do we have a valid drive here
0M bEQ processDP1 ; >No Jump to Exit
1R ldr r3, [rDrive, #OD_Next%] ;*r3 => Next Drive entry
23 ldr r9, [rDrive, #OD_Flags%]
3, tst r9, #Flags_Added%
4% blNE driveStart
5# blVS retError
6h orrVS r9, r9, #Flags_Removed% ; If error while starting then Remove Now!!!!!
7. tst r9, #Flags_Removed%
8& blNE driveRemove
9# blVS retError
:2 tst r9, #Flags_FinalRemove%
;+ blNE driveFinalRemove
<# blVS retError
=A bic r9, r9, #Flags_Added% + Flags_Removed%
>Y teq rDrive, #0 ; Does drive entry still exist?
?Y strNE r9, [rDrive, #OD_Flags%] ; >Yes Store new state of Flags
@% mov r2, rDrive
A% mov rDrive, r3
BF b loop ; Process it
C!.processDP1 mov r0, #0
D8 str r0, [r12, #DT_DrivesPending%]
E7 ldmfd r13!, {r0 - r3, rDrive, pc}^
G3.TaskName equs "Over Filer" +bl$: align
H4.PollMask equd %110010000001100100110010
I!.TASK equs "TASK"
Jd.Messages equd 1: equd 3: equd &407: equd &502: equd &503: equd &400C1: equd &400c3: equd 0
LG.start ldr r12, [r12] ; r12 => DaTa
MH add r13, r12, #DT_Stack% ; Set up stack
O$; Tell the WIMP manager about us
P].start0 mov r0, #256 ; == 310 Minimum WIMP version 3.10
Q- add r0, r0, #310 - 256
R# ldr r1, TASK
S' adr r2, TaskName
T' adr r3, Messages
U, swi "Wimp_Initialise"
V5 str r1, [r12, #DT_TaskHandle%]
WW; Want to trap if a filing medium is not present/known or we might miss a disc swap
XC.start1 mov r0, #&1D ; UpCallV
Y) adr r1, trapupcall
Z" mov r2, r12
[& swi "XOS_Claim"
\H mov r0, #&0F ; OS_FSControl
]' adr r1, trapfscv
^" mov r2, r12
_& swi "XOS_Claim"
`N; We can now set up a suitable place to retreat to in the case of an error
a*
adrl("", 0, closeDown)
b; str r0, [r12, #DT_CloseDownRoutine%]
; Initialize XEigfactor
dH mvn r0, #0 ; Current mode
eF mov r1, #4 ; XEigfactor
f1 swi "XOS_ReadModeVariable"
g5 str r2, [r12, #DT_XEigfactor%]
h7; Initialize any drive entries that have been setup
i/ bl processDrivesPending
jC; Can now set suitable place to continue processing after error
k' adr r0, wimpPoll
l: str r0, [r12, #DT_WimpPollRoutine%]
m@; Set initial values for any pre-loaded icons
na b testAllDrives ; Insert drive names, etc straight away
p^.wimpPoll adr r14, wimpPoll ; Set up return address just in case
q2 swi "XOS_ReadMonotonicTime"
r+ addVC r2, r0, #Update%
s' ldrVC r0, PollMask
t. addVC r1, r12, #DT_Space%
u6 addVC r3, r12, #DT_DrivesPending%
v+ swiVC "XWimp_PollIdle"
w$ bVS wimpError
yL teq r0, #0 ; Null_Reason_Code
z( bEQ testAllDrives
|L teq r0, #13 ; PollWord_NonZero
}/ bEQ processDrivesPending
H teq r0, #17 ; User_Message
Q teqNE r0, #18 ; User_Message_Recorded
) bEQ receiveMessage
G teq r0, #6 ; Mouse_Click
% bEQ mouseclick
Y b wimpPoll ; Nothing that interested us...
H; See's if any of the drives under our control have changed in state
Z.testAllDrives ldr rDrive, [r12, #DT_Drives%] ;*rDrive => First drive in chain
b.loop teq rDrive, #0 ; Have we reached the end of the drives?
g bEQ wimpPoll ; >Yes ***Exit*** @Reached end of drive chain
H ldr r9, [rDrive, #OD_Flags%] ;*r9 == Flags
_ tst r9, #Flags_Poll% + Flags_FullProcess%; Should this drive be checked?
L blNE testDrive ; >Yes So check it
W strNE r9, [rDrive, #OD_Flags%] ; Store new set of flags
Q ldr rDrive, [rDrive, #OD_Next%] ; Advance to next drive
K b loop ; Process it
/.testDrive stmfd r13!, {r0 - r8, r14}
; Has drive poll changed?
H.testDrive1 mov r0, #1 ; Poll changed
4 ldr r1, [rDrive, #OD_MiscOp%]
4 str r1, [r12, #DT_InlineSWI%]
3 ldr r1, [rDrive, #OD_Drive%]
6 ldr r2, [rDrive, #OD_Sequence%]
- adr r14, testDrive1swi
R add pc, r12, #DT_InlineSWI% ; bl to SWI "Xfs_MiscOp"
S.testDrive1swi movVS r3, #0 ; Pretend to get a result
6 orrVS r9, r9, #Flags_DiscCorrupt%
6 bicVC r9, r9, #Flags_DiscCorrupt%
a str r2, [rDrive, #OD_Sequence%] ; Store for next MiscOp with this drive
:; ldr r4, [rDrive, #OD_PollChanged%]
"; cmp r3, r4
:; strNE r3, [rDrive, #OD_PollChanged%]
'; bEQ testDrive1b
h mov r3, r3, LSL #5 ;WARN WARN WARN uses absolute positions of bit@@@@@@@@@@@@@@@@
0 and r3, r3, #Flags_Empty%
% eor r0, r9, r3
0 bic r9, r9, #Flags_Empty%
% orr r9, r9, r3
R.testDrive1b tst r9, #Flags_FullProcess% ; Completly update icon?
6 bic r9, r9, #Flags_FullProcess%
@ bNE testDrive2 ; >Yes
T tst r0, #Flags_Empty% ; Has drive state changed?
K ldmEQfd r13!, {r0 - r8, pc}^ ; >Yes ***Exit***
5; Make icon name/sprite details reflect new state
G.testDrive2 add r0, rDrive, #OD_IName% ;*r0 => IName
& mov r1, #
(":")
3 ldr r2, [rDrive, #OD_Drive%]
X add r2, r2, #
("0") ; FileCore limits to < 10 drives
B orr r1, r1, r2, LSL #8 ; ";n00"
# str r1, [r0]
, tst r9, #Flags_Empty%
b movNE r2, #
("o") ; >Yes Disk out of drive - sprite end char
U bNE testDrive2_0 ; Jump to next section
;; There is a disc in the drive so try and find its name
: ldr r1, [rDrive, #OD_DescribeDisc%]
4 str r1, [r12, #DT_InlineSWI%]
c swi "XHourglass_On" ; DescribeDisc can take a noticeable time
f sub r1, r13, #64 +4 ; Assume temp space on stack for disk record
- adr r14, testDrive2swi
T add pc, r12, #DT_InlineSWI% ; bl to "Xfs_DescribeDisc"
a.testDrive2swi movVS r8, #1 ;*r8 Indicate if there was a disc error
! movVC r8, #0
f addVC r1, r1, #22 ;*r1 => Discname (with space & poss. no end)
( adrVS r1, DiskError
[ addVS r0, rDrive, #OD_IName% ; r0 was overwritten by swi error
] mov r2, #10 ; Discname up to 10 characters long
'.loop ldrB r3, [r1], #1
f cmp r3, #
(" ") ; Check for character terminater (incld SPACE)
! movLE r3, #0
' strB r3, [r0], #1
% subS r2, r2, #1
bGT loop
^ mov r3, #0 ; Properly terminate it if it wasn't
# strB r3, [r0]
T tst r9, #Flags_ModeSame% ; Was there a mode change?
Q teqNE r8, #1 ; >No Was the disc ok?
f tstNE r9, #Flags_Directory% ; >Yes Does user want us to open filer?
] blNE filerOpen ; >Yes Open filer on disc
+ swi "XHourglass_Off"
a mov r2, #
("i") ; Disc in drive - end of sprite character
O; Set sprite name *r2 == end character
T.testDrive2_0 tst r9, #Flags_ModeSame% ; Was there a mode change?
O orrEQ r9, r9, #Flags_ModeSame% ; >Yes So reset flags
1 tst r9, #Flags_SprCorrupt%
% bNE testDrive3
3 add r0, rDrive, #OD_ISprite%
\.loop ldrB r1, [r0], #1 ;.Find end of current Sprite name
& cmp r1, #
(" ")
bGE loop
( strB r2, [r0, #-2]
3; Change icon in WIMPs eye to reflect new state
1.testDrive3 add r0, rDrive, #OD_IName%
O mov r2, #0 ;*r2 == width of text
U.loop ldrB r1, [r0], #1 ;.Count length of disc name
" cmp r1, #32
% addGE r2, r2, #1
bGE loop
Y mov r2, r2, ASL #4 ; width in external coordinates
4 ldr r3, [rDrive, #OD_SWidth%]
d cmp r2, r3 ; Must be at least width enough for sprite
! movLE r2, r3
4 ldr r0, [rDrive, #OD_IWidth%]
N teq r0, r2 ; Has width changed?
U strNE r2, [rDrive, #OD_IWidth%] ; >Yes Store new width then
\ blNE iconRebirth ; Delete & then reCreate icon
/ ldmNEfd r13!, {r0 - r8, pc}^
9; Icon has same dimensions so just redraw screen form
S add r1, r12, #DT_UpdateIcon% ; No change to icon flags
2 ldr r3, [rDrive, #OD_Icon%]
' str r3, [r1, #4]
/ swi "XWimp_SetIconState"
# blVS retError
/ ldmfd r13!, {r0 - r8, pc}^
U; Deletes a drives icon then recreates *rDrive => this drive entry
!; Entry NE delete icon first
/.iconRebirth stmfd r13!, {r0 - r7, r14}
Z sub r1, r13, #36 +4 ; Assume a bit of space on stack
U mvnNE r0, #1 ; == icon bar window handle
2 ldrNE r2, [rDrive, #OD_Icon%]
' stmNEia r1, {r0, r2}
- swiNE "XWimp_DeleteIcon"
. adr r2, ProtoCreateIcon
g ldmia r2, {r2 - r7} ; r2 == window; r3..r6 == coords; r7 == flags
4 ldr r5, [rDrive, #OD_IWidth%]
( stmia r1, {r2 - r7}
) add r0, r1, #20 +4
O add r2, rDrive, #OD_IName% ; => Icon text buffer
U add r3, rDrive, #OD_ISprite% ; => Icon validation buffer
L mov r4, #12 ; == buffer length
+ stmia r0, {r2, r3, r4}
7 ldr r0, [rDrive, #OD_IPriority%]
- swi "XWimp_CreateIcon"
# blVS retError
2 strVC r0, [rDrive, #OD_Icon%]
/ ldmfd r13!, {r0 - r7, pc}^
).trapfscv_adfs equs "ADFS" +
0: align
C; Trap a disc changing name and us updating our display of this
I.trapfscv teq r0, #50 ; Name the disc
" movNES pc, r14
/ stmfd r13!, {r0 - r5, r14}
1; Check to see filing system was not included
# ldrB r2, [r1]
_ teq r2, #
(":") ; No filing system given so assume ADFS
_ adrEQ r0, trapfscv_adfs ; should be able to calculate real FS
$ bEQ trapfscv0
; Find filing system name
1 add r0, r12, #DT_Trapfscv%
m mov r3, #12 ; Remember max size so don't write all over storage
'.loop ldrB r2, [r1], #1
!% subS r3, r3, #1
"! movLE r2, #0
#& teq r2, #
(":")
$! movEQ r2, #0
%& cmp r2, #
(" ")
&! movLT r2, #0
'' strB r2, [r0], #1
bGE loop
)1 add r0, r12, #DT_Trapfscv%
; Get drive number
+\.trapfscv0 ldrB r2, [r1, #1] ; Should be drive number character
,L sub r2, r2, #
("0") ;*r2 == drive number
-f cmp r2, #7 ; Should only be up to 7 devices on FileCore
.F ldmHIfd r13!, {r0 - r5, pc}^ ; ***Exit***
/$; Now search for matching drives
01 ldr r5, [r12, #DT_Drives%]
1!.loop teq r5, #0
2F ldmEQfd r13!, {r0 - r5, pc}^ ; ***Exit***
3/ ldr r3, [r5, #OD_Flags%]
4A tst r3, #Flags_Empty% + Flags_DiscCorrupt%
5/ ldrEQ r4, [r5, #OD_Drive%]
6! teqEQ r4, r2
7$ bNE trapfscv1
8. add r1, r5, #OD_FSName%
9! bl strcmp
:6 orrEQ r3, r3, #Flags_FullProcess%
;/ strEQ r3, [r5, #OD_Flags%]
<..trapfscv1 ldr r5, [r5, #OD_Next%]
b loop
Ah; Trap if there is a request for a media change. If there is a change then we won't catch the change
BM.trapupcall teq r0, #1 ; Media not present
CK teqNE r0, #2 ; Media not known
D" movNES pc, r14
E/ stmfd r13!, {r5 - r6, r14}
FU ldr r5, [r12, #DT_Drives%] ;*r5 => Current drive entry
GX.loop teq r5, #0 ; Is this a valid drive entry?
Hc ldmEQfd r13!, {r5 - r6, pc}^ ; >No ***Exit*** @Dont control this drive
IK ldr r6, [r5, #OD_FSNumber%] ; Same FS number?
J! teq r6, r1
K& bNE trapupcall0
L! cmn r3, #1
MK ldrNE r6, [r5, #OD_Drive%] ; And same drive?
N! teqNE r6, r3
OV.trapupcall0 ldrNE r5, [r5, #OD_Next%] ; >No Load next drive entry
PK bNE loop ; Process it
Q/ ldr r6, [r5, #OD_Flags%]
Re orr r6, r6, #Flags_FullProcess% ; Reprocess this drive as disc might change
S/ str r6, [r5, #OD_Flags%]
TF ldmfd r13!, {r5 - r6, pc}^ ; ***Exit***
WY.helpRequest ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Current Drive entry
XM ldr r3, [r1, #36] ;*r3 == icon handle
YX.loop teq rDrive, #0 ; Is this still a drive entry?
Zc bEQ wimpPoll ; >No ***Exit*** @Shouldnt have happened
[2 ldr r0, [rDrive, #OD_Icon%]
\Z teq r0, r3 ; Help requested from this icon?
]\ ldrNE rDrive, [rDrive, #OD_Next%] ; >No Advance to next drive entry
^K bNE loop ; Process it
_W ldr r3, [rDrive, #OD_Task%] ;*r3 == real icon task handle
`g teq r3, #0 ; Does the real owner has a valid task handle
aK bEQ wimpPoll ; >No ***Exit***
b%; Acknowledge Message_HelpRequest
c' ldr r0, [r1, #8]
dM str r0, [r1, #12] ; your_ref = my_ref
eT mov r0, #19 ; User_Message_Acknowledge
fP ldr r2, [r1, #4] ; Reply to task handle
ge str r2, [r12, #DT_HelpTask%] ; Remember task for later helpReply message
h. swi "XWimp_SendMessage"
i8; Now send Message_HelpRequest to real owner of icon
j5 ldrVC r0, [rDrive, #OD_OldIcon%]
k( strVC r0, [r1, #36]
lH movVC r0, #17 ; User_Message
m! movVC r2, r3
nh swiVC "XWimp_SendMessage" ; >Yes So pass on HelpRequest to real receiver
o# bVC wimpPoll
p$ bVS wimpError
rH.helpReply mov r0, #17 ; User_Message
s3 ldr r2, [r12, #DT_HelpTask%]
tZ teq r2, #0 ; Is HelpTask a real task handle
uZ swiNE "XWimp_SendMessage" ; >Yes So send Message_HelpReply
v# bVC wimpPoll
w$ bVS wimpError
.receiveMessage
zJ ldr r2, [r1, #16] ; Message number
{Q mov r3, #&500 : add r4, r3, #2 : teq r2, r4: bEQ helpRequest
|O add r4, r3, #3 : teq r2, r4: bEQ helpReply
~T mov r3, #&400 : add r4, r3, #7 : teq r2, r4: bEQ filerSelection
N teq r2, #3: bEQ dataLoad
N teq r2, #1: bEQ dataSave
P mov r3, #&40000: add r4, r3, #&C1: teq r2, r4: bEQ modeChange
T add r4, r3, #&C3: teq r2, r4: bEQ checkCloseDown
@ teq r2, #0 ; Quit
# bNE wimpPoll
:
C.closeDown mov r0, #&1D ; UpCallV
) adr r1, trapupcall
" mov r2, r12
( swi "XOS_Release"
H mov r0, #&0F ; OS_FSControl
' adr r1, trapfscv
" mov r2, r12
( swi "XOS_Release"
) adr r1, closeDown3
; str r1, [r12, #DT_CloseDownRoutine%]
) adr r1, closeDown1
: str r1, [r12, #DT_WimpPollRoutine%]
# blVS retError
?; Set Flags_Remove% for each drive to get them to shut down
5 ldr rDrive, [r12, #DT_Drives%]
%.loop teq rDrive, #0
% bEQ closeDown0
3 ldr r9, [rDrive, #OD_Flags%]
2 tst r9, #Flags_FinalRemove%
2 orrEQ r9, r9, #Flags_Removed%
3 strEQ r9, [rDrive, #OD_Flags%]
6 ldr rDrive, [rDrive, #OD_Next%]
b loop
/.closeDown0 bl processDrivesPending
,; Give chance to recreate original icons
5.closeDown1 ldr rDrive, [r12, #DT_Drives%]
% teq rDrive, #0
% bEQ closeDown3
` adr r14, closeDown1 ; Set up return address just in case
' ldr r0, PollMask
I orr r0, r0, #1 ; Mask out Null
. add r1, r12, #DT_Space%
6 add r3, r12, #DT_DrivesPending%
' swi "XWimp_Poll"
$ bVS wimpError
L teq r0, #13 ; PollWord_NonZero
/ bEQ processDrivesPending
H teq r0, #17 ; User_Message
Q teqNE r0, #18 ; User_Message_Recorded
( ldrEQ r2, [r1, #16]
H teqEQ r2, #0 ; Message_Quit
% bNE closeDown1
; Now finally Exit
5.closeDown3 ldr r0, [r12, #DT_TaskHandle%]
# ldr r1, TASK
, swi "XWimp_CloseDown"
! mov r0, #0
5 str r0, [r12, #DT_TaskHandle%]
,; Delete our module for testing purposes
-
adrl(" ", 3, titleString)
* swi "OS_ExitAndDie"
P.ProtoCreateIcon equd -5: equd 0: equd -16: equd -1: equd 60: equd &1700212B
h; Used if Vset on swi DescribeDisc, assume disc itself is corrupted. '*' is illegal disc name char!!
0.DiskError equs "*Corrupt*" +bl$: align
*; Redirect mouseclick to original task
&.mouseclick add r0, r1, #12
U ldmia r0, {r0, r2} ;*r0 == window ;*r2 == icon
X cmn r0, #2 ; Is this the icon bar window?
d bNE wimpPoll ; >No ***Exit*** Should not have received
Q ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Drive entry
S.loop teq rDrive, #0 ; Is this a valid entry?
_ bEQ wimpPoll ; >No ***Exit*** Failed to find icon
2 ldr r0, [rDrive, #OD_Icon%]
Y teq r0, r2 ; Is this for the correct icon?
[ ldrNE rDrive, [rDrive, #OD_Next%] ; >No Advance to next drive enty
K bNE loop ; Process it
L; If MENU pressed then ignore -Click test (by Kade Hansson, many thanks)
O ldr r0, [r1, #8] ; Load button pressed
S teq r0, #2 ; Was it the menu button?
& bEQ mouseclick0
<; If drive has -Click on then set to update icon display
3 ldr r9, [rDrive, #OD_Flags%]
P tst r9, #Flags_Click% ; Is -Click switch on?
R orrNE r9, r9, #Flags_FullProcess% ; >Yes Update drive icon
3 strNE r9, [rDrive, #OD_Flags%]
(; Send message to original task/icon
5.mouseclick0 ldr r0, [rDrive, #OD_OldIcon%]
( str r0, [r1, #16]
G mov r0, #6 ; Mouse_Click
2 ldr r2, [rDrive, #OD_Task%]
Y teq r2, #0 ; Is there a valid task handle?
d swiNE "XWimp_SendMessage" ; >Yes So inform real owners of mouseclick
# bVC wimpPoll
$ bVS wimpError
V.dataSave ldr r3, [r1, #24] ;*r3 == icon bar icon handle
5 ldr rDrive, [r12, #DT_Drives%]
%.loop teq rDrive, #0
# bEQ wimpPoll
2 ldr r0, [rDrive, #OD_Icon%]
! teq r0, r3
6 ldrNE rDrive, [rDrive, #OD_Next%]
bNE loop
3 ldr r9, [rDrive, #OD_Flags%]
, tst r9, #Flags_Click%
5 orrNE r9, r9,#Flags_FullProcess%
$ blNE testDrive
3 strNE r9, [rDrive, #OD_Flags%]
A tst r9, #Flags_DiscCorrupt% + Flags_Empty%
W swiNE XOS_WriteI + 7 ; >Yes Little feedback to user
$ bVS wimpError
e bNE wimpPoll ; ***Exit*** @Can't save to empty drive
3 add r0, r12, #44 +DT_Space%
3 add r1, r12, #192 +DT_Space%
! bL strcpy
3 add r1, r12, #44 +DT_Space%
( bL drivePathname
& mov r0, #
(".")
( strB r0, [r1, #-1]
3 add r0, r12, #192 +DT_Space%
! bL strcpy
. add r0, r12, #DT_Space%
J sub r1, r1, r0 ; Message length
n add r1, r1, #3 + 1 ; Align message length to word (also add terminator)
% bic r1, r1, #3
R str r1, [r12, #0 +DT_Space%] ; Store new message size
! mov r1, r0
' ldr r0, [r1, #8]
M str r0, [r1, #12] ; your_ref = my_ref
O mov r0, #2 ; Message_DataSaveAck
( str r0, [r1, #16]
H mov r0, #17 ; User_Message
X ldr r2, [r1, #4] ; Return it to original sender
. swi "XWimp_SendMessage"
f mvnVC r0, #1 ; Mark a DataSave for future DataLoad mesage
3 strVC r0, [r12, #DT_DataLoad%]
# bVC wimpPoll
$ bVS wimpError
Q; Used by filer to inform us of the number of files it is going to give to us
(.filerSelection ldr r0, [r1, #56]
( ldr r2, [r1, #60]
S teq r0, #0 ; -ve value means trouble
S teqPL r2, #0 ; -ve value means trouble
! movMI r0, #0
! movMI r2, #0
= str r0, [r12, #DT_FilerSelect_Column%]
: str r2, [r12, #DT_FilerSelect_Row%]
!W mov r0, #0 ; Start of selection DataLoad
"/ str r0, [r12, #DT_DataLoad%]
## b wimpPoll
%:.FilerAction_Start equs "Filer_Action" + bl$: align
'O.dataLoad ldr r6, [r12, #DT_DataLoad%] ;*r6 == present state
(R cmn r6, #2 ; Did DataSave preceeded
)V bEQ dataload_ack ; >Yes Simply acknowledge it
*(; find drive which received dataLoad
+S ldr r2, [r1, #24] ; Destination icon handle
,Y ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Current drive entry
-b.loop teq rDrive, #0 ; Have we reached the end of our drives?
.h bEQ wimpPoll ; >Yes ***Exit*** @Should not have been inform
/2 ldr r0, [rDrive, #OD_Icon%]
0Y teq r0, r2 ; DataLoad for this drive icon?
1_ ldrNE rDrive, [rDrive, #OD_Next%] ; >No So advance to next drive entry
2K bNE loop ; Process it
; Test state of drive
43 ldr r9, [rDrive, #OD_Flags%]
5, tst r9, #Flags_Click%
66 orrNE r9, r9, #Flags_FullProcess%
7$ blNE testDrive
83 strNE r9, [rDrive, #OD_Flags%]
9A tst r9, #Flags_DiscCorrupt% + Flags_Empty%
:\ swiNE XOS_WriteI + 7 ; >Yes Give a little user feedback
;$ bVS wimpError
<f bNE wimpPoll ; ***Exit*** @Can't save to empty drive
>R cmp r6, #0 ; Test state of transfer
?d adrLE r0, FilerAction_Start ; >First Have to load up a new FilerAction
@, swiLE "XWimp_StartTask"
A$ bVS wimpError
BW strLE r0, [r12, #DT_FilerAction_Task%]; Remember task handle
Ce addGE r2, r6, #1 ; >Filer Record that the next file has been
DL strGE r2, [r12, #DT_DataLoad%] ; processed
EE ldrGT r0, [r12, #DT_FilerAction_Task%];>NotFirst
F$ bGT dataLoad1
HR; Check to see if Shift key is pressed, if so then move rather than copy files
I) mov r3, r0: mov r4, r1
JW mov r0, #202: mov r1, #0:mov r2, #255: swi "XOS_Byte": blVS retError
Kd tst r1, #%1000:movEQ r1, #0: movNE r1, #6: str r1, [r12, #DT_FilerAction_Reason%]
L) mov r0, r3: mov r1, r4
M:
NR.dataLoad1 add r1, r1, #44 ;*r1 => pathname of file
O! mov r2, r1
PQ.loop ldrB r3, [r2], #1 ;.Go to end of pathname
Q& cmp r3, #
(" ")
bGE loop
SM mov r8, r2 ;*r8 => message end
Th.loop ldrB r3, [r2, #-1]! ;.RSearch for first directory separator marker
U& teq r3, #
(".")
bNE loop
W! mov r3, #0
X[ strB r3, [r2], #1 ; Terminate path just before leaf
Z^ cmp r6, #0 ; Is this the first file to process?
[_ swiLE "XFilerAction_SendSelectedDirectory"; >Yes So have to send directory
\I movVC r1, r2 ; Send the leaf
]: swiVC "XFilerAction_SendSelectedFile"
^$ bVS wimpError
_.; Read the current filer options from CMOS
`! mov r3, r0
aX mov r0, #161 ; read battery-backed CMOS RAM
bI mov r1, #198 ; Desktop state
c% swi "XOS_Byte"
d# blVS retError
e! mov r0, #0
fC tst r2, #1 << 6 ; Verbose
g* orrNE r0, r0, #%00001
hC tst r2, #1 << 5 ; Conform
i* orrNE r0, r0, #%00010
jA tst r2, #1 << 4 ; Force
k* orrNE r0, r0, #%00100
lA tst r2, #1 << 7 ; Newer
m* orrNE r0, r0, #%01000
nC mov r2, r0 ; Options
o! mov r0, r3
q3 add r1, r12, #192 +DT_Space%
r( bL drivePathname
s3 add r3, r12, #192 +DT_Space%
t[ sub r4, r1, r3 ; Length of destination directory
uT ldr r1, [r12, #DT_FilerAction_Reason%]; Operation reason code
wR cmp r6, #0 ; Is this a one off file
x] bMI dataLoad2 ; >Yes So ignore test for moe files
yO; Check column/row range to see if Filer will send us more files to process
z_ add r8, r8, #3 ; Set message length to multiple of 4
{% bic r8, r8, #3
|a ldr r5, [r12, #DT_FilerSelect_Column%]; Maximum column of files to process
}V ldr r7, [r8], #4 ; Load current column number
~T cmp r7, r5 ; At the limit of columns?
\ ldrHS r5, [r12, #DT_FilerSelect_Row%]; >Yes Max row of files to process
# ldrHS r7, [r8]
! cmpHS r7, r5
b bLO wimpPoll ; Still more files to come so ***Exit***
<.dataLoad2 swi "XFilerAction_SendStartOperation"
$ bVS wimpError
,; Acknowledge that we have loaded a file
Q.dataload_ack mov r5, #0 ; Re-initialize markers
= str r5, [r12, #DT_FilerSelect_Column%]
: str r5, [r12, #DT_FilerSelect_Row%]
I mvn r5, #0 ; No selection
; str r5, [r12, #DT_DataLoad%]
H mov r0, #17 ; User_Message
. add r1, r12, #DT_Space%
' ldr r2, [r1, #8]
L str r2, [r1, #12] ; you_ref = my_ref
O mov r2, #4 ; Message_DataLoadAck
( str r2, [r1, #16]
' ldr r2, [r1, #4]
. swi "XWimp_SendMessage"
# bVC wimpPoll
$ bVS wimpError
O; Attempts to open a drives directory display *rDrive => OverBlock
/.filerOpen stmfd r13!, {r0 - r2, r14}
. add r1, r12, #DT_Space%
! mov r0, #0
G str r0, [r1, #12] ; == your_ref
@ str r0, [r1, #24] ; bits
P mov r0, #&400 ; Message_FilerOpenDir
( str r0, [r1, #16]
6 ldr r0, [rDrive, #OD_FSNumber%]
( str r0, [r1, #20]
O add r1, r1, #28 ;*r1 => direcory name
( bL drivePathname
. add r0, r12, #DT_Space%
% sub r1, r1, r0
% add r1, r1, #3
% bic r1, r1, #3
' str r1, [r0, #0]
! mov r1, r0
" mov r0, #17
R mov r2, #0 ; Broadcast to all tasks
. swi "XWimp_SendMessage"
# blVS retError
/ ldmfd r13!, {r0 - r2, pc}^
H.modeChange mvn r0, #0 ; Current mode
F mov r1, #4 ; XEigfactor
1 swi "XOS_ReadModeVariable"
$ bVS wimpError
5 ldr r0, [r12, #DT_XEigfactor%]
h teq r0, r2 ; Has the XEigfactor changed over mode change?
^ bEQ wimpPoll ; >No ***Exit*** No action necessary
5 str r2, [r12, #DT_XEigfactor%]
5 ldr rDrive, [r12, #DT_Drives%]
%.loop teq rDrive, #0
# bEQ wimpPoll
3 ldr r9, [rDrive, #OD_Flags%]
6 orr r9, r9, #Flags_FullProcess%
_ bic r9, r9, #Flags_ModeSame% ; Mark that we have just changed mode
[ bl spriteSize ; New size of sprite in this mode
X str r9, [rDrive, #OD_Flags%] ; Store new set of drive flags
[ ldr rDrive, [rDrive, #OD_Next%] ; Advance to the next drive entry
F b loop ; Process it
L; Checks to see if one of the tasks we are interested in has closed down
\.checkCloseDown ldr r0, [r1, #4] ;*r0 == task which has closed down
Y ldr rDrive, [r12, #DT_Drives%] ;*rDrive => Current drive entry
R mov r2, #0 ;*r2 == null task handle
V.loop teq rDrive, #0 ; Are there any drives left?
K bEQ wimpPoll ; >No ***Exit***
2 ldr r1, [rDrive, #OD_Task%]
V teq r0, r1 ; Is this task closing down?
Q strEQ r2, [rDrive, #OD_Task%] ; >Yes So mark it as so
6 ldr rDrive, [rDrive, #OD_Next%]
b loop
/; Creates full pathname for root on a drive
O; Entry r1 => start ; Exit r1 => end ;*rDrive => OverBlock
+.drivePathname stmfd r13!, {r0, r14}
3 add r0, rDrive, #OD_FSName%
" bl strcpy
I mov r0, #
(":"): strB r0, [r1], #1: strB r0, [r1], #1
2 add r0, rDrive, #OD_IName%
" bl strcpy
6 mov r0, #
("."): strB r0, [r1], #1
6 mov r0, #
("$"): strB r0, [r1], #1
C mov r0, # 0 : strB r0, [r1], #1 ; BIZARRE
+ ldmfd r13!, {r0, pc}^
'.SFloppydisc equs "floppydisc" +bl$
..SHarddisc equs "harddisc" +bl$: align
F; Calculate width of the current drive entry sprite (current mode)
; Entry rDrive, r9
/.spriteSize stmfd r13!, {r0 - r7, r14}
S mov r0, #40 ; Read sprite information
e add r2, rDrive, #OD_ISprite% +1 ; Sprite name, after inital 'S' in indirect
+ swi "XWimp_SpriteOp"
e bVC spriteSize1 ; Was the sprite found? >Yes Jump past this
1 tst r9, #Flags_SprCorrupt%
: blNE retError
b orrEQ r9, r9, #Flags_SprCorrupt% ; Mark that we have bodged a sprite name
a tst r9, #Flags_Hard% ; What type of drive do we think it is?
Y adrEQ r0, SFloppydisc ;} both of these sprites should
e adrNE r0, SHarddisc ;} exist as they are put of the ROM sprites
O add r1, rDrive, #OD_ISprite% +1 ; Set new sprite name
! bl strcpy
6 add r2, rDrive, #OD_ISprite% +1
S mov r0, #40 ; Read sprite information
+ swi "XWimp_SpriteOp"
R.spriteSize1 movVC r0, #&100 ; Pointer to sprite name
L movVC r1, #1 ; Wimp sprite area
O addVC r6, r12, #DT_Space% ; Scale factors block
W movVC r7, #0 ; No colour translation table
/ swiVC "XWimp_ReadPixTrans"
/ ldmVSfd r13!, {r0 - r7, pc}^
5 ldr r2, [r12, #DT_XEigfactor%]
) mov r3, r3, LSL r2
' ldr r0, [r6, #0]
% mul r0, r3, r0
' ldr r1, [r6, #8]
bL udiv
4 str r0, [rDrive, #OD_SWidth%]
4 ldr r1, [rDrive, #OD_IWidth%]
! cmp r0, r1
4 strGT r0, [rDrive, #OD_IWidth%]
. ldmfd r13!, {r0 - r7, pc}^
&; Load word from unknown alignment
; Entry r0 => from
(; Exit r0 => from r1 == word value
*.loadWord stmfd r13!, {r2 - r3}
% bic r2, r0, #3
' ldmia r2, {r1, r3}
% and r2, r0, #3
) movS r2, r2, LSL #3
) movNE r1, r1, LSR r2
& rsbNE r2, r2, #32
- orrNE r1, r1, r3, LSL r2
* ldmFD r13!, {r2 - r3}
" movS pc, r14
!; Simple string copy function
; Entry r0 => from; r1 => to
/; Exit r0 => from; r1 => 0 terminate of to
-.strcpy stmfd r13!, {r0, r2, r14}
&.loop ldrB r2, [r0], #1
% cmp r2, #
(" ")
& strB r2, [r1], #1
bGE loop
$ sub r1, r1, #1
!- ldmfd r13!, {r0, r2, pc}^
; Simple string compare
$!; Entry r0 =>one r1 => two
; Exit LT/EQ/GT set
&/.strcmp stmfd r13!, {r0 - r3, r14}
''.loop ldrB r2, [r0], #1
(' ldrB r3, [r1], #1
)! cmp r2, r3
*. ldmNEfd r13!, {r0 - r3, pc}
+R cmp r2, #32 ; String terminated yet?
,U bGE loop ; >No So process next char
-I cmp r2, r2 ; Ensure EQ set
.. ldmfd r13!, {r0 - r3, pc}
1!; r0
r1 = r0 ; r0
r1 = r1
2/.udiv stmfd r13!, {r2 - r3, r14}
3! mov r3, r1
4) cmp r3, r0, LSR #1
5).loop movLS r3, r3, LSL #1
6) cmp r3, r0, LSR #1
bLS loop
8! mov r2, #0
9!.loop cmp r0, r3
:% subCS r0, r0, r3
;% adc r2, r2, r2
<) mov r3, r3, lsr #1
=! cmp r3, r1
bHS loop
?! mov r1, r0
@! mov r0, r2
A/ ldmfd r13!, {r2 - r3, pc}^
defineMemory(A%)
fill(0, A%)
equsPadWithTo(string$, pad%, length%)
This stores the string$. Ensuring it is pad% terminated, and altogether
takes length% bytes. (Pads all with pad%)
short$, temp$
O#short$ =
string$, length% - 1)
[OPT pass%: equs short$:]
Q,temp$ =
fill(pad%, length% -
(short$))
fill(byte, count)
This fills in count bytes with the value in byte
loop
count = 0
Z%
"Assigning zero space here!"
=""
loop = 1
count
[ OPT pass%
equb byte
loop
[ OPT pass%
ALIGN
copy(from%, to%, using%)
[ OPT pass%
k..copy ldrB using%, [from%], #1
l, strB using%, [to%], #1
m& cmp using%, #32
bGE copy
]: =""
adrl(c$,r%,addr%)
c%,df%,byte_lo%,byte_hi%,opcode1%,opcode2%
addr%=P%
(pass%
12)=0
P%+=8:O%+=8:=0
(addr%-P%)<256
error("ADRL failed: Address within range when setting R"+
r%+" to "+
addr%,-1)
(addr%-P%)>65535
error("ADRL failed: Address outside range when setting R"+
r%+" to "+
addr%,-1)
c$=" "
c$="" c$="AL"
w.c%=
"EQNECSCCMIPLVSVCHILSGELTGTLEALNV",c$)
c%=0
error("ADRL failed: ARM condition code not recognized when setting R"+
r%+" to "+
addr%,-1)
c%=(c%-1)
df%=addr%-P%-8
byte_lo%=
(df%)
byte_hi%=
(df%)
&FF00
df%>=0
}3 opcode1%=(c%<<28)+&028F0000+(r%<<12)+byte_lo%
~A opcode2%=(c%<<28)+&02800C00+(r%<<16)+(r%<<12)+(byte_hi%>>8)
3 opcode1%=(c%<<28)+&024F0000+(r%<<12)+byte_lo%
A opcode2%=(c%<<28)+&02400C00+(r%<<16)+(r%<<12)+(byte_hi%>>8)
,[OPT pass%:EQUD opcode1%:EQUD opcode2%:]
stmfd r13!, {r0 - r3}: swi &104: mov r0, r4: sub r1, r13, #20: mov r2, #16: swi "OS_ConvertInteger4":swi "OS_Write0":swi &100 +
("*"): swi &105: ldmfd r13!, {r0 - r3}