Now supporting multi-floppy mode.

This commit is contained in:
Martin Haye 2017-01-11 19:02:31 -08:00
parent 6e47f62e84
commit 99f9f9f35c
4 changed files with 58 additions and 33 deletions

View File

@ -2623,6 +2623,9 @@ end
def dst = new File("game.2mg")
Files.copy(new GZIPInputStream(new FileInputStream(jitCopy(new File("build/data/disks/base_800k.2mg.gz")))), dst.toPath())
// Now put the files into the image
String[] args = ["-put", "game.2mg", "/", "build/root"]
new a2copy.A2Copy().main(args)
}
def createFloppyImages()
@ -2650,7 +2653,6 @@ end
// Now put the files into the image
String[] args = ["-put", "game${i}.dsk", "/", "build/root${i}"]
println args.join(" ")
new a2copy.A2Copy().main(args)
}
}

View File

@ -8,7 +8,7 @@
;place no code before init label below.
;user-defined options
verbose_info = 1 ;set to 1 to enable display of memory usage
verbose_info = 0 ;set to 1 to enable display of memory usage
enable_floppy = 1 ;set to 1 to enable floppy drive support
poll_drive = 1 ;set to 1 to check if disk is in drive
override_adr = 1 ;set to 1 to require an explicit load address
@ -111,6 +111,11 @@
tmptrk = $1e ;(internal) temporary copy of current track
phase = $1f ;(internal) current phase for seek
} ;enable_floppy
!if poll_drive = 1 {
retstk = $48
failctlo = $49
failcthi = $4A
} ;poll_drive
;constants
cmdseek = 0 ;requires enable_seek=1
@ -171,9 +176,6 @@ init jsr SETVID
sta unrdrvoff2 + 1
tax
inx ;MOTORON
!if poll_drive = 1 {
stx unrdrvon1 + 1
} ;poll_drive
stx unrdrvon2 + 1
inx ;DRV0EN
!if allow_multi = 1 {
@ -181,11 +183,10 @@ init jsr SETVID
} ;allow_multi
inx
inx ;Q6L
stx unrread1 + 1
!if poll_drive = 1 {
stx unrread2 + 1
stx unrread3 + 1
stx unrread0 + 1
} ;poll_drive
stx unrread1 + 1
stx unrread4 + 1
stx unrread5 + 1
!if check_chksum = 1 {
@ -419,6 +420,10 @@ rdwrpart jmp rdwrfile
;self-modified by init code
opendir
!if poll_drive = 1 {
tsx
stx retstk
} ;poll_drive
unrblocklo = unrelocdsk + (* - reloc)
ldx #2
unrblockhi = unrelocdsk + (* - reloc)
@ -489,6 +494,10 @@ savetype
} ;might_exist
!if (might_exist + poll_drive) > 0 {
nodisk
!if poll_drive = 1 {
ldx retstk
txs
} ;poll_drive
unrdrvoff1=unrelocdsk+(*-reloc)
lda MOTOROFF
inc status
@ -1000,6 +1009,10 @@ step1 !byte 1, $30, $28, $24, $20, $1e, $1d, $1c
step2 !byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c
readadr
!if poll_drive {
lda #0
sta failcthi
} ;poll_drive
- jsr readd5aa
cmp #$96
bne -
@ -1015,7 +1028,19 @@ readadr
seekret rts
readd5aa
!if poll_drive {
unrread0 = unrelocdsk + (* - reloc)
-- lda Q6L
bmi +
inc failctlo
bne --
inc failcthi
bne --
jmp nodisk
+
} else {
-- jsr readnib
}
- cmp #$d5
bne --
jsr readnib
@ -1042,19 +1067,8 @@ unrdrvsel = unrelocdsk + (* - reloc)
} ;allow_multi
!if poll_drive = 1 {
sty status
unrdrvon1 = unrelocdsk + (* - reloc)
ldy MOTORON
unrread2 = unrelocdsk + (* - reloc)
- ldy Q6L
bpl -
unrread3 = unrelocdsk + (* - reloc)
- cpy Q6L
bne readdirsec
inc status
bne -
pla
pla
jmp nodisk
sty failctlo
sty failcthi
} ;poll_drive
readdirsec

View File

@ -27,8 +27,8 @@
; Constants
MAX_SEGS = 96
DEBUG = 1
SANITY_CHECK = 1 ; also prints out request data
DEBUG = 0
SANITY_CHECK = 0 ; also prints out request data
; Zero page temporary variables
tmp = $2 ; len 2
@ -144,16 +144,15 @@ relocate:
lda #>brkHandler
sta $FFFF
; Place the bulk of the memory manager code into the LC
ldx #>hiMemBegin
.cpmm stx .ld4+2
ldx #>(hiMemEnd-hiMemBegin+$FF)
.ld4 lda hiMemBegin,y
.st4 sta $D000,y
iny
bne .ld4
inc .ld4+2
inc .st4+2
inx
cpx #>(hiMemEnd+$100)
bne .cpmm
dex
bne .ld4
; fall through into init...
;------------------------------------------------------------------------------
@ -1115,6 +1114,7 @@ setMarkPos: !fill 3
nSegsQueued: !byte 0
bufferDigest: !fill 4
diskActState: !byte 0
floppyDrive: !byte 0
;------------------------------------------------------------------------------
; Heap management variables
@ -1947,8 +1947,10 @@ openPartition: !zone
; Make sure to read header into main mem, even if outer cmd is aux
lda isAuxCmd
pha
lda #0
.retry lda #0
sta isAuxCmd ; header buf always in main mem
lda floppyDrive
sta .origFloppy
; complete the partition file name, changing "1" to "2" if opening partition 2.
.mkname lda curPartition
bne +
@ -1969,11 +1971,12 @@ openPartition: !zone
sta reqLen
lda #0
sta reqLen+1
lda #cmdread ; no hi bit => go to drive 1
lda #cmdread
ora floppyDrive ; $80 for drive 2
sta tmp
clc
jsr callProRWTS ; opendir
bne .insert ; status: zero=ok, 1=err
bne .flip ; status: zero=ok, 1=err
sta curMarkPos+1 ; by opening we did an implicit seek to zero
sta curMarkPos+2
lda #2 ; and then we read 2 bytes
@ -1996,6 +1999,11 @@ openPartition: !zone
pla
sta isAuxCmd ; back to aux if that's what outer was using
rts
.flip lda floppyDrive
eor #$80
sta floppyDrive
cmp .origFloppy
bne .open
; ask user to insert the disk
; TODO: handle dual drive configuration
.insert +safeHome
@ -2008,7 +2016,8 @@ openPartition: !zone
+waitKey
+safeHome
bit $c050
jmp .open ; try again
jmp .retry ; try again
.origFloppy: !byte 0
;------------------------------------------------------------------------------
sequenceError: !zone
@ -2903,4 +2912,4 @@ tableEnd = *
}
} ; end of !pseudopc $D000
hiMemEnd = *
hiMemEnd = *