passport/src/standarddelivery.a
2021-04-20 01:10:23 -04:00

152 lines
3.6 KiB
Plaintext

; Standard Delivery bootloader
; https://github.com/peterferrie/standard-delivery/
; rev. a5b839d7d0fa21b0ff3a7776d9f6c9750b09ae10 of 2016-11-29
;-------------------------------
; ConstructStandardDelivery
; in: A = low byte of Standard Delivery parameter table (see below)
; X = high byte of Standard Delivery parameter table
; out: $1000..$10FF replaced with Standard Delivery bootloader
; all registers clobbered
; A,X clobbered
; Y preserved
;-------------------------------
ConstructStandardDelivery
dex
beq @construct32
dex
beq @construct32lo
dex
beq @constructrdos
@construct33p
lda #<SD_DOS33p
ldx #>SD_DOS33p
bne +
@construct32
lda #<SD_DOS32
ldx #>SD_DOS32
bne +
@construct32lo
lda #<SD_DOS32LO
ldx #>SD_DOS32LO
bne +
@constructrdos
lda #<SD_RDOS13
ldx #>SD_RDOS13
+ sta @A+1
stx @A+2
ldx #$00
txa
- sta $1000,x
inx
bne -
ldx #$4C
- lda @code,x
sta $1000,x
dex
bpl -
- inx
@A lda $FFFF,x
sta $104D,x
cmp #$C0
bne -
rts
@code
!byte $01,$a8,$ee,$06,$08,$ad,$4e,$08
!byte $c9,$c0,$f0,$40,$85,$27,$c8,$c0
!byte $10,$90,$09,$f0,$05,$20,$2f,$08
!byte $a8,$2c,$a0,$01,$84,$3d,$c8,$a5
!byte $27,$f0,$df,$8a,$4a,$4a,$4a,$4a
!byte $09,$c0,$48,$a9,$5b,$48,$60,$e6
!byte $41,$06,$40,$20,$37,$08,$18,$20
!byte $3c,$08,$e6,$40,$a5,$40,$29,$03
!byte $2a,$05,$2b,$a8,$b9,$80,$c0,$a9
!byte $30,$4c,$a8,$fc,$4c
;
; Format for Standard Delivery parameter table
;
; - word: entry point of next boot phase (Standard Delivery bootloader will JMP to this address)
; - byte array: high byte of target address of each sector, in the following order
; T00,S0E
; T00,S0D
; T00,S0C
; T00,S0B
; T00,S0A
; T00,S09
; T00,S08
; T00,S07
; T00,S06
; T00,S05
; T00,S04
; T00,S03
; T00,S02
; T00,S01
; T00,S0F
; T01,S00
; T01,S0E
; T01,S0D
; T01,S0C
; T01,S0B
; T01,S0A
; T01,S09
; T01,S08
; T01,S07
; T01,S06
; T01,S05
; T01,S04
; T01,S03
; T01,S02
; T01,S01
; T01,S0F
; &c. (all other tracks are the same order as track 1)
; - byte: $C0 (end of data)
;
; Unused sectors are marked as $00.
;
; Address array does NOT include T00,S00. This sector holds the Standard Delivery
; code and can not be reloaded at another address (unlike DOS 3.3).
SD_DOS33p
; exit via JMP $10B3
!byte $b3,$10
; track 0
!byte $1E,$1D,$1C,$1B,$00,$00,$00,$00,$00,$00,$13,$12,$11,$10,$1F
; track 1
!byte $20,$2E,$2D,$2C,$2B,$2A,$29,$28,$27,$26,$25,$24,$23,$22,$21,$2F
; track 2
!byte $30,$3E,$3D,$3C,$3B,$3A,$39,$38,$37,$36,$35,$34,$33,$32,$31,$3F
!byte $C0
SD_DOS32
; exit via JMP $B700
!byte $00,$B7
; track 0
!byte $00,$00,$00,$00,$00,$BF,$BE,$BD,$BC,$BB,$BA,$B9,$B8,$B7
!byte $C0
SD_DOS32LO
; exit via JMP $3700
!byte $00,$37
; track 0
!byte $00,$00,$1C,$1B,$00,$3F,$3E,$3D,$3C,$3B,$3A,$39,$38,$37,$00
; track 1
!byte $1D,$00,$00,$29,$28,$27,$26,$25,$24,$23,$22,$21,$20,$1F,$1E,$00
; track 2
!byte $2A,$00,$00,$00,$35,$34,$33,$32,$31,$30,$2F,$2E,$2D,$2C,$2B,$00
!byte $C0
SD_RDOS13
; exit via JMP $B300
!byte $00,$B3
; track 0
!byte $00,$00,$00,$BD,$BC,$BB,$BA,$B9,$B8,$B7,$B6,$B5,$B4,$B3
!byte $C0