Commit a6c7a3b0 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

32-bit compatible.

Admin:
  Tested on a 32-bit system; untested on 26-bit, and merge with Ursula branch
  untested.

Version 2.52. Tagged as 'FileSwitch-2_52'
parent af0badf9
......@@ -6,9 +6,9 @@
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
Module_MajorVersion SETS "2.51"
Module_Version SETA 251
Module_MajorVersion SETS "2.52"
Module_Version SETA 252
Module_MinorVersion SETS ""
Module_Date SETS "20 Mar 2000"
Module_FullVersion SETS "2.51"
Module_FullVersion SETS "2.52"
END
/* (2.51)
/* (2.52)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.51
#define Module_MajorVersion_CMHG 2.52
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Mar 2000
#define Module_MajorVersion "2.51"
#define Module_Version 251
#define Module_MajorVersion "2.52"
#define Module_Version 252
#define Module_MinorVersion ""
#define Module_Date "20 Mar 2000"
#define Module_FullVersion "2.51"
#define Module_FullVersion "2.52"
......@@ -158,7 +158,7 @@ ReduceParents ENTRY "r0-r3"
; R2 = unchanged, RMAlloced disc^ or NULL
;
CanonicaliseSpecialAndDisc ENTRY "r0,r3,r4,r5,r6,r7,r8", 4
CanonicaliseSpecialAndDisc EntryS "r0,r3,r4,r5,r6,r7,r8", 4
[ debugcanonical
DSTRING r1, "Canonicalise #",cc
DSTRING r2, "::"
......
......@@ -119,7 +119,8 @@ SimpleReadDir ENTRY "r0-r8", 512
90
STR r1, [sp, #Proc_LocalStack + 1*4]
EXITS
CLRV
EXIT
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -864,7 +865,7 @@ NullString DCB 0
;
; expected uses: from Service_DiscDismounted and rename
AlterMatchingDirs ENTRY "r0-r9"
AlterMatchingDirs EntryS "r0-r9"
[ debugservice
DSTRING r1, "AlterMatchingDirs(",cc
DSTRING r2, ",",cc
......@@ -947,7 +948,7 @@ AlterMatchingDirs ENTRY "r0-r9"
BNE %FT70
; Hot stuff! prefix prefixes path in an interesting way - let's do the business to it
LDR r1, [r9, #2*4]
LDR r1, [r9, #Proc_RegOffset + 2*4]
TEQ r1, #0
BNE %FT40
......@@ -1033,6 +1034,6 @@ UnsetMatchingDirs ENTRY "r1-r3"
BL AlterMatchingDirs
99
EXITS
EXIT
END
......@@ -48,7 +48,7 @@
; The path should be in canonical form.
;
EnsureCanonicalObject ENTRY "r7,r8,r9"
EnsureCanonicalObject EntryS "r7,r8,r9"
[ debugensure
DSTRING r6,"EnsureCanonicalObject ",cc
DSTRING r1," "
......@@ -332,7 +332,7 @@ strcmp_forimagefilepath ENTRY "r1,r2,r3,r4"
; the fscb is correct as it may be the case that a deeper nesting of
; fscbs is required.
AssessDestinationForPath ENTRY "r2,r3,scb"
AssessDestinationForPath EntryS "r2,r3,scb"
[ debugensure
DSTRING r1, "Assessing destination for "
......
......@@ -195,12 +195,12 @@ EnumDir_Code ENTRY "r0-r1, r7, r9-r10" ; Low registers used sp relative
75 ADD sp, sp, #enumdir_bsize ; Destroy local frame
STRVS r0, [sp] ; Return current error (if any) to Sam
MOV r2, psr
SavePSR r2
MOV r0, #0
MOV r1, r7
SWI XOS_Find
STRVS r0, [sp] ; May modify it though
TEQVCP r2, #0 ; V from op/Close
RestPSR r2, VC ; V from op/Close
EXIT
fsw_wildstar ; Used from all over
......@@ -396,9 +396,8 @@ SussCopyOptions ENTRY
TEQ r0, #"a"
MOVEQ r8, #util_noattr
MOVEQ r14, psr ; Invert C as bit wrong way round
TEQEQP r14, #C_bit ; for backwrods compatabilly-T
BEQ %BT05
TOGPSR C_bit, r14, EQ ; Invert C as bit wrong way round
BEQ %BT05 ; for backwrods compatabilly-T
TEQ r0, #"c"
MOVEQ r8, #util_confirm
......@@ -538,13 +537,22 @@ SetAndGetUtilOption ENTRY "r2"
TestBadOption ROUT
CMP r0, #space
[ No26bitCode
MOVLS pc, lr ; V will be clear 'cause r0 is small
|
BICLSS pc, lr, #V_bit
]
Push "lr"
ADRL r0, ErrorBlock_BadCommandOption
BL copy_error
[ No26bitCode
SETV
Pull "pc"
|
Pull "lr"
ORRS pc, lr, #V_bit
]
]
......@@ -672,12 +680,12 @@ Truncate_Code ENTRY
BLVS copy_error
EXIT VS
MOV R3, PC ; save PSR state
SavePSR R3 ; save PSR state
MOV R0, #ReadCMOS
MOV R1, #FileSwitchCMOS
SWI XOS_Byte
EXIT VS
TEQP R3, #0 ; restore PSR state
RestPSR R3 ; restore PSR state
ORRNE R2, R2, #FileSwitchTruncateNamesCMOSBit ; EQ => off, so clear bit
BICEQ R2, R2, #FileSwitchTruncateNamesCMOSBit ; NE => on, so set bit
MOV R0, #WriteCMOS
......@@ -717,11 +725,17 @@ Truncate_Code ENTRY
;
GetOnOff ROUT
[ :LNOT:No26bitCode
BIC R14, R14, #V_bit ; prepare to exit VC
]
LDRB R1, [R0], #1
TEQ R1, #"O"
TEQNE R1, #"o"
[ No26bitCode
BNE %FA20
|
ORRNES PC, R14, #V_bit
]
LDRB R1, [R0], #1
TEQ R1, #"N"
......@@ -730,22 +744,44 @@ GetOnOff ROUT
LDRB R1, [R0], #1
CMP R1, #" "
[ No26bitCode
BHI %FA20
CMP PC, #0 ; NE: found ON
MOV PC, R14
20 SETV
MOV PC, R14
|
ORRHIS PC, R14, #V_bit
BICS PC, R14, #Z_bit ; found ON
]
10
TEQ R1, #"F"
TEQNE R1, #"f"
[ No26bitCode
BNE %BA20
|
ORRNES PC, R14, #V_bit
]
LDRB R1, [R0], #1
TEQ R1, #"F"
TEQNE R1, #"f"
[ No26bitCode
BNE %BA20
|
ORRNES PC, R14, #V_bit
]
LDRB R1, [R0], #1
CMP R1, #" "
[ No26bitCode
BHI %BA20
CMP R0, R0 ; EQ: found OFF
MOV PC, R14
|
ORRHIS PC, R14, #V_bit
ORRS PC, R14, #Z_bit ; found OFF
]
END
......@@ -358,7 +358,7 @@ fsw_GetArea
; Out VC: r2 = Nowt, block freed
; VS: r2 = Nowt, fail or VSet on entry
SFreeArea ENTRY "r0, r1"
SFreeArea EntryS "r0, r1"
[ debugheap
DREG r2,"SFreeArea "
......@@ -638,7 +638,7 @@ SNewLinkedString ENTRY
; Out VC: block freed
; VS: failed to free block, or V set initially
SFreeLinkedArea ENTRY "r0, r2"
SFreeLinkedArea EntryS "r0, r2"
LDR r2, [r0] ; Get this block^
SUB r2, r2, #la_hsize ; Get real memory^
......@@ -688,7 +688,7 @@ SFreeLinkedArea ENTRY "r0, r2"
;
; As SFreeLinkedArea, but checks for NULL/Nowt first
SFreeLinkedString ENTRY
SFreeLinkedString EntryS
LDR r14, [r0]
TEQ r14, #NULL
TEQNE r14, #Nowt
......@@ -699,51 +699,6 @@ SFreeLinkedString ENTRY
EXIT
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; DelinkLinkedArea
; ================
;
; Unlink the given heap block from global list. Preserves V
; In r2 -> block
DelinkLinkedArea ENTRY "r0, r2"
SUB r2, r2, #la_hsize ; Get real memory^
[ debugheap
DREG r2,"DelinkLinkedArea: "
]
ADR r0, LinkedAreas - la_link
10 LDR r14, [r0, #la_link] ; Is this a pointer to the block we
; want to delink ?
[ debugheap
DREG r14, "Trying against block at "
]
[ paranoid
CMP r14, #Nowt
BNE %FT01
ADR r0, %FT90
BL CopyError
EXIT
90
DCD 0
DCB "Linked area underflow !", 0
ALIGN
01
]
CMP r14, #Nowt ; End of list without finding it ?
EXITS EQ ; [really bad stuff]
CMP r14, r2
MOVNE r0, r14
BNE %BT10 ; Loop till we find it
LDR r14, [r2, #la_link] ; Store block pointer in previous block
STR r14, [r0, #la_link]
EXITS
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
; SFreeAllLinkedAreas
......@@ -754,7 +709,7 @@ DelinkLinkedArea ENTRY "r0, r2"
; Out VC: blocks freed
; VS: failed to free all blocks
SFreeAllLinkedAreas ENTRY "r0, r2, r3"
SFreeAllLinkedAreas EntryS "r0, r2, r3"
ADR r0, LinkedAreas - la_link
MOV r3, #0 ; Free blocks allocated in this domain
......@@ -789,7 +744,7 @@ SFreeAllLinkedAreas ENTRY "r0, r2, r3"
; Out VC: blocks freed
; VS: failed to free all blocks
SFreeAllLinkedAreasEverywhere ENTRY "r0, r2"
SFreeAllLinkedAreasEverywhere EntryS "r0, r2"
[ debugheap
DLINE "SFreeAllLinkedAreasEverywhere"
......@@ -883,7 +838,7 @@ SGetRMA ENTRY "r0-r1, r3"
; Out r3 = number of chars (can be used as size for Heap)
strlen ENTRY "r0, r4"
strlen EntryS "r0, r4"
MOV r4, #space-1
......@@ -915,7 +870,7 @@ strlenTS ALTENTRY
; Out r3 += number of chars (can be used as size for Heap)
strlen_accumulate ENTRY "r0, r1"
strlen_accumulate EntryS "r0, r1"
MOV r14, #space-1
......@@ -946,7 +901,7 @@ strlenTS_accumulate ALTENTRY
; Out new string in r1 = "r1" :CC: "r2" :CC: 0
strcat ENTRY "r1, r2, r4"
strcat EntryS "r1, r2, r4"
MOV r4, #space-1
......@@ -1006,7 +961,7 @@ strcpyTS ALTENTRY ; Match with strcatTS !!!
;
; r1 advanced to end of new string (points at the terminator).
strcat_advance ENTRY "r2, r4"
strcat_advance EntryS "r2, r4"
MOV r4, #space-1
......@@ -1081,8 +1036,13 @@ strchr ENTRY
BHI %BT10
MOV r1, #0
[ No26bitCode
CMP pc, #0 ; NE
EXIT
|
PullEnv
BICS pc, lr, #Z_bit ; NE
]
[ Version >= 170
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -1313,7 +1273,7 @@ FS_SkipSpaces ROUT
; Out r2,r3 updated, flags preserved
SReadTime ENTRY "r0-r1, r4", 8 ; Uses local stack for block
SReadTime EntryS "r0-r1, r4", 8 ; Uses local stack for block
MOV r4, #&FF000000 ; Create &FFFFFttt
ORR r2, r2, r4, ASR #12 ; Fill bits 31-12 with 1's
......@@ -1678,12 +1638,22 @@ ValidateR2R5_WriteToCoreCodeLoad ALTENTRY
; Start in &8000...MemoryLimit ?
CMP r2, #&8000
CMPHS r1, r2
[ No26bitCode
BLO %FT97
|
EXITS LO ; No
]
; Yes, start's in range, is end?
CMP r5, r1
BHI %BA90 ; No - give error
[ No26bitCode
97
CLRV
EXIT
|
EXITS
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......
......@@ -129,8 +129,12 @@ FSControl_BadReason
addr r0, ErrorBlock_BadFSControlReason
BL copy_error
[ No26bitCode
Pull pc ; copy_error sets V
|
Pull lr
ORRS pc, lr, #V_bit
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -405,7 +409,7 @@ Run_UndatedFile
]
LDR sp, =SVCSTK ; Flatten superstack, we don't return
TEQP pc, #0 ; USR mode, all ints on
WritePSRc 0, r12 ; USR mode, all ints on
MOV r12, #&80000000 ; Cause address extinction if used
MOV r13, #&80000000 ; (keep 1.20 compat capable)
ADR lr, ReturnFromAbsoluteCode
......@@ -474,7 +478,7 @@ Run_TransientFile
LDR r0, CommandLine
LDR r1, commandtailptr
TEQP pc, #0 ; USR mode, all ints on
WritePSRc 0, wp ; USR mode, all ints on
ADD r5, r3, r5 ; r12 -> transient workspace. Not bank
SUB wp, r5, #transient_code ; Must correct as r5 = info + code
; and r2 = code^
......@@ -512,7 +516,7 @@ Run_TransientFile
ReturnFromPIC
MOV r1, psr ; Remember V, you whalley (SWI clears)
SavePSR r1 ; Remember V, you whalley (SWI clears)
SWI XOS_EnterOS ; Get back to superstate in all cases
......@@ -884,7 +888,8 @@ CopyCommandLineAndReadTime ENTRY "r0-r2"
MOV r14, #3
STR r14, [r1]
SWI XOS_Word ; ReadTime shouldn't give error
EXITS ; So make like it didn't !
CLRV ; So make like it didn't !
EXIT
LTORG
......
......@@ -654,8 +654,14 @@ LookupIFSType ENTRY
IsFSNameTerm
[ No26bitCode
ASSERT space = &20 ; also assume r0 < 256
TST r0, #&E0
MOVEQ pc, lr ; sneaky, huh?
|
CMP r0, #space ; CtrlChar is always term
ORRLOS pc, lr, #Z_bit ; EQ
]
TEQ r0, #":" ; For fsname:
TEQNE r0, #"-" ; For -fsname-
......@@ -1239,7 +1245,6 @@ PrintR0Chars ENTRY
;
; In currentfs is valid fscb^ to reselect
[ Version >= 170
RestoreCurrEntry NewSwiEntry "r0,r2"
BL ReadCurrentFS
MOVVC r2, r0
......@@ -1254,13 +1259,6 @@ RestoreCurrEntry NewSwiEntry "r0,r2"
DREG r0,"globalerror before exit is "
]
SwiExit
|
RestoreCurrEntry ROUT ; NB. No local frame, just dealing with global state
LDR r14, currentfs
STR r14, tempfs
Pull pc,,^ ; Claim vector. Assumes VClear in lr
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -1272,7 +1270,6 @@ RestoreCurrEntry ROUT ; NB. No local frame, just dealing with global state
; Out r1 = module base of Filing System, 0 if none selected
; r2 = ptr to private word
[ Version >= 170
ReadTempModEntry NewSwiEntry "r0"
BL ReadTempFS
BVS %FT90
......@@ -1282,16 +1279,6 @@ ReadTempModEntry NewSwiEntry "r0"
LDRNE r2, [r0, #fscb_privwordptr]
90
SwiExit
|
ReadTempModEntry ROUT ; NB. No local frame, just dealing with global state
LDR r2, tempfs
CMP r2, #Nowt
MOVEQ r1, #0
LDRNE r1, [r2, #fscb_modulebase]
LDRNE r2, [r2, #fscb_privwordptr]
Pull pc,,^ ; Claim vector. Assumes VClear in lr
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -1304,7 +1291,6 @@ ReadTempModEntry ROUT ; NB. No local frame, just dealing with global state
; Out r1 = secondary module base, 0 if no fs selected
; r2 = ptr to private word
[ Version >= 170
ReadSecModEntry NewSwiEntry "r0"
BL ReadTempFS
BVS %FT10
......@@ -1315,16 +1301,6 @@ ReadSecModEntry NewSwiEntry "r0"
10
SwiExit
|
ReadSecModEntry ROUT ; NB. No local frame, just dealing with global state
LDR r2, tempfs
CMP r2, #Nowt
MOVEQ r1, #0
LDRNE r1, [r2, #fscb_modulebase2]
LDRNE r2, [r2, #fscb_privwordptr2]
Pull pc,,^ ; Claim vector. Assumes VClear in lr
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -1354,7 +1330,12 @@ ReadFSHandle ROUT ; NB. No local frame, just dealing with global state
LDREQ r1, [r2, #:INDEX: scb_fshandle] ; Get scb^.fshandle
LDREQ r2, [r2, #:INDEX: scb_fscb] ; Get scb^.fscb
LDREQ r2, [r2, #fscb_info] ; Get fscb^.info
[ No26bitCode
CLRV
Pull pc ; Claim vector.
|
Pull pc,,^ ; Claim vector. Assumes VClear in lr
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......
......@@ -33,11 +33,12 @@ ErrorBlock_$label
; In r0 -> error block
; fp (may be 0)
; Preserves V
CopyErrorStore ROUT
TEQ fp, #0
STRNE r0, globalerror
MOVS pc, lr
MOV pc, lr
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Check external error pointer is kosha, replacing with translated
......@@ -46,9 +47,11 @@ CopyErrorStore ROUT
; In r0 -> error block
CopyErrorValidateExternal ROUT
[ :LNOT:No26bitCode
TST r0, #&FC000003
MOVEQS pc, lr
ADRL r0, ErrorBlock_InvalidErrorBlock
]
B copy_error ; Tail folding
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -261,8 +264,13 @@ AppendHandleToError ENTRY "r0-r5", (?fsw_on_file_handle + 4 + 12 + 3) :AND: :NOT
80
STR r0, globalerror
[ No26bitCode
85 SETV
EXIT
|
85 PullEnv
ORRS pc, lr, #V_bit
]
fsw_on_file_handle DCB "OnFileHandle", 0
ALIGN
......@@ -394,25 +402,45 @@ SetErrorNotOpenForUpdate ALTENTRY
Lowlevel_UnsupportedFSEntry
ADR r0, ErrorBlock_UnsupportedFSEntry
[ No26bitCode
SETV
MOV pc, lr
|
ORRS pc, lr, #V_bit ; VSet, r0 as if FS
]
Lowlevel_UnalignedFSEntry
ADR r0, ErrorBlock_UnalignedFSEntry
[ No26bitCode
SETV
MOV pc, lr
|
ORRS pc, lr, #V_bit ; VSet, r0 as if FS
]
Lowlevel_NotEnoughStackForFSEntry
ADR r0, ErrorBlock_NotEnoughStackForFSEntry
[ No26bitCode
SETV
MOV pc, lr
|
ORRS pc, lr, #V_bit ; VSet, r0 as if FS
]
Lowlevel_NoFilingSystemsActive
ADR r0, ErrorBlock_NoSelectedFilingSystem
[ No26bitCode
SETV
MOV pc, lr
|
ORRS pc, lr, #V_bit ; VSet, r0 as if FS
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Standard error blocks
......
......@@ -564,8 +564,8 @@ FSPath_AddVarToContext ENTRY "r0,r1,r2,r3,r4,r5,r6"
MOV r3, #FSPathEnum_size + 1 + 1 ; One for each string terminator
BL strlen_accumulate
MOV r4, r1
MOV r1, r0
BL strlen_accumulate
MOVS r1, r0
BLNE strlen_accumulate
MOV r0, r6
LDR r6, [r0]
......@@ -616,7 +616,7 @@ FSPath_PackPath ENTRY "r0,r1"
CMP r14, #delete
CMPNE r14, #space-1
BHI %BT10
EXITS
EXIT
;
; FSPath_StepContext
......@@ -742,7 +742,7 @@ FSPath_AllDone ENTRY "r3"
; <path>: is stripped and the process repeated on the new first
; element.
;
FSPath_ResolveContext ENTRY "r0,r1,r2,r3,r4,r5,r6"
FSPath_ResolveContext EntryS "r0,r1,r2,r3,r4,r5,r6"
[ debugpath
DLINE "ResolveContext"
]
......
......@@ -14,10 +14,6 @@
;
SUBT > Sources.FSShared
[ AssemblingArthur
! 1,"Why are you assembling this file ???
]
SharedCodeStart ROUT
; Make sure these are consistent with those used in OSUtils
......@@ -41,7 +37,12 @@ OpenFileWithWinge ENTRY
SetErrorEscape ; This is for utility command and should NOT go BL CopyError !
ADR r0, ErrorBlock_Escape
[ No26bitCode
SETV
MOV pc, lr
|
ORRS pc, lr, #V_bit
]
ErrorBlock_Escape
DCD ErrorNumber_Escape
......@@ -50,7 +51,7 @@ ErrorBlock_Escape
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SkipOverNameAndSpaces ENTRY
SkipOverNameAndSpaces EntryS
BL SkipToSpace
......@@ -69,7 +70,7 @@ SkipToSpace ENTRY "r0"
CMPNE r0, #space ; Leave r1 -> space or CtrlChar
BHI %BT10
SUB r1, r1, #1
EXITS
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; In r0 = number to print
......@@ -144,10 +145,6 @@ HexR0Nibble
STRVS R0, [sp]
Pull "R0, PC"
[ :LNOT: anyfiledebug
! 0, "It would cost ":CC:(:STR:(.-SharedCodeStart)):CC:" bytes to do a near-full divorce from the kernel"
]
FileSwitch_ModuleEnd
END
......@@ -1340,18 +1340,19 @@ Copy_CloseSrc ENTRY "r0-r2"
LDRB r1, copy_srchandle ; Already closed ?
TEQ r1, #0
EXITS EQ ; Accumulates V
EXIT EQ ; Accumulates V
MOV r14, #0
STRB r14, copy_srchandle ; Now closed
BL Copy_PromptSource ; Accumulates V, preserves r1
10 MOV r2, psr
10
SavePSR r2
MOV r0, #0
SWI XOS_Find ; Don't call internal routine as we
BLVS CopyErrorExternal ; may have globalerror set, and the
TEQVCP r2, #0 ; flushing code sets V if globalerror
RestPSR r2, VC ; flushing code sets V if globalerror
EXIT ; was set at all
; .............................................................................
......@@ -1599,7 +1600,13 @@ CopyFile_EnsureDestFileWriteable ENTRY
SUBS r3, r3, r4 ; Another careful date comparison
MOVNE r3, #Z_bit ; lo words first
SBCS r2, r2, r0 ; hi words next
[ No26bitCode
mrs EQ ,r14, CPSR
EOREQ r14, r14, r3
msr EQ ,CPSR_f, r14
|
TEQEQP r3, pc
]
BHI %FT65 ; [yes, do copy]
......@@ -1908,7 +1915,7 @@ CopyDirectory_VerboseCDir ENTRY "r0, r2"
; Out VC: ok
; VS: error copied, or VSet on entry
Copy_PromptSource ENTRY "r0, r1"
Copy_PromptSource EntryS "r0, r1"
MOV r1, #copy_at_source
......@@ -1998,13 +2005,13 @@ SDescribeRMA ENTRY "r0, r3"
DREG r2, "rmaSize = "
]
STR r2, copy_rmasize ; Remember this anyway
EXITS
EXIT
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Out r1 = apl size
; r2 -> apl
SClaimAPL ENTRY "r0, r3"
SClaimAPL EntryS "r0, r3"
LDRB r14, copy_owns_apl_flag
TEQ r14, #0
......@@ -2037,7 +2044,7 @@ SClaimAPL ENTRY "r0, r3"
; Out V accumulated, block freed to appropriate owner
SFreeCopy ENTRY "r0-r2"
SFreeCopy EntryS "r0-r2"
[ debugcopy
DREG r2, "SFreeCopy "
......
......@@ -567,7 +567,7 @@ bytetags
; Out r0 advanced to relevant for number
Util_PluralAdvanceTag ENTRY
Util_PluralAdvanceTag EntryS
CMP r1, #0
BLHI %FT50
CMP r1, #1
......@@ -690,7 +690,7 @@ Util_FreeFileStrings_R7 ENTRY "r1-r2"
LDR r2, [r1, #copy_dirprefix]
BL SFreeArea
EXITS
EXIT ; SFreeArea preserves flags, so we don't have to
; .............................................................................
......@@ -999,7 +999,9 @@ Util_IntoDirectory ROUT
; Out Contexts unnested, stack freed
; r0 = old value of util_nskipped
; r1 = util_length (old value of util_totalsize)
Util_OutOfDirectory ENTRY "r2-r6,r9-r10"
Util_OutOfDirectory
ENTRY "r2-r6,r9-r10"
TEQ r8, #0
ADDEQ r14, sp, #8*4 + 9*4
......@@ -1030,7 +1032,11 @@ Util_OutOfDirectory ENTRY "r2-r6,r9-r10"
Pull "$Proc_RegList.,r14"
ADDEQ sp, sp, #9*4
ADDNE sp, sp, #13*4
[ No26bitCode ; We have preserved V, which is all
MOV pc, lr ; that is necessary
|
MOVS pc, lr
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -1423,7 +1429,13 @@ Util_DateRange ENTRY "r0-r5"
SUBS r4, r1, r4 ; After end date ?
MOVNE r4, #Z_bit ; lo words first
SBCS r5, r0, r5 ; hi words next
[ No26bitCode
mrs EQ ,r14, CPSR
EOREQ r14, r14, r4
msr EQ ,CPSR_f, r14
|
TEQEQP r4, pc
]
[ debugutil
BLS %FT00
DLINE "source newer than end date"
......@@ -1434,7 +1446,13 @@ Util_DateRange ENTRY "r0-r5"
SUBS r2, r1, r2 ; After or equal to start date ?
MOVNE r2, #Z_bit ; lo words first
SBCS r3, r0, r3 ; hi words next
[ No26bitCode
mrs EQ ,r14, CPSR
EOREQ r14, r14, r2
msr EQ ,CPSR_f, r14
|
TEQEQP r2, pc
]
[ debugutil
BLO %FT00
DLINE "source date in range"
......@@ -1486,12 +1504,12 @@ Util_IncrementSkipped ENTRY
LDR r14, util_nskipped
ADD r14, r14, #1
STR r14, util_nskipped
EXITS
EXIT ; Haven't touched flags
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Must preserve flags
Util_DecrementDirEntry ENTRY
Util_DecrementDirEntry EntryS
LDR r14, util_direntry
[ debugutil
......
......@@ -619,9 +619,14 @@ $label ROUT
MACRO
$label InitialiseFrame
$label TEQP pc, #SVC_mode ; Reenable interrupts
$label WritePSRc SVC_mode, fp ; Reenable interrupts
MOV fp, sp ; Point to dumped registers
[ No26bitCode
; ensure V clear
SUBS sp, sp, #Proc_LocalStack ; Never zero for main entry frame
|
SUB sp, sp, #Proc_LocalStack ; Never zero for main entry frame
]
[ debugframe
DREG fp,"InitialiseFrame: fp := "
]
......@@ -777,11 +782,9 @@ copy_n_upcalls # 1 ; Reference count on UpCallV
codeflag # 1 ; 0 if data being loaded, 1 if code
]
[ :LNOT: AssemblingArthur
AlignSpace
EnvStringAddr # 4 ; Only needed when we're not bound to kernel
EnvTimeAddr # 4
]
; No need to align end of global workspace; saves alloc when rounded!
......@@ -1000,16 +1003,7 @@ gbpb_fileptr # 4
; Header bits for gluing into Arthur ROM or running standalone in RAM
[ AssemblingArthur
ALIGN
DCD NextModuleInImage-FSModule ; Chain more modules after this
FSModule
Module_BaseAddr SETA .
|
Module_BaseAddr * .
]
DCD 0 ; Not an application
DCD FileSwitch_Init - Module_BaseAddr
......@@ -1018,13 +1012,16 @@ Module_BaseAddr * .
DCD FileSwitch_Title - Module_BaseAddr
DCD FileSwitch_HelpText - Module_BaseAddr
DCD FileSwitch_HC_Table - Module_BaseAddr
[ International_Help <> 0
[ International_Help <> 0 :LOR: No26bitCode
DCD 0
DCD 0
DCD 0
DCD 0
DCD message_filename - Module_BaseAddr
]
[ No26bitCode
DCD FileSwitch_ModFlags - Module_BaseAddr
]
GBLS FileSwitchMinor
[ Version = 154
......@@ -1096,6 +1093,11 @@ FileSwitch_Title
ALIGN
[ No26bitCode
FileSwitch_ModFlags
DCD 1 ; 32-bit compatible
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Possible startup / reset sequences :
;
......@@ -1135,27 +1137,6 @@ FileSwitch_Init ENTRY "r7"
01 ; Get some workspace from the RMA first of all
[ AssemblingArthur
addr r14, Module_BaseAddr ; Someone tried to *RMFaster us ?
CMP r14, #ROM
BHS %FT01
MOV r0, #ModHandReason_ReInit ; Start ROM FileSwitch up again
addr r1, FileSwitch_Title
SWI XOS_Module
; NB. it is not possible to preserve current filing system over this as the
; ROM FileSwitch is dead and devectored
ADRVC r0, ErrorBlock_CantRMFasterFileSwitch
SETV
EXIT ; Stop this one initialising
MakeErrorBlock CantRMFasterFileSwitch
01
]
[ debuginit
DLINE "Hard Init"
]
......@@ -1173,11 +1154,9 @@ FileSwitch_Init ENTRY "r7"
Push "r0"
]
[ :LNOT: AssemblingArthur
SWI XOS_GetEnv ; Read these to gain MOS independence
STR r0, EnvStringAddr ; in soft loaded version
STR r2, EnvTimeAddr
]
; Initialise lots of pointers to Nowt
......@@ -1602,7 +1581,7 @@ FileSwitch_ResetInitCommon ENTRY
FileSwitch_Service_TerritoryStarted
LDR R12,[R12]
ReadCaseTables ENTRY
ReadCaseTables EntryS
BL open_message_file
MOV r0, #-1
SWI XTerritory_UpperCaseTable
......@@ -1770,8 +1749,8 @@ FileSwitch_Service_Memory ROUT
[ debugservice
DREG r2,"Memory moving service: CAO "
]
TEQ r0, #0 ; Can always ADD to apl size
MOVPLS pc, lr ; when we own it, just forbid takeaway
CMP r0, #0 ; Can always ADD to apl size
MOVPL pc, lr ; when we own it, just forbid takeaway
; It would be nice to allow memory to be taken away up to the point where
; we are currently using for the copy buffer, but as we don't have any
......@@ -1788,7 +1767,7 @@ FileSwitch_Service_Memory ROUT
DLINE "Forbidding memory move: FileSwitch owns this domain's apl"
00
]
MOVS pc, lr ; VClear
MOV pc, lr
; .............................................................................
; When a nice filing system has told us a disc's been dismounted, we aught to
......@@ -1934,17 +1913,6 @@ SitOnVectors ENTRY "r0-r4"
CMP r0, #&FF ; End entry ?
EXIT EQ
[ AssemblingArthur
TST r0, #&80 ; If not BGet or BPut, always vector
BEQ %FT20
LDR r14, =fileswitch_ws1 ; Defined in ArthurSWIs
CMP r14, wp
BEQ %BT10 ; [got expected wp, so don't vector]
BIC r0, r0, #&80
20
]
LDR r14, [r4], #4 ; Form address of routine
ADD r1, r4, r14 ; NB. r2 advanced !
MOV r2, wp
......@@ -1963,7 +1931,7 @@ SitOnVectors ENTRY "r0-r4"
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Out V preserved
DelinkTheLot ENTRY "r0-r4"
DelinkTheLot EntryS "r0-r4"
ADR r4, FileSwitch_VectorTable
ADR r3, FileSwitch_VectorNumberTable
......@@ -1972,17 +1940,6 @@ DelinkTheLot ENTRY "r0-r4"
CMP r0, #&FF ; End entry ?
EXITS EQ
[ AssemblingArthur
TST r0, #&80 ; If not BGet or BPut, always unlink
BEQ %FT20
LDR r14, =fileswitch_ws1 ; Defined in ArthurSWIs
CMP r14, wp
BEQ %BT10 ; [got expected wp, so not vectored]
BIC r0, r0, #&80
20
]
LDR r14, [r4], #4
ADD r1, r4, r14 ; Form address of routine
MOV r2, wp
......@@ -2014,13 +1971,8 @@ FileSwitch_VectorNumberTable
DCB FindV
DCB GBPBV
DCB ArgsV
[ AssemblingArthur
DCB BGetV :OR: &80 ; Only claim if wp~=expected if in ROM
DCB BPutV :OR: &80
|
DCB BGetV ; Always claim if not in ROM
DCB BGetV
DCB BPutV
]
DCB &FF ; End of table marker
ALIGN
......@@ -2042,7 +1994,11 @@ FileSwitchExit ROUT
00
Pull r14
]
[ No26bitCode
CMP r14, #0 ; clear V
|
TEQ r14, #0
]
[ anyfiledebug
BEQ %FT00
DREG r14, "globalerror on exit "
......@@ -2062,8 +2018,12 @@ FileSwitchExit ROUT
DREG r10, ",",cc
DREG r11, ","
]
[ No26bitCode
Pull pc, EQ ; don't preserve NZC on 32-bit systems
|
Pull lr, EQ
BICEQS pc, lr, #V_bit ; Return to punter, NZC flags intact
]
; .............................................................................
; In r14 -> error block
......@@ -2071,8 +2031,13 @@ FileSwitchExit ROUT
LethalFileSwitchExit
MOV r0, r14 ; r0 -> error block
[ No26bitCode
SETV
Pull pc ; don't preserve NZC on 32-bit systems
|
Pull lr
ORRS pc, lr, #V_bit ; Return to punter, NZC flags intact
]
; .............................................................................
; In C flag significant and should be returned to punter
......@@ -2083,10 +2048,15 @@ FileSwitchExitSettingC ROUT
TEQ r14, #0 ; Careful to preserve C !
BNE LethalFileSwitchExit
[ No26bitCode
CLRPSR V_bit, lr ; clear V carefully, preserving C
Pull pc ; NZ corrupted
|
Pull lr
BIC lr, lr, #V_bit ; ??? Does this have VClear anyway ?
BIC lr, lr, #V_bit ; ??? Does this have VClear anyway ? (No - KJB)
BICCCS pc, lr, #C_bit ; Return to punter, NZ flags intact
ORRCSS pc, lr, #C_bit
]
; .............................................................................
......@@ -2143,9 +2113,8 @@ CreateHBlockArray ROUT
;
ClaimHBlock ROUT
Push "r1,r4,lr"
MOV r4,pc
ORR r1,r4,#I_bit
TEQP r1,#0 ;protect critical manipulation from interrupt re-entry
SavePSR r4
SETPSR I_bit, r1 ;protect critical manipulation from interrupt re-entry
LDR r2,[r3,#8] ;pick up block container at front of free list
CMP r2,#0
BEQ ClaimHBlock_NoneFree
......@@ -2158,11 +2127,11 @@ ClaimHBlock ROUT
LDR r3,[r3,#4]
SUB r3,r3,#4 ;size of block
BIC r4,r4,#V_bit ;return with V clear
TEQP r4,#0 ;restore IRQ state
RestPSR r4,,cf ;restore IRQ state
Pull "r1,r4,pc"
ClaimHBlock_NoneFree
ORR r4,r4,#V_bit ;return with V set
TEQP r4,#0 ;restore IRQ state
RestPSR r4,,cf ;restore IRQ state
Pull "r1,r4,pc"
;
......@@ -2175,9 +2144,8 @@ ClaimHBlock_NoneFree
;
FreeHBlock ROUT
Push "r2,r3,r4,lr"
MOV r4,pc
ORR r3,r4,#I_bit
TEQP r3,#0 ;protect critical manipulation from interrupt re-entry
SavePSR r4
SETPSR I_bit,r3 ;protect critical manipulation from interrupt re-entry
ADD r3,r1,#12 ;r3 -> first block container
SUB r2,r2,#4 ;r2 -> container for block (if valid)
CMP r2,r3
......@@ -2202,11 +2170,11 @@ FreeHBlock ROUT
STR lr,[r2,#4] ;chain free list to block container we are freeing
STR r2,[r1,#8] ;put freed block container at front
BIC r4,r4,#V_bit ;return with V clear
TEQP r4,#0 ;restore IRQ state
RestPSR r4,,cf ;restore IRQ state
Pull "r2,r3,r4,pc"
FreeHBlock_NaffOff
ORR r4,r4,#V_bit ;return with V set
TEQP r4,#0 ;restore IRQ state
RestPSR r4,,cf ;restore IRQ state
Pull "r2,r3,r4,pc"
; InitHBlocks
......
......@@ -19,6 +19,13 @@
GET Hdr:Macros
GET Hdr:System
GET Hdr:Machine.<Machine>
; Get brutal with 32-bitness - use 26-bit code unless we really mustn't,
; as 32-bit is a performance drain. Can't softload FileSwitch really,
; anyway.
[ :LNOT: No26bitCode
No32bitCode SETL {TRUE}
]
GET Hdr:CMOS
GET Hdr:ModHand
GET Hdr:Services
......
......@@ -42,17 +42,6 @@
GET s.OSGBPB
GET s.OSArgs
GET s.LowLevel
GBLS whattodonow
GET s.FSShared
[ :LNOT: AssemblingArthur
whattodonow SETS " GET s.FSShared"
|
FileSwitch_ModuleEnd
DCD 0 ; Next module is the end of module chain now
whattodonow SETS ""
]
$whattodonow
END
......@@ -46,14 +46,30 @@ IsFileTyped ROUT
CMPNE r2, #-1
CMPEQ r3, #-1
TEQNE r2, r3 ; Check for load=exec
[ No26bitCode
BEQ %FT01
|
BICEQS pc, lr, #Z_bit
]
; Check for load < &fff00000
CMP r2, #&fff00000
[ No26bitCode
MOVLO pc, lr ; LO => NE
|
BICLOS pc, lr, #Z_bit
]
; load >= &fff00000 hence date stamped
[ No26bitCode
CMP r0, r0 ; set EQ
MOV pc, lr
01
CMP pc, #0 ; set NE
MOV pc, lr
|
ORRS pc, lr, #Z_bit
]
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -89,8 +105,12 @@ FileTypeToifscb ROUT
10
LDR r1, [r1, #fscb_link]
TEQ r1, #Nowt
[ No26bitCode
BEQ %FT20
|
Pull "lr", EQ
BICEQS pc, lr, #Z_bit
]
; Skip non-MultiFS fscbs
LDRB r14, [r1, #fscb_info]
......@@ -101,8 +121,15 @@ FileTypeToifscb ROUT
TEQ r14, r2
BNE %BT10
[ No26bitCode
Pull "pc"
20 CMP pc, #0
Pull "pc"
|
Pull "lr"
ORRS pc, lr, #Z_bit
]
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
......@@ -116,7 +143,7 @@ FileTypeToifscb ROUT
; r2 = unchanged
; r3 = unchanged
;
AdjustObjectTypeReMultiFS ENTRY "r1,r2"
AdjustObjectTypeReMultiFS EntryS "r1,r2"
; Is it a file?
TEQ r0, #object_file
......@@ -159,7 +186,7 @@ AdjustObjectTypeReMultiFS ENTRY "r1,r2"
; any if error==not found
; then map to object_notfound
;
ComplexAdjustObjectTypeReMultiFS ENTRY "r1,r2"
ComplexAdjustObjectTypeReMultiFS EntryS "r1,r2"
BVS %FT50
......
......@@ -463,7 +463,7 @@ BangFile5Cache Entry "r2"
MOV lr, #Nowt
STR lr, OsFile5Cache
BL SFreeArea
EXITS
EXIT ; Don't think we need to preserve, but SFreeArea does
]
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......@@ -539,7 +539,7 @@ DuffFSTable
DCD 2_00000000000000000000000000000000 ;c0
DCD 2_00000000000000000000000000000000 ;e0
SortSpecialForFSEntry ENTRY "r1,r2"
SortSpecialForFSEntry EntryS "r1,r2"
[ debuglowspecial
DREG r6, "Sorting special field = "
]
......@@ -626,7 +626,7 @@ SortSpecialForFSEntry ENTRY "r1,r2"
TEQ lr, #0
[ debugdollarstrip
BNE %FT01
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
01
]
......@@ -646,7 +646,7 @@ SortSpecialForFSEntry ENTRY "r1,r2"
BNE %BT70
[ debugdollarstrip
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
]
EXITS
......@@ -654,7 +654,7 @@ SortSpecialForFSEntry ENTRY "r1,r2"
80
; there's $<something other than .> here, check for .$
SUB r1, r1, #2 ; point to char before the $
LDR lr, [sp, #0*4]
LDR lr, [sp, #Proc_RegOffset + 0*4]
CMP r1, lr ; HS if not before start of string
LDRHSB lr, [r1]
CMPHS lr, #"." ; EQ if char before $ is a .
......@@ -662,7 +662,7 @@ SortSpecialForFSEntry ENTRY "r1,r2"
STREQB lr, [r1] ; truncate here as .$<anything other than . or \0> is a bug
[ debugdollarstrip
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
]
EXITS
......@@ -678,7 +678,7 @@ SortSpecialForFSEntry ENTRY "r1,r2"
;
; Out r1 string has $. stripped if appropriate
;
SortSpecialForFSExit ENTRY "r1,r2,r3"
SortSpecialForFSExit EntryS "r1,r2,r3"
LDR lr, [fscb, #fscb_info]
TST lr, #&ff
......@@ -716,7 +716,7 @@ SortSpecialForFSExit ENTRY "r1,r2,r3"
TEQ lr, #"$"
BNE %FT20
[ debugdollarstrip
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
]
EXITS
......@@ -755,7 +755,7 @@ SortSpecialForFSExit ENTRY "r1,r2,r3"
STRNEB r3, [r1, #2]
[ debugdollarstrip
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
]
EXITS
......@@ -770,7 +770,7 @@ SortSpecialForFSExit ENTRY "r1,r2,r3"
STRB lr, [r1]
[ debugdollarstrip
LDR r1, [sp]
LDR r1, [sp, #Proc_RegOffset]
DSTRING r1,"->"
]
EXITS
......@@ -1556,7 +1556,9 @@ CallFSEntryChecked
DREG r0, " fscb_modulebase="
Pull "r0,r1"
]
[ :LNOT: No26bitCode
BIC lr, lr, #V_bit :OR: I_bit ; VClear, IClear in lr
]
[ anyfiledebug :LAND: False
DREG sp, "sp on entry to fs = "
......
......@@ -113,7 +113,7 @@ copy_error3 ALTENTRY
; In r0 = pointer to nul-terminated tag
; Out r0 = pointer to ctrl-char terminated string
; error possible
message_lookup ENTRY "r0-r7"
message_lookup EntryS "r0-r7"
[ debugmsgstuff
DSTRING r0,"message_lookup(",cc
DLINE ")->",cc
......@@ -132,14 +132,14 @@ message_lookup ENTRY "r0-r7"
DSTRING r2
01
]
STRVC r2, [sp]
STRVC r2, [sp, #Proc_RegOffset]
EXITS VC
[ debugmsgstuff
ADD r0, r0, #4
DSTRING r0, "error:"
SUB r0, r0, #4
]
STR r0, [sp]
STR r0, [sp, #Proc_RegOffset]
EXIT
MsgsNul DCB 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment