Print volume name on DOS 3.3, Diversi-DOS, and Pronto-DOS disks

This commit is contained in:
4am 2017-12-12 19:21:15 -05:00
parent d7e83af2bf
commit f7693d117d
6 changed files with 124 additions and 6 deletions

@ -130,6 +130,10 @@ FIRSTFILTER
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gCapturedDiskVolumeNumber
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in patchers/t11diskvol.a after reading T11,S00
;gIsRWTS
!byte FALSE ; 0=true, 1=false
; reset before each operation
@ -152,6 +156,11 @@ FIRSTFILTER
; set in IDBootloader() after reading T00,S00
LASTFILTER
;gDiskVolumeNumber
!byte 00 ; int
; disk volume number from address field of T11,S00
; only valid if gCapturedDiskVolumeNumber is TRUE
; never explicitly reset to any default value
;gLastTrack
!byte 00 ; int
; the last track that we should try to read

@ -54,14 +54,15 @@ gTriedUniv = gPatchCount-$01 ; byte
gSaidWriting = gTriedUniv-$01 ; byte
gChangedPrefs = gSaidWriting-$01 ; byte
gLastTrack = gChangedPrefs-$01 ; byte
gDiskVolumeNumber = gLastTrack-$01 ; byte
;FIRSTFILTER ; add new gIs* below this line
gIsDOS32 = gLastTrack-$01 ; byte
gIsDOS32 = gDiskVolumeNumber-$01 ; byte
gIsBoot0 = gIsDOS32-$01 ; byte
gIsBoot1 = gIsBoot0-$01 ; byte
gIsMaster = gIsBoot1-$01 ; byte
gIsRWTS = gIsMaster-$01 ; byte
gIsProDOS = gIsRWTS-$01 ; byte
gCapturedDiskVolumeNumber = gIsRWTS-$01 ; byte
gIsProDOS = gCapturedDiskVolumeNumber-$01 ; byte
gIsDinkeyDOS = gIsProDOS-$01 ; byte
gIsPascal = gIsDinkeyDOS-$01 ; byte
gIsProtDOS = gIsPascal-$01 ; byte
@ -123,6 +124,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gIsBoot1=",gIsBoot1
!warn "gIsMaster=",gIsMaster
!warn "gIsRWTS=",gIsRWTS
!warn "gCapturedDiskVolumeNumber=",gCapturedDiskVolumeNumber
!warn "gIsProDOS=",gIsProDOS
!warn "gIsDinkeyDOS=",gIsDinkeyDOS
!warn "gIsPascal=",gIsPascal

@ -691,8 +691,8 @@ ChangeSector
; Looks at buffer in memory to detect known
; copy protections and disable/revert/modify them
; to work on standard disks.
; Prints through COUT as it finds and makes
; modifications in memory only.
; Prints through COUT
; Makes modifications in memory only.
; in: $BASEPAGE page contains one track worth of data
; out: if C set, no known protections were found and
; no modifications were made
@ -736,6 +736,8 @@ _applyToAll
!source "patchers/dos32muse.a" ; T01 && gIsDOS32 only
!source "patchers/sra.a" ; gIsDOS32 or gIsRWTS only
!source "patchers/sierra13.a" ; gIsDOS32 only
!source "patchers/t11diskvol.a" ; T11 && gIsRWTS only
!source "patchers/t02volumename.a" ; T02 && gIsBoot0 only
lda gPatchCount
beq .nopatches

@ -0,0 +1,81 @@
;-------------------------------
; #T02VOLUMENAME
; print disk volume name and number after reading track 2
;-------------------------------
!zone {
lda gTrack
cmp #$02
bne .exit
lda gIsBoot0
bne .exit
lda #$00 ; look for volume name on T02,S00 (Pronto-DOS)
jsr .findVolumeName
bcc +
lda #$02 ; also look on T02,S02 (DOS 3.3, Diversi-DOS)
jsr .findVolumeName
bcs .exit
;
; We've found what looks like a DOS 3.3-ish disk volume name, so print it
;
+ sta gDisplayBytes
adc #BASEPAGE ; carry is guaranteed to be clear here
sta .a+2
lda #s_volumename
jsr PrintByID
ldy #$0B
.a lda $d1AF,Y ; high byte set at runtime (low byte is constant)
ora #$80
jsr PrintA
dey
bpl .a
lda gCapturedDiskVolumeNumber
bne .exitwithCR
;
; We captured a disk volume number earlier (probably on track $11), so print that too
; (This hex-to-decimal routine was lifted from DOS 3.3 @ $AE42)
;
lda gDiskVolumeNumber
sta cmp1
lda #$FF
sta cmp2
ldy #$02
.loop1 lda #$00
pha
.loop2 lda cmp1
cmp .digits,y
bcc +
sbc .digits,y
sta cmp1
lda cmp2
sbc #$00
sta cmp2
pla
adc #$00
pha
jmp .loop2
+ pla
ora #$B0
jsr PrintA
dey
bpl .loop1
bmi .exitwithCR ; always branches
.digits
!byte $01,$0A,$64
.findVolumeName
ldx #$A7
ldy #$08
jsr compare
!byte $D4,$C9,$C1,$C2,$D3,$D2,$C1,$C2
rts
.exitwithCR
lda #$8D
jsr PrintA
.exit
}

24
src/patchers/t11diskvol.a Normal file

@ -0,0 +1,24 @@
;-------------------------------
; #T11DISKVOL
; capture disk volume number after reading T11,S00
;-------------------------------
!zone {
lda gTrack
cmp #$11
bne .exit
lda gTriedUniv
beq .exit
lda jCallRWTS+2; #$3D or #$BD
sec
sbc #$04 ; #$39 or #$B9
ldx #$80
ldy #$03
jsr CompareMemory
!byte $99,$2C,$00; STA $002C,Y
bcs .exit
lda $2F ; disk volume number of last sector read
sta gDiskVolumeNumber
lda #TRUE
sta gCapturedDiskVolumeNumber
.exit
}

@ -137,7 +137,7 @@ StringTable
; can be set directly before calling PrintByID.
;
.header
!text "Passport by 4am 2017-12-11",$00
!text "Passport by 4am 2017-12-12",$00
.mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " "