Commit f33177d5 authored by Ben Avison's avatar Ben Avison
Browse files

First stage of changes for RISC OS 5.

Detail:
  * Moved resources here from CDFSResources - allows tokenisation
  * Uses objasm, shared makefiles and global headers
  * 32-bit compatible
Admin:
  Not tested. Still IOC/IOMD-centric.

Version 1.28. Tagged as 'ATAPI-1_28'
parent 08ae23d0
......@@ -21,63 +21,15 @@
# ---- ---- -----------
# 07-Dec-94 AMcC Created.
# 03-Jan-95 AMcC Now exports hdr.ATAPI
# 06-Nov-02 BJGA Now uses shared makefiles
#
#
# Paths
#
EXP_HDR = <export$dir>
#
# Generic options:
#
MKDIR = cdir
AS = aasm
CP = copy
RM = remove
STRIP = stripdepnd
CFLAGS = -c -depend !Depend -IC:
AFLAGS = -depend !Depend -Stamp -quit -module
CPFLAGS = ~cfr~v
#
# Program specific options:
#
COMPONENT = ATAPI
EXPORTS = ${EXP_HDR}.ATAPI
SOURCE = s.Main
TARGET = rm.ATAPI
RDIR = Resources
LDIR = ${RDIR}.${LOCALE}
CDFSRES = <src$dir>.OS_Core.FileSys.CDFS.CDFSRes
RESDIR = ${CDFSRES}.Resources.${Locale}.Resources.CDFSDriver.${COMPONENT}
#
# Generic rules:
#
rom: ${TARGET}
@echo ${COMPONENT}: rom module built
export: ${EXPORTS}
@echo ${COMPONENT}: export complete
install_rom: ${TARGET}
${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom module installed
resources:
@echo ${COMPONENT}: Resources are in CDFSRes
clean:
${RM} ${TARGET}
${STRIP}
@echo ${COMPONENT}: cleaned
${TARGET}: ${SOURCE}
${AS} ${AFLAGS} -To $@ -From ${SOURCE}
COMPONENT = ATAPI
HEADER1 = ATAPI
RESFSDIR = ${RESDIR}.CDFSDriver.${TARGET}
ROM_SOURCE = Main.s
${EXP_HDR}.ATAPI: hdr.ATAPI
${CP} hdr.ATAPI $@ ${CPFLAGS}
include StdTools
include AAsmModule
# Dynamic dependencies:
......@@ -14,3 +14,4 @@
|
Dir <Obey$Dir>
amu_machine clean
stripdepnd
| Copyright 2002 Tematic Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine export
#{DictTokens}
NoDrive:No CD-ROM drive present
NotAud:Not audio
DrEmpty:CD-ROM drive empty
DLocked:CD-ROM drive drawer locked
BadMode:Data in wrong mode
SChNSup:Sub-channel not supported
NotAudT:Not an audio track
BadDisc:Compact disc is faulty
NotSupp:Drive does not support that
BadHandle:Bad handle
CantLock:Cannot lock IDE bus
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.68.
;
GBLS Module_MajorVersion
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
GBLS Module_ApplicationDate2
GBLS Module_ApplicationDate4
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.27"
Module_Version SETA 127
Module_MajorVersion SETS "1.28"
Module_Version SETA 128
Module_MinorVersion SETS ""
Module_Date SETS "06 Dec 2000"
Module_ApplicationDate2 SETS "06-Dec-00"
Module_ApplicationDate4 SETS "06-Dec-2000"
Module_Date SETS "07 Nov 2002"
Module_ApplicationDate SETS "07-Nov-02"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.27"
Module_HelpVersion SETS "1.27 (06 Dec 2000)"
Module_FullVersion SETS "1.28"
Module_HelpVersion SETS "1.28 (07 Nov 2002)"
END
/* (1.27)
/* (1.28)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 1.27
#define Module_MajorVersion_CMHG 1.28
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Dec 2000
#define Module_Date_CMHG 07 Nov 2002
#define Module_MajorVersion "1.27"
#define Module_Version 127
#define Module_MajorVersion "1.28"
#define Module_Version 128
#define Module_MinorVersion ""
#define Module_Date "06 Dec 2000"
#define Module_Date "07 Nov 2002"
#define Module_ApplicationDate2 "06-Dec-00"
#define Module_ApplicationDate4 "06-Dec-2000"
#define Module_ApplicationDate "07-Nov-02"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.27"
#define Module_HelpVersion "1.27 (06 Dec 2000)"
#define Module_FullVersion "1.28"
#define Module_HelpVersion "1.28 (07 Nov 2002)"
#define Module_LibraryVersionInfo "1:28"
......@@ -58,10 +58,6 @@ IOMD__IDE_INTERRUPT_BIT * 1:SHL:1
TASKFILE_BASE_ADDRESS * &30107C0
IOC * &3200000
Timer0CL * &40
Timer0LR * &4c
; Task file registers when read from
TASKFILE__R_DATA * &0000 ; The lower 16 bits are used when reading
......
This diff is collapsed.
; Copyright 2002 Tematic Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
;******************************************************************************
;
; hdr.macros
;
; Author: Mark Watson (EESOX)
;
; Description
; ===========
; Macro definitions.
;
; =============================================
; Macros should be kept in ALPHABETICAL order !
; =============================================
; **********************************************************
; **********************************************************
; This macro will display the contents of a register in hex
; Only 8 digits are displayed
; **********************************************************
; **********************************************************
MACRO
$label Display $reg
[ $reg <= r1
! 0,"Cannot use r0 - r1 in Display macro !"
]
$label [ OUTPUT_ON=1
STASH "r0 - r1, r14"
MOV r1, # 8 ; altering this figure affects the number of
01 MOV $reg, $reg, ROR #28 ; characters displayed
AND r0, $reg, #15
SUBS r0, r0, # 10
ADDLT r0, r0, # "0" + 10
ADDGE r0, r0, # "a"
[ OUTPUT_TO_SCREEN<>0
SWI 0+(1:SHL:17) ; XOS_WriteC
|
SWI &a194a:OR:(1:SHL:17) ; XStream_WriteC
]
SUBS r1, r1, #1
BNE %BT01
GRAB "r0 - r1, r14"
]
MEND
; **********************************************************
; **********************************************************
; This macro will display the contents of a register in hex
; Only 8 digits are displayed FORCED TO SCREEN
; **********************************************************
; **********************************************************
MACRO
$label DisplayTS $reg
[ $reg <= r1
! 0,"Cannot use r0 - r1 in Display macro !"
]
STASH "r0 - r1, r14"
MOV r1, # 8 ; altering this figure affects the number of
01 MOV $reg, $reg, ROR #28 ; characters displayed
AND r0, $reg, #15
SUBS r0, r0, # 10
ADDLT r0, r0, # "0" + 10
ADDGE r0, r0, # "a"
SWI 0+(1:SHL:17) ; XOS_WriteC
SUBS r1, r1, #1
BNE %BT01
GRAB "r0 - r1, r14"
MEND
; **********************************************************
; **********************************************************
MACRO
$label DisplayNewLine
$label [ OUTPUT_ON=1
STASH r14
[ OUTPUT_TO_SCREEN<>0
SWI XOS_NewLine
|
SWI &a194e:OR:(1:SHL:17) ; SYS "Stream_NewLine"
]
GRAB r14
]
MEND
; ********************************************
; *** Macro for returning from the drive ***
; ********************************************
MACRO
$label MACRO__ENTER_DRIVER
$label STASH "r0-r8, r14"
MEND
; ********************************************
; *** Macro for returning from the drive ***
; ********************************************
MACRO
$label MACRO__EXIT_DRIVER_OK $cc
$label GRAB "r0-r8, pc", "$cc"
MEND
; ********************************************
; *** Macro for returning from the drive ***
; ********************************************
MACRO
$label MACRO__EXIT_DRIVER_WITH_R0 $cc, $noexit
$label ADD$cc r13, r13, #4
[ "$noexit"=""
GRAB "r1-r8, pc", "$cc"
|
GRAB "r1-r8, r14", "$cc"
]
MEND
; *******************************
; *** String immediate out. ***
; *******************************
MACRO
$label MySTRIM $string
$label [ OUTPUT_ON=1
STASH r14
[ OUTPUT_TO_SCREEN<>0
SWI XOS_WriteS
|
SWI &a194b:OR:(1:SHL:17)
]
DCB "$string", 0
ALIGN
GRAB r14
]
MEND
; *************************************************************************
; *** Declare string with the order of every other pair of characters ***
; *** swapped i.e. ABCD -> BADC ***
; *************************************************************************
MACRO
$lab SwapBytes $str
LCLS s
LCLA i
LCLA j
i SETA :LEN:"$str"
j SETA 1
WHILE i > 1
s SETS "$s":CC:(("$str":LEFT:(j+1)):RIGHT:1)
s SETS "$s":CC:(("$str":LEFT:j):RIGHT:1)
j SETA j + 2
i SETA i - 2
WEND
[ i > 0
s SETS "$s":CC:(("$str":LEFT:j):RIGHT:1)
]
$lab DCB "$s"
MEND
END
......@@ -309,27 +309,7 @@ cdebug_debugging_all_ops SETL {FALSE}
; Define registers etc.for general use
;***************************************************************************
r14 RN 14
r13 RN 13
sp RN 13
SP RN 13
r12 RN 12 ; This register is linked to the variables in w/s
r11 RN 11 ; NEVER CHANGE R11 in the driver
SWIN RN 11
r10 RN 10
r9 RN 9
r8 RN 8
r7 RN 7
r6 RN 6
r5 RN 5
r4 RN 4
r3 RN 3
r2 RN 2
r1 RN 1
r0 RN 0
SVC_mode * 3
;***************************************************************************
; Debugging options
......@@ -350,11 +330,6 @@ XATAPI_BaseNumber * ATAPI_BaseNumber:OR:X_bit
^ XATAPI_BaseNumber
XATAPI_GetDrives # 1
XOS_Word * 7:OR:X_bit
[ faster_startup
XOS_Byte * 6:OR:X_bit
]
;*************** CD driver SWI numbers *******************
XCD_BaseNumber * (&41240:OR:X_bit)
......@@ -581,40 +556,8 @@ DefaultInternalRetryCount * 1600
;***************************** SWI Numbers ******************************
XSCSI_Command * &403C0:OR:bit17 ; For OAK SCSI
XSCSI_Op * &403C3:OR:bit17
XSCSI_Control * &403C2:OR:bit17
XSCSI_Initialise * &403C1:OR:bit17
XPodule_ReadHeader * &40281:OR:bit17
ADFS_LockIDE * &40251
XADFS_LockIDE * ADFS_LockIDE:OR:bit17 ; ADFS 2.97 onwards
XOS_ConvertCardinal2 * &D6
XOS_ConvertCardinal3 * &D7
XOS_ConvertCardinal4 * &D8
XOS_ReadSysInfo * &58:OR:bit17
XOS_AddCallBack * &54:OR:bit17
XOS_PrettyPrint * &44:OR:bit17
XOS_ReadMonotonicTime * &42:OR:bit17
XOS_SWINumberFromString * &39:OR:bit17
OS_GenerateError * &2b ; don't use X version 'cause it doesn't do anything
XOS_Release * &20:OR:bit17
XOS_Claim * &1f:OR:bit17
XOS_Module * &1E:OR:bit17
XOS_NewLine * &3:OR:bit17
XOS_Write0 * &2:OR:bit17
XOS_WriteS * &1:OR:bit17
XOS_WriteC * &0:OR:bit17
XMessageTrans_OpenFile * &41501:OR:bit17
XMessageTrans_ErrorLookup * &41506:OR:bit17
XMessageTrans_CloseFile * &41504:OR:bit17
;***************************** Values for SCSI_Op ************************
I_bit * 1:ROL:27
FIRQ_Flag * 1:ROL:26
IRQ_Flag * 1:ROL:27
Overflow_Flag * 1:ROL:28
Carry_Flag * 1:ROL:29
Zero_Flag * 1:ROL:30
......
......@@ -152,8 +152,7 @@ ATAPI_Control ROUT
MOV r0,#1 ; lock, not unlock
BL ATAPI_LockUnlockIDE
ADDVS sp,sp,#4 ; if error, discard stacked r0...
GRAB "r14",VS ; ...get link
ORRVSS pc,r14,#Overflow_Flag ; and return error (other flags preserved)
GRAB "pc",VS ; and return error
; managed to lock IDE registers
......@@ -178,7 +177,8 @@ ATAPIC_UnknownReason
MOV r0,#DRIVERERROR__UNKNOWN_REASON
MOV r1,#0
ORRS pc,r14,#Overflow_Flag
SETV
MOV pc,r14
;;;;;;;;;;;;;;;;;
......@@ -187,16 +187,18 @@ ATAPIC_UnknownReason
; unlock IDE registers
; original r14 on stack
LDR r14,[sp] ; get original r14
ORRVS r14,r14,#Overflow_Flag ; set V in r14 if error
BICVC r14,r14,#Overflow_Flag ; ...clear it otherwise
STR r14,[sp] ; overwrite stacked r14
BVS %FT91
STASH "r0" ; save return code
MOV r0,#0 ; unlock, not lock
BL ATAPI_LockUnlockIDE
GRAB "r0,pc",,^ ; return with flags
CLRV
GRAB "r0,pc" ; return
91
STASH "r0" ; save return code
MOV r0,#0 ; unlock, not lock
BL ATAPI_LockUnlockIDE
SETV
GRAB "r0,pc" ; return
;------------------------------------------------------------------------------
; ATAPI_Op
......@@ -792,11 +794,11 @@ ACOD_ExitOK
; Get the status and sensekey bytes
CLRV
LDR r1,TBA
LDRB r3,[r1,#TASKFILE__R_ALTERNATE_STATUS]
TSTS r3,#STATUSFLAGS__CHECK
GRAB "r0-r10,r14",EQ ; exit if no error
BICEQS pc,r14,#Overflow_Flag
GRAB "r0-r10,pc",EQ ; exit VC if no error
; error
......@@ -906,10 +908,9 @@ change_of_disc
ACOD_DiscNotChanged
STR r0,[r13,#0*4] ; overwrite stacked r0
GRAB "r0-r10,r14"
ORRS pc,r14,#Overflow_Flag
SETV
ADD r13, r13, #4
GRAB "r1-r10,pc"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
......@@ -1000,8 +1001,8 @@ WaitForIRQ ROUT
; no IRQ before timeout
LDMFD sp!,{r14}
BICS pc,r14,#Zero_Flag ; return NE
CMP pc, #0
LDMFD sp!,{pc} ; return NE
;;;;;;;;;;;;;;;;;
22
......@@ -1030,20 +1031,22 @@ WaitForIRQ ROUT
]
; drive did not deassert IRQ before timeout
LDMFD sp!,{r14}
BICS pc,r14,#Zero_Flag ; return NE
CMP pc, #0
LDMFD sp!,{pc} ; return NE
;;;;;;;;;;;;;;;;;
27
; IRQ cleared - wait for !BSY
LDRB r0,[r1,#TASKFILE__R_ALTERNATE_STATUS]
TSTS r0,#STATUSFLAGS__BSY
BNE %FT28
[ extra_delay_after_irq
MOVEQ r0,#1*2 ; if !BSY, wait > 400ns for other...
BLEQ DoMicroDelay ; ...status bits to become valid...
MOV r0,#1*2 ; if !BSY, wait > 400ns for other...
BL DoMicroDelay ; ...status bits to become valid...
]
LDMEQFD sp!,{pc} ; ...and return EQ
SWI XOS_ReadMonotonicTime
CMP r0, r0
LDMFD sp!,{pc} ; ...and return EQ
28 SWI XOS_ReadMonotonicTime
CMPS r0,r5 ; time to quit?
BLO %B27 ; branch if no
......@@ -1052,8 +1055,8 @@ WaitForIRQ ROUT
]
; drive did not clear BSY after IRQ
LDMFD sp!,{r14}
BICS pc,r14,#Zero_Flag ; return NE
CMP pc, #0
LDMFD sp!,{pc} ; return NE
;------------------------------------------------------------------------------
......@@ -1091,8 +1094,7 @@ ATAPI_Reset ROUT
BNE %F10
BL Extras_ConvertControlBlockToDrive
GRAB "r0-r2,r14",VS ; return error if bad drive
ORRVSS pc,r14,#Overflow_Flag
GRAB "r0-r2,pc",VS ; return error if bad drive
10
; drive bit in r0
; select drive, ignoring BSY status
......@@ -1130,8 +1132,8 @@ ATAPI_Reset ROUT
; either: drive is not busy or we've waited too long
; return OK
GRAB "r0-r2,r14"
BICS pc,r14,#Overflow_Flag
CLRV
GRAB "r0-r2,pc"
;------------------------------------------------------------------------------
......@@ -1193,8 +1195,8 @@ ATAPI_CheckForDrive ROUT
[ cdebug
CDebug_WriteS "Drive busy (1)"
]
GRAB "r0-r2,r5,r14"
ORRS pc,r14,#Overflow_Flag ; return VS
SETV
GRAB "r0-r2,r5,pc"
;;;;;;;;;;;;;;;;;
08
......@@ -1228,8 +1230,8 @@ ATAPI_CheckForDrive ROUT
[ cdebug
CDebug_WriteS "Drive busy (2)"
]
GRAB "r0-r2,r5,r14"
ORRS pc,r14,#Overflow_Flag ; return VS
SETV
GRAB "r0-r2,r5,pc"
;;;;;;;;;;;;;;;;;
......@@ -1252,7 +1254,7 @@ ATAPI_CheckForDrive ROUT
]
BNE %F35 ; ...skip to IDENTIFY
LDRB r0,[r1,#TASKFILE__W_BYTE_COUNT_LOW]
TEQS r0,#ATAPI_Signature :AND: &FF
CMPS r0,#ATAPI_Signature :AND: &FF
LDREQB r14,[r1,#TASKFILE__W_BYTE_COUNT_HIGH]
TEQEQS r14,#ATAPI_Signature >> 8
[ cdebug
......@@ -1260,8 +1262,7 @@ ATAPI_CheckForDrive ROUT
CDebug_WriteS "Signature found (1)"
00
]
GRAB "r0-r2,r5,r14",EQ ; if signature found
BICEQS pc,r14,#Overflow_Flag ; ...return VC
GRAB "r0-r2,r5,pc",EQ ; if signature found, return VC
[ cdebug
CDebug_StrReg2 "Signature not found (1): ",r14,cc
......@@ -1310,8 +1311,8 @@ ATAPI_CheckForDrive ROUT
[ cdebug
CDebug_WriteS "Drive busy (3)"