shave some bytes

This commit is contained in:
4am 2021-06-21 11:24:21 -04:00
parent 2a594af93b
commit e2a397815c
25 changed files with 119 additions and 183 deletions

View File

@ -35,6 +35,8 @@
jmp modify1
;jcompare
jmp compare
;jcompare1
jmp compare1
;gDisplayBytes
!fill 10 ; array of ten bytes for use as
; substitution strings

View File

@ -189,7 +189,8 @@ gTargetType = gOnAClearDayYouCanReadForever-$01 ; byte
gRAMDiskRef = gTargetType-$01 ; byte
gHardDiskRef = gRAMDiskRef-$01 ; byte
gDisplayBytes = gHardDiskRef-$0A ; 10 bytes
jcompare = gDisplayBytes-$03 ; 3-byte
jcompare1 = gDisplayBytes-$03 ; 3-byte
jcompare = jcompare1-$03 ; 3-byte
jmodify1 = jcompare-$03 ; 3-byte
jmodify = jmodify1-$03 ; 3-byte
jPrintByID = jmodify-$03 ; 3-byte
@ -204,6 +205,7 @@ gNIBTableBase = gNIBTableFF-$7F ; 127 byte
!ifdef MODULE {
compare = jcompare
compare1 = jcompare1
modify = jmodify
modify1 = jmodify1
PrintByID = jPrintByID

View File

@ -173,6 +173,10 @@ all_done_set
sec
rts
compare1
ldy #$01
; /!\ execution falls through here
;-------------------------------
; compare subroutine
; in: A = sector

View File

@ -76,8 +76,7 @@ IDBootloader
;
lda #$08
ldx #BASEPAGE
ldy #$01
jsr CopyMemory ; exits with X=0
jsr CopyMemory1 ; exits with X=0
;
; Try to identify DOS 3.3-shaped bootloader.
; Exit via custom trace function if found.

View File

@ -12,8 +12,7 @@ Trace
pha
lda #$C6
ldx #$16
ldy #$01
jsr CopyMemory
jsr CopyMemory1
pla
ldx #0
ldy $16F8

View File

@ -47,8 +47,7 @@ TraceSpecDel
sta $3FFF ; RWTS loads successfully later
;; lda #$00 ; save zero page before trace
ldx #$0A
ldy #$01
jsr CopyMemory
jsr CopyMemory1
jsr MoveT00PakHigh
@ -105,8 +104,7 @@ SDfail
php
lda #$0A ; restore zero page from before trace
ldx #$00
ldy #$01
jsr CopyMemory
jsr CopyMemory1
plp
bcc SDsuccess
@ -140,20 +138,16 @@ SDsuccess
;
lda #$13
ldx #$14
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$12
ldx #$13
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$11
ldx #$12
ldy #$01
jsr CopyMemory
jsr CopyMemory1
lda #$10
ldx #$11
ldy #$01
jsr CopyMemory
jsr CopyMemory1
; $1B00-$1FFF is real code and in the right place
; but we should clear the rest of T00 so we're not
@ -210,8 +204,7 @@ SDsuccess
!byte $C9,$AD,$90,$E5
lda #$18
ldx #$38
ldy #$01
jsr CopyMemory
jsr CopyMemory1
jsr WriteTrackNA ; doesn't really write anything in verify-only mode
lda #$C9
sta $38B6

View File

@ -52,6 +52,11 @@ MoveT00PakHigh
ldx #$B2
+ stx T00PakPtr+1
ldy #$0D
!byte $2C ; hide next LDY
; /!\ execution falls through here
CopyMemory1
ldy #$01
; /!\ execution falls through here
;-------------------------------

View File

@ -458,8 +458,8 @@ _byte_hi = * + 2
_byte_skip_hi:
rts
!source "wholetrack.a"
!source "id/bootfailure.a"
!source "wholetrack.a"
!source "apicode.a" ; /!\ must be last
!if RELBASE = $2000 {

View File

@ -449,35 +449,31 @@ Do555
.patchepi
inx
ldy #1
pha
jsr modify
jsr modify1
!byte $DE
txa
clc
adc #10
tax
ldy #1
pla
pha
jsr modify
jsr modify1
!byte $AA
txa
clc
adc #$52
tax
ldy #1
pla
pha
jsr modify
jsr modify1
!byte $DE
txa
clc
adc #10
tax
ldy #1
pla
jsr modify
jsr modify1
!byte $AA
ldy #8
jsr SearchTrack
@ -489,8 +485,7 @@ Do555
inx
inx
inx
ldy #1
jsr modify
jsr modify1
!byte $00
.novol
rts
@ -509,8 +504,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $08
clc
txa
@ -538,8 +532,7 @@ Do555
pla
adc #$FE
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -547,8 +540,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -556,8 +548,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -565,8 +556,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -574,8 +564,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -583,8 +572,7 @@ Do555
tax
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $8D
clc
txa
@ -592,8 +580,7 @@ Do555
tax
pla
adc #$FE
ldy #1
jsr modify
jsr modify1
!byte $8D
rts

View File

@ -38,10 +38,12 @@
!byte $A9,$96 ;LDA #$96
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $60 ;RTS
bcs .pop ; passport-test-suite/Borrowed Time.woz [C=0] matches
ldy #1 ; passport-test-suite/Mindshadow.woz [C=0] matches
jsr modify ; passport-test-suite/The Tracer Sanction.woz [C=0] matches
bcs .pop ; passport-test-suite/Borrowed Time.woz [C=0] matches
; passport-test-suite/Mindshadow.woz [C=0] matches
; passport-test-suite/The Tracer Sanction.woz [C=0] matches
jsr modify1
!byte $10 ;BEQ -> BPL
ldy #23
jsr SearchTrack
!byte $A4,WILDCARD ;LDY $xx

View File

@ -65,14 +65,12 @@
sta .patch2+1
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $AA ;data prologue #2
.patch2
ldx #$D1
pla
ldy #1
jsr modify
jsr modify1
!byte $AD ;data prologue #3
+ ldy #13
@ -84,8 +82,7 @@
!byte $04,$EB,$19 ;LDA $c0e8
bcs +
jsr inx5
ldy #1
jsr modify
jsr modify1
!byte $04
+ ldy #15
jsr SearchTrack
@ -94,8 +91,7 @@
!byte $5A,$16,$DA,$30,$06,$45,$C2
bcs +
inx
ldy #1
jsr modify
jsr modify1
!byte $EE ;enciphered jsra->lda to disable call
+ ldy #8
@ -106,8 +102,7 @@
!byte $4C ;JMP $xxxx
bcs +
jsr inx6
ldy #1
jsr modify
jsr modify1
!byte $00 ;disable branch
+ ldy #15
@ -130,14 +125,12 @@
sta .patch3 + 1
pla
pha
ldy #1
jsr modify
jsr modify1
!byte $04 ;new checksum value for sub
pla
.patch3
ldx #$D1
ldy #1
jsr modify
jsr modify1
!byte $00 ;jsra->lda to disable call
;routine loops infinitely on failure
@ -158,8 +151,7 @@
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $00 ;disable branch
+ ldy #15
@ -179,8 +171,7 @@
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $4C ;new checksum value for sub
+ ldy #14
@ -197,8 +188,7 @@
!byte s_tamper
pla
jsr inx5
ldy #1
jsr modify
jsr modify1
!byte $00 ;new checksum value for cmp
+ ldy #9
@ -211,8 +201,7 @@
jsr PrintByID
!byte s_tamper
jsr inx6
ldy #1
jsr modify
jsr modify1
!byte $50 ;new checksum value for cmp
+ ldy #7
@ -224,8 +213,7 @@
jsr PrintByID
!byte s_tamper
jsr inx4
ldy #1
jsr modify
jsr modify1
!byte $50 ;new checksum value for cmp
+ ldy #12
@ -236,8 +224,7 @@
!byte $4C,$94,$69 ;JMP $6994
bcs +
jsr inx6
ldy #1
jsr modify
jsr modify1
!byte $2C ;JSR->BIT
+ ldy #23
@ -257,8 +244,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $C7 ;lda from known-zero instead
+ ldy #23
@ -277,8 +263,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -297,8 +282,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -317,8 +301,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #31
@ -341,8 +324,7 @@
adc #29
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $D1 ;lda from known-zero instead
+ ldy #16
@ -361,8 +343,7 @@
jsr PrintByID
!byte s_tamper
inx
ldy #1
jsr modify
jsr modify1
!byte $E8 ;new checksum value for eor
+ ldy #14
@ -383,8 +364,7 @@
adc #12
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $A1 ;new checksum value for eor
+ ldy #24
@ -407,35 +387,30 @@
adc #24
tax
pla
ldy #1
jsr compare
jsr compare1
!byte $AB ;Last Gladiator
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $BB ;new checksum value for eor
bvc +
++ ldy #1
jsr compare
++
jsr compare1
!byte $D4 ;Arctic Fox, PHM Pegasus
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $D5 ;new checksum value for eor
bvc +
++ ldy #1
jsr compare
++
jsr compare1
!byte $2C
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $2D ;new checksum value for eor
++ ldy #1
jsr compare
++
jsr compare1
!byte $DB ;Adventure Construction Set, Archon, Marble Madness, Bard's Tale
bcs ++
ldy #1
jsr modify
jsr modify1
!byte $D4 ;new checksum value for eor
++
@ -455,8 +430,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #23
@ -475,8 +449,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $30 ;lda from known-zero instead
+ ldy #14
@ -493,8 +466,7 @@
!byte s_tamper
inx
inx
ldy #1
jsr modify
jsr modify1
!byte $F0 ;new checksum value for eor
+ ldy #23
@ -513,8 +485,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $E0 ;lda from known-zero instead
+ ldy #14
@ -536,12 +507,10 @@
adc #25
tax
pla
ldy #1
jsr compare
jsr compare1
!byte $4C
bcs +
ldy #1
jsr modify
jsr modify1
!byte $2C ;jmp to bit
+
@ -566,8 +535,7 @@
adc #21
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $7F ;lda from known-zero instead
+ ldy #13
@ -584,8 +552,7 @@
adc #11
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $00 ;disable branch
+

View File

@ -32,11 +32,10 @@
!byte $C9
bcs +
ldx #$91
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc +
jsr modify
jsr modify1
!byte $DE
+
ldx #$2F
@ -47,11 +46,10 @@
!byte $C9
bcs +
ldx #$35
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc +
jsr modify
jsr modify1
!byte $DE
+
ldx #$9D
@ -61,11 +59,10 @@
JSR $B8B8
bcs +
ldx #$9E
ldy #$01
jsr compare ; first data epilogue nibble (write)
jsr compare1 ; first data epilogue nibble (write)
!byte $DE
bcc +
jsr modify
jsr modify1
!byte $DE
+
dec .sector+1

View File

@ -37,13 +37,12 @@
sta .modbyte
lda .table-24,y
ldx .table+1-24,y
ldy #$01
jsr compare
jsr compare1
.cmpbyte
!byte $D1 ; SMC
bcc +
jsr modify
jsr modify1
.modbyte
!byte $D1 ; SMC

View File

@ -13,11 +13,10 @@
!byte $20,$10,$30,WILDCARD,$AA,$EB
bcs + ; passport-test-suite/Mystery Objects v1.1.woz [C=0] matches
jsr inx0B
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc +
jsr modify
jsr modify1
!byte $DE
+
ldy #$0A

View File

@ -21,11 +21,10 @@ _prodosrwts
!byte $38
bcs .exit ; passport-test-suite/Mystery Objects v1.1.woz [C=0] matches
jsr inx0F
ldy #$01
jsr compare
jsr compare1
!byte $DE
bcc .exit
jsr modify
jsr modify1
!byte $DE
.exit
}

View File

@ -179,11 +179,10 @@
;
lda #$07
ldx #$4C
ldy #$01
jsr compare ; if T00,S07,$4C ==
jsr compare1 ; if T00,S07,$4C ==
!byte $A0
bcs + ; passport-test-suite/Bingo Bugglebee Presents Outdoor Safety.woz [C=0] matches
jsr modify ; then set T00,S07,$4C =
jsr modify1 ; then set T00,S07,$4C =
!byte $20
+
jmp .exit

View File

@ -124,16 +124,14 @@
txa
pha
tya
ldy #1
jsr modify
jsr modify1
!byte $EA ;NOP
pla
clc
adc #5
tax
pla
ldy #1
jsr modify
jsr modify1
!byte $EA ;NOP
+ ldy #10
jsr SearchTrack

View File

@ -32,11 +32,10 @@
bne .yes
+
ldx #$EB
ldy #$01
jsr compare ; and T00,S01,$EB !=
jsr compare1 ; and T00,S01,$EB !=
!byte $FE
bcc .exit
jsr compare ; and T00,S01,$EB !=
jsr compare1 ; and T00,S01,$EB !=
!byte $00
bcc .exit
.yes

View File

@ -168,18 +168,17 @@ _jmpbbfe
lda #$04
ldx #$69
ldy #$01
jsr compare ; if T00,S04,$69 ==
jsr compare1 ; if T00,S04,$69 ==
!byte $A9
bcs + ; passport-test-suite/Mask Parade.woz [C=0] matches
jsr modify ; then set T00,S04,$69 =
jsr modify1 ; then set T00,S04,$69 =
!byte $60
+
ldx #$7D
jsr compare ; if T00,S04,$7D ==
jsr compare1 ; if T00,S04,$7D ==
!byte $A9
bcs + ; passport-test-suite/Mask Parade.woz [C=0] matches
jsr modify ; then set T00,S04,$7D =
jsr modify1 ; then set T00,S04,$7D =
!byte $60
+
.exit

View File

@ -24,11 +24,10 @@
sta .valueb
lda .sectors,y
ldx .offsets,y
ldy #$01
jsr compare
jsr compare1
.valuea !byte $d1
bcc +
jsr modify
jsr modify1
.valueb !byte $d1
+ dec .loop+1
bpl .loop

View File

@ -31,13 +31,12 @@
sta .modbyte
lda .table-24,y
ldx .table+1-24,y
ldy #$01
jsr compare
jsr compare1
.cmpbyte
!byte $D1 ; SMC
bcc +
jsr modify
jsr modify1
.modbyte
!byte $D1 ; SMC

View File

@ -26,11 +26,10 @@
!byte $C9,WILDCARD
bcs + ; passport-test-suite/Solar Reading- Flight 1 - Paraphrase - Jupiter.woz [C=0] matches
ldx #$51
ldy #$01
jsr compare ; and T00,S0D,$51 !=
jsr compare1 ; and T00,S0D,$51 !=
!byte $AA
bcc +
jsr modify
jsr modify1
!byte $AA
+ lda #$0F
@ -47,11 +46,10 @@
!byte $C9,WILDCARD
bcs +
ldx #$7B
ldy #$01
jsr compare ; and T00,S0F,$7B !=
jsr compare1 ; and T00,S0F,$7B !=
!byte $AA
bcc +
jsr modify
jsr modify1
!byte $AA
+
.exit

View File

@ -55,8 +55,7 @@
+
lda #$0A
ldx #$8B
ldy #1
jsr modify
jsr modify1
!byte $96
jsr PrintByID

View File

@ -108,14 +108,11 @@
sta .modify3
pla
dex
ldy #1
jsr compare
jsr compare1
.cmpbyte3 ; SMC
!byte $D1
bcc +
ldy #1
jsr modify
jsr modify1
.modify3 ; SMC
!byte $D1
@ -134,8 +131,7 @@
ldy #$D1 ; SMC
lda .table4,y
ldx .table4+1,y
ldy #1
jsr compare
jsr compare1
!byte $A9
bcs +
@ -163,14 +159,11 @@
sta .modify6
pla
dex
ldy #1
jsr compare
jsr compare1
.cmpbyte6
!byte $D1 ; SMC
bcc +
ldy #1
jsr modify
jsr modify1
.modify6
!byte $D1 ; SMC

View File

@ -62,12 +62,11 @@
lda #$03
ldx #$40
ldy #$01
jsr compare ; if T00,S03,$40 ==
jsr compare1 ; if T00,S03,$40 ==
!byte $D0
bcs .exit
ldx #$9C
jsr compare ; and T00,S03,$9C ==
jsr compare1 ; and T00,S03,$9C ==
!byte $F0
bcs .exit
lda #$04