Commit b2893e51 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

STASH/GRAB -> Push/Pull.

Disassembly unchanged apart from the single register STM's which now use STR ith writeback.

Version 1.33. Tagged as 'ATAPI-1_33'
parent 1a0b479e
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.2.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.32"
Module_Version SETA 132
Module_MajorVersion SETS "1.33"
Module_Version SETA 133
Module_MinorVersion SETS ""
Module_Date SETS "22 Apr 2005"
Module_ApplicationDate SETS "22-Apr-05"
Module_Date SETS "24 May 2012"
Module_ApplicationDate SETS "24-May-12"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.32"
Module_HelpVersion SETS "1.32 (22 Apr 2005)"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.33"
Module_HelpVersion SETS "1.33 (24 May 2012)"
END
/* (1.32)
/* (1.33)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.2.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.32
#define Module_MajorVersion_CMHG 1.33
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Apr 2005
#define Module_Date_CMHG 24 May 2012
#define Module_MajorVersion "1.32"
#define Module_Version 132
#define Module_MajorVersion "1.33"
#define Module_Version 133
#define Module_MinorVersion ""
#define Module_Date "22 Apr 2005"
#define Module_Date "24 May 2012"
#define Module_ApplicationDate "22-Apr-05"
#define Module_ApplicationDate "24-May-12"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.32"
#define Module_HelpVersion "1.32 (22 Apr 2005)"
#define Module_LibraryVersionInfo "1:32"
#define Module_FullVersion "1.33"
#define Module_HelpVersion "1.33 (24 May 2012)"
#define Module_LibraryVersionInfo "1:33"
......@@ -59,7 +59,7 @@ $label [ OUTPUT_ON=1
BNE %BT01
GRAB "r0 - r1, r14"
Pull "r0 - r1, r14"
]
MEND
......@@ -76,7 +76,7 @@ $label DisplayTS $reg
[ $reg <= r1
! 0,"Cannot use r0 - r1 in Display macro !"
]
STASH "r0 - r1, r14"
Push "r0 - r1, r14"
MOV r1, # 8 ; altering this figure affects the number of
01 MOV $reg, $reg, ROR #28 ; characters displayed
......@@ -92,7 +92,7 @@ $label DisplayTS $reg
BNE %BT01
GRAB "r0 - r1, r14"
Pull "r0 - r1, r14"
MEND
......@@ -104,13 +104,13 @@ $label DisplayTS $reg
MACRO
$label DisplayNewLine
$label [ OUTPUT_ON=1
STASH r14
Push r14
[ OUTPUT_TO_SCREEN<>0
SWI XOS_NewLine
|
SWI &a194e:OR:(1:SHL:17) ; SYS "Stream_NewLine"
]
GRAB r14
Pull r14
]
MEND
......@@ -121,7 +121,7 @@ $label [ OUTPUT_ON=1
; ********************************************
MACRO
$label MACRO__ENTER_DRIVER
$label STASH "r0-r8, r14"
$label Push "r0-r8, r14"
MEND
; ********************************************
......@@ -129,7 +129,7 @@ $label STASH "r0-r8, r14"
; ********************************************
MACRO
$label MACRO__EXIT_DRIVER_OK $cc
$label GRAB "r0-r8, pc", "$cc"
$label Pull "r0-r8, pc", "$cc"
MEND
; ********************************************
......@@ -139,9 +139,9 @@ $label GRAB "r0-r8, pc", "$cc"
$label MACRO__EXIT_DRIVER_WITH_R0 $cc, $noexit
$label ADD$cc r13, r13, #4
[ "$noexit"=""
GRAB "r1-r8, pc", "$cc"
Pull "r1-r8, pc", "$cc"
|
GRAB "r1-r8, r14", "$cc"
Pull "r1-r8, r14", "$cc"
]
MEND
......@@ -151,7 +151,7 @@ $label ADD$cc r13, r13, #4
MACRO
$label MACRO__EXIT_DRIVER_WITHOUT_RESTORING_REGISTERS $cc
$label ADD$cc r13, r13, #4*9
GRAB "pc", "$cc"
Pull "pc", "$cc"
MEND
; *******************************
......@@ -160,7 +160,7 @@ $label ADD$cc r13, r13, #4*9
MACRO
$label MySTRIM $string
$label [ OUTPUT_ON=1
STASH r14
Push r14
[ OUTPUT_TO_SCREEN<>0
SWI XOS_WriteS
|
......@@ -168,7 +168,7 @@ $label [ OUTPUT_ON=1
]
DCB "$string", 0
ALIGN
GRAB r14
Pull r14
|
[ cdebug
CDebug_WriteS $string
......
......@@ -183,12 +183,12 @@ ATAPIC_UnknownReason
;------------------------------------------------------------------------------
ATAPI_Op ROUT
STASH "r0-r5,r14"
Push "r0-r5,r14"
MOV r5,#0
BL ATAPI_RawOp
ADDVC sp,sp,#4*3
GRAB "r3-r5,pc",VC ; no-error case
Pull "r3-r5,pc",VC ; no-error case
TEQ r0,#DRIVERERROR__SELECTION_TIMEOUT
TEQNE r0,#DRIVERERROR__OTHER_TIMEOUT
BEQ %FT90 ; serious problems, try resetting before retrying
......@@ -214,12 +214,12 @@ ATAPI_Op ROUT
10 ; Return any remaining errors
ADD sp,sp,#4
SETV
GRAB "r1-r5,pc"
Pull "r1-r5,pc"
90 ; Reset drive before retrying command
STASH "r0"
Push "r0"
BL ATAPI_Reset
GRAB "r0"
Pull "r0"
95 ; Retry command unless number of retries has been reached
ADDS r14,SWIN,#1:SHL:30
......@@ -234,7 +234,7 @@ ATAPI_Op ROUT
MOV r1,#0
BL Extras_SetDrawerStatus
GRAB "r0-r5,r14"
Pull "r0-r5,r14"
B ATAPI_Op
;------------------------------------------------------------------------------
......@@ -249,10 +249,10 @@ ATAPI_Op ROUT
;------------------------------------------------------------------------------
ATAPI_Reset ROUT
STASH "r5,r14"
Push "r5,r14"
BL Extras_ConvertControlBlockToDrive ; sets up r0
GRAB "r5,pc", VS ; return error if bad drive
Pull "r5,pc", VS ; return error if bad drive
MOV r0,r0,LSL #15 ; device -> bit15, controller -> bits 16-23
ORR r0,r0,#1 ; do DEVICE RESET command
......@@ -260,11 +260,11 @@ ATAPI_Reset ROUT
SWI XADFS_ATAPIOp
BVS %FT90
TEQ r0,#0 ; not a disc error?
GRAB "r5,pc" ; exit with V clear
Pull "r5,pc" ; exit with V clear
; Any disc error at this point is bound to be a timeout
MOV r0,#DRIVERERROR__OTHER_TIMEOUT
SETV
GRAB "r5,pc"
Pull "r5,pc"
90 ; Error pointer returned from SWI - is it "Bad drive"?
LDR r14,[r0]
......@@ -272,7 +272,7 @@ ATAPI_Reset ROUT
TEQ r14,r5
MOVEQ r0,#DRIVERERROR__INVALID_PARAMETER
; Otherwise (eg "Driver in use") pass error pointer back
GRAB "r5,pc"
Pull "r5,pc"
;------------------------------------------------------------------------------
; ATAPI_RawOp - ATAPICONTROL__RAW_OP reason code
......@@ -302,9 +302,9 @@ ATAPI_Reset ROUT
;------------------------------------------------------------------------------
ATAPI_RawOp ROUT
STASH "r0-r2,r14"
Push "r0-r2,r14"
[ cdebug
STASH "r0-r4"
Push "r0-r4"
CDebug_WriteS "ATAPI cmd:",cc
00
LDRB r4,[r2],#1
......@@ -312,14 +312,14 @@ ATAPI_RawOp ROUT
SUBS r1,r1,#1
BNE %B00
CDebug_NewLine
GRAB "r0-r4"
Pull "r0-r4"
]
MOV r0,#0
MOV r14,#0
STASH "r0,r14"
STASH "r0,r14" ; create zeroed 16-byte block on stack
Push "r0,r14"
Push "r0,r14" ; create zeroed 16-byte block on stack
ADD r14,r2,r1
ADD r2,sp,r1
......@@ -331,14 +331,14 @@ ATAPI_RawOp ROUT
BL Extras_ConvertControlBlockToDrive ; sets up r0
MOVVS r0,#DRIVERERROR__SELECTION_TIMEOUT ; different error required
ADDVS sp,sp,#16+12
GRAB "pc",VS
Pull "pc",VS
STASH "r0" ; save drive number for "Driver in use" retries
Push "r0" ; save drive number for "Driver in use" retries
SWI XOS_ReadMonotonicTime
TEQ r5,#0
ADDNE r0,r0,r5
ADDEQ r0,r0,#1000
STASH "r0" ; save timeout for "Driver in use" retries
Push "r0" ; save timeout for "Driver in use" retries
LDR r0,[sp,#4] ; get drive number back in r0
ADR r14,DriveRecognisedStatus
......@@ -352,7 +352,7 @@ ATAPI_RawOp ROUT
BVS %FT90
ADD sp,sp,#8+16
TEQ r0,#0 ; not a disc error?
GRAB "r0-r2,pc", EQ ; exit with V clear
Pull "r0-r2,pc", EQ ; exit with V clear
; A disc error occurred - convert into appropriate internal error number
; or SCSI error register set
......@@ -361,15 +361,15 @@ ATAPI_RawOp ROUT
TEQ r0,#WinIDEErrCmdBusy
TEQNE r0,#WinIDEErrCmdNotRdy
MOVEQ r0,#DRIVERERROR__SELECTION_TIMEOUT
GRAB "pc",EQ
Pull "pc",EQ
TEQ r0,#WinIDEErrWFT
TEQNE r0,#WinIDEErrABRT
TEQNE r0,#WinIDEErrPacket
MOVNE r0,#DRIVERERROR__OTHER_TIMEOUT ; the only disc errors I expect here
GRAB "pc",NE ; are &22 or &23, but treat all
Pull "pc",NE ; are &22 or &23, but treat all
; unexpected ones the same
; Do a REQUEST SENSE command
STASH "r3-r6"
Push "r3-r6"
ADRAL r6,%FT50 ; r6 = where to go if command fails
TEQ r0,#WinIDEErrABRT
ADREQ r6,%FT60
......@@ -384,7 +384,7 @@ ATAPI_RawOp ROUT
MOV r3,#3:SHL:16 ; operation = REQUEST SENSE, LUN = reserved = 0
MOV r2,#0
MOV r1,#0
STASH "r1-r5,r14" ; command block at sp+10,
Push "r1-r5,r14" ; command block at sp+10,
; result block at sp+1
MOV r1,#12 ; actually a 6-byte comand, but padded
ADD r2,sp,#10
......@@ -453,7 +453,7 @@ ATAPI_RawOp ROUT
40 ADD sp,sp,#24
SETV
GRAB "r3-r6,pc"
Pull "r3-r6,pc"
50 ; REQUEST SENSE failed, or "no sense" returned, after WinIDEErrWFT
MOVVS r4,#0 ; can't suppose any filemark/EOM/ILI bits
......@@ -486,7 +486,7 @@ ATAPI_RawOp ROUT
90 ; Error pointer returned from first SWI
; Is it "Bad drive" or "Driver in use"?
; These are selection timeouts (we need to timeout the latter)
STASH "r5"
Push "r5"
LDR r14,[r0]
LDR r5,=ADFSBadDrive
TEQ r14,r5
......@@ -501,15 +501,15 @@ ATAPI_RawOp ROUT
SWI XOS_ReadMonotonicTime
LDR r14,[sp,#4+0]
CMP r14,r0
GRAB "r5", PL ; PL condition for clock arithmetic
Pull "r5", PL ; PL condition for clock arithmetic
LDRPL r0,[sp,#4]
BPL %BT10
MOV r0,r5 ; get back "Driver in use" error pointer
SETV
95
GRAB "r5"
Pull "r5"
ADD sp,sp,#8+16+4
GRAB "r1-r2,pc"
Pull "r1-r2,pc"
; ============= Non-HAL case ==================================================
|
......@@ -554,16 +554,16 @@ ATAPI_Control ROUT
; reason code is valid so try to lock IDE registers
STASH "r0,r14"
Push "r0,r14"
MOV r0,#1 ; lock, not unlock
BL ATAPI_LockUnlockIDE
ADDVS sp,sp,#4 ; if error, discard stacked r0...
GRAB "pc",VS ; and return error
Pull "pc",VS ; and return error
; managed to lock IDE registers
GRAB "r0" ; get original r0
Pull "r0" ; get original r0
MOV r14,pc ; set return address
ADD pc,pc,r8,LSL #2 ; call routine
......@@ -595,17 +595,17 @@ ATAPIC_UnknownReason
; original r14 on stack
BVS %FT91
STASH "r0" ; save return code
Push "r0" ; save return code
MOV r0,#0 ; unlock, not lock
BL ATAPI_LockUnlockIDE
CLRV
GRAB "r0,pc" ; return
Pull "r0,pc" ; return
91
STASH "r0" ; save return code
Push "r0" ; save return code
MOV r0,#0 ; unlock, not lock
BL ATAPI_LockUnlockIDE
SETV
GRAB "r0,pc" ; return
Pull "r0,pc" ; return
;------------------------------------------------------------------------------
; ATAPI_Op
......@@ -641,7 +641,7 @@ ATAPIC_UnknownReason
ATAPI_Op ROUT
STASH "r0-r10,r14"
Push "r0-r10,r14"
[ cdebug
CDebug_Time
......@@ -1093,7 +1093,7 @@ ACOD_WaitForCommandComplete
;
; save registers we must not destroy before starting
STASH "r2,r4,r6,r7,r8,r10"
Push "r2,r4,r6,r7,r8,r10"
SUB r5,r5,#8*4 ; number of bytes per loop
10
......@@ -1142,7 +1142,7 @@ ACOD_WaitForCommandComplete
SUBS r5,r5,#8*4 ; number of bytes per loop
BGE %B10
GRAB "r2,r4,r6,r7,r8,r10"
Pull "r2,r4,r6,r7,r8,r10"
; r5 now contains 0 (copy was multiple of 32 bytes) or <0 (copy was NOT
; multiple of 32 bytes) and flags will reflect this. If <0, need to copy
......@@ -1205,7 +1205,7 @@ ACOD_ExitOK
LDR r1,TBA
LDRB r3,[r1,#TASKFILE__R_ALTERNATE_STATUS]
TSTS r3,#STATUSFLAGS__CHECK
GRAB "r0-r10,pc",EQ ; exit VC if no error
Pull "r0-r10,pc",EQ ; exit VC if no error
; error
......@@ -1308,7 +1308,7 @@ change_of_disc
[ cdebug
CDebug_WriteS "retry"
]
GRAB "r0-r10,r14" ; yes
Pull "r0-r10,r14" ; yes
B ATAPI_Op
;;;;;;;;;;;;;;;;;
......@@ -1317,7 +1317,7 @@ ACOD_DiscNotChanged
SETV
ADD r13, r13, #4
GRAB "r1-r10,pc"
Pull "r1-r10,pc"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......@@ -1328,11 +1328,11 @@ drive_error ROUT
; Original entry registers to ATAPI_Op are on stack
; r0 = error
STASH "r0"
Push "r0"
LDR r0,[sp,#4+0*4] ; get stacked r0
LDR r7,[sp,#4+7*4] ; get stacked r7
BL ATAPI_Reset
GRAB "r0"
Pull "r0"
B change_of_disc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......@@ -1493,7 +1493,7 @@ ATAPI_Reset ROUT
CDebug_Time
CDebug_WriteS ": Reset.."
]
STASH "r0-r2,r14"
Push "r0-r2,r14"
; work out which drive to use
......@@ -1501,7 +1501,7 @@ ATAPI_Reset ROUT
BNE %F10
BL Extras_ConvertControlBlockToDrive
GRAB "r0-r2,pc",VS ; return error if bad drive
Pull "r0-r2,pc",VS ; return error if bad drive
10
; drive bit in r0
; select drive, ignoring BSY status
......@@ -1540,7 +1540,7 @@ ATAPI_Reset ROUT
; return OK
CLRV
GRAB "r0-r2,pc"
Pull "r0-r2,pc"
;------------------------------------------------------------------------------
......@@ -1573,7 +1573,7 @@ ATAPI_CheckForDrive ROUT
[ cdebug2
CDebug_StrReg2 "CheckForDrive ",r0
]
STASH "r0-r2,r5,r14"
Push "r0-r2,r5,r14"
LDR r1,TBA ; r1 -> IDE registers
MOV r2,r0,LSL #4 ; put drive bit in place
......@@ -1603,7 +1603,7 @@ ATAPI_CheckForDrive ROUT
CDebug_WriteS "Drive busy (1)"
]
SETV
GRAB "r0-r2,r5,pc"
Pull "r0-r2,r5,pc"
;;;;;;;;;;;;;;;;;
08
......@@ -1638,7 +1638,7 @@ ATAPI_CheckForDrive ROUT
CDebug_WriteS "Drive busy (2)"
]
SETV
GRAB "r0-r2,r5,pc"
Pull "r0-r2,r5,pc"
;;;;;;;;;;;;;;;;;
......@@ -1669,7 +1669,7 @@ ATAPI_CheckForDrive ROUT
CDebug_WriteS "Signature found (1)"
00
]
GRAB "r0-r2,r5,pc",EQ ; if signature found, return VC
Pull "r0-r2,r5,pc",EQ ; if signature found, return VC
[ cdebug
CDebug_StrReg2 "Signature not found (1): ",r14,cc
......@@ -1719,7 +1719,7 @@ ATAPI_CheckForDrive ROUT
CDebug_WriteS "Drive busy (3)"
]
SETV
GRAB "r0-r2,r5,pc" ; return VS
Pull "r0-r2,r5,pc" ; return VS
;;;;;;;;;;;;;;;;;
50
......@@ -1766,7 +1766,7 @@ ATAPI_CheckForDrive ROUT
01
]
SETV NE ; otherwise V is left clear
GRAB "r0-r2,r5,pc"
Pull "r0-r2,r5,pc"
]
;------------------------------------------------------------------------------
......@@ -1789,7 +1789,7 @@ ATAPI_CheckForDrive ROUT
DoMicroDelay ROUT
STASH "r1,r2,r14"
Push "r1,r2,r14"
MOV r2,#IOC ; R2 -> IOC
STRB r0,[r2,#Timer0LR] ; copies counter to output latch
......@@ -1810,7 +1810,7 @@ DoMicroDelay ROUT
; delay has expired
GRAB "r1,r2,pc"
Pull "r1,r2,pc"
;------------------------------------------------------------------------------
; ATAPI_LockUnlockIDE
......@@ -1837,7 +1837,7 @@ DoMicroDelay ROUT
ATAPI_LockUnlockIDE
STASH "r0-r6, r14"
Push "r0-r6, r14"
MySTRIM "e"
DisplayNewLine
......@@ -1882,11 +1882,11 @@ ALU_Loop
ALU_Error
SETV
STR r0, [ r13 ]
GRAB "r0-r6, pc"
Pull "r0-r6, pc"
ALU_ExitOK
CLRV
GRAB "r0-r6, pc"
Pull "r0-r6, pc"
......
......@@ -124,22 +124,22 @@ driver_handler_code ROUT
[ OUTPUT_ON=1
MySTRIM "Z"
STASH "r0, r14"
Push "r0, r14"
ADD r0, SWIN, # "A"
[ OUTPUT_TO_SCREEN<>0
SWI 0+(1:SHL:17) ; XOS_WriteC
|
SWI &a194a:OR:(1:SHL:17) ; XStream_WriteC
]
GRAB "r0, r14"
Pull "r0, r14"
; Display SWIN
DisplayNewLine
]
[ cdebug_debugging_all_ops
STASH "r0,r14"
Push "r0,r14"
ADD r0,r11,#"A"
SWI 1<<17
GRAB "r0,r14"
Pull "r0,r14"
]
;----------------------------------------------------------
; Branch to the correct piece of code to handle the command
......@@ -268,7 +268,7 @@ ReadData ROUT
CDebug_WriteS "ReadTOC...",cc
]
STASH "r1-r8"
Push "r1-r8"
MOV r0, # readdata + ATAPIOP__COMMAND_PACKET
MOV r1, # 12
......@@ -306,7 +306,7 @@ ReadData ROUT
02
]
GRAB "r1-r8"
Pull "r1-r8"
BVS error_handler
......@@ -406,7 +406,7 @@ RD_HowManyBlocks
; set bit 31 to indicate that retry in different mode has not been done
ORR r0,r0,#1<<31
STASH "r0,r8"
Push "r0,r8"
10
; r0 = expected mode 1,2,3
; r0 bit 31 => have not yet tried alternative mode
......@@ -451,7 +451,7 @@ RD_HowManyBlocks
MOV r8,#ATAPICONTROL__SEND_COMMAND
BL ATAPI_Control
[ cdebug
STASH "r1-r3"
Push "r1-r3"
SavePSR r2
LDR r1,inbytes
SUBS r1,r4,r1
......@@ -462,14 +462,14 @@ RD_HowManyBlocks
CDebug_StrReg8 " not transferred=",r1
00
RestPSR r2
GRAB "r1-r3"
Pull "r1-r3"
BLVS do_request_sense
]
BVS %F20 ; branch if error
; sector read OK
GRAB "r0,r8"
Pull "r0,r8"
; Do I need to copy bytes out from the 1 block loaded ?
; r8 = number of blocks
......@@ -500,7 +500,7 @@ RD_HowManyBlocks
BIC r14,r0,#(1:SHL:ZERRORFLAGS__SENSEKEY_SHIFT) - 1
TEQS r14,#TARGETERROR__ILLEGAL_REQUEST ; illegal request?
ADDNE sp,sp,#4 ; if no, discard stacked r0
GRAB "r8",NE ; ...restore r8
Pull "r8",NE ; ...restore r8
BNE error_handler ; ...and branch
; illegal request error