passport/src/sectormap.a

149 lines
3.4 KiB
Plaintext
Executable File

;-------------------------------
; Passport maintains a table of codes for each sector on the disk.
; One byte per sector, arranged in increasing logical sector order
; from T00,S00 to T22,S0F. Some sectors have their own individual
; labels for convenience, but you can use math to find any specific
; sector.
; e.g.
; LDA #kSectorOptional
; STA T00S0A
; will mark T00,S0A as optional
;
; LDA #kSectorOptional
; LDY #$0A
; STA T00,Y
; will also mark T00,S0A as optional
;
; The sector map is reset for each disk (to #kSectorRequired for
; all sectors), then modified based on boot sector identification
; and other factors.
;
; Codes are opaque values, not bit flags.
; Some codes are grouped into ranges that are compared as integers.
; Always use labels for comparison.
;
kSectorIgnore = $00 ; ignore this sector (don't even read it)
kSectorOptional = $01 ; sector is optional (read, but errors are non-fatal)
kSectorSwitchToBuiltinRWTS = $FE ; sector is required, and switch to built-in RWTS before reading it
kSectorRequired = $FF ; sector is required (errors are fatal)
; range of codes that trigger various custom routines before reading a sector
kSectorCustomFirst = $C0
kSectorCustomLast = $D0
; specific codes
kSectorResetAdaptiveRWTS = $C0 ; will accept any epilogue on next sector, then remember it
kSectorIgnoreAddressChecksum = $C1 ; will ignore address field checksum
kSectorCustomDOS32B4BB = $C2 ; DOS 3.2 / JMP B4BB RWTS swapper
kSectorCustomEarthware = $C3 ; Earthware reverse RWTS swapper
;-------------------------------
InitSectorMapWithIgnore
lda #kSectorOptional
!byte $2C
InitSectorMap
lda #kSectorRequired
ldx #<sectormap
stx @B+1
ldx #>sectormap
stx @B+2
ldx #$22
@A ldy #$0F
@B sta $FFFF
inc @B+1
bne +
inc @B+2
+ dey
bpl @B
dex
bpl @A
rts
sectormap = $CD0
T00 = sectormap
T00S00 = T00
T00S08 = T00 + $08
T00S09 = T00 + $09
T00S0A = T00 + $0A
T00S0B = T00 + $0B
T00S0C = T00 + $0C
T00S0D = T00 + $0D
T00S0E = T00 + $0E
T00S0F = T00 + $0F
T01 = T00 + $10
T01S0F = T01 + $0F
T02 = T01 + $10
T02S04 = T02 + $04
T02S05 = T02 + $05
T02S07 = T02 + $07
T02S0A = T02 + $0A
T02S0C = T02 + $0C
T02S0F = T02 + $0F
T03 = T02 + $10
T04 = T03 + $10
T05 = T04 + $10
T06 = T05 + $10
T07 = T06 + $10
T08 = T07 + $10
T09 = T08 + $10
T0A = T09 + $10
T0B = T0A + $10
T0C = T0B + $10
T0D = T0C + $10
T0E = T0D + $10
T0F = T0E + $10
T10 = T0F + $10
T11 = T10 + $10
T11S0F = T11 + $0F
T12 = T11 + $10
T13 = T12 + $10
T14 = T13 + $10
T14S06 = T14 + $06
T15 = T14 + $10
T16 = T15 + $10
T17 = T16 + $10
T18 = T17 + $10
T19 = T18 + $10
T1A = T19 + $10
T1B = T1A + $10
T1C = T1B + $10
T1D = T1C + $10
T1E = T1D + $10
T1F = T1E + $10
T20 = T1F + $10
T21 = T20 + $10
T22 = T21 + $10
T22S0F = T22 + $0F