passport/src/patchers/t00_dos32.a
2021-06-21 11:57:02 -04:00

65 lines
1.7 KiB
Plaintext

;-------------------------------
; #DOS32
; construct new bootloader and RWTS for converted DOS 3.2 disks
;-------------------------------
!zone {
lda gIsDOS32
bne .exit
lda gIsRDOS13
beq .exit
; sector 1
lda jCallRWTS+2
sta .cr+1
sec
sbc #$06 ; #$B7 or #$37
ldx #$11 ; #BASEPAGE+1
ldy #$01
jsr CopyMemory
; sectors 2-9
lda #$12 ; #BASEPAGE+2
jsr CopyUniversalAnywhere
lda #$38
sta $1656 ; #BASEPAGE+6
jsr PrintByID
!byte s_rwtswrite
; If original disk loads boot1 into $B700, Standard Delivery only needs to
; load boot1+RWTS (into $B700..$BFFF) and transfer control to boot1 at $B700.
;
; If original disk loads boot1 into $3700 (and expects the RWTS at $3800),
; we let Standard Delivery load boot1+RWTS+DOS and patch boot1 here so it
; doesn't try to call the RWTS itself. Boot1 will exit via the standard
; relocation routine at $1B03, after which both RWTS and DOS will be
; in higher memory. This will fail horribly if the relocation routine decides
; not to relocate (on old Apple II machines with less than 48K), and I have
; made peace with that.
lda #$01
ldx #$38
jsr compare3
!byte $20,$93,$37
bcs + ; passport-test-suite/Bellhop.woz [C=0] matches
jsr modify1
!byte $2C
+
; sector 0
ldx #ID_DOS32LO
.cr lda #$d1 ; set at runtime
cmp #$3D
beq +
ldx #ID_DOS32
+ jsr ConstructStandardDelivery
jsr PrintByID
!byte s_bootwrite
inc gPatchCount
.exit
}