mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-05 01:28:57 +00:00
Now supporting multi-floppy mode.
This commit is contained in:
parent
6e47f62e84
commit
99f9f9f35c
@ -2623,6 +2623,9 @@ end
|
|||||||
def dst = new File("game.2mg")
|
def dst = new File("game.2mg")
|
||||||
Files.copy(new GZIPInputStream(new FileInputStream(jitCopy(new File("build/data/disks/base_800k.2mg.gz")))), dst.toPath())
|
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()
|
def createFloppyImages()
|
||||||
@ -2650,7 +2653,6 @@ end
|
|||||||
|
|
||||||
// Now put the files into the image
|
// Now put the files into the image
|
||||||
String[] args = ["-put", "game${i}.dsk", "/", "build/root${i}"]
|
String[] args = ["-put", "game${i}.dsk", "/", "build/root${i}"]
|
||||||
println args.join(" ")
|
|
||||||
new a2copy.A2Copy().main(args)
|
new a2copy.A2Copy().main(args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -8,7 +8,7 @@
|
|||||||
;place no code before init label below.
|
;place no code before init label below.
|
||||||
|
|
||||||
;user-defined options
|
;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
|
enable_floppy = 1 ;set to 1 to enable floppy drive support
|
||||||
poll_drive = 1 ;set to 1 to check if disk is in drive
|
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
|
override_adr = 1 ;set to 1 to require an explicit load address
|
||||||
@ -111,6 +111,11 @@
|
|||||||
tmptrk = $1e ;(internal) temporary copy of current track
|
tmptrk = $1e ;(internal) temporary copy of current track
|
||||||
phase = $1f ;(internal) current phase for seek
|
phase = $1f ;(internal) current phase for seek
|
||||||
} ;enable_floppy
|
} ;enable_floppy
|
||||||
|
!if poll_drive = 1 {
|
||||||
|
retstk = $48
|
||||||
|
failctlo = $49
|
||||||
|
failcthi = $4A
|
||||||
|
} ;poll_drive
|
||||||
|
|
||||||
;constants
|
;constants
|
||||||
cmdseek = 0 ;requires enable_seek=1
|
cmdseek = 0 ;requires enable_seek=1
|
||||||
@ -171,9 +176,6 @@ init jsr SETVID
|
|||||||
sta unrdrvoff2 + 1
|
sta unrdrvoff2 + 1
|
||||||
tax
|
tax
|
||||||
inx ;MOTORON
|
inx ;MOTORON
|
||||||
!if poll_drive = 1 {
|
|
||||||
stx unrdrvon1 + 1
|
|
||||||
} ;poll_drive
|
|
||||||
stx unrdrvon2 + 1
|
stx unrdrvon2 + 1
|
||||||
inx ;DRV0EN
|
inx ;DRV0EN
|
||||||
!if allow_multi = 1 {
|
!if allow_multi = 1 {
|
||||||
@ -181,11 +183,10 @@ init jsr SETVID
|
|||||||
} ;allow_multi
|
} ;allow_multi
|
||||||
inx
|
inx
|
||||||
inx ;Q6L
|
inx ;Q6L
|
||||||
stx unrread1 + 1
|
|
||||||
!if poll_drive = 1 {
|
!if poll_drive = 1 {
|
||||||
stx unrread2 + 1
|
stx unrread0 + 1
|
||||||
stx unrread3 + 1
|
|
||||||
} ;poll_drive
|
} ;poll_drive
|
||||||
|
stx unrread1 + 1
|
||||||
stx unrread4 + 1
|
stx unrread4 + 1
|
||||||
stx unrread5 + 1
|
stx unrread5 + 1
|
||||||
!if check_chksum = 1 {
|
!if check_chksum = 1 {
|
||||||
@ -419,6 +420,10 @@ rdwrpart jmp rdwrfile
|
|||||||
;self-modified by init code
|
;self-modified by init code
|
||||||
|
|
||||||
opendir
|
opendir
|
||||||
|
!if poll_drive = 1 {
|
||||||
|
tsx
|
||||||
|
stx retstk
|
||||||
|
} ;poll_drive
|
||||||
unrblocklo = unrelocdsk + (* - reloc)
|
unrblocklo = unrelocdsk + (* - reloc)
|
||||||
ldx #2
|
ldx #2
|
||||||
unrblockhi = unrelocdsk + (* - reloc)
|
unrblockhi = unrelocdsk + (* - reloc)
|
||||||
@ -489,6 +494,10 @@ savetype
|
|||||||
} ;might_exist
|
} ;might_exist
|
||||||
!if (might_exist + poll_drive) > 0 {
|
!if (might_exist + poll_drive) > 0 {
|
||||||
nodisk
|
nodisk
|
||||||
|
!if poll_drive = 1 {
|
||||||
|
ldx retstk
|
||||||
|
txs
|
||||||
|
} ;poll_drive
|
||||||
unrdrvoff1=unrelocdsk+(*-reloc)
|
unrdrvoff1=unrelocdsk+(*-reloc)
|
||||||
lda MOTOROFF
|
lda MOTOROFF
|
||||||
inc status
|
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
|
step2 !byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c
|
||||||
|
|
||||||
readadr
|
readadr
|
||||||
|
!if poll_drive {
|
||||||
|
lda #0
|
||||||
|
sta failcthi
|
||||||
|
} ;poll_drive
|
||||||
- jsr readd5aa
|
- jsr readd5aa
|
||||||
cmp #$96
|
cmp #$96
|
||||||
bne -
|
bne -
|
||||||
@ -1015,7 +1028,19 @@ readadr
|
|||||||
seekret rts
|
seekret rts
|
||||||
|
|
||||||
readd5aa
|
readd5aa
|
||||||
|
!if poll_drive {
|
||||||
|
unrread0 = unrelocdsk + (* - reloc)
|
||||||
|
-- lda Q6L
|
||||||
|
bmi +
|
||||||
|
inc failctlo
|
||||||
|
bne --
|
||||||
|
inc failcthi
|
||||||
|
bne --
|
||||||
|
jmp nodisk
|
||||||
|
+
|
||||||
|
} else {
|
||||||
-- jsr readnib
|
-- jsr readnib
|
||||||
|
}
|
||||||
- cmp #$d5
|
- cmp #$d5
|
||||||
bne --
|
bne --
|
||||||
jsr readnib
|
jsr readnib
|
||||||
@ -1042,19 +1067,8 @@ unrdrvsel = unrelocdsk + (* - reloc)
|
|||||||
} ;allow_multi
|
} ;allow_multi
|
||||||
!if poll_drive = 1 {
|
!if poll_drive = 1 {
|
||||||
sty status
|
sty status
|
||||||
unrdrvon1 = unrelocdsk + (* - reloc)
|
sty failctlo
|
||||||
ldy MOTORON
|
sty failcthi
|
||||||
unrread2 = unrelocdsk + (* - reloc)
|
|
||||||
- ldy Q6L
|
|
||||||
bpl -
|
|
||||||
unrread3 = unrelocdsk + (* - reloc)
|
|
||||||
- cpy Q6L
|
|
||||||
bne readdirsec
|
|
||||||
inc status
|
|
||||||
bne -
|
|
||||||
pla
|
|
||||||
pla
|
|
||||||
jmp nodisk
|
|
||||||
} ;poll_drive
|
} ;poll_drive
|
||||||
|
|
||||||
readdirsec
|
readdirsec
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
; Constants
|
; Constants
|
||||||
MAX_SEGS = 96
|
MAX_SEGS = 96
|
||||||
|
|
||||||
DEBUG = 1
|
DEBUG = 0
|
||||||
SANITY_CHECK = 1 ; also prints out request data
|
SANITY_CHECK = 0 ; also prints out request data
|
||||||
|
|
||||||
; Zero page temporary variables
|
; Zero page temporary variables
|
||||||
tmp = $2 ; len 2
|
tmp = $2 ; len 2
|
||||||
@ -144,16 +144,15 @@ relocate:
|
|||||||
lda #>brkHandler
|
lda #>brkHandler
|
||||||
sta $FFFF
|
sta $FFFF
|
||||||
; Place the bulk of the memory manager code into the LC
|
; Place the bulk of the memory manager code into the LC
|
||||||
ldx #>hiMemBegin
|
ldx #>(hiMemEnd-hiMemBegin+$FF)
|
||||||
.cpmm stx .ld4+2
|
|
||||||
.ld4 lda hiMemBegin,y
|
.ld4 lda hiMemBegin,y
|
||||||
.st4 sta $D000,y
|
.st4 sta $D000,y
|
||||||
iny
|
iny
|
||||||
bne .ld4
|
bne .ld4
|
||||||
|
inc .ld4+2
|
||||||
inc .st4+2
|
inc .st4+2
|
||||||
inx
|
dex
|
||||||
cpx #>(hiMemEnd+$100)
|
bne .ld4
|
||||||
bne .cpmm
|
|
||||||
; fall through into init...
|
; fall through into init...
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -1115,6 +1114,7 @@ setMarkPos: !fill 3
|
|||||||
nSegsQueued: !byte 0
|
nSegsQueued: !byte 0
|
||||||
bufferDigest: !fill 4
|
bufferDigest: !fill 4
|
||||||
diskActState: !byte 0
|
diskActState: !byte 0
|
||||||
|
floppyDrive: !byte 0
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Heap management variables
|
; Heap management variables
|
||||||
@ -1947,8 +1947,10 @@ openPartition: !zone
|
|||||||
; Make sure to read header into main mem, even if outer cmd is aux
|
; Make sure to read header into main mem, even if outer cmd is aux
|
||||||
lda isAuxCmd
|
lda isAuxCmd
|
||||||
pha
|
pha
|
||||||
lda #0
|
.retry lda #0
|
||||||
sta isAuxCmd ; header buf always in main mem
|
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.
|
; complete the partition file name, changing "1" to "2" if opening partition 2.
|
||||||
.mkname lda curPartition
|
.mkname lda curPartition
|
||||||
bne +
|
bne +
|
||||||
@ -1969,11 +1971,12 @@ openPartition: !zone
|
|||||||
sta reqLen
|
sta reqLen
|
||||||
lda #0
|
lda #0
|
||||||
sta reqLen+1
|
sta reqLen+1
|
||||||
lda #cmdread ; no hi bit => go to drive 1
|
lda #cmdread
|
||||||
|
ora floppyDrive ; $80 for drive 2
|
||||||
sta tmp
|
sta tmp
|
||||||
clc
|
clc
|
||||||
jsr callProRWTS ; opendir
|
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+1 ; by opening we did an implicit seek to zero
|
||||||
sta curMarkPos+2
|
sta curMarkPos+2
|
||||||
lda #2 ; and then we read 2 bytes
|
lda #2 ; and then we read 2 bytes
|
||||||
@ -1996,6 +1999,11 @@ openPartition: !zone
|
|||||||
pla
|
pla
|
||||||
sta isAuxCmd ; back to aux if that's what outer was using
|
sta isAuxCmd ; back to aux if that's what outer was using
|
||||||
rts
|
rts
|
||||||
|
.flip lda floppyDrive
|
||||||
|
eor #$80
|
||||||
|
sta floppyDrive
|
||||||
|
cmp .origFloppy
|
||||||
|
bne .open
|
||||||
; ask user to insert the disk
|
; ask user to insert the disk
|
||||||
; TODO: handle dual drive configuration
|
; TODO: handle dual drive configuration
|
||||||
.insert +safeHome
|
.insert +safeHome
|
||||||
@ -2008,7 +2016,8 @@ openPartition: !zone
|
|||||||
+waitKey
|
+waitKey
|
||||||
+safeHome
|
+safeHome
|
||||||
bit $c050
|
bit $c050
|
||||||
jmp .open ; try again
|
jmp .retry ; try again
|
||||||
|
.origFloppy: !byte 0
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
sequenceError: !zone
|
sequenceError: !zone
|
||||||
@ -2903,4 +2912,4 @@ tableEnd = *
|
|||||||
}
|
}
|
||||||
|
|
||||||
} ; end of !pseudopc $D000
|
} ; end of !pseudopc $D000
|
||||||
hiMemEnd = *
|
hiMemEnd = *
|
||||||
|
Loading…
Reference in New Issue
Block a user