mirror of
https://github.com/a2-4am/4cade.git
synced 2024-06-01 23:41:39 +00:00
.
This commit is contained in:
parent
d2b049233d
commit
45901afa57
1
Makefile
1
Makefile
|
@ -29,6 +29,7 @@ dsk: md asm
|
||||||
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "build/LAUNCHER.SYSTEM" >>build/log
|
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "build/LAUNCHER.SYSTEM" >>build/log
|
||||||
$(CADIUS) CREATEFOLDER build/"$(DISK)" "/${VOLUME}/X/" >>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/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" >>build/log
|
||||||
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER.A2FC" >>build/log
|
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER.A2FC" >>build/log
|
||||||
rsync -aP res/hgr/* build/I >>build/log
|
rsync -aP res/hgr/* build/I >>build/log
|
||||||
|
|
|
@ -6,4 +6,4 @@ import os.path
|
||||||
|
|
||||||
indir = sys.argv[1]
|
indir = sys.argv[1]
|
||||||
with open(os.path.join(indir, "_FileInformation.txt"), "w") as writer:
|
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)]))
|
||||||
|
|
|
@ -3,3 +3,4 @@ LAUNCHER.SYSTEM=Type(FF),AuxType(2000),Access(C3)
|
||||||
COVER=Type(06),AuxType(2000),Access(C3)
|
COVER=Type(06),AuxType(2000),Access(C3)
|
||||||
COVER.A2FC=Type(06),AuxType(2000),Access(C3)
|
COVER.A2FC=Type(06),AuxType(2000),Access(C3)
|
||||||
GAMES.CONF=Type(04),AuxType(4000),Access(C3)
|
GAMES.CONF=Type(04),AuxType(4000),Access(C3)
|
||||||
|
ATTRACT.CONF=Type(04),AuxType(4000),Access(C3)
|
||||||
|
|
80
src/4cade.a
80
src/4cade.a
|
@ -53,13 +53,31 @@
|
||||||
FirstMover
|
FirstMover
|
||||||
!pseudopc $D000 {
|
!pseudopc $D000 {
|
||||||
!zone
|
!zone
|
||||||
|
Reenter ; self-running demos should call this to exit back to 4cade
|
||||||
|
; TODO
|
||||||
Start
|
Start
|
||||||
jsr LoadFile
|
jsr LoadFile ; load games list from file
|
||||||
- !word gamesconf
|
!word kGameListConfFile
|
||||||
|
|
||||||
jsr ParseGamesList
|
jsr ParseGamesList ; parse games list
|
||||||
!word gGamesListStore
|
!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
|
jsr okvs_iter_values
|
||||||
!word gGamesListStore
|
!word gGamesListStore
|
||||||
|
@ -82,54 +100,22 @@ HGRLoad
|
||||||
jsr FizzleHGR
|
jsr FizzleHGR
|
||||||
@exit rts
|
@exit rts
|
||||||
|
|
||||||
ShowCover
|
kGameListConfFile
|
||||||
bit MachineStatus
|
!byte @kGameListConfFile_e-@kGameListConfFile_b
|
||||||
bvs @Load128
|
@kGameListConfFile_b
|
||||||
|
|
||||||
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
|
|
||||||
!text "GAMES.CONF"
|
!text "GAMES.CONF"
|
||||||
gamesconf_e
|
@kGameListConfFile_e
|
||||||
cover64
|
kAttractModeConfFile
|
||||||
!byte cover64_e-cover64_b
|
!byte @kAttractModeConfFile_e-@kAttractModeConfFile_b
|
||||||
cover64_b
|
@kAttractModeConfFile_b
|
||||||
!text "COVER"
|
!text "ATTRACT.CONF"
|
||||||
cover64_e
|
@kAttractModeConfFile_e
|
||||||
cover128
|
|
||||||
!byte cover128_e-cover128_b
|
|
||||||
cover128_b
|
|
||||||
!text "COVER.A2FC"
|
|
||||||
cover128_e
|
|
||||||
; these routines will only be called after relocating to language card
|
; these routines will only be called after relocating to language card
|
||||||
!source "src/prodos.path.a"
|
!source "src/prodos.path.a"
|
||||||
!source "src/glue.prorwts2.a"
|
!source "src/glue.prorwts2.a"
|
||||||
!source "src/okvs.a"
|
!source "src/okvs.a"
|
||||||
|
!source "src/parse.common.a"
|
||||||
!source "src/parse.games.a"
|
!source "src/parse.games.a"
|
||||||
!source "src/fx.hgr.fizzle.a"
|
!source "src/fx.hgr.fizzle.a"
|
||||||
!source "src/fx.dhgr.fizzle.a"
|
!source "src/fx.dhgr.fizzle.a"
|
||||||
|
|
129
src/parse.common.a
Normal file
129
src/parse.common.a
Normal 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
|
|
@ -110,20 +110,3 @@ ParseGamesList
|
||||||
cmp #$0D ; CR
|
cmp #$0D ; CR
|
||||||
bne @skipLine
|
bne @skipLine
|
||||||
beq @newkey ; always branches
|
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
39
src/unused.a
Normal 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
|
Loading…
Reference in New Issue
Block a user