mirror of
https://github.com/a2-4am/passport.git
synced 2025-08-15 15:27:24 +00:00
support EDDs like Neptune
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
; tested on
|
; tested on
|
||||||
; - Choplifter (Broderbund)
|
; - Choplifter (Broderbund)
|
||||||
; - Eggs-It (Gebelli)
|
; - Eggs-It (Gebelli)
|
||||||
|
; - Neptune (Gebelli)
|
||||||
;-------------------------------
|
;-------------------------------
|
||||||
!zone {
|
!zone {
|
||||||
rts ; reachable only via inspect
|
rts ; reachable only via inspect
|
||||||
@@ -131,34 +132,6 @@ ReadChoplifter
|
|||||||
.ignore
|
.ignore
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.readtrack0B
|
|
||||||
|
|
||||||
.checkkey1
|
|
||||||
lda KEY
|
|
||||||
bmi .cancel
|
|
||||||
jsr .readnib
|
|
||||||
- cmp #$DD
|
|
||||||
bne .checkkey1
|
|
||||||
jsr .readnib
|
|
||||||
cmp #$F5
|
|
||||||
bne -
|
|
||||||
jsr .readnib
|
|
||||||
cmp #$D5
|
|
||||||
bne - ; this had the same bug (see below)
|
|
||||||
ldx #$03
|
|
||||||
- jsr .read4x4
|
|
||||||
jsr .read4x4
|
|
||||||
jsr .read4x4
|
|
||||||
sta cmp1+0,x
|
|
||||||
dex
|
|
||||||
bpl -
|
|
||||||
rts
|
|
||||||
|
|
||||||
.checktrack1E
|
|
||||||
cmp #$40
|
|
||||||
bcs .checktrack20
|
|
||||||
rts
|
|
||||||
|
|
||||||
.cancel
|
.cancel
|
||||||
jsr .cleanup
|
jsr .cleanup
|
||||||
jmp Cancel
|
jmp Cancel
|
||||||
@@ -176,53 +149,52 @@ ReadChoplifter
|
|||||||
|
|
||||||
.readtrack
|
.readtrack
|
||||||
stx tmpx
|
stx tmpx
|
||||||
ldx #3
|
ldx #$00
|
||||||
|
- lda .readtracki,x
|
||||||
.retry0
|
sta $2000,x
|
||||||
dex
|
inx
|
||||||
beq .fatal
|
|
||||||
|
|
||||||
.checkkey0
|
|
||||||
lda KEY
|
|
||||||
.linkcancel2
|
|
||||||
bmi .cancel
|
|
||||||
jsr .readnib
|
|
||||||
- cmp cmp2+1
|
|
||||||
bne .checkkey0
|
|
||||||
jsr .readnib
|
|
||||||
cmp cmp2+0
|
|
||||||
bne -
|
bne -
|
||||||
jsr .readnib
|
jsr $2000 ; must run from page-aligned address for precise timing
|
||||||
eor cmp1+1
|
|
||||||
bne - ; this had a bug
|
;back-up in case of read failure
|
||||||
; it branched to the middle nibble instead of the first one
|
|
||||||
; it allowed PR0 PR1 [any] PR1 PR2 instead of requiring PR0 PR1 PR2
|
lda unform+0 ; prologue 2
|
||||||
tay
|
sta cmp2+0
|
||||||
-- jsr .read4x4
|
lda unform+1 ; prologue 1
|
||||||
sta (modsrc), y
|
sta cmp2+1
|
||||||
iny
|
lda prbuf+0 ; epilog
|
||||||
bne --
|
sta cmp1+0
|
||||||
- lda $C0EC
|
lda prbuf+1 ; prologue 3
|
||||||
bpl -
|
sta cmp1+1
|
||||||
cmp cmp1+0
|
|
||||||
bne .retry0
|
|
||||||
inc modsrc+1
|
|
||||||
dec tmpx
|
|
||||||
bne --
|
|
||||||
jsr .readnib
|
|
||||||
sta cmp1+1 ; prologue 3
|
|
||||||
jsr .readnib
|
|
||||||
sta cmp2+0 ; prologue 2
|
|
||||||
jsr .readnib
|
|
||||||
sta cmp2+1 ; prologue 1
|
|
||||||
jsr .readnib
|
|
||||||
sta cmp1+0 ; epilog
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.fatal
|
.readtrack0B
|
||||||
jsr .cleanup
|
|
||||||
; if we get to here, we've
|
.checkkey1
|
||||||
jmp FatalError ; decided the read error is fatal
|
lda KEY
|
||||||
|
bmi .cancel
|
||||||
|
jsr ReadNib
|
||||||
|
- cmp #$DD
|
||||||
|
bne .checkkey1
|
||||||
|
jsr ReadNib
|
||||||
|
cmp #$F5
|
||||||
|
bne -
|
||||||
|
jsr ReadNib
|
||||||
|
cmp #$D5
|
||||||
|
bne - ; this had the same bug (see below)
|
||||||
|
ldx #$03
|
||||||
|
- jsr Read4x4
|
||||||
|
jsr Read4x4
|
||||||
|
jsr Read4x4
|
||||||
|
sta cmp1+0,x
|
||||||
|
dex
|
||||||
|
bpl -
|
||||||
|
rts
|
||||||
|
|
||||||
|
.checktrack1E
|
||||||
|
cmp #$40
|
||||||
|
bcs .checktrack20
|
||||||
|
rts
|
||||||
|
|
||||||
.checktrack20
|
.checktrack20
|
||||||
beq .readtrack20
|
beq .readtrack20
|
||||||
@@ -234,92 +206,152 @@ ReadChoplifter
|
|||||||
ldx #1
|
ldx #1
|
||||||
jsr .readtrack
|
jsr .readtrack
|
||||||
lda (BASEPAGE<<8)+$C5
|
lda (BASEPAGE<<8)+$C5
|
||||||
sta .prolog1+1
|
sta .readtrack20i+.prolog1+1-.reloc
|
||||||
lda (BASEPAGE<<8)+$CC
|
lda (BASEPAGE<<8)+$CC
|
||||||
sta .prolog2+1
|
sta .readtrack20i+.prolog2+1-.reloc
|
||||||
lda (BASEPAGE<<8)+$D3
|
lda (BASEPAGE<<8)+$D3
|
||||||
sta .prolog3+1
|
sta .readtrack20i+.prolog3+1-.reloc
|
||||||
|
ldy #$00
|
||||||
|
- lda .readtrack20i,y
|
||||||
|
sta $2100,y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
ldx #$60
|
||||||
|
jmp $2100 ; must run from page-aligned address for precise timing
|
||||||
|
|
||||||
.checkkey2
|
.readtrack20i !pseudopc $2100 {
|
||||||
lda KEY
|
.reloc
|
||||||
bmi .linkcancel2
|
-- jsr .readnibx
|
||||||
jsr .readnib
|
|
||||||
|
|
||||||
.prolog1
|
.prolog1
|
||||||
- cmp #$D1 ; SMC
|
- cmp #$D1 ; SMC
|
||||||
bne .checkkey2
|
bne --
|
||||||
jsr .readnib
|
jsr .readnibx
|
||||||
.prolog2
|
.prolog2
|
||||||
cmp #$D1 ; SMC
|
cmp #$D1 ; SMC
|
||||||
bne -
|
bne -
|
||||||
jsr .readnib
|
jsr .readnibx
|
||||||
.prolog3
|
.prolog3
|
||||||
eor #$D1 ; SMC
|
cmp #$D1 ; SMC
|
||||||
bne - ; this had the same bug
|
bne - ; this had the same bug
|
||||||
tax
|
|
||||||
-- lda $C0EC ; timing issue requires unrolling part of this
|
-- lda $C0EC ; timing issue requires unrolling part of this
|
||||||
bpl --
|
bpl --
|
||||||
sec
|
sec
|
||||||
rol
|
rol
|
||||||
sta tmp
|
sta tmp
|
||||||
jsr .readnib
|
jsr .readnibx
|
||||||
and tmp
|
and tmp
|
||||||
sta (BASEPAGE+8)<<8,x
|
sta (BASEPAGE+8)<<8,y
|
||||||
inx
|
iny
|
||||||
jsr .read4x4
|
jsr .read4x4x
|
||||||
sta (BASEPAGE+8)<<8,x
|
sta (BASEPAGE+8)<<8,y
|
||||||
inx
|
iny
|
||||||
jsr .readnib
|
jsr .readnibx
|
||||||
sec
|
sec
|
||||||
rol
|
rol
|
||||||
sta tmp
|
sta tmp
|
||||||
- lda $C0EC
|
- lda $C0EC
|
||||||
bpl -
|
bpl -
|
||||||
and tmp
|
and tmp
|
||||||
sta (BASEPAGE+8)<<8,x
|
sta (BASEPAGE+8)<<8,y
|
||||||
inx
|
iny
|
||||||
cmp #$EA
|
cmp #$EA
|
||||||
bne --
|
bne --
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.readtrack22
|
.read4x4x
|
||||||
ldx #$40
|
- lda $C08C,x
|
||||||
ldy #0
|
|
||||||
-- dey
|
|
||||||
bne +
|
|
||||||
dex
|
|
||||||
beq ++
|
|
||||||
+ jsr .readnib
|
|
||||||
- cmp #$D5
|
|
||||||
bne --
|
|
||||||
jsr .readnib
|
|
||||||
cmp #$FF
|
|
||||||
bne -
|
|
||||||
jsr .readnib
|
|
||||||
cmp #$DD
|
|
||||||
bne - ; this had the same bug
|
|
||||||
ldx #$00
|
|
||||||
- jsr .read4x4
|
|
||||||
sta BASEPAGE<<8,x
|
|
||||||
inx
|
|
||||||
bne -
|
|
||||||
++ rts
|
|
||||||
|
|
||||||
.read4x4
|
|
||||||
- lda $C0EC
|
|
||||||
bpl -
|
bpl -
|
||||||
sec
|
sec
|
||||||
rol
|
rol
|
||||||
sta tmp
|
sta tmp
|
||||||
- lda $C0EC
|
- lda $C08C,x
|
||||||
bpl -
|
bpl -
|
||||||
and tmp
|
and tmp
|
||||||
rts
|
rts
|
||||||
|
}
|
||||||
|
|
||||||
.readnib
|
.readtrack22
|
||||||
- lda $C0EC
|
ldx #$40
|
||||||
|
ldy #$00
|
||||||
|
-- dey
|
||||||
|
bne +
|
||||||
|
dex
|
||||||
|
beq ++
|
||||||
|
+ ldx #$60
|
||||||
|
jsr .readnibx
|
||||||
|
- cmp #$D5
|
||||||
|
bne --
|
||||||
|
jsr .readnibx
|
||||||
|
cmp #$FF
|
||||||
|
bne -
|
||||||
|
jsr .readnibx
|
||||||
|
cmp #$DD
|
||||||
|
bne - ; this had the same bug
|
||||||
|
ldy #$00
|
||||||
|
- jsr .read4x4x
|
||||||
|
sta BASEPAGE<<8,y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
++ rts
|
||||||
|
|
||||||
|
.readtracki !pseudopc $2000 {
|
||||||
|
ldx #$60
|
||||||
|
.retry
|
||||||
|
lda tmpx
|
||||||
|
sta nibcount
|
||||||
|
lda modsrc
|
||||||
|
sta moddest
|
||||||
|
lda modsrc+1
|
||||||
|
sta moddest+1
|
||||||
|
ldy #$00
|
||||||
|
--- jsr .readnibx
|
||||||
|
-- cmp cmp2+1
|
||||||
|
bne ---
|
||||||
|
jsr .readnibx
|
||||||
|
- cmp cmp2+0
|
||||||
|
bne --
|
||||||
|
jsr .readnibx
|
||||||
|
cmp cmp1+1
|
||||||
|
bne - ; this has a bug which is also present in the original code
|
||||||
|
; it branches to the middle nibble instead of the first one
|
||||||
|
; it allows PR0 PR1 [any] PR1 PR2 instead of requiring PR0 PR1 PR2
|
||||||
|
-- lda $C08C,x
|
||||||
|
bpl --
|
||||||
|
rol
|
||||||
|
sta tmp
|
||||||
|
- lda $C08C,x
|
||||||
|
bpl -
|
||||||
|
and tmp
|
||||||
|
sta (moddest), y
|
||||||
|
iny
|
||||||
|
bne --
|
||||||
|
asl $C000
|
||||||
|
- lda $C08C,x
|
||||||
|
bpl -
|
||||||
|
cmp cmp1+0
|
||||||
|
bne .retry
|
||||||
|
inc modsrc+1
|
||||||
|
dec nibcount
|
||||||
|
bne --
|
||||||
|
jsr .readnibx
|
||||||
|
sta prbuf+1 ; prologue 3
|
||||||
|
jsr .readnibx
|
||||||
|
sta unform+0 ; prologue 2
|
||||||
|
jsr .readnibx
|
||||||
|
sta unform+1 ; prologue 1
|
||||||
|
jsr .readnibx
|
||||||
|
sta prbuf+0 ; epilog
|
||||||
|
jsr .readnibx
|
||||||
|
cmp unform+1 ; trailer epilog
|
||||||
|
bne .retry
|
||||||
|
rts
|
||||||
|
|
||||||
|
.readnibx
|
||||||
|
- lda $C08C,x
|
||||||
bpl -
|
bpl -
|
||||||
rts
|
rts
|
||||||
|
}
|
||||||
|
|
||||||
.inittable
|
.inittable
|
||||||
ldy #$08
|
ldy #$08
|
||||||
|
@@ -280,7 +280,7 @@ StringTableHigh
|
|||||||
; can be set directly before calling PrintByID.
|
; can be set directly before calling PrintByID.
|
||||||
;
|
;
|
||||||
.header
|
.header
|
||||||
!text "Passport by 4am 2019-04-20",$00
|
!text "Passport by 4am 2019-04-23",$00
|
||||||
.mainmenu
|
.mainmenu
|
||||||
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
||||||
!text " "
|
!text " "
|
||||||
|
Reference in New Issue
Block a user