mirror of
https://github.com/a2-4am/anti-m.git
synced 2024-06-02 00:41:34 +00:00
Merge pull request #1 from peterferrie/master
support SpiraDisc, extend interface
This commit is contained in:
commit
301b78c0c1
|
@ -15,6 +15,12 @@ Tested (Gebelli):
|
|||
- Russki Duck
|
||||
- Zenith
|
||||
|
||||
Tested (Sierra):
|
||||
- Frogger
|
||||
- Jawbreaker ][
|
||||
- Lunar Leepers
|
||||
- Pest Patrol
|
||||
|
||||
Untested (Gebelli):
|
||||
- Lazer Silk
|
||||
|
||||
|
@ -30,10 +36,6 @@ Do not work yet:
|
|||
- Shuffleboard (IDSI)
|
||||
- Trick Shot (IDSI)
|
||||
- Quadrant 6112 (Sensible Software)
|
||||
- Frogger (Sierra)
|
||||
- Jawbreaker ][ (Sierra)
|
||||
- Lunar Leepers (Sierra)
|
||||
- Pest Patrol (Sierra)
|
||||
- Beer Run (Sirius)
|
||||
- Gamma Goblins (Sirius)
|
||||
- Orbitron (Sirius)
|
||||
|
|
90
src/anti-m.a
90
src/anti-m.a
|
@ -40,6 +40,10 @@ TEXT = $FB2F
|
|||
HOME = $FC58
|
||||
COUT = $FDED
|
||||
|
||||
cmp1 = $F8 ; word
|
||||
cmp2 = $FA ; word
|
||||
tmp = $FC ; byte
|
||||
|
||||
jsr TEXT
|
||||
jsr HOME
|
||||
|
||||
|
@ -65,18 +69,13 @@ MainMenu
|
|||
!byte $04,$00,$00,$00,$00,$00,$00
|
||||
|
||||
Boot
|
||||
ldx #0
|
||||
- lda Tracer,x
|
||||
sta $1700,x
|
||||
inx
|
||||
bne -
|
||||
ldx #$00
|
||||
- lda $C600,x
|
||||
sta $1600,x
|
||||
inx
|
||||
bne -
|
||||
lda #$00
|
||||
ldx #$17
|
||||
lda #<Tracer
|
||||
ldx #>Tracer
|
||||
ldy $16F8
|
||||
cpy #$4C
|
||||
bne @iigs
|
||||
|
@ -96,67 +95,18 @@ Boot
|
|||
jmp REBOOT
|
||||
|
||||
Tracer
|
||||
!pseudopc $1700 {
|
||||
; patch code to regain control after it loads 1 sector into $0300
|
||||
lda #<@callback1
|
||||
sta $0838
|
||||
lda #>@callback1
|
||||
sta $0839
|
||||
jsr IDAntiM
|
||||
bcc @jmpboot
|
||||
jsr IDSpiraDisc
|
||||
bcc @jmpboot
|
||||
;... others ...
|
||||
|
||||
@jmpboot
|
||||
sec ;match boot-time flags and registers
|
||||
lda #1
|
||||
ldy #0
|
||||
ldx #$60
|
||||
jmp $0801
|
||||
@callback1
|
||||
; duplicate bootloader from $0300 to $0200
|
||||
ldx #$00
|
||||
- lda $0300,x
|
||||
sta $0200,x
|
||||
inx
|
||||
bne -
|
||||
; patch bootloader so it reads the pristine copy at $0200
|
||||
dec $030A
|
||||
dec $0310
|
||||
dec $0316
|
||||
dec $031C
|
||||
; patch bootloader to regain control after it decrypts itself into $0100
|
||||
lda #$4C
|
||||
sta $0325
|
||||
lda #<@callback2
|
||||
sta $0326
|
||||
lda #>@callback2
|
||||
sta $0327
|
||||
jmp $0301
|
||||
@callback2
|
||||
; patch bootloader to regain control after it loads 4 sectors into $0400
|
||||
lda #$4C
|
||||
sta $01FB
|
||||
lda #<@callback3
|
||||
sta $01FC
|
||||
lda #>@callback3
|
||||
sta $01FD
|
||||
rts
|
||||
@callback3
|
||||
; patch bootloader so it doesn't wipe main memory
|
||||
lda #$60
|
||||
sta $04E2
|
||||
; patch bootloader to regain control after it loads title screen and code into $2000+
|
||||
lda #$4C
|
||||
sta $0498
|
||||
lda #<@callback4
|
||||
sta $0499
|
||||
lda #>@callback4
|
||||
sta $049A
|
||||
; restore bytes on stack page that we patched earlier because they're checksummed soon
|
||||
lda #$AE
|
||||
sta $01FB
|
||||
lda #$65
|
||||
sta $01FC
|
||||
lda #$05
|
||||
sta $01FD
|
||||
jmp $01FB
|
||||
@callback4
|
||||
; patch bootloader to bypass ROM check at $6300
|
||||
lda #$60
|
||||
sta $0421
|
||||
jmp $0400
|
||||
}
|
||||
|
||||
PrintByID
|
||||
cmp #STRINGCOUNT
|
||||
|
@ -199,4 +149,8 @@ StringTable
|
|||
!text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
||||
!text " Insert original disk in slot 6 drive 1",$8D
|
||||
!text $8D
|
||||
!text " and press <RETURN> to boot",$00
|
||||
!text " and press <RETURN> to boot",$8D,$00
|
||||
|
||||
!src "src/compare.a"
|
||||
!src "src/idantim.a"
|
||||
!src "src/idspira.a"
|
||||
|
|
53
src/compare.a
Normal file
53
src/compare.a
Normal file
|
@ -0,0 +1,53 @@
|
|||
WILDCARD = $97
|
||||
|
||||
;-------------------------------
|
||||
; CompareMemory subroutine
|
||||
; in: A = page
|
||||
; X = offset
|
||||
; Y = string length
|
||||
; stack = string to compare
|
||||
; #WILDCARD in search string matches any 1 byte
|
||||
; (like "." character in regular expressions)
|
||||
; out: C clear if string matches
|
||||
; or set if not matched
|
||||
; A,X unchanged
|
||||
; Y clobbered
|
||||
; $tmp zero page clobbered
|
||||
; $cmp1 zero page clobbered
|
||||
; $cmp2 zero page clobbered
|
||||
; stack set to first instruction after string
|
||||
;-------------------------------
|
||||
!zone {
|
||||
CompareMemory
|
||||
sta cmp1+1
|
||||
stx cmp1
|
||||
pla
|
||||
sta cmp2
|
||||
pla
|
||||
sta cmp2+1
|
||||
tax
|
||||
tya
|
||||
clc
|
||||
adc cmp2
|
||||
bcc +
|
||||
inx
|
||||
+ sta tmp
|
||||
txa
|
||||
pha
|
||||
lda tmp
|
||||
pha
|
||||
.cmp
|
||||
lda (cmp2),y
|
||||
dey
|
||||
bmi .success
|
||||
cmp (cmp1),y
|
||||
beq .cmp
|
||||
cmp #WILDCARD
|
||||
beq .cmp
|
||||
sec
|
||||
!byte $24 ; hide CLC
|
||||
.success clc
|
||||
lda cmp1+1
|
||||
ldx cmp1
|
||||
rts
|
||||
}
|
81
src/idantim.a
Normal file
81
src/idantim.a
Normal file
|
@ -0,0 +1,81 @@
|
|||
IDAntiM
|
||||
lda #8
|
||||
ldx #1
|
||||
ldy #11
|
||||
jsr CompareMemory
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $BD,$00,$08 ;LDA $0800,X
|
||||
!byte $9D,$00,$02 ;STA $0200,X
|
||||
!byte $E8 ;INX
|
||||
!byte $D0,$F7 ;BNE *-7
|
||||
bcs @exit
|
||||
|
||||
; patch code to regain control after it loads 1 sector into $0300
|
||||
lda #<@callback1
|
||||
sta $0838
|
||||
lda #>@callback1
|
||||
sta $0839
|
||||
|
||||
@exit
|
||||
rts
|
||||
|
||||
@callback1
|
||||
; duplicate bootloader from $0300 to $0200
|
||||
ldx #$00
|
||||
- lda $0300,x
|
||||
sta $0200,x
|
||||
inx
|
||||
bne -
|
||||
- lda @copysrc,x
|
||||
sta $1700,x
|
||||
inx
|
||||
bne -
|
||||
; patch bootloader so it reads the pristine copy at $0200
|
||||
dec $030A
|
||||
dec $0310
|
||||
dec $0316
|
||||
dec $031C
|
||||
; patch bootloader to regain control after it decrypts itself into $0100
|
||||
lda #$4C
|
||||
sta $0325
|
||||
lda #<@callback2
|
||||
sta $0326
|
||||
lda #>@callback2
|
||||
sta $0327
|
||||
jmp $0301
|
||||
@copysrc
|
||||
!pseudopc $1700 {
|
||||
@callback2
|
||||
; patch bootloader to regain control after it loads 4 sectors into $0400
|
||||
lda #$4C
|
||||
sta $01FB
|
||||
lda #<@callback3
|
||||
sta $01FC
|
||||
lda #>@callback3
|
||||
sta $01FD
|
||||
rts
|
||||
@callback3
|
||||
; patch bootloader so it doesn't wipe main memory
|
||||
lda #$60
|
||||
sta $04E2
|
||||
; patch bootloader to regain control after it loads title screen and code into $2000+
|
||||
lda #$4C
|
||||
sta $0498
|
||||
lda #<@callback4
|
||||
sta $0499
|
||||
lda #>@callback4
|
||||
sta $049A
|
||||
; restore bytes on stack page that we patched earlier because they're checksummed soon
|
||||
lda #$AE
|
||||
sta $01FB
|
||||
lda #$65
|
||||
sta $01FC
|
||||
lda #$05
|
||||
sta $01FD
|
||||
jmp $01FB
|
||||
@callback4
|
||||
; patch bootloader to bypass ROM check at $6300
|
||||
lda #$60
|
||||
sta $0421
|
||||
jmp $0400
|
||||
}
|
36
src/idspira.a
Normal file
36
src/idspira.a
Normal file
|
@ -0,0 +1,36 @@
|
|||
;-------------------------------
|
||||
; SpiraDisc support
|
||||
; written by qkumba
|
||||
; supports:
|
||||
;
|
||||
; Frogger
|
||||
; Jawbreaker ][
|
||||
; Lunar Leepers
|
||||
; Pest Patrol
|
||||
|
||||
IDSpiraDisc
|
||||
lda #8
|
||||
ldx #1
|
||||
ldy #12
|
||||
jsr CompareMemory
|
||||
!byte $86,$0A ;STA $0A
|
||||
!byte $8E,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!byte $8E,WILDCARD,WILDCARD ;STA $xxxx
|
||||
!byte $90,$78 ;BCC *+$7A
|
||||
!byte $D0,$01 ;BNE *+$03
|
||||
bcs @exit
|
||||
|
||||
; patch code to regain control after it loads sectors into $B500+
|
||||
lda #<@callback1
|
||||
sta $0870
|
||||
lda #>@callback1
|
||||
sta $0871
|
||||
|
||||
@exit
|
||||
rts
|
||||
|
||||
@callback1
|
||||
; disable ROM checksum-failure branching
|
||||
lda #0
|
||||
sta $B845
|
||||
jmp $B800
|
Loading…
Reference in New Issue
Block a user