Commit f7507077 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Tidy things up a bit

Detail:
  s/ScsiFs00, ScsiFs05, ScsiFs15, ScsiFs20, ScsiFs50 - Add comments for some of the different IDs which are used. Add MaxDriveNo constant, and make use of it where appropriate. Make BlockSizes non-braindead.
Admin:
  Cosmetic changes only, binary unchanged.


Version 1.29. Not tagged
parent a290d023
......@@ -193,6 +193,8 @@ OpMask * 2_1111 ;ops 0-15
DiscBits * 2_111 :SHL: (32-3) ;In all disc addresses
MaxDriveNo * 8 ; FileCore drive numbers 0-7
; CMOS allocation
^ ScsiFsCMOS
......@@ -335,12 +337,14 @@ LostUnitAtn bit 0
ASSERT MiscOp_PollChanged_EmptyWorks_Flag = bit6
ASSERT MiscOp_PollChanged_ChangedWorks_Flag = bit7
DevNo # 3
DevNo # 3 ; SCSI device ID
;HeadPosition # 4
;PositionUnknown * bit31
DrvSequenceNum # 4
SzDrvRec # 0
; $rdr = drive record ptr
; $rd = SCSI device ID
MACRO
$lab STDevNo $rd,$rdr,$rtemp,$c
ASSERT $rtemp<>$rdr
......@@ -352,6 +356,7 @@ $lab LDRB$c $rtemp,[$rdr,#DrvFlags]
;point Rptr to start of drive record Rindex, must preserve flags
; $Rindex = FileCore drive number
MACRO
$lab DrvRecPtr $Rptr,$Rindex,$cond
......@@ -384,9 +389,7 @@ ParkDiscAdd # 4
^ 0, SB
SCSIFSWorkBase # 0
Padding # 4 ;>>>RCM stop 'sbaddr R7, BlockSizes-4' in ScsiFs15 from failing
BlockSizes a4 4 ;log to base two of block size for device or 0 if not
;mounted yet
BlockSizes a4 MaxDriveNo ;log2 of block size for device or 0 if not mounted yet
[ :LNOT: BigDisc
MapSizes a4 4
]
......@@ -398,7 +401,7 @@ FC_Big * bit0
FC_NewErrors * bit1
]
[ AllowPartitions
PartitionBaseAdd a4 4*8
PartitionBaseAdd a4 4*MaxDriveNo
]
[ UseSpecialScatterBlk
ScatterFlag a4 4 ;Are we converting a save to use scatterblk ?
......@@ -425,7 +428,7 @@ Winnies # 1
[ FloppySupport:LOR:AutoDetect
Floppies # 1
# 2
DrvRecs # SzDrvRec*8
DrvRecs # SzDrvRec*MaxDriveNo
]
[ UseSpecialScatterBlk
......@@ -472,6 +475,19 @@ CTL_BACKGROUND EQU &01 :SHL: 29
;
CTL_cnvt EQU 21 ;Shift (left) factor
; mapDrvToDevLo:
; In:
; $rs = FileCore drive number
; $rdr = Drive record ptr (optional)
; Out:
; $rd = SCSI device ID
; mapDevToDrvLo:
; In:
; $rs = SCSI device ID
; Out:
; $rd = FileCore drive number, or MaxDriveNo if not found
[ AutoDetect
MACRO
$lab mapDrvToDevLo $rd, $rs, $rdr
......@@ -494,6 +510,7 @@ $lab BIC R1, R1, #&FF000000
BL MapDevToDrv
MEND
|
; Non-AutoDetect uses a fixed mapping of drives 4-7 to SCSI devices 0-3
MACRO
$lab mapDrvToDevLo $rd, $rs
[ fix_2
......
......@@ -413,6 +413,10 @@ WrDec ROUT
Pull "R0-R2,PC"
[ AutoDetect
; In:
; R1 = SCSI device ID
; Out:
; R1 = FileCore drive number, or MaxDriveNo if not found
MapDevToDrv ROUT
Push "R2,R3,LR"
MOV R2, #0
......@@ -420,7 +424,7 @@ MapDevToDrv ROUT
mapDrvToDevLo R3, R2
TEQ R3, R1
ADDNE R2, R2, #1
TEQNE R2, #8
TEQNE R2, #MaxDriveNo
BNE %BT01
MOV R1, R2
Pull "R2,R3,PC"
......@@ -470,7 +474,7 @@ ScanLoop
]
MOV R8, R1 ; check we've not already
BL MapDevToDrv ; spotted this drive
TEQ R1, #8
TEQ R1, #MaxDriveNo
MOV R1, R8
BNE ScanNext
[ AllowPartitions
......@@ -841,7 +845,7 @@ DoDetachedCallback
10 AND LR,R1,R2
TEQ LR,R0 ; if the device number fits the mask
BNE %FT80
MOV R3,#7 ; then loop over all drives
MOV R3,#MaxDriveNo-1 ; then loop over all drives
20
DrvRecPtr R5,R3
mapDrvToDevLo LR,R3,R5
......@@ -853,7 +857,7 @@ DoDetachedCallback
LDRB LR, [R5,#DrvFlags]
ORR LR, LR, #LostUnitAtn
STRB LR, [R5,#DrvFlags]
sbaddr R5, BlockSizes-4
sbaddr R5, BlockSizes
MOV LR, #0 ; blank the block size
STRB LR, [R5, R3]
Push "R0,R1,R8"
......
......@@ -84,7 +84,7 @@ LowLevelOp2 ;another internal entry point
10
]
sbaddr R7, BlockSizes-4 ; if not examined drive yet
sbaddr R7, BlockSizes ; if not examined drive yet
LDRB R8, [R7,R2, LSR #(32-3)]
CMPS R8, #0 ; V=0
......@@ -742,7 +742,7 @@ SCSIOp_HandlingAtn
Pull "R9,PC",NE
LDRB R2,[SP,#0] ; R2 = SCSI device of operation
MOV R1,#7 ; loop over 8 drives
MOV R1,#MaxDriveNo-1 ; loop over 8 drives
05
mapDrvToDevLo R0,R1
TEQ R0,R2 ; were we talking to this drive's device?
......
......@@ -104,7 +104,7 @@ DoMount ROUT
BEQ %FT05
; fudgery - Mount gets passed a byte address; we need to convert to the
; sector/block address that LowLevelOp expects.
sbaddr R7, BlockSizes-4 ; if not examined drive yet
sbaddr R7, BlockSizes ; if not examined drive yet
LDRB R8, [R7,R2, LSR #(32-3)]
CMPS R8, #0 ; V=0
......@@ -270,8 +270,8 @@ CheckSum ROUT
;do any initialisation required for drive including reading block size
;entry
; R2 drive (4 to 7) in top 3 bits
; R7 -> BlockSizes-4 (see ScsiFs15)
; R2 FileCore drive number in top 3 bits
; R7 -> BlockSizes
;exit
; R0, V set if error
......@@ -476,7 +476,7 @@ DoEject
;entry
; R1 drive 0..7
DoDriveStatus
CMP R1, #8
CMP R1, #MaxDriveNo
MOVHS R2, #2
MOVHS PC, LR
[ HotPlug
......@@ -514,7 +514,7 @@ DoDismount
ADD SP, SP, #(Dismount_end - Dismount_start)
sbaddr R2, BlockSizes-4 ; Zero the BlockSize table entry, to force
sbaddr R2, BlockSizes ; Zero the BlockSize table entry, to force
MOVVC R0, #0 ; an Examine and re-initialise of the
STRVCB R0, [R2,R1] ; ScsiDriver on next ScsiFs access
mapDrvToDevLo R1, R1 ; map drive onto device
......@@ -607,7 +607,7 @@ UnLockMedia
ADR R2, CDB_UnLockMedia
UnLocMed_10
AND R1, R1, #&FF ; Incase any high order bits are set
sbaddr R5, BlockSizes
sbaddr R5, BlockSizes+4 ; BUG - assumes non-AutoDetect drive mapping in use
MOV R4, #0
STRB R4, [R5,R1]
......
......@@ -62,6 +62,7 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
STRB R2, AttCBCount
STRB R2, DetCBCount
STRB R2, Dieing
ASSERT MaxDriveNo = 8
[ AllowPartitions
STR R2, PartitionBaseAdd+0
STR R2, PartitionBaseAdd+4
......@@ -84,8 +85,9 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
[ FloppySupport
MOV R2, #0
STR R2, Padding ; >>>>Init floppy BlockSizes
STR R2, BlockSizes ; Block (sector size) for ScsiFs::4..7
ASSERT MaxDriveNo = 8
STR R2, BlockSizes ; >>>>Init floppy BlockSizes
STR R2, BlockSizes+4 ; Block (sector size) for ScsiFs::4..7
ASSERT DrvFlags = 0
ASSERT DevNo = 1
......@@ -99,8 +101,9 @@ InitEntry ROUT ; NO REENTRANCY CHECK NEEDED
STMIA R0!, {R1,R2} ; 2
STMIA R0!, {R1,R2} ; 3
|
ASSERT MaxDriveNo = 8
MOV R0, #0
STR R0, BlockSizes
STR R0, BlockSizes+4
]
[ AutoDetect:LAND:{FALSE}
......@@ -218,7 +221,7 @@ DieEntry
MOVVS R9, R0
MOV R5, #0
sbaddr R7, BlockSizes-4
sbaddr R7, BlockSizes
01
[ HotPlug
MOV R0, #UpCall_DriveRemoved
......@@ -238,7 +241,7 @@ DieEntry
02
MOVVS R9, R0
ADD R5, R5, #1 ; Next drive
CMP R5, #8
CMP R5, #MaxDriveNo
BNE %BT01 ; Loop until no more drives
85
......@@ -343,7 +346,7 @@ ServiceEntry2
; a non-zero BlockSize entry
;
MOV R5, #0
sbaddr R4, BlockSizes-4
sbaddr R4, BlockSizes
101
LDRB LR, [R4, R5]
TST LR, #&FF
......@@ -352,11 +355,12 @@ ServiceEntry2
BL ReserveDevice
102
ADD R5, R5, #1 ; Next drive
CMP R5, #8
CMP R5, #MaxDriveNo
BNE %BT101 ; Loop until no more drives
|
ASSERT MaxDriveNo = 8
MOV R0, #0 ; Reservation lost over reset, force 'Examine'
STR R0, BlockSizes ; on next access
STR R0, BlockSizes+4 ; on next access
]
Pull "R0-R5,R8,PC"
......@@ -475,7 +479,7 @@ DoSWIPartitions ROUT
Push "R1,R2,LR"
TEQ R0, #0 ; set partition base
BNE %ft1
CMP R1, #7
CMP R1, #MaxDriveNo-1
Pull "R1,R2,PC", HI
ADD LR, SB, R1, LSL #2 ; word offset
STR R2, [LR, #:INDEX:PartitionBaseAdd-:INDEX:SCSIFSWorkBase] ; remember
......@@ -484,7 +488,7 @@ DoSWIPartitions ROUT
TEQ R0, #1 ; report icon used
Pull "R1,R2,PC",NE
Push "R3,R4"
MOV R2, #7
MOV R2, #MaxDriveNo-1
2
DrvRecPtr R4, R2
LDRB R3, [R4, #:INDEX:DevNo]
......
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