Merge pull request #8 from peterferrie/master

boot13
This commit is contained in:
4am 2019-03-13 08:14:57 -04:00 committed by GitHub
commit 8d79f6cf62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 197 additions and 48 deletions

View File

@ -35,7 +35,6 @@
MLI = $BF00
KEY = $C000
STROBE = $C010
REBOOT = $FAA6
TEXT = $FB2F
HOME = $FC58
COUT = $FDED
@ -71,35 +70,46 @@ Boot
jsr HOME
ldx #$00
- lda $C600,x
sta $1600,x
sta $8600,x
inx
bne -
lda $165C
lda $865C
cmp #$80
bne +
lda #$18
sta $865C
lda #$08
sta $165D
lda #$B7
sta $16A5
sta $865D
lda #$F7
sta $8666
lda #$D9
sta $8682
lda #$BE
sta $869D
ldx #$B8
stx $86A3
dex
stx $86A5
+ lda #<Tracer
ldx #>Tracer
ldy $16F8
ldy $86F8
cpy #$4C
bne @iigs
; entry point for Disk II controller
sta $16F9 ; lo byte of callback
stx $16FA ; hi byte of callback
jmp $1600
sta $86F9 ; lo byte of callback
stx $86FA ; hi byte of callback
beq @tryboot
@iigs
ldy $16FB
ldy $86FB
cpy #$4C
bne RebootImmediately
bne @unknowncontroller
; entry point for IIgs smart controller
sta $16FC ; lo byte of callback
stx $16FD ; hi byte of callback
jmp $1600
sta $86FC ; lo byte of callback
stx $86FD ; hi byte of callback
@tryboot
jmp IDBoot
@unknowncontroller
jmp RebootImmediately
jmp $C600
Tracer
jsr IDBroderbund
@ -111,21 +121,7 @@ Tracer
jsr IDSirius
bcc BeginTheBoot
; [execution falls through here]
Unsupported
lda $C082
lda $C0E8
jsr TEXT
jsr HOME
lda #s_header
jsr PrintByID
lda #s_unsupported
jsr PrintByID
bit STROBE
- lda KEY
bpl -
bit STROBE
RebootImmediately
jmp REBOOT
; [and runs anyway]
BeginTheBoot
sec ;match boot-time flags and registers
@ -162,13 +158,11 @@ PrintByID
;
s_header = $00
s_mainmenu = $01
s_unsupported =$02
STRINGCOUNT = $03
STRINGCOUNT = $02
StringTable
!word @header
!word @mainmenu
!word @unsupported
@header
!text "Anti-M v1.1-dev by 4am 2019-03-12"
@ -178,12 +172,10 @@ StringTable
!text " Insert original disk in slot 6 drive 1",$8D
!text $8D
!text " and press <RETURN> to boot",$00
@unsupported
!text $8D
!text " Unsupported game (sorry)",$00
!src "src/compare.a"
!src "src/idbroderbund.a"
!src "src/idspiradisc.a"
!src "src/ididsi.a"
!src "src/idsirius.a"
!src "src/idboot.a"

156
src/idboot.a Normal file
View File

@ -0,0 +1,156 @@
; Bootsector tracer
; written by qkumba
;
IDBoot
; try to determine sector type based on found boot sector
lda #$60
sta $867B
jsr $8600
bcc +
-- lda #$90
sta $867B
; found D5 AA 96 T00S00 D5 AA AD, proceed as 16-sector
- clc
jmp $865D
; found D5 AA not-96
; check for out-of-order D5 AA AD
+ cmp #$AD
beq --
; otherwise, loop in case we will see D5 AA B5
cmp #$B5
bne -
; found D5 AA B5, assume 13-sector
lda #$90
sta $867B
; build 5-and-3 decoder table
ldx #$00
ldy #$AB
- tya
sta $3C
lsr
ora $3C
cmp #$FF
bne +
cpy #$D5
beq +
txa
asl
asl
asl
sta $300,y
inx
+ iny
bne -
; patch boot PROM to recognise 13-sector instead
lda #$B5
sta $8677
lda #$9A
sta $86A7
sty $86B0
inc $86B1
sty $86C2
inc $86C3
sty $86D1
inc $86D2
- lda @decode53,y
sta $86D5,y
iny
bne -
lda #$02
sta $27
sty $42
lda #$08
ldx #<@callback53
ldy #>@callback53
- sta $43
stx $44
sty $45
clc
jmp @run53
@callback53
lda $8FF
lsr
lsr
lsr
tay
iny
sty @patch53+1
ldx #0
ldy $8FE
iny
tya
bne -
@decode53 !pseudopc $16D5 {
@decode53x
ldx #$32
ldy #$00
- lda $300,x
lsr
lsr
lsr
sta $3C
lsr
sta $2A
lsr
ora $200,x
sta ($42),y
iny
lda $333,x
lsr
lsr
lsr
lsr
rol $3C
lsr
rol $2A
ora $233,x
sta ($42),y
iny
lda $366,x
lsr
lsr
lsr
lsr
rol $3C
lsr
rol $2A
ora $266,x
sta ($42),y
iny
lda $2A
and #7
ora $299,x
sta ($42),y
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)
}

View File

@ -66,10 +66,10 @@ IDBroderbund
bne @maybeDMM
lda $0302
cmp #$2E
bne @unsupported
bne @runanyway
lda $0303
cmp #$9A
bne @unsupported
bne @runanyway
;
; found Choplifter protection
;
@ -94,17 +94,18 @@ IDBroderbund
sta $0326
lda #>@choplifterCallback
sta $0327
@runanyway
jmp $0301
@maybeDMM
cmp #$8C
bne @unsupported
bne @runanyway
lda $030B
cmp #$4D
bne @unsupported
bne @runanyway
lda $0323
cmp #$60
bne @unsupported
bne @runanyway
;
; found David's Midnight Magic protection
;
@ -127,10 +128,6 @@ IDBroderbund
lda #>@DMMCallback
sta $0323
jmp $0301
; TODO
@unsupported
jmp Unsupported
@copyChoplifter
!pseudopc $1700 {
@ -249,18 +246,19 @@ IDBroderbund
ldx #<@BugAttackCallback
ldy #>@BugAttackCallback
cmp #$A1
bne +
bne @jmpdos
@hookhybrid
lda #$4C
sta $33C
stx $33D
sty $33E
@jmpdos
jmp $301
@maybeQuadrant
cmp #$3B
bne +
bne @jmpdos
lda #$4C xor $99
sta $39A
lda #<@QuadrantCallback xor $99

View File

@ -39,4 +39,7 @@ IDSpiraDisc
sta $B606
lda #$24
sta $B60A
; and slot checksum-failure branching
lda #$FD
sta $BF41
+ jmp $B800