passport/src/id/trace33p.a

238 lines
5.8 KiB
Plaintext
Raw Permalink Normal View History

2017-01-08 03:35:35 +00:00
; "Special Delivery" boot tracer
; for DOS 3.3P disks
; e.g. Ernie's Quiz, Elite
2017-08-15 15:31:36 +00:00
2017-01-08 03:35:35 +00:00
;-------------------------------
; IDSpecDel
2021-06-19 23:42:56 +00:00
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
2021-06-20 04:18:55 +00:00
; X = 0
2021-06-19 23:42:56 +00:00
; out: C clear if Special Delivery bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
2017-01-08 03:35:35 +00:00
;-------------------------------
2021-06-19 14:54:56 +00:00
!macro IDSpecDel {
ldy #$08
2017-01-08 03:35:35 +00:00
jsr compare
2021-06-19 14:54:56 +00:00
!byte $02
!byte $90,$4A
!byte $C6,$27
!byte $BD,$31,$09
; passport-test-suite/Ernie's Quiz.woz [C=0] matches
}
2017-01-08 03:35:35 +00:00
;-------------------------------
; TraceSpecDel
; set up boot trace to capture the bootloader and DOS
; of "Special Delivery" disks (stored in non-sector
; format on tracks 0-2)
;-------------------------------
TraceSpecDel
ldx #$0F
lda #$FF
- sta precheck_sectors, x
dex
bpl -
inc precheck_sectors
lda #$07
inc precheck_sectors+1
jsr PreCheckT00
2017-01-08 03:35:35 +00:00
jsr ClearTSBuffer
lda #$00 ; set a marker to see if entire
sta $3FFF ; RWTS loads successfully later
2019-04-16 05:39:12 +00:00
;; lda #$00 ; save zero page before trace
2017-01-08 03:35:35 +00:00
ldx #$0A
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2017-01-08 03:35:35 +00:00
jsr MoveT00PakHigh
2017-01-08 03:35:35 +00:00
lda #<TraceSpecDel2
ldx #>TraceSpecDel2
jmp Trace
TraceSpecDel2
lda #$4C
sta $0855
lda #<TraceSpecDel3
sta $0856
lda #>TraceSpecDel3
sta $0857
lda #$02
sec
jmp $0801
TraceSpecDel3
lda $1212
cmp #$D8
sec
2017-01-08 03:35:35 +00:00
bne SDfail
2019-05-05 15:08:45 +00:00
ldy #$00
lda $10D1
cmp #$A2
2019-05-07 01:24:29 +00:00
beq + ; passport-test-suite/Ernie's Quiz.woz [Z=1] matches
ldy #$04 ; passport-test-suite/Kaves of Karkhan.woz [Z=0] matches
2019-05-05 15:08:45 +00:00
+ lda #$4C
sta $10D1,Y
sta $10EC,Y
2017-01-08 03:35:35 +00:00
lda #<TraceSpecDel4
2019-05-05 15:08:45 +00:00
sta $10D2,Y
sta $10ED,Y
2017-01-08 03:35:35 +00:00
lda #>TraceSpecDel4
2019-05-05 15:08:45 +00:00
sta $10D3,Y
sta $10EE,Y
2017-01-08 03:35:35 +00:00
jmp $1212
TraceSpecDel4
lda $C0E8 ; turn off source drive
lda $3FFF
cmp #$EA
sec
2017-01-08 03:35:35 +00:00
bne SDfail
lda #$0B
ldx #$00
2021-06-21 15:57:02 +00:00
jsr compare3 ; if $1B00 ==
2017-01-08 03:35:35 +00:00
!byte $4C,$4D,$2A
SDfail
php
lda #$0A ; restore zero page from before trace
ldx #$00
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
plp
bcc SDsuccess
2017-01-08 03:35:35 +00:00
jmp UseUniversal
SDsuccess
;
; Restore the original code in memory before writing.
;
2019-05-05 15:08:45 +00:00
ldy #$00
lda $10D1
cmp #$4C
beq +
ldy #$04
+ lda #$A2
sta $10D1,Y
2017-01-08 03:35:35 +00:00
lda #$FF
2019-05-05 15:08:45 +00:00
sta $10D2,Y
2017-01-08 03:35:35 +00:00
lda #$9A
2019-05-05 15:08:45 +00:00
sta $10D3,Y
2017-01-08 03:35:35 +00:00
lda #$A5
2019-05-05 15:08:45 +00:00
sta $10EC,Y
2017-01-08 03:35:35 +00:00
lda #$2B
2019-05-05 15:08:45 +00:00
sta $10ED,Y
2017-01-08 03:35:35 +00:00
lda #$4A
2019-05-05 15:08:45 +00:00
sta $10EE,Y
2017-01-08 03:35:35 +00:00
;
; move $1000-$13FF to $1100-$14FF to align it as we need it
; for writing to disk with the Standard Delivery bootloader
; in T00,S00
;
lda #$13
ldx #$14
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2017-01-08 03:35:35 +00:00
lda #$12
ldx #$13
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2017-01-08 03:35:35 +00:00
lda #$11
ldx #$12
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2017-01-08 03:35:35 +00:00
lda #$10
ldx #$11
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2017-01-08 03:35:35 +00:00
; $1B00-$1FFF is real code and in the right place
; but we should clear the rest of T00 so we're not
; writing garbage to disk on unused sectors
lda #$15
ldx #$00
ldy #$06
jsr ClearMemory
; copy Standard Delivery bootloader into place for T00,S00
ldx #ID_DOS33p
2017-08-15 15:31:36 +00:00
jsr ConstructStandardDelivery
2019-04-08 15:36:01 +00:00
; maybe say we're writing a bootloader
bit gMode ; don't say we're writing a bootloader in verify-only mode,
bpl + ; that's scary
jsr PrintByID
!byte s_bootwrite
2019-04-08 15:36:01 +00:00
+
2017-01-08 03:35:35 +00:00
; now manually write out track 0 with Standard Delivery
; bootloader
jsr IncProgress
lda #$00
sta gTrack
2019-04-08 15:36:01 +00:00
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
2017-01-08 03:35:35 +00:00
; manually write out track 1
jsr IncProgress
inc gTrack
2019-04-16 05:39:12 +00:00
lda #$10
tax
tay
asl
2017-01-08 03:35:35 +00:00
jsr CopyMemory
2019-04-08 15:36:01 +00:00
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
2017-01-08 03:35:35 +00:00
; manually write out track 2 with a patched RWTS
jsr IncProgress
inc gTrack
lda #$30
ldx #$10
ldy #$10
jsr CopyMemory
lda #$08
ldx #$B6
ldy #$04
jsr modify
!byte $C9,$AD,$90,$E5
lda #$18
ldx #$38
2021-06-21 15:24:21 +00:00
jsr CopyMemory1
2019-04-08 15:36:01 +00:00
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
2017-01-08 03:35:35 +00:00
lda #$C9
sta $38B6
lda #$AD
sta $38B7
lda #$90
sta $38B8
lda #$E5
sta $38B9
; mark tracks 0-2 as "skip" in sector map
ldy #$2F
lda #kSectorIgnore
2017-01-08 03:35:35 +00:00
skipsectors
sta T00,y
dey
bpl skipsectors
; set up RWTS entry point
lda #$D5
sta jCallRWTS+1
2017-01-08 03:35:35 +00:00
lda #$36
sta jCallRWTS+2
2017-01-08 03:35:35 +00:00
; read the rest of the disk with the original RWTS
lda #$03
sta gLastTrack
jmp ADStyle