This commit is contained in:
4am 2018-10-23 15:44:06 -04:00
parent d2b049233d
commit 45901afa57
7 changed files with 204 additions and 65 deletions

View File

@ -29,6 +29,7 @@ dsk: md asm
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "build/LAUNCHER.SYSTEM" >>build/log
$(CADIUS) CREATEFOLDER build/"$(DISK)" "/${VOLUME}/X/" >>build/log
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/GAMES.CONF" >>build/log
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/ATTRACT.CONF" >>build/log
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER" >>build/log
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER.A2FC" >>build/log
rsync -aP res/hgr/* build/I >>build/log

View File

@ -6,4 +6,4 @@ import os.path
indir = sys.argv[1]
with open(os.path.join(indir, "_FileInformation.txt"), "w") as writer:
writer.write("\r\n".join(["%s=Type(06),AuxType(2000),Access(C3)" % f for f in os.listdir(indir)]))
writer.write("\r\n".join(["%s=Type(06),AuxType(4000),Access(C3)" % f for f in os.listdir(indir)]))

View File

@ -3,3 +3,4 @@ LAUNCHER.SYSTEM=Type(FF),AuxType(2000),Access(C3)
COVER=Type(06),AuxType(2000),Access(C3)
COVER.A2FC=Type(06),AuxType(2000),Access(C3)
GAMES.CONF=Type(04),AuxType(4000),Access(C3)
ATTRACT.CONF=Type(04),AuxType(4000),Access(C3)

View File

@ -53,13 +53,31 @@
FirstMover
!pseudopc $D000 {
!zone
Reenter ; self-running demos should call this to exit back to 4cade
; TODO
Start
jsr LoadFile
- !word gamesconf
jsr LoadFile ; load games list from file
!word kGameListConfFile
jsr ParseGamesList
jsr ParseGamesList ; parse games list
!word gGamesListStore
!word -
!word @fileBuffer
+LDAY SRC
+STAY gAttractModeStore ; save pointer to free space for next store
jsr LoadFile ; load attract-mode configuration from file
!word kAttractModeConfFile
jsr ParseKeyValueList ; parse attract-mode configuration
!word gAttractModeStore
!word @fileBuffer
lda #$00
- beq -
@fileBuffer
!word $4000
jsr okvs_iter_values
!word gGamesListStore
@ -82,54 +100,22 @@ HGRLoad
jsr FizzleHGR
@exit rts
ShowCover
bit MachineStatus
bvs @Load128
jsr LoadFile
!word cover64
clc
bcc @Show
@Load128
jsr LoadDHRFile
!word cover128
sta $C000 ; double hi-res mode
sta $C00D
sta $C05E
sta $C001
@Show
sta $C057 ; show graphics page 1 (HGR or DHGR)
sta $C052
sta $C054
sta $C050
bit $C010
- lda $C000
bpl -
bit $C010
rts
gamesconf
!byte gamesconf_e-gamesconf_b
gamesconf_b
kGameListConfFile
!byte @kGameListConfFile_e-@kGameListConfFile_b
@kGameListConfFile_b
!text "GAMES.CONF"
gamesconf_e
cover64
!byte cover64_e-cover64_b
cover64_b
!text "COVER"
cover64_e
cover128
!byte cover128_e-cover128_b
cover128_b
!text "COVER.A2FC"
cover128_e
@kGameListConfFile_e
kAttractModeConfFile
!byte @kAttractModeConfFile_e-@kAttractModeConfFile_b
@kAttractModeConfFile_b
!text "ATTRACT.CONF"
@kAttractModeConfFile_e
; these routines will only be called after relocating to language card
!source "src/prodos.path.a"
!source "src/glue.prorwts2.a"
!source "src/okvs.a"
!source "src/parse.common.a"
!source "src/parse.games.a"
!source "src/fx.hgr.fizzle.a"
!source "src/fx.dhgr.fizzle.a"

129
src/parse.common.a Normal file
View File

@ -0,0 +1,129 @@
;license:MIT
;(c) 2018 by 4am
;
; generic key/value text parser
;
; Public functions:
; - ParseKeyValueList
;
gAttractModeStore
!word $FDFD
gSlideshowStore
!word $FDFD
;------------------------------------------------------------------------------
; ParseKeyValueList
; parse buffer with KEY=VALUE lines of a text file into an okvs
; keys and values limited to 127 characters, which should be enough for anyone
; if '=' is missing, key is kept and value is a 0-length string
; blank lines are ignored
; '#' character at beginning of line is a comment, entire line is ignored
; '[' character at beginning of line exits the parser
;
; in: stack contains 4 bytes of parameters:
; +1 [word] handle to storage space for okvs
; +3 [word] handle to buffer containing contents of text file
; out: all registers and flags clobbered
; $1F00..$1FFF clobbered
; $00/$01 clobbered
; $02/$03 clobbered
; $04/$05 has the address of the next available byte after the okvs
; $FE/$FF clobbered
;------------------------------------------------------------------------------
ParseKeyValueList
+PARAMS_ON_STACK 4
+LDPARAM 1
+STAY @store1
+STAY @store2
+LDPARAM 3
+STAY $FE
ldy #0
lda ($FE),y
pha
iny
lda ($FE),y
tay
pla
sec
sbc #$01
sta $FE
bcs +
dey
+ sty $FF
jsr okvs_init ; reset key/value store
@store1 !word $FDFD ; SMC
ldy #$00 ; index into ($FE) pointing to current character
@newkey ldx #$00 ; X = index into current key
stx gVal ; initialize value length (in case this line has no value)
jsr IncAndGetChar
cmp #$0D ; CR in first position (blank line) -> no key
beq @newkey
cmp #$23 ; '#' starts a comment -> no key, skip to CR
beq @skipLine
cmp #$5B ; '[' ends the parsing
beq .parseKeyValueDone
bne @appendToKey
@gatherKey
jsr IncAndGetChar
cmp #$0D ; CR -> finalize key, no value
beq @finalizeKey
cmp #$3D ; '=' -> finalize key, start gathering value
beq @finalizeKey
@appendToKey
sta gKey,x
inx
bpl @gatherKey
@finalizeKey
stx gKeyLen
cmp #$0D
beq @storeInOKVS
ldx #$00 ; now X = index into the current value
@gatherValue
jsr IncAndGetChar
cmp #$0D ; CR -> finalize value
beq @finalizeValue
sta gVal,x
inx
bpl @gatherValue
@finalizeValue
stx gValLen
@storeInOKVS
tya
pha ; okvs functions clobber everything but we need Y
jsr okvs_append
@store2 !word $FDFD ; SMC
!word gKeyLen
!word gValLen
!byte 0
pla
tay
clc
bcc @newkey ; always branches
@skipLine ; skip to CR
jsr IncAndGetChar
cmp #$0D ; CR
bne @skipLine
beq @newkey ; always branches
;------------------------------------------------------------------------------
; IncAndGetChar
;
; in: Y = index into ($FE)
; ($FE) -> buffer
; out: A contains next byte from buffer
; Y incremented
; $FF possibly incremented
;------------------------------------------------------------------------------
IncAndGetChar
iny
bne +
inc $FF
+ lda ($FE),y
.parseKeyValueDone
rts

View File

@ -110,20 +110,3 @@ ParseGamesList
cmp #$0D ; CR
bne @skipLine
beq @newkey ; always branches
;------------------------------------------------------------------------------
; IncAndGetChar
;
; in: Y = index into ($FE)
; ($FE) -> buffer
; out: A contains next byte from buffer
; Y incremented
; $FF possibly incremented
;------------------------------------------------------------------------------
IncAndGetChar
iny
bne +
inc $FF
+ lda ($FE),y
.parseKeyValueDone
rts

39
src/unused.a Normal file
View File

@ -0,0 +1,39 @@
ShowCover
bit MachineStatus
bvs @Load128
jsr LoadFile
!word cover64
clc
bcc @Show
@Load128
jsr LoadDHRFile
!word cover128
sta $C000 ; double hi-res mode
sta $C00D
sta $C05E
sta $C001
@Show
sta $C057 ; show graphics page 1 (HGR or DHGR)
sta $C052
sta $C054
sta $C050
bit $C010
- lda $C000
bpl -
bit $C010
rts
cover64
!byte cover64_e-cover64_b
cover64_b
!text "COVER"
cover64_e
cover128
!byte cover128_e-cover128_b
cover128_b
!text "COVER.A2FC"
cover128_e