mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 19:30:50 +00:00
shave some bytes
This commit is contained in:
parent
24a67c61fc
commit
154aea3cd9
@ -182,8 +182,7 @@ all_done_set
|
||||
; (like "." character in regular expressions)
|
||||
; out: C clear if string matches
|
||||
; or set if not matched
|
||||
; A,X unchanged
|
||||
; Y clobbered
|
||||
; A,X,Y preserved
|
||||
; $tmp zero page clobbered
|
||||
; $cmp1 zero page clobbered
|
||||
; $cmp2 zero page clobbered
|
||||
@ -195,6 +194,7 @@ compare
|
||||
CompareMemory
|
||||
sta cmp1+1
|
||||
stx cmp1
|
||||
sty compare_tmp_y
|
||||
pla
|
||||
sta cmp2
|
||||
pla
|
||||
@ -226,5 +226,7 @@ CompareMemory
|
||||
sec
|
||||
sbc #BASEPAGE
|
||||
ldx cmp1
|
||||
compare_tmp_y=*+1
|
||||
ldy #$FD ; SMC
|
||||
plp
|
||||
rts
|
||||
|
@ -10,12 +10,12 @@
|
||||
; $moddest zero page clobbered
|
||||
; stack set to return to
|
||||
; code after string
|
||||
; A,X preserved
|
||||
; Y clobbered
|
||||
; A,X,Y preserved
|
||||
; oVerflow bit clear
|
||||
; all other flags clobbered
|
||||
;-------------------------------
|
||||
modify
|
||||
sty mod_tmp_y
|
||||
sta gDisplayBytes
|
||||
clc
|
||||
adc #BASEPAGE
|
||||
@ -68,5 +68,7 @@ modify
|
||||
@exitnomod
|
||||
lda gDisplayBytes
|
||||
ldx moddest
|
||||
mod_tmp_y=*+1
|
||||
ldy #$FD ; SMC
|
||||
clv
|
||||
rts
|
||||
|
@ -26,7 +26,6 @@
|
||||
!byte $C9,$D5 ; CMP #$D5
|
||||
!byte $F0,$12 ; BEQ +$12
|
||||
bcs .exit ; passport-test-suite/Dinosaur Days.woz [C=0] matches
|
||||
lda #$03
|
||||
ldx #$59
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S03,$59 =
|
||||
|
@ -46,7 +46,6 @@
|
||||
jsr compare ; if T00,S01,$38 ==
|
||||
!byte $20,$03,$BB; JSR $BB03
|
||||
bcc .variant1
|
||||
ldy #$03
|
||||
jsr compare ; if T00,S01,$38 ==
|
||||
!byte $4C,$03,$BB; JMP $BB03
|
||||
bcs .no
|
||||
@ -63,7 +62,7 @@
|
||||
!byte $6B,$F6 ; encrypted, decrypts to 'BNE +$5C' which will unconditionally branch to success path at $BBC9
|
||||
lda #$06
|
||||
ldx #$0F
|
||||
ldy #$01
|
||||
dey
|
||||
jsr modify ; and set T00,S06,$0F =
|
||||
!byte $89 ; encrypted, decrypts to $10 which is the expected nibble count value
|
||||
; unconditional branch (V is always 0 coming out of modify)
|
||||
|
@ -37,7 +37,6 @@
|
||||
jsr modify
|
||||
!byte $DE
|
||||
jsr inx0A
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $AA
|
||||
.exit
|
||||
|
@ -33,7 +33,6 @@
|
||||
!byte $D0,$F1 ; BNE -$F1
|
||||
bcs .exit
|
||||
ldx #$A4
|
||||
ldy #$0F
|
||||
jsr compare
|
||||
!byte $A9,$23 ; LDA #$23
|
||||
!byte $85,$02 ; STA $02
|
||||
|
@ -36,8 +36,6 @@
|
||||
jsr compare ; and T00,S01,$EB !=
|
||||
!byte $FE
|
||||
bcc .exit
|
||||
|
||||
ldy #$01
|
||||
jsr compare ; and T00,S01,$EB !=
|
||||
!byte $00
|
||||
bcc .exit
|
||||
@ -52,8 +50,8 @@
|
||||
bcc .veryyes ; passport-test-suite/The Incredible Laboratory.woz [C=0] matches
|
||||
|
||||
ldx #$16 ; or T00,S08,$16 == the same thing
|
||||
ldy #$05 ; (variation used by PanglosDOS)
|
||||
jsr compare ; preserves A/X
|
||||
; (variation used by PanglosDOS)
|
||||
jsr compare ; preserves A/X/Y
|
||||
!byte $A0,$03
|
||||
!byte $B1,$48
|
||||
!byte $48
|
||||
|
@ -18,7 +18,6 @@
|
||||
jsr compare ; if T00,S0B,$84 ==
|
||||
!byte $4C,$F0,$BC
|
||||
bcs .exit ; passport-test-suite/Demolition Division.woz [C=0] matches
|
||||
ldy #$03
|
||||
jsr modify ; then set T00,S0B,$84 =
|
||||
!byte $AD,$E9,$B7
|
||||
.exit
|
||||
|
@ -17,7 +17,7 @@
|
||||
jsr compare ; if T01,S08,$D6 ==
|
||||
!byte $4C,$D5
|
||||
bcs .exit ; passport-test-suite/Castle Wolfenstein.woz [C=0] matches
|
||||
ldy #$03
|
||||
iny
|
||||
jsr modify ; then set T01,S08,$D6 =
|
||||
!byte $E8,$D0,$32
|
||||
.exit
|
||||
|
@ -18,7 +18,7 @@ EARTHWARE
|
||||
ldy #$03
|
||||
jsr compare
|
||||
!byte $4C,$89,$B6
|
||||
bcs @exit
|
||||
bcs @exit ; passport-test-suite/Zoo Master.woz [C=0] here
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
lda #s_bytrack
|
||||
|
@ -35,7 +35,6 @@
|
||||
lda #s_hoffman
|
||||
jsr PrintByID
|
||||
lda #$0C
|
||||
ldx #$00
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S0C,$00 =
|
||||
;
|
||||
|
@ -36,7 +36,6 @@
|
||||
jsr compare
|
||||
!byte $DE
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $DE
|
||||
+
|
||||
@ -52,7 +51,6 @@
|
||||
jsr compare
|
||||
!byte $DE
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $DE
|
||||
+
|
||||
@ -67,8 +65,6 @@
|
||||
jsr compare ; first data epilogue nibble (write)
|
||||
!byte $DE
|
||||
bcc +
|
||||
ldx #$9E
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $DE
|
||||
+
|
||||
|
@ -17,7 +17,7 @@
|
||||
lda #s_jmpae8e
|
||||
jsr PrintByID
|
||||
lda #$0D
|
||||
ldx #$4E
|
||||
inx
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S0D,$4E =
|
||||
!byte $80,$A1
|
||||
|
@ -50,10 +50,10 @@
|
||||
sta gDisplayBytes ; address (hi)
|
||||
lda #$00
|
||||
sta gDisplayBytes+1 ; address (lo)
|
||||
tax
|
||||
lda #s_beforedos
|
||||
jsr PrintByID
|
||||
lda #$03
|
||||
ldx #$00
|
||||
tay
|
||||
jsr modify ; then set T02,S03,$00 =
|
||||
!byte $4C,$84,$9D
|
||||
|
@ -54,7 +54,6 @@
|
||||
!byte $AD,$FF,$CF; LDA $CFFF
|
||||
bcc .found ; passport-test-suite/Kamikaze.woz [C=0] matches
|
||||
ldx #$DD
|
||||
ldy #$04
|
||||
jsr compare ; or T02,S0x,$DD ==
|
||||
!byte $D8 ; CLD
|
||||
!byte $AD,$FF,$CF; LDA $CFFF
|
||||
|
@ -24,8 +24,6 @@ _jmpb720
|
||||
!byte $10,$F1
|
||||
!byte $60
|
||||
bcs .exit ; passport-test-suite/Analogies Tutorial.woz [C=0] matches
|
||||
lda #$0B
|
||||
ldx #$08
|
||||
ldy #$06
|
||||
jsr modify ; then set T00,S0B,$08 =
|
||||
!byte $BD,$8C,$C0
|
||||
|
@ -136,7 +136,7 @@ _jmpbbfe
|
||||
+ !byte $FD ; SMC (byte offset of new entry point)
|
||||
|
||||
ldx #$5E
|
||||
ldy #$02
|
||||
iny ; Y=#$02
|
||||
jsr compare ; check for code that branches over serial number
|
||||
!byte $D0,$05
|
||||
bcs .exit
|
||||
|
@ -22,7 +22,6 @@ _jmpbcf0
|
||||
lda #s_jmpbcf0
|
||||
jsr PrintByID
|
||||
lda #$03
|
||||
ldx #$94
|
||||
ldy #$08
|
||||
jsr modify ; then set T00,S03,$94 =
|
||||
!byte $EA
|
||||
|
@ -71,7 +71,6 @@ _jmpbeb1
|
||||
jsr modify ; and set T00,S02,$52 =
|
||||
!byte $A9,$D5
|
||||
_jsr !byte $20,$B8,$d1; final byte set at runtime
|
||||
lda #$02
|
||||
ldx #$5F
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S02,$5F =
|
||||
|
@ -24,7 +24,6 @@
|
||||
;
|
||||
; variant seen in Library Magic
|
||||
;
|
||||
ldy #$0D
|
||||
jsr compare ; or T00,S02,$F4 ==
|
||||
!byte $4C,$CA,WILDCARD
|
||||
!byte $EA
|
||||
|
@ -28,7 +28,6 @@
|
||||
jsr compare
|
||||
.valuea !byte $d1
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
.valueb !byte $d1
|
||||
+ dec .loop+1
|
||||
@ -40,7 +39,6 @@
|
||||
jsr compare
|
||||
!byte $B1,$48
|
||||
bcs .exit
|
||||
ldy #$02
|
||||
jsr modify
|
||||
!byte $A9,$00
|
||||
.exit
|
||||
|
@ -35,7 +35,6 @@
|
||||
!byte $D1 ; SMC
|
||||
bcc +
|
||||
|
||||
ldy #$01
|
||||
jsr modify
|
||||
.modbyte
|
||||
!byte $D1 ; SMC
|
||||
|
@ -43,7 +43,6 @@
|
||||
!byte $D1 ; SMC
|
||||
bcc +
|
||||
|
||||
ldy #$01
|
||||
jsr modify
|
||||
.modbyte
|
||||
!byte $D1 ; SMC
|
||||
|
@ -40,14 +40,13 @@
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S00,$BD =
|
||||
!byte $24 ; BIT
|
||||
lda #$01
|
||||
tya
|
||||
ldx #$47
|
||||
ldy #$03
|
||||
jsr compare ; if T00,S01,$47 ==
|
||||
!byte $4C,$CE,$36; JMP $36CE
|
||||
bcs .exit
|
||||
lda #$01
|
||||
ldx #$48
|
||||
inx
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S01,$48 =
|
||||
!byte $D8
|
||||
|
@ -14,8 +14,6 @@
|
||||
jsr compare
|
||||
!byte $4C,$B8,$B6
|
||||
bcs .exit ; passort-test-suite/Crown Of Arthain.woz [C=0] matches
|
||||
sta gDisplayBytes
|
||||
ldy #$03
|
||||
jsr modify
|
||||
!byte $20,$B8,$B8
|
||||
.exit
|
||||
|
@ -15,7 +15,6 @@
|
||||
jsr compare ; and T00,S01,$48 ==
|
||||
!byte $03,$9B
|
||||
bcs .exit ; passport-test-suite/Tangrams Puzzler.woz [C=0] matches
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S01,$48 =
|
||||
!byte $84,$9D
|
||||
.exit
|
||||
|
@ -15,12 +15,10 @@
|
||||
jsr compare ; if T00,S06,$F2 ==
|
||||
!byte $20,$B6,$B6
|
||||
bcs .exit ; passport-test-suite/The Function Game.woz [C=0] matches
|
||||
pha
|
||||
lda #6
|
||||
sta gDisplayBytes
|
||||
lda #s_bytrack
|
||||
jsr PrintByID
|
||||
pla
|
||||
lda #$06
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S06,$F2 =
|
||||
!byte $2C
|
||||
|
@ -30,7 +30,6 @@
|
||||
jsr compare ; and T00,S0D,$51 !=
|
||||
!byte $AA
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $AA
|
||||
|
||||
@ -52,7 +51,6 @@
|
||||
jsr compare ; and T00,S0F,$7B !=
|
||||
!byte $AA
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $AA
|
||||
+
|
||||
|
@ -20,7 +20,6 @@
|
||||
jsr compare
|
||||
!byte $DE
|
||||
bcc +
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $DE
|
||||
+
|
||||
|
@ -26,7 +26,6 @@ _prodosrwts
|
||||
jsr compare
|
||||
!byte $DE
|
||||
bcc .exit
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $DE
|
||||
.exit
|
||||
|
@ -39,7 +39,7 @@
|
||||
tax
|
||||
.swapper2
|
||||
lda #$FF ; modified at runtime
|
||||
ldy #$01
|
||||
;Y=#$01
|
||||
jsr modify ; offset $08. $D5 -> 9B
|
||||
!byte $9B
|
||||
|
||||
@ -111,7 +111,7 @@
|
||||
!byte $AD
|
||||
lda #$02
|
||||
ldx #$B7
|
||||
ldy #$01
|
||||
;Y=#$01
|
||||
jsr modify ; and set T01,S02,$B7 =
|
||||
!byte $9B
|
||||
|
||||
@ -163,7 +163,6 @@
|
||||
jsr compare ; if T00,S01,$93 ==
|
||||
!byte $4C,$00,$B8
|
||||
bcs .skipcheck ; passport-test-suite/Ultima IV.woz [C=0] matches
|
||||
ldy #$03
|
||||
jsr modify ; then set T00,S01,$93 =
|
||||
!byte $AC,$E5,$B7
|
||||
.skipcheck
|
||||
@ -179,7 +178,6 @@
|
||||
jsr compare ; if T00,S05,$15 ==
|
||||
!byte $A5,$2F
|
||||
bcs .exit ; passport-test-suite/Math Blaster v080584.woz [C=0] matches
|
||||
ldy #$02
|
||||
jsr modify ; then set T00,S05,$15 =
|
||||
!byte $A9,$00
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
lda #$9
|
||||
ldx #$89
|
||||
ldy #3
|
||||
jsr modify
|
||||
!byte $04 ;sync delay
|
||||
!byte $48 ;PHA
|
||||
@ -50,7 +49,6 @@
|
||||
jsr compare
|
||||
!byte $C9,$D5 ;CMP #$D5
|
||||
bcc +
|
||||
ldy #2
|
||||
jsr modify
|
||||
!byte $C9,$D5 ;CMP #$D5
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
; /!\ execution falls through here
|
||||
|
||||
.variant1
|
||||
lda #$01
|
||||
;A=#$01 here regardless of how we got here
|
||||
ldx #$87
|
||||
ldy #$03
|
||||
jsr compare ; if T00,S01,$87 ==
|
||||
@ -71,7 +71,6 @@
|
||||
jsr modify ; then set T00,S01,$8E =
|
||||
!byte $F8 ; change branch to unconditionally jump to success path
|
||||
ldx #$92
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S01,$92 =
|
||||
!byte $F1 ; change branch to unconditionally jump to success path
|
||||
bvc .exit ; always branches
|
||||
@ -88,7 +87,6 @@
|
||||
jsr modify ; then set T00,S01,$8E =
|
||||
!byte $F9 ; change branch to unconditionally jump to success path
|
||||
ldx #$92
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S01,$92 =
|
||||
!byte $F2 ; change branch to unconditionally jump to success path
|
||||
.exit
|
||||
|
@ -109,8 +109,6 @@
|
||||
; David-DOS variant
|
||||
lda #$05
|
||||
sta gDisplayBytes
|
||||
ldx #$8B
|
||||
ldy #$09
|
||||
jsr compare ; or T00,S05,$8B ==
|
||||
!byte $BD,$8C,$C0
|
||||
!byte $10,$FB
|
||||
|
@ -21,7 +21,6 @@
|
||||
!byte $10,$F7
|
||||
bcs .exit
|
||||
ldx #$7F
|
||||
ldy #$0B
|
||||
jsr compare ; and T00,S04,$7F ==
|
||||
!byte $A0,$07
|
||||
!byte $B9,$E7,$BC
|
||||
@ -33,9 +32,7 @@
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S04,$69 =
|
||||
!byte $60
|
||||
lda #$04
|
||||
ldx #$7F
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S04,$7F =
|
||||
!byte $60
|
||||
.exit
|
||||
|
@ -40,9 +40,7 @@ _rwtsswap2
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S04,$69 =
|
||||
!byte $60
|
||||
lda #$04
|
||||
ldx #$7D
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S04,$7D =
|
||||
!byte $60
|
||||
.exit
|
||||
|
@ -46,12 +46,10 @@
|
||||
!byte $23,$2A,$28
|
||||
bcc .variant1 ; passport-test-suite/Creative Contraptions.woz [C=0] matches
|
||||
|
||||
ldy #$03
|
||||
jsr compare
|
||||
!byte $70,$79,$77
|
||||
bcc .variant2 ; passport-test-suite/Wortgefecht.woz [C=0] matches
|
||||
|
||||
ldy #$03
|
||||
jsr compare
|
||||
!byte $23,$2A,$24 ; passport-test-suite/Metric System Tutor.woz [C=0] matches
|
||||
bcc .variant3
|
||||
@ -67,7 +65,7 @@
|
||||
!byte $EA ; NOP
|
||||
!byte $A9,$35 ; LDA #$35
|
||||
ldx #$76
|
||||
ldy #$02
|
||||
dey
|
||||
jsr modify
|
||||
!byte $AA,$A2 ; new JMP entry point ($0900 when decrypted)
|
||||
bvc .nextsector ; always branches
|
||||
@ -79,7 +77,7 @@
|
||||
!byte $EA ; NOP
|
||||
!byte $A9,$27 ; LDA #$27
|
||||
ldx #$76
|
||||
ldy #$02
|
||||
dey
|
||||
jsr modify ; new JMP entry point ($0903 when decrypted)
|
||||
!byte $FA,$F2
|
||||
bvc .nextsector ; always branches
|
||||
@ -91,7 +89,7 @@
|
||||
!byte $EA ; NOP
|
||||
!byte $A9,$27 ; LDA #$27
|
||||
ldx #$76
|
||||
ldy #$02
|
||||
dey
|
||||
jsr modify ; new JMP entry point ($0903 when decrypted)
|
||||
!byte $A9,$A1
|
||||
|
||||
|
@ -67,21 +67,19 @@
|
||||
!byte $D0
|
||||
bcs .exit
|
||||
ldx #$9C
|
||||
ldy #$01
|
||||
jsr compare ; and T00,S03,$9C ==
|
||||
!byte $F0
|
||||
bcs .exit
|
||||
lda #$04
|
||||
ldx #$69
|
||||
ldy #$04
|
||||
tay
|
||||
jsr compare ; and T00,S04,$69 ==
|
||||
!byte $48
|
||||
!byte $A5,$2A
|
||||
!byte $4A
|
||||
bcs .exit
|
||||
lda #$06
|
||||
ldx #$69
|
||||
ldy #$06
|
||||
tay
|
||||
jsr compare ; and T00,S06,$69 ==
|
||||
!byte $4C,$B8,$B6
|
||||
!byte $EA
|
||||
@ -102,14 +100,12 @@
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S03,$40 =
|
||||
!byte $F0
|
||||
lda #$03
|
||||
ldx #$9C
|
||||
ldy #$01
|
||||
jsr modify ; and set T00,S03,$9C =
|
||||
!byte $D0
|
||||
lda #$06
|
||||
ldx #$69
|
||||
ldy #$06
|
||||
tay
|
||||
jsr modify ; and set T00,S06,$69 =
|
||||
!byte $20,$C3,$BC
|
||||
!byte $20,$C3,$BC
|
||||
|
@ -15,9 +15,6 @@
|
||||
jsr compare
|
||||
!byte $4C,$71,$A9 ; JMP $A971
|
||||
bcs .exit
|
||||
lda #$08
|
||||
ldx #$5A
|
||||
ldy #$03
|
||||
jsr modify
|
||||
!byte $48,$A0,$01
|
||||
lda #$06
|
||||
@ -33,7 +30,7 @@
|
||||
and #$7f
|
||||
sta .config
|
||||
lda #$06
|
||||
ldx #$55
|
||||
dex
|
||||
ldy #$01
|
||||
jsr modify
|
||||
.config
|
||||
|
@ -28,11 +28,10 @@
|
||||
jsr PrintByID
|
||||
lda #$01
|
||||
ldx #$81
|
||||
ldy #$01
|
||||
tay
|
||||
jsr modify
|
||||
!byte $2C
|
||||
ldx #$84
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $2C
|
||||
.exit
|
||||
|
@ -73,7 +73,6 @@
|
||||
!byte $D4,$C9,$C1,$C2,$D3,$D2,$C1,$C2
|
||||
rts
|
||||
|
||||
|
||||
.exitwithCR
|
||||
lda #$8D
|
||||
jsr PrintA
|
||||
|
@ -33,7 +33,6 @@
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $A9 ; LDA
|
||||
.exit
|
||||
|
@ -35,7 +35,6 @@
|
||||
jsr modify ; then set T04,S0B,$A2 =
|
||||
!byte $2C
|
||||
ldx #$A7
|
||||
ldy #$01
|
||||
jsr modify ; and set T04,S0B,$A7 =
|
||||
!byte $2C
|
||||
.exit
|
||||
|
Loading…
Reference in New Issue
Block a user