support Personal Software titles

This commit is contained in:
Peter Ferrie 2019-11-04 20:49:32 -08:00
parent 7658093d78
commit c4ff7c504f
3 changed files with 198 additions and 134 deletions

View File

@ -199,6 +199,19 @@ BeginTheBoot
ldx #$60 ldx #$60
jmp $0801 jmp $0801
Tracer13
jsr PatchBoot13
jsr IDPersonal
bcc BeginTheBoot13
jsr IDBoot13
bcc BeginTheBoot13
; [execution falls through here]
; [and runs anyway]
BeginTheBoot13
ldy $0300
jmp $0301
PrintByID PrintByID
cmp #STRINGCOUNT cmp #STRINGCOUNT
bcs @exit bcs @exit
@ -240,7 +253,7 @@ StringTable
!word @mainmenu !word @mainmenu
@header @header
!text "Anti-M v1.6-pre by 4am 2019-09-05" !text "Anti-M v1.6-pre by 4am 2019-11-04"
!text "________________________________________",$8D !text "________________________________________",$8D
!text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D,$00 !text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D,$00
@mainmenu @mainmenu
@ -256,3 +269,4 @@ StringTable
!src "src/idboot.a" !src "src/idboot.a"
!src "src/idprodos.a" !src "src/idprodos.a"
!src "src/idprogame.a" !src "src/idprogame.a"
!src "src/idpersonal.a"

View File

@ -37,138 +37,95 @@ IDBoot
sta $867B sta $867B
; build 5-and-3 decoder table ; build 5-and-3 decoder table
ldx #$00 ldx #$20 ;now you know why the boot PROM
ldy #$AB ldy #$00 ;starts with these magic values
- tya -- lda #$03
sta $3C sta $3C
lsr clc
ora $3C dey
cmp #$FF tya
bne + - bit $3C
beq --
rol $3C
bcc -
cpy #$D5 cpy #$D5
beq + beq --
dex
txa txa
asl sta $800,y
asl bne --
asl
sta $300,y
inx
+ iny
bne -
; patch boot PROM to recognise 13-sector instead ; patch boot PROM to recognise 13-sector instead
lda #$B5 ldy #$B5
sta $8677 sty $8677
lda #$9A dec $86A1
sta $86A7 ldy #$9A
sty $86B0 sty $86A7
inc $86B1 sta $86B0
sty $86C2 ldy #$08
inc $86C3 sty $86B1
sty $86D1 sty $86B7
inc $86D2 sta $86C2
- lda @decode53,y sty $86C3
sta $86D5,y sta $86D1
lda @decode53+$100,y sty $86D2
sta $86D5+$100,y - lda @decode53,x
iny sta $86D5,x
lda @decode53 + $100,x
sta $86D5 + $100,x
inx
bne - bne -
lda #$02 lda #$03
sta $27 sta $27
sty $42 sta $2A
lda #$08 ldx #$60
ldx #<@callback53 jsr $865D
ldy #>@callback53 jmp $86D6
- sta $43
stx $44
sty $45
clc
jmp @run53
@callback53
lda $8FF
lsr
lsr
lsr
tay
iny
sty @patch53+1
ldy $8FE
tya
pha
lda #$FF
pha
iny
tya
ldx #<@callback53_2
ldy #>@callback53_2
bne -
@decode53 !pseudopc $86D5 { @decode53 !pseudopc $86D5 {
@decode53x @decode53x
ldx #$32 rts
ldy #$00 tay
- lda $300,x -- ldx #$00
lsr - lda $800,y
lsr lsr
rol $3CC,x
lsr lsr
rol $399,x
sta $3C sta $3C
lsr lda ($26),y
sta $2A asl
lsr asl
ora $200,x asl
sta ($42),y ora $3C
sta ($26),y
iny iny
lda $333,x inx
lsr cpx #$33
lsr bne -
lsr dec $2A
lsr bne --
rol $3C cpy $300
lsr - bne -
rol $2A jmp Tracer13
ora $233,x
sta ($42),y IDBoot13
iny lda $33C
lda $366,x cmp #$AD
lsr sec
lsr bne +
lsr lda #$4C
lsr sta $33C
rol $3C lda $33D
lsr sta @dispatch+1
rol $2A lda #<@callback53
ora $266,x sta $33D
sta ($42),y lda $33E
iny sta @dispatch+2
lda $2A lda #>@callback53
and #7 sta $33E
ora $299,x clc
sta ($42),y + rts
iny
lda $3C
and #7
ora $2CC,x
sta ($42),y
iny
dex
bpl -
lda $399
lsr
lsr
lsr
ora $2FF
sta ($42),y
inc $3D
inc $43
lda $3D
@patch53
cmp #$01
@run53
ldx #$60
bcs +
jmp $865D
+ jmp ($44)
@CompareMemoryRel @CompareMemoryRel
sta cmp1+1 sta cmp1+1
@ -201,9 +158,10 @@ IDBoot
.success clc .success clc
lda cmp1+1 lda cmp1+1
ldx cmp1 ldx cmp1
@skip2
rts rts
@callback53_2 @callback53
lda $85FF lda $85FF
beq @skip2 beq @skip2
lda #$29 lda #$29
@ -215,8 +173,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notinfocom bcs @notinfocom
inc $296F inc $296F
@skip2 jmp @dispatch
rts
@notinfocom @notinfocom
lda #$3D lda #$3D
@ -228,8 +185,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32a bcs @notdos32a
inc $3D60 inc $3D60
ldx #$60 jmp @dispatch
rts
@notdos32a @notdos32a
lda #$BD lda #$BD
@ -241,8 +197,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32b bcs @notdos32b
inc $BD6F inc $BD6F
ldx #$60 jmp @dispatch
rts
@notdos32b @notdos32b
lda #$3D lda #$3D
@ -254,8 +209,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32c bcs @notdos32c
inc $3D6F inc $3D6F
ldx #$60 jmp @dispatch
rts
@notdos32c @notdos32c
lda #$BD lda #$BD
@ -267,8 +221,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32d bcs @notdos32d
inc $BD60 inc $BD60
ldx #$60 jmp @dispatch
rts
@notdos32d @notdos32d
lda #$24 lda #$24
@ -280,8 +233,7 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32e bcs @notdos32e
inc $246F inc $246F
ldx #$60 jmp @dispatch
rts
@notdos32e @notdos32e
lda #$7D lda #$7D
@ -293,9 +245,49 @@ IDBoot
!byte $BD,$8B,$C0 ;LDA $C08B,X !byte $BD,$8B,$C0 ;LDA $C08B,X
bcs @notdos32f bcs @notdos32f
inc $7D60 inc $7D60
ldx #$60 jmp @dispatch
rts
@notdos32f @notdos32f
@dispatch
lda $d1d1 ;SMC
pha
lda #$ff
pha
ldx #$60
rts rts
} }
PatchBoot13
lda #3
ldx #$1B
ldy #8
jsr CompareMemory
!byte $4A ;LSR
!byte $4A ;LSR
!byte $4A ;LSR
!byte $4A ;LSR
!byte $09,$C0 ;ORA #$C0
!byte $85,$3F ;STA $3F
bcs @retry
lda #$80
sta $320
bcc @exit
@retry
lda #3
ldx #$25
ldy #8
jsr CompareMemory
!byte $4A ;LSR
!byte $4A ;LSR
!byte $4A ;LSR
!byte $4A ;LSR
!byte $09,$C0 ;ORA #$C0
!byte $85,$3F ;STA $3F
bcs @exit
lda #$80
sta $32A
@exit
rts

58
src/idpersonal.a Normal file
View File

@ -0,0 +1,58 @@
; Personal Software tracer
; written by qkumba
;
; tested on
; - MicroChess
; - Gammon Gambler
; - Checker King
IDPersonal
lda #3
ldx #$3C
ldy #7
jsr CompareMemory
!byte $AD,$CC,$03 ;LDA $03CC
!byte $EA ;NOP
!byte $4C,$A5,$03 ;JMP $03A5
bcs @not_microchess
; patch code to regain control after decryption
lda #<@callback_microchess
sta $3bf
lda #>@callback_microchess
sta $3c0
@exit
rts
@callback_microchess
lda $85ff
beq +
inc $35c1
+ jmp $3500
@not_microchess
lda #3
ldx #$46
ldy #9
jsr CompareMemory
!byte $AD,$BB,$03 ;LDA $03BB
!byte $85,$3F ;STA $3F
!byte $E6,$3F ;INC $3F
!byte $A0,$4E ;LDY #$4E
bcs @exit2
; patch code to regain control after decryption
lda #$4c
sta $346
lda #<@callback_gammon
sta $347
lda #>@callback_gammon
sta $348
@exit2
rts
@callback_gammon
lda $85ff
beq +
inc $ba2
+ jmp $b00