mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
Moved ProRWTS to aux LC. Also getting further in boot seq now.
This commit is contained in:
parent
410ba2238f
commit
3123bdd903
Binary file not shown.
|
@ -30,6 +30,7 @@
|
|||
;but limits file size to 64k-2 bytes.
|
||||
load_high = 0 ;set to 1 to load to top of RAM (either main or banked, enables a himem check)
|
||||
load_banked = 1 ;set to 1 to load into banked RAM instead of main RAM
|
||||
load_auxbnk = 1 ;set to 1 to load into AUX banked RAM
|
||||
lc_bank = 1 ;load into specified bank (1 or 2) if load_banked=1
|
||||
|
||||
;user-defined driver load address
|
||||
|
@ -40,7 +41,7 @@
|
|||
reloc = $fb00 ;page-aligned, as high as possible, the ideal value will be shown on mismatch
|
||||
} ;PASS2
|
||||
} else { ;load_high
|
||||
reloc = $f600 ;page-aligned, but otherwise wherever you want
|
||||
reloc = $d000 ;page-aligned, but otherwise wherever you want
|
||||
} ;load_high
|
||||
} else { ;load_banked
|
||||
!if load_high = 1 {
|
||||
|
@ -87,11 +88,11 @@
|
|||
|
||||
entries = $18 ;(internal) total number of entries in directory
|
||||
!if bounds_check = 1 {
|
||||
bleftlo = $19 ;(internal) bytes left in file
|
||||
blefthi = $1a ;(internal) bytes left in file
|
||||
bleftlo = $1b ;(internal) bytes left in file
|
||||
blefthi = $1c ;(internal) bytes left in file
|
||||
} ;bounds_check
|
||||
blkofflo = $1b ;(internal) offset within cache block
|
||||
blkoffhi = $1c ;(internal) offset within cache block
|
||||
blkofflo = $19 ;(internal) offset within cache block
|
||||
blkoffhi = $1a ;(internal) offset within cache block
|
||||
!if enable_floppy = 1 {
|
||||
step = $1d ;(internal) state for stepper motor
|
||||
tmptrk = $1e ;(internal) temporary copy of current track
|
||||
|
@ -132,6 +133,7 @@
|
|||
LCBANK2 = $c089
|
||||
CLRAUXRD = $c002
|
||||
CLRAUXWR = $c004
|
||||
CLRAUXZP = $c008
|
||||
|
||||
init jsr SETVID
|
||||
jsr SETKBD
|
||||
|
@ -299,6 +301,9 @@ ifoundname iny
|
|||
tya
|
||||
set_slot sta slot + 2
|
||||
sta unrentry + 2
|
||||
!if load_auxbnk = 1 {
|
||||
sta CLRAUXZP+1
|
||||
}
|
||||
!if enable_floppy = 1 {
|
||||
ldx #>unrelocdsk
|
||||
ldy #<unrelocdsk
|
||||
|
@ -359,7 +364,7 @@ reladr sta reloc, y
|
|||
iny
|
||||
+ inx
|
||||
bpl --
|
||||
++ rts
|
||||
++
|
||||
} else { ;enable_floppy
|
||||
slot lda $cfff
|
||||
sta unrentry + 1
|
||||
|
@ -389,8 +394,11 @@ slot lda $cfff
|
|||
sta reloc + hack, y
|
||||
iny
|
||||
bne -
|
||||
rts
|
||||
} ;enable_floppy
|
||||
!if load_auxbnk = 1 {
|
||||
sta CLRAUXZP
|
||||
}
|
||||
rts
|
||||
|
||||
c7_parms !byte 1
|
||||
!word $200
|
||||
|
|
|
@ -58,12 +58,10 @@ cmdread = 1
|
|||
cmdwrite = 2
|
||||
|
||||
; ProRWTS locations
|
||||
reseek_0 = $18 ; to reset seek ptr, zero out these 3 locs
|
||||
reseek_1 = $1B
|
||||
reseek_2 = $1C
|
||||
proRWTS = $F600
|
||||
rdwrpart = proRWTS
|
||||
opendir = rdwrpart+3
|
||||
rwts_mark0 = $18 ; to reset seek ptr, zero out these 3 locs
|
||||
rwts_mark1 = $1B
|
||||
rwts_mark2 = $1C
|
||||
proRWTS = $D000
|
||||
|
||||
; Memory buffers
|
||||
fileBuf = $4000 ; len $400
|
||||
|
@ -118,17 +116,17 @@ relocate:
|
|||
bne .lold
|
||||
; verify that aux mem exists
|
||||
inx
|
||||
stx $D000
|
||||
stx $E000
|
||||
sei ; disable interrupts while in aux
|
||||
sta setAuxZP
|
||||
inx
|
||||
stx $D000
|
||||
cpx $D000
|
||||
stx $E000
|
||||
cpx $E000
|
||||
sta clrAuxZP
|
||||
cli
|
||||
bne .noaux
|
||||
dex
|
||||
cpx $D000
|
||||
cpx $E000
|
||||
beq .gotaux
|
||||
.noaux jsr inlineFatal : !text "AuxMemReq",0
|
||||
; Copy the 6502 ROM vectors
|
||||
|
@ -428,6 +426,41 @@ brkHandler:
|
|||
bit $c054
|
||||
_jbrk jmp $1111 ; self-modified by init
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Call to ProRWTS in the aux LC
|
||||
; Parameters in zero page locs $2-$F.
|
||||
; Clear carry to call opendir, set carry to call rdwrpart
|
||||
; On return, A contains status (for opendir only)
|
||||
callProRWTS:
|
||||
; Copy the parameters to aux zero page
|
||||
ldx #$F
|
||||
- sta clrAuxZP
|
||||
lda 0,x
|
||||
sta setAuxZP
|
||||
sta 0,x
|
||||
dex
|
||||
bpl -
|
||||
bcc +
|
||||
jsr proRWTS ; rdwrpart
|
||||
jmp ++
|
||||
+ jsr proRWTS+3 ; opendir
|
||||
++ ; grab the status code and we're done
|
||||
lda tmp+1
|
||||
sta clrAuxZP
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
disk_rewind: !zone
|
||||
lda #0
|
||||
ldx #2 ; clear all 24 bits
|
||||
- sta setAuxZP
|
||||
sta rwts_mark0,x ; rewind the ProRWTS seek pointer
|
||||
sta clrAuxZP
|
||||
sta curMarkPos,x ; reset our record of the current mark
|
||||
dex
|
||||
bpl -
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Utility routine for convenient assembly routines in PLASMA code.
|
||||
; Params: Y=number of parameters passed from PLASMA routine
|
||||
|
@ -1943,9 +1976,9 @@ openPartition: !zone
|
|||
sta reqLen+1
|
||||
lda #cmdread ; no hi bit => go to drive 1
|
||||
sta tmp
|
||||
jsr opendir
|
||||
lda tmp+1 ; get status
|
||||
bne .insert ; zero=ok, 1=err
|
||||
clc
|
||||
jsr callProRWTS ; opendir
|
||||
bne .insert ; 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
|
||||
|
@ -1962,7 +1995,8 @@ openPartition: !zone
|
|||
sta pDst
|
||||
lda #>(headerBuf+2)
|
||||
sta pDst+1
|
||||
jsr disk_read
|
||||
lda #cmdread
|
||||
jsr readAndAdj
|
||||
inc partFileOpen ; remember we've opened it now
|
||||
rts
|
||||
; ask user to insert the disk
|
||||
|
@ -2089,17 +2123,30 @@ disk_queueLoad: !zone
|
|||
+ jmp .scan ; go for more
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
disk_rewind: !zone
|
||||
rts
|
||||
readAndAdj:
|
||||
sta tmp ; store cmd num
|
||||
sec ; calling rdwrpart (not opendir)
|
||||
jsr callProRWTS ; and seek or read on the underlying file
|
||||
; Advance our record of the mark position by the specified # of bytes.
|
||||
; reqLen is still intact, because ProRWTS changes its copy in aux zp only
|
||||
lda curMarkPos
|
||||
clc
|
||||
adc reqLen
|
||||
sta curMarkPos
|
||||
lda curMarkPos+1
|
||||
adc reqLen+1
|
||||
sta curMarkPos+1
|
||||
bcc +
|
||||
inc curMarkPos+2
|
||||
+ rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
disk_seek: !zone
|
||||
lda #cmdseek
|
||||
sta tmp
|
||||
lda setMarkPos
|
||||
sec
|
||||
sbc curMarkPos
|
||||
sta reqLen
|
||||
tax
|
||||
lda setMarkPos+1
|
||||
sbc curMarkPos+1
|
||||
sta reqLen+1
|
||||
|
@ -2107,65 +2154,31 @@ disk_seek: !zone
|
|||
sbc curMarkPos+2
|
||||
bcc .back
|
||||
bne .far
|
||||
ldx #2 ; record the new position
|
||||
- lda setMarkPos,x
|
||||
sta curMarkPos,x
|
||||
dex
|
||||
bpl -
|
||||
jmp rdwrpart ; and seek on the underlying file
|
||||
.back lda #0
|
||||
sta reseek_0 ; rewind the ProRWTS seek pointer
|
||||
sta reseek_1
|
||||
sta reseek_2
|
||||
sta curMarkPos
|
||||
sta curMarkPos+1
|
||||
sta curMarkPos+2
|
||||
txa ; check for already there
|
||||
ora reqLen+1
|
||||
bne .go
|
||||
rts
|
||||
.go lda #cmdseek
|
||||
jmp readAndAdj
|
||||
.back jsr disk_rewind
|
||||
beq disk_seek ; always taken
|
||||
.far +internalErr '+' ; for now
|
||||
lda #$FF ; seek forward $FFFF bytes
|
||||
.far lda #$FF ; seek forward $FFFF bytes
|
||||
sta reqLen
|
||||
sta reqLen+1
|
||||
jsr rdwrpart
|
||||
lda #$FF
|
||||
tax
|
||||
jsr adjMark
|
||||
jmp disk_seek
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
adjMark: !zone
|
||||
clc
|
||||
adc curMarkPos
|
||||
sta curMarkPos
|
||||
txa
|
||||
adc curMarkPos+1
|
||||
sta curMarkPos+1
|
||||
bcc +
|
||||
inc curMarkPos+2
|
||||
+ rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
disk_read: !zone
|
||||
lda #cmdread
|
||||
sta tmp
|
||||
lda reqLen
|
||||
pha
|
||||
lda reqLen+1
|
||||
pha
|
||||
jsr rdwrpart
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
jmp adjMark
|
||||
jsr .go
|
||||
jmp disk_seek ; and try again
|
||||
.done rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
disk_finishLoad: !zone
|
||||
lda nSegsQueued ; see if we actually queued anything
|
||||
beq .done ; if nothing queued, we're done
|
||||
jsr disk_rewind ; ProRWTS' file position may have been overwritten; reset it.
|
||||
lda headerBuf ; grab # header bytes
|
||||
sta setMarkPos ; set to start reading at first non-header byte in file
|
||||
lda headerBuf+1 ; hi byte too
|
||||
sta setMarkPos+1
|
||||
lda #0
|
||||
lda #0 ; hi-hi byte (it's a 24 bit quantity altogether)
|
||||
sta setMarkPos+2
|
||||
sta .nFixups ; might as well clear fixup count while we're at it
|
||||
jsr startHeaderScan ; start scanning the partition header
|
||||
|
@ -2229,7 +2242,8 @@ disk_finishLoad: !zone
|
|||
lda tSegAdrHi,x ; hi byte too
|
||||
sta pDst+1
|
||||
!if DEBUG { jsr .debug2 }
|
||||
jsr disk_read
|
||||
lda #cmdread
|
||||
jsr readAndAdj
|
||||
;jsr lz4Decompress ; decompress (or copy if uncompressed)
|
||||
.resume ldy .ysave
|
||||
.next lda (pTmp),y ; lo byte of length
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
;10/14 v.24 input a single char
|
||||
;10/27 v.25 comments updated
|
||||
|
||||
* = $E000
|
||||
|
||||
; Use hi-bit ASCII for Apple II
|
||||
!convtab "../include/hiBitAscii.ct"
|
||||
|
||||
|
@ -47,6 +45,9 @@
|
|||
!source "../include/global.i"
|
||||
!source "../include/mem.i"
|
||||
!source "../include/plasma.i"
|
||||
!source "../include/fontEngine.i"
|
||||
|
||||
* = fontEngine
|
||||
|
||||
DEBUG = 0 ; 1=some logging, 2=lots of logging
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
; by Andrew Hogan
|
||||
;
|
||||
|
||||
fontEngine = $E000
|
||||
fontEngine = $EC00
|
||||
SetFont = fontEngine
|
||||
SetWindow = SetFont+3
|
||||
ClearWindow = SetWindow+3
|
||||
|
|
|
@ -47,30 +47,8 @@ pTmp = $4
|
|||
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copy entire heap (main LC $EF00.FAFF) to or from main low mem $5000.5BFF
|
||||
asm copyHeap // params: dir (0=LCtoMain, 1=MainToLC)
|
||||
+asmPlasm 1
|
||||
lsr ; direction bit to carry flag
|
||||
lda #$50
|
||||
bcs +
|
||||
lda #$EF ; $EF00 is start of heap (right after font engine)
|
||||
+ sta tmp+1
|
||||
eor #$BF ; $EF -> $50
|
||||
sta pTmp+1
|
||||
ldy #0
|
||||
sty tmp
|
||||
sty pTmp
|
||||
ldx #12 ; Heap is 12 pages
|
||||
- lda (tmp),y
|
||||
sta (pTmp),y
|
||||
iny
|
||||
bne -
|
||||
inc tmp+1
|
||||
inc pTmp+1
|
||||
dex
|
||||
bne -
|
||||
rts
|
||||
def copyHeap(dir)
|
||||
fatal("TODO: reimpl with copyMem")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
const seed = $4E // Incremented continuously by keyboard read routine
|
||||
const displayEngine = $6000 // main mem (raycaster and tile engine at same location)
|
||||
const expandVec = $200 // aux mem (only for raycaster)
|
||||
const fontEngine = $E000 // main mem
|
||||
const fontEngine = $EC00 // main mem LC
|
||||
const fontEngineLen = $F00 // really a bit less, but this leaves space for debug code
|
||||
const fontData = $FB00 // main mem LC
|
||||
const fontDataLen = $4FA // really only $474, but we need to fill all gaps
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Other constants
|
||||
|
@ -221,6 +224,47 @@ asm swapTile // params: fromX, fromY, toX, toY
|
|||
jmp $6024
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export asm memcpy // params: pSrc, pDst, len. Non-overlapping only!
|
||||
+asmPlasm 3
|
||||
lda evalStkL+2,x ; source ptr
|
||||
sta tmp
|
||||
lda evalStkH+2,x
|
||||
sta tmp+1
|
||||
lda evalStkL+1,x ; dest ptr
|
||||
sta pTmp
|
||||
lda evalStkH+1,x
|
||||
sta pTmp+1
|
||||
lda evalStkH,x ; len hi
|
||||
pha
|
||||
lda evalStkL,x ; len lo
|
||||
tax
|
||||
ldy #0
|
||||
.pglup:
|
||||
pla
|
||||
sec
|
||||
sbc #1
|
||||
bcc .part
|
||||
pha
|
||||
- lda (tmp),y
|
||||
sta (pTmp),y
|
||||
iny
|
||||
bne -
|
||||
inc tmp+1
|
||||
inc pTmp+1
|
||||
bne .pglup ; always taken
|
||||
.part:
|
||||
cpx #0
|
||||
beq .done
|
||||
- lda (tmp),y
|
||||
sta (pTmp),y
|
||||
iny
|
||||
dex
|
||||
bne -
|
||||
.done
|
||||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
asm readAuxByte // params: ptr; ret: char
|
||||
+asmPlasm 1
|
||||
|
@ -2261,7 +2305,7 @@ end
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load and display the title screen.
|
||||
def loadTitle()
|
||||
word pFont
|
||||
word pEngine, pFont
|
||||
|
||||
puts("Loading game.\n")
|
||||
|
||||
|
@ -2276,21 +2320,30 @@ def loadTitle()
|
|||
^$C07E=0 // disable double-hi-res
|
||||
^$C05F // disable double-hi-res
|
||||
|
||||
// Load the font engine and its font, and lock them in place forever.
|
||||
// Allocate and permanently lock mem for the font engine and its font
|
||||
mmgr(SET_MEM_TARGET, fontEngine)
|
||||
mmgr(QUEUE_LOAD, CODE_FONT_ENGINE<<8 | RES_TYPE_CODE)
|
||||
mmgr(REQUEST_MEMORY, fontEngineLen)
|
||||
mmgr(LOCK_MEMORY, fontEngine)
|
||||
|
||||
mmgr(SET_MEM_TARGET, $9000)
|
||||
mmgr(SET_MEM_TARGET, fontData)
|
||||
mmgr(REQUEST_MEMORY, fontDataLen)
|
||||
mmgr(LOCK_MEMORY, fontData)
|
||||
|
||||
// Load them into lo mem
|
||||
pEngine = mmgr(QUEUE_LOAD, CODE_FONT_ENGINE<<8 | RES_TYPE_CODE)
|
||||
pFont = mmgr(QUEUE_LOAD, 1<<8 | RES_TYPE_FONT)
|
||||
mmgr(LOCK_MEMORY, pFont)
|
||||
mmgr(FINISH_LOAD, 0)
|
||||
|
||||
// Tell the font engine where to find its font
|
||||
setFont(pFont)
|
||||
// Relocate them to their final spots
|
||||
memcpy(pEngine, fontEngine, fontEngineLen)
|
||||
memcpy(pFont, fontData, fontDataLen)
|
||||
|
||||
// Wait for a key.
|
||||
//getUpperKey()
|
||||
// And free up the low mem
|
||||
mmgr(FREE_MEMORY, pEngine)
|
||||
mmgr(FREE_MEMORY, pFont)
|
||||
|
||||
// Tell the font engine where to find its font
|
||||
setFont(fontData)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -60,7 +60,7 @@ const HEAP_INTERN = $23
|
|||
const HEAP_COLLECT = $24
|
||||
|
||||
// Heap location in memory
|
||||
const HEAP_BOTTOM = $EF00
|
||||
const HEAP_BOTTOM = $E000
|
||||
const HEAP_SIZE = $C00
|
||||
|
||||
// Event code
|
||||
|
|
Loading…
Reference in New Issue
Block a user