Merge pull request #79 from peterferrie/master

support EDDs like Neptune
This commit is contained in:
4am 2019-04-24 18:45:35 -04:00 committed by GitHub
commit 9daae4417a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 187 additions and 154 deletions

View File

@ -81,7 +81,7 @@ IsF7F6
tay tay
lda #$19 lda #$19
sta nibcount sta nibcount
- jsr .readnib - jsr ReadNib
cmp #$F7 cmp #$F7
beq + beq +
.restart iny .restart iny
@ -91,28 +91,39 @@ IsF7F6
sec sec
beq .driveoff beq .driveoff
+ +
jsr .readnib jsr ReadNib
cmp #$F6 cmp #$F6
bne .restart bne .restart
jsr .readnib jsr ReadNib
cmp #$EF cmp #$EF
bne .restart bne .restart
jsr .readnib jsr ReadNib
cmp #$EE cmp #$EE
bne .restart bne .restart
jsr .readnib jsr ReadNib
cmp #$AB cmp #$AB
bne .restart bne .restart
clc clc
.driveoff .driveoff
lda $C0E8 lda $C0E8
rts rts
}
.readnib ReadNib
- lda $C0EC - lda $C0EC
bpl - bpl -
rts rts
}
Read4x4
- lda $C0EC
bpl -
sec
rol
sta tmp
- lda $C0EC
bpl -
and tmp
rts
;------------------------------- ;-------------------------------
; SetupF7F6SecondRound ; SetupF7F6SecondRound

View File

@ -366,28 +366,19 @@ VerifyInfocom18
; the issue being that both have a D5 AA AD sequence ; the issue being that both have a D5 AA AD sequence
+ +
- lda $C0EC jsr ReadNib
bpl -
-- cmp #$D5 -- cmp #$D5
bne --- bne ---
- lda $C0EC jsr ReadNib
bpl -
cmp #$AA cmp #$AA
bne -- bne --
- lda $C0EC jsr ReadNib
bpl -
cmp #$B5 ; 13-sector only cmp #$B5 ; 13-sector only
beq .build13 beq .build13
cmp #$AD cmp #$AD
bne -- bne --
- lda $C0EC jsr Read4x4
bpl -
nop
nop ; ignore half of 4x4 track number
- lda $C0EC
bpl - ; ignore half of 4x4 track number
lda #$12 ; all 18 sectors when in verify mode lda #$12 ; all 18 sectors when in verify mode
ldx gIsInfocom18 ldx gIsInfocom18
beq .setcount beq .setcount
@ -469,16 +460,13 @@ read13
dex dex
beq .badread1 beq .badread1
+ +
- lda $C0EC jsr ReadNib
bpl -
-- cmp #$D5 -- cmp #$D5
bne --- bne ---
- lda $C0EC jsr ReadNib
bpl -
cmp #$AA cmp #$AA
bne -- bne --
- lda $C0EC jsr ReadNib
bpl -
cmp #$B5 cmp #$B5
bne + bne +
ldy #$03 ldy #$03

View File

@ -185,12 +185,6 @@ FirstMover
!source "standarddelivery.a" !source "standarddelivery.a"
ResetVector ResetVector
lda #<ResetVector
sta $03F2
lda #>ResetVector
sta $03F3
eor #$A5
sta $03F4
lda $C0E8 lda $C0E8
jsr PR0 jsr PR0
jsr IN0 jsr IN0
@ -200,6 +194,12 @@ ResetVector
sta $C00C sta $C00C
sta $C00E sta $C00E
MainMenu MainMenu
lda #<ResetVector
sta $03F2
lda #>ResetVector
sta $03F3
eor #$A5
sta $03F4
ldx #$FF ldx #$FF
txs txs
jsr ClearScreen jsr ClearScreen

View File

@ -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,54 @@ 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 lda moddest+1
bne .retry0 sta modsrc+1
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 +208,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 moddest+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

View File

@ -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-24",$00
.mainmenu .mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " " !text " "