cut some bytes

This commit is contained in:
Peter Ferrie 2019-04-15 22:39:12 -07:00
parent 3601c5be62
commit 4e2ddef1d7
31 changed files with 240 additions and 329 deletions

View File

@ -7,7 +7,8 @@
SkipTrack
; don't look for whole-track protections on track 0, that's silly
lda gTrack
beq .donotskip
sec
beq .linknoskip
;
; Electronic Arts protection track?
;
@ -24,6 +25,7 @@ SkipTrack
; Unformatted track?
;
jsr IsUnformatted
.linknoskip
bcs .donotskip
;
; $F7F6EFEAAB protection track?
@ -52,15 +54,12 @@ SkipTrack
;
lda gTrack
cmp #$22
bne +
clc
bne .donotskip
lda gIsProDOS
bne +
lda #TRUE
bne .donotskip
sta gPossibleGamco
+ clc
!byte $24 ; hides next SEC
.donotskip
sec
rts
}
@ -79,40 +78,40 @@ IsF7F6
lda $C0E9
lda #$00
jsr WAIT
tay
lda #$19
sta nibcount
ldy #$00
- lda $C0EC
bpl -
jsr .readnib
cmp #$F7
beq +
.restart iny
bne -
dec nibcount
bne -
beq .fail
sec
beq .driveoff
+
- lda $C0EC
bpl -
jsr .readnib
cmp #$F6
bne .restart
- lda $C0EC
bpl -
jsr .readnib
cmp #$EF
bne .restart
- lda $C0EC
bpl -
jsr .readnib
cmp #$EE
bne .restart
- lda $C0EC
bpl -
jsr .readnib
cmp #$AB
bne .restart
clc
!byte $24 ; hides SEC
.fail sec
.driveoff
lda $C0E8
rts
.readnib
- lda $C0EC
bpl -
rts
}
;-------------------------------
@ -250,7 +249,6 @@ xHeredityDog
lda $08FE
clc
adc #$04
pha
ldx #$16
ldy #$4A
jsr CompareMemory
@ -259,7 +257,6 @@ xHeredityDog
!byte $C0,$10,$FB,$C9,$D5,$D0,$EE,$BD,$8C,$C0,$10,$FB,$C9,$AA,$D0,$E5
!byte $A9,$4C,$A0,$00,$99,$00,$95,$88,$D0,$FA,$CE,$46,$BB,$AD,$46,$BB
!byte $C9,$07,$D0,$EC,$A9,$18,$8D,$42,$B9,$A9,$0A,$8D,$ED,$B7,$D0,$05
pla
bcs .exit
lda #kSectorOptional
sta T00S0A
@ -351,9 +348,8 @@ b4bbcompare
!byte $08,$85,$3D,$85,$43,$A9,$BF,$85
!byte $3F,$A9,$00,$85,$3C,$85,$42,$E6
!byte $42,$A9,$FE,$85,$3E,$A0,$00,$AD
bcc +
jmp _b4bbexit
+ lda gIsDOS32
bcs _b4bbexit
ldy gIsDOS32
beq .dos32
lda #$55 ; low byte of address that checks address prologue 1
sta b4bbmodify+1
@ -368,14 +364,13 @@ b4bbcompare
lda #$B2 ; low byte of address that checks address epilogue 1
sta b4bbmodify2+1
ldx #$01 ; track
ldy #$00 ; sector
;;ldy #$00 ; sector
.all
stx gTrack
sty gSector
lda #$00
sta gAddress
lda #$0C
clc
adc #BASEPAGE
sta gAddress+1
jsr ReadSector ; read sector so we can look for 'JMP $B4BB' marker
@ -386,13 +381,11 @@ b4bbcompare
jsr compare
!byte $4C,$BB,$B4
bcs _b4bbexit
lda gIsDOS32
beq .dos32b
ldx #$02 ; track
ldy #$02 ; sector
bne .allb ; always branches
lda gIsDOS32
bne .allb
.dos32b
ldx #$02 ; track
ldy #$09 ; sector
.allb
stx gTrack
@ -400,7 +393,6 @@ b4bbcompare
jsr ReadSector ; read sector to get address prologue 3 for rest of disk
bcs _b4bbexit
lda #$0C
clc
adc #BASEPAGE
sta x0+2
x0 lda $FFC2 ; high byte modified at runtime (above)

View File

@ -10,7 +10,7 @@
;-------------------------------
IDDatasoft
lda #$00
ldx #$00
tax
ldy #$7E
jsr compare
!byte $01,$4C,$7E,$08,$04,$8A,$0C,$B8

View File

@ -17,7 +17,7 @@ IDDavidson
bne .no ; no, give up
lda gSector ; sector $00?
bne .no ; no, give up
lda #$00 ; try re-reading the sector but
;;lda #$00 ; try re-reading the sector but
sta $B92E ; ignore data field checksum failure
jsr ReadSector
lda #$13

View File

@ -32,7 +32,7 @@ IDDOS33
; Code at $0801 must be standard (with one exception)
;
++ lda #$00
ldx #$00
tax
ldy #$3F
jsr compare ; if T00,S00,$00 ==
!byte $01

View File

@ -26,16 +26,16 @@ IDBootloader
dex
bpl -
lda gIsInfocom18
bne .check13
lda #s_infocom18
jsr PrintByID
jmp UseUniversal
ldx gIsInfocom18
beq .printinfo
.check13
lda gIs13Sector
bne .sanity
lda #s_13sector
.printinfo
jsr PrintByID
jmp UseUniversal
@ -74,16 +74,14 @@ IDBootloader
lda #TRUE
sta gPossibleD5D5F7
+ jsr IDDiversi
bcc .diversi
jsr IDPronto
bcc .pronto
lda #s_dosb0
!byte $2c
.diversi
lda #s_diversidos
!byte $2c
.pronto
bcc .printdos
jsr IDPronto
lda #s_prontodos
bcc .printdos
lda #s_dosb0
.printdos
jsr PrintByID
jmp TraceDOS33
;

View File

@ -13,7 +13,7 @@
!zone {
ID8b3
lda #$00
ldx #$00
tax
ldy #$5A
jsr compare
!byte $01,$20,$B3,$08,$D0,$19,$EA,$A5

View File

@ -16,7 +16,7 @@
!zone {
IDMECC
lda #$00
ldx #$00
tax
ldy #$17
jsr compare
!byte $01,$4C,$1A,$08,$17,$0F,$00,$00

View File

@ -17,7 +17,7 @@ IDPascal
; addresses (e.g. Wizardry I, Sundog Frozen Legacy)
;
lda #$00
ldx #$00
tax
ldy #$08
jsr compare ; if T00,S00,$00 ==
!byte $01

View File

@ -17,7 +17,7 @@ IDProDOS
; Dazzle Draw, SuperPrint II). All of these variants
; will match.
lda #$00
ldx #$00
tax
ldy #$05
jsr compare ; if T00,S00,$00 ==
!byte $01

View File

@ -12,7 +12,7 @@
!zone {
IDRDOS
lda #$00
ldx #$00
tax
ldy #$0E
jsr compare ; if T00,S00,$00 ==
!byte $01

View File

@ -15,24 +15,21 @@ Trace
ldy #$01
jsr CopyMemory
pla
tax
pla
ldx #0
ldy $B6F8
cpy #$4C
bne +
sty $B6F8 ; JMP for Disk II controller
sta $B6F9 ; lo byte of callback
stx $B6FA ; hi byte of callback
jmp $B600
beq +
ldx #3
+ ldy $B6FB
cpy #$4C
bne +
sty $B6FB ; JMP for IIgs smart controller
sta $B6FC ; lo byte of callback
stx $B6FD ; hi byte of callback
sta $B6FA,x ; hi byte of callback
pla
sta $B6F9,x ; lo byte of callback
jmp $B600
+ lda #s_canttrace ; unknown disk controller
+ pla
lda #s_canttrace ; unknown disk controller
jsr PrintByID
jmp UseUniversal
}

View File

@ -10,7 +10,7 @@
!zone {
IDDOS32
lda #$00
ldx #$00
tax
ldy #$0F
jsr compare
!byte $01
@ -52,7 +52,7 @@ IDDOS32
!zone {
IDDOS32LO
lda #$00
ldx #$00
tax
ldy #$0F
jsr compare
!byte $01
@ -90,10 +90,11 @@ IDDOS32LO
TraceDOS32
lda #<.TraceDOS32b
ldx #>.TraceDOS32b
jmp Trace
bne .linktrace
TraceDOS32LO
lda #<.TraceDOS32LOb
ldx #>.TraceDOS32LOb
.linktrace
jmp Trace
.TraceDOS32b
@ -101,7 +102,7 @@ TraceDOS32LO
sta $0846
lda #>.TraceDOS32c
sta $0847
jmp $0801
bne .linkjmp
.TraceDOS32LOb
ldy #$00
@ -113,6 +114,7 @@ TraceDOS32LO
sta $0838,y
lda #>.TraceDOS32c
sta $0839,y
.linkjmp
jmp $0801
.TraceDOS32c
@ -336,13 +338,13 @@ FFer
bne +
iny
bne -
tya
ldy jCallRWTS+2
dey
sty .G+2
dey
sty .F+2
ldy #$00
tya
tay
.F sta $FF00,y
iny
bne .F

View File

@ -9,7 +9,7 @@
;-------------------------------
IDSpecDel
lda #$00
ldx #$00
tax
ldy #$58
jsr compare
!byte $02,$90,$4A,$C6,$27,$BD,$31,$09
@ -35,7 +35,7 @@ TraceSpecDel
jsr ClearTSBuffer
lda #$00 ; set a marker to see if entire
sta $3FFF ; RWTS loads successfully later
lda #$00 ; save zero page before trace
;; lda #$00 ; save zero page before trace
ldx #$0A
ldy #$01
jsr CopyMemory
@ -164,9 +164,10 @@ SDsuccess
jsr IncProgress
inc gTrack
lda #$20
ldx #$10
ldy #$10
lda #$10
tax
tay
asl
jsr CopyMemory
jsr WriteTrackNA ; doesn't really write anything in verify-only mode

View File

@ -17,6 +17,30 @@
;-------------------------------
;-------------------------------
; SaveProDOS
; saves memory pages used by ProDOS
; pages $00, $03, $BF
; in: none
; out: all flags and registers clobbered
;-------------------------------
!zone {
SaveProDOS
lda #$00
ldx #$40
ldy #$01
jsr CopyMemory
lda #$03
ldx #$41
ldy #$01
jsr CopyMemory
SaveGlobal
lda #$BF
ldx #$42
ldy #$01
;;jsr CopyMemory ; fall through
}
;-------------------------------
; CopyMemory
; in: A = source address (high)
@ -40,27 +64,6 @@ CopyMemory
rts
}
;-------------------------------
; ClearMemory
; in: A = source address (high)
; X = value to set
; Y = number of pages
; out: all flags and registers clobbered
;-------------------------------
!zone {
ClearMemory
sta .dest+2
txa
ldx #$00
.dest sta $FF00,x
inx
bne .dest
inc .dest+2
dey
bne .dest
rts
}
;-------------------------------
; ClearTSBuffer
; clear the $1000 byte memory buffer
@ -72,7 +75,69 @@ ClearTSBuffer
lda #BASEPAGE
ldx #$00
ldy #$10
jmp ClearMemory
;; jmp ClearMemory ; fall through
;-------------------------------
; ClearMemory
; in: A = source address (high)
; X = value to set
; Y = number of pages
; out: all flags and registers clobbered
;-------------------------------
!zone {
ClearMemory
sta .dest+2
.dest stx $FF00
inc .dest+1
bne .dest
inc .dest+2
dey
bne .dest
rts
}
;-------------------------------
; ReorderBuffer - convert data
; buffer between ProDOS and
; DOS 3.3 ordering (use after
; read or before write under
; ProDOS)
; in: none
; out: all flags clobbered
; all registers clobbered
;-------------------------------
!zone {
ReorderBuffer
lda #BASEPAGE+1
ldx #BASEPAGE+$0E
ldy #$07
clc
bcc SwapMemory ; branch always
}
;-------------------------------
; SwapProDOS
; saves/restores memory pages used by ProDOS
; pages $00, $03, $BF
; in: none
; out: all flags and registers clobbered
;-------------------------------
SwapProDOS
lda #$00
ldx #$40
ldy #$01
sec
jsr SwapMemory
lda #$03
ldx #$41
ldy #$01
sec
jsr SwapMemory
lda #$BF
ldx #$42
ldy #$01
sec
;;jsr SwapMemory ; fall through
;-------------------------------
; SwapMemory
@ -114,76 +179,6 @@ SwapMemory
rts
}
;-------------------------------
; ReorderBuffer - convert data
; buffer between ProDOS and
; DOS 3.3 ordering (use after
; read or before write under
; ProDOS)
; in: none
; out: all flags clobbered
; all registers clobbered
;-------------------------------
!zone {
ReorderBuffer
lda #BASEPAGE+1
ldx #BASEPAGE+$0E
ldy #$07
clc
jmp SwapMemory
}
;-------------------------------
; SaveProDOS
; saves memory pages used by ProDOS
; pages $00, $03, $BF
; in: none
; out: all flags and registers clobbered
;-------------------------------
!zone {
SaveProDOS
lda #$00
ldx #$40
ldy #$01
jsr CopyMemory
lda #$03
ldx #$41
ldy #$01
jsr CopyMemory
SaveGlobal
lda #$BF
ldx #$42
ldy #$01
jsr CopyMemory
.exit
rts
}
;-------------------------------
; SwapProDOS
; saves/restores memory pages used by ProDOS
; pages $00, $03, $BF
; in: none
; out: all flags and registers clobbered
;-------------------------------
SwapProDOS
lda #$00
ldx #$40
ldy #$01
sec
jsr SwapMemory
lda #$03
ldx #$41
ldy #$01
sec
jsr SwapMemory
lda #$BF
ldx #$42
ldy #$01
sec
jsr SwapMemory
rts
;-------------------------------
; ReorderLogicalToPhysical - reorder pages in
; track data buffer for disks that expect

View File

@ -503,12 +503,13 @@ nextsector
dec checksector+2
.nodec
dec checksector+1
lda gSector
sec
sbc #$01
ldy gSector
dey
tya
jsr ChangeSector
lda gSector
bmi .prevtrack
.linkread
jmp .read
.prevtrack
lda #$0F
@ -516,16 +517,15 @@ nextsector
bne +
lda #$0C
+ jsr ChangeSector
lda gTrack
sec
sbc #$01
ldy gTrack
dey
tya
jsr ChangeTrack
jsr IncProgress
lda gTrack
bmi Pass
cmp gLastTrack
bcc Pass
jmp .read
bcs .linkread
Pass
bit gMode
bmi .passwrite
@ -543,12 +543,10 @@ Pass
jsr WriteRAMToDisk
bcc +
jmp FatalWriteError
+ lda gPatchCount
beq .passcrack0
+ lda #s_passcrack0
ldx gPatchCount
beq .passprint
lda #s_passcrack
!byte $2C ; hide next LDA
.passcrack0
lda #s_passcrack0
.passprint
jsr PrintByID
jmp TheEnd
@ -600,17 +598,15 @@ FatalError
jsr PrintByID
lda gTrack
cmp #$22
beq .failont22
jmp TheEnd
bne TheEnd
.failont22
lda gSector
cmp #$0F
beq .failont22s0f
ldx gIsDOS32
bne +
bne TheEnd
cmp #$0C
beq .failont22s0f
+ jmp TheEnd
bne TheEnd
.failont22s0f
lda #s_fatal220f
jsr PrintByID
@ -706,22 +702,18 @@ WriteTrackNA ; entry point used by Special Delivery tracer
;-------------------------------
FatalWriteError
sta gDisplayBytes ; for use in error messages, if any
cmp #MLI_IOERR
beq .ioerr
cmp #MLI_NODEV
beq .nodev
cmp #MLI_WRITEPROT
beq .writeprot
lda #s_othermli
!byte $2C ; hide next LDA
.ioerr
tax
lda #s_writeioerr
!byte $2C ; hide next LDA
.nodev
cpx #MLI_IOERR
beq .printerr
lda #s_writenodev
!byte $2C ; hide next LDA
.writeprot
cpx #MLI_NODEV
beq .printerr
lda #s_writeprot
cpx #MLI_WRITEPROT
beq .printerr
lda #s_othermli
.printerr
pha
lda #s_writeerr
jsr PrintByID

View File

@ -7,11 +7,10 @@
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gTrack
cmp #$01
ldx gTrack
dex
bne .exit
lda #$00
ldx #$00
txa
ldy #$23
jsr compare ; if T01,S00,$00 !=
!byte $AD,$F3,$03,$8D,$F4,$03,$20,$2F

View File

@ -10,8 +10,7 @@
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsBoot0 ; if DOS 3.3 boot0 loader
bne .exit
lda gIsBoot1 ; and DOS 3.3 boot1 loader
ora gIsBoot1 ; and DOS 3.3 boot1 loader
bne .exit
lda #$08
ldx #$5A

View File

@ -29,8 +29,7 @@
; additional samples.)
;
lda gIsBoot0
bne .exit
lda gPossibleD5D5F7
ora gPossibleD5D5F7
bne .exit
+ ldy #$20

View File

@ -12,7 +12,7 @@
lda #$01
ldx #$EE
ldy #$01
tay
jsr compare ; and T00,S01,$EE ==
!byte $FB
bcs .exit
@ -27,8 +27,7 @@
beq .yes
lda gIsPanglosDOS
bne +
lda gCapturedDiskVolumeNumber
ora gCapturedDiskVolumeNumber
bne +
lda gDiskVolumeNumber
cmp #$FE

View File

@ -18,8 +18,7 @@
- jmp .exit
+ bvc - ; nothing to do here in demuffin mode
lda gIsHolle
beq +
jmp .exit
bne -
+ lda gTrack
bne +
jmp .DecryptBootloader
@ -246,11 +245,11 @@
EOR $01
AND #$01
.alternatingTrackEnd
bcs +
bcs .exit
ldy #$01
jsr modify
!byte $A9 ; EOR -> LDA so alternating track check always passes
+
jmp .exit
.reorderAndExit
jsr ReorderBuffer

View File

@ -8,8 +8,7 @@
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsBoot0 ; if DOS 3.3 boot0 loader
bne .exit
lda gIsBoot1 ; and DOS 3.3 boot1 loader
ora gIsBoot1 ; and DOS 3.3 boot1 loader
bne .exit
lda #$0D
ldx #$4D

View File

@ -52,7 +52,7 @@
jsr PrintByID
lda #$03
ldx #$00
ldy #$03
tay
jsr modify ; then set T02,S03,$00 =
!byte $4C,$84,$9D
.exit

View File

@ -10,12 +10,11 @@
lda gTrack
cmp #$02
bne .exit
lda gIsDOS32
lda #$03
ldx gIsDOS32
bne +
lda #$0A
!byte $2C ; hide next LDA
+ lda #$03
sta gDisplayBytes
+ sta gDisplayBytes
ldx #$D7
ldy #$04
jsr compare ; and T02,S0x,$D7 ==

View File

@ -10,7 +10,6 @@ _jmpbbfe
bpl .exit
lda gIsBoot0 ; if DOS 3.3 boot0 loader
bne .exit
lda #$00
ldx #$4A
ldy #$03
jsr compare ; and T00,S00,$4A ==

View File

@ -19,14 +19,11 @@
!byte $C9,$BE
!byte $D0,$E5
bcs .exit
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #8
tax
tya
ldy #$01
jsr modify ; change BNE to continue instead
!byte $00

View File

@ -18,17 +18,11 @@
!byte $20,$10,$30,WILDCARD,$AA,$EB
bcs +
sta gDisplayBytes
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #$0B
tax
tya
ldy #$01
jsr compare
!byte $DE
@ -44,25 +38,11 @@
!byte $02,$18,$24,$38,$60
bcs +
sta gDisplayBytes
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #$13
tax
tya
ldy #$01
jsr compare
!byte $38
@ -81,28 +61,11 @@
!byte $C9,$DE,$F0,$02,$18,$24,$38,$60
bcs +
sta gDisplayBytes
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #$16
tax
tya
ldy #$01
jsr compare
!byte $38
@ -121,16 +84,11 @@
!byte $38
!byte $60
bcs +
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #$0A
tax
tya
ldy #$01
jsr compare
!byte $38

View File

@ -23,21 +23,11 @@ _prodosrwts
!byte $38
bcs .exit
sta gDisplayBytes
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
inx
tay
txa
adc #$0F
tax
tya
ldy #$01
jsr compare
!byte $DE

View File

@ -152,7 +152,7 @@
;
lda #$01
ldx #$07
ldy #$01
tay
jsr modify ; set T00,S01,$07 =
!byte $2C

View File

@ -10,8 +10,7 @@
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsBoot0 ; if DOS 3.3 boot0 loader
bne .exit
lda gIsBoot1 ; and DOS 3.3 boot1 loader
ora gIsBoot1 ; and DOS 3.3 boot1 loader
bne .exit
lda #$04
ldx #$69

View File

@ -54,9 +54,8 @@ universale7
!byte $00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00
!byte $00,$00,$00,$00,$00,$00,$00,$00
bcc +
jmp .nextsector
+
bcs .nextsector
lda .sector+1
sta gDisplayBytes
lda #s_e7

View File

@ -96,15 +96,9 @@ PrintByID
; @tmpy clobbered
;-------------------------------
PrintByte
sta tmpa
stx tmpx
sty tmpy
jsr .saveAXY
jsr PRBYTE
lda tmpa
ldx tmpx
ldy tmpy
clv
rts
jmp .loadAXY
;-------------------------------
; PrintA
@ -117,16 +111,22 @@ PrintByte
; @tmpy clobbered
;-------------------------------
PrintA
sta tmpa
stx tmpx
sty tmpy
jsr .saveAXY
jsr COUT
.loadAXY
lda tmpa
ldx tmpx
ldy tmpy
clv
rts
.saveAXY
sta tmpa
stx tmpx
sty tmpy
rts
;-------------------------------
; ClearScreen
;-------------------------------
@ -144,17 +144,16 @@ ClearScreen
ldy #$00
sty flag
.loop
lda $FF00,y ; modified at runtime
cmp #$A0
ldx $FF00,y ; modified at runtime
cpx #$A0
beq .nochange
bcs .down
clc
adc #$01
inx
bne .change
.down
sec
sbc #$01
dex
.change
txa
sta $FF00,y ; modified at runtime
sta flag
.nochange