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

View File

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

View File

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

View File

@ -8,6 +8,7 @@
; tested on
; - Choplifter (Broderbund)
; - Eggs-It (Gebelli)
; - Neptune (Gebelli)
;-------------------------------
!zone {
rts ; reachable only via inspect
@ -131,34 +132,6 @@ ReadChoplifter
.ignore
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
jsr .cleanup
jmp Cancel
@ -176,53 +149,54 @@ ReadChoplifter
.readtrack
stx tmpx
ldx #3
.retry0
dex
beq .fatal
.checkkey0
lda KEY
.linkcancel2
bmi .cancel
jsr .readnib
- cmp cmp2+1
bne .checkkey0
jsr .readnib
cmp cmp2+0
ldx #$00
- lda .readtracki,x
sta $2000,x
inx
bne -
jsr .readnib
eor cmp1+1
bne - ; this had a bug
; it branched to the middle nibble instead of the first one
; it allowed PR0 PR1 [any] PR1 PR2 instead of requiring PR0 PR1 PR2
tay
-- jsr .read4x4
sta (modsrc), y
iny
bne --
- lda $C0EC
bpl -
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
jsr $2000 ; must run from page-aligned address for precise timing
;back-up in case of read failure
lda unform+0 ; prologue 2
sta cmp2+0
lda unform+1 ; prologue 1
sta cmp2+1
lda prbuf+0 ; epilog
sta cmp1+0
lda prbuf+1 ; prologue 3
sta cmp1+1
lda moddest+1
sta modsrc+1
rts
.fatal
jsr .cleanup
; if we get to here, we've
jmp FatalError ; decided the read error is fatal
.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
.checktrack20
beq .readtrack20
@ -234,92 +208,152 @@ ReadChoplifter
ldx #1
jsr .readtrack
lda (BASEPAGE<<8)+$C5
sta .prolog1+1
sta .readtrack20i+.prolog1+1-.reloc
lda (BASEPAGE<<8)+$CC
sta .prolog2+1
sta .readtrack20i+.prolog2+1-.reloc
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
lda KEY
bmi .linkcancel2
jsr .readnib
.readtrack20i !pseudopc $2100 {
.reloc
-- jsr .readnibx
.prolog1
- cmp #$D1 ; SMC
bne .checkkey2
jsr .readnib
bne --
jsr .readnibx
.prolog2
cmp #$D1 ; SMC
bne -
jsr .readnib
jsr .readnibx
.prolog3
eor #$D1 ; SMC
cmp #$D1 ; SMC
bne - ; this had the same bug
tax
-- lda $C0EC ; timing issue requires unrolling part of this
bpl --
sec
rol
sta tmp
jsr .readnib
jsr .readnibx
and tmp
sta (BASEPAGE+8)<<8,x
inx
jsr .read4x4
sta (BASEPAGE+8)<<8,x
inx
jsr .readnib
sta (BASEPAGE+8)<<8,y
iny
jsr .read4x4x
sta (BASEPAGE+8)<<8,y
iny
jsr .readnibx
sec
rol
sta tmp
- lda $C0EC
bpl -
and tmp
sta (BASEPAGE+8)<<8,x
inx
sta (BASEPAGE+8)<<8,y
iny
cmp #$EA
bne --
rts
.readtrack22
ldx #$40
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
.read4x4x
- lda $C08C,x
bpl -
sec
rol
sta tmp
- lda $C0EC
- lda $C08C,x
bpl -
and tmp
rts
}
.readnib
- lda $C0EC
.readtrack22
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 -
rts
}
.inittable
ldy #$08

View File

@ -280,7 +280,7 @@ StringTableHigh
; can be set directly before calling PrintByID.
;
.header
!text "Passport by 4am 2019-04-20",$00
!text "Passport by 4am 2019-04-24",$00
.mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " "