assemble transition effects to separate files and load them on demand

This commit is contained in:
4am 2018-10-29 19:23:43 -04:00
parent ce60795f54
commit 6ed2e7b6f3
19 changed files with 201 additions and 149 deletions

View File

@ -21,6 +21,12 @@ CADIUS=cadius
asm: md
$(ACME) -r build/4cade.lst src/4cade.a
$(ACME) src/fx/fx.hgr.diagonal.a
$(ACME) src/fx/fx.hgr.iris.a
$(ACME) src/fx/fx.hgr.interlock.ud.a
$(ACME) src/fx/fx.hgr.interlock.lr.a
$(ACME) src/fx/fx.hgr.spiral.a
$(ACME) src/fx/fx.hgr.fizzle.a
dsk: md asm
$(CADIUS) CREATEVOLUME build/"$(DISK)" "${VOLUME}" 32766KB >>build/log
@ -30,6 +36,7 @@ dsk: md asm
$(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/FX.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/HGR >>build/log
@ -42,6 +49,8 @@ dsk: md asm
$(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/SS" "build/SS" >>build/log
rsync -aP res/demo/* build/DEMO >>build/log
$(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/DEMO" "build/DEMO" >>build/log
rsync -aP res/fx/* build/FX >>build/log
$(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/FX" "build/FX" >>build/log
# bin/do2po.py res/dsk/ build/po/
# rsync -a res/dsk/*.po build/po/
# bin/extract.py build/po/ | sh >build/log
@ -65,6 +74,7 @@ md:
mkdir -p build/DHGR
mkdir -p build/SS
mkdir -p build/DEMO
mkdir -p build/FX
clean:
rm -rf build/

View File

@ -4,3 +4,4 @@ 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)
FX.CONF=Type(04),AuxType(4000),Access(C3)

View File

@ -1 +1 @@
# # Mega-Attract-Mode configuration file # # Mega-Attract-Mode is split into modules. Each module can be a # short slideshow or a self-running demo (like a game's built-in # 'attract mode'). Modules are run in the order listed here, one # after the next, until interrupted by user input. The last-run # module is tracked in the master prefs file. # # Format: # key=value # # value must be one of # 1 for HGR slideshow (key is a file containing a list of HGR graphics) # 2 for DHGR slideshow (key is a file containing a list of DHGR graphics) # 3 for self-running demo (key is an executable binary file) # # Blank lines and lines beginning with '#' are ignored (like this one!) # A line beginning with '[' terminates the parsing # FAVORITES.CONF=1 #SHORT.CONF=1 WAVY.NAVY=3 AB.CONF=1 BRODERBUND.CONF=1 DHGR.CONF=2 ACTIVISION.CONF=1 CD.CONF=1 ATARI.CONF=1 EFG.CONF=1 SIERRA.CONF=1 DATAMOST.CONF=1 HIJKL.CONF=1 DATASOFT.CONF=1 MNO.CONF=1 MICROFUN.CONF=1 PQR.CONF=1 PICCADILLY.CONF=1 S.CONF=1 SIRIUS.CONF=1 T.CONF=1 [eof]
# # Mega-Attract-Mode configuration file # # Mega-Attract-Mode is split into modules. Each module can be a # short slideshow or a self-running demo (like a game's built-in # 'attract mode'). Modules are run in the order listed here, one # after the next, until interrupted by user input. The last-run # module is tracked in the master prefs file. # # Format: # key=value # # value must be one of # 1 for HGR slideshow (key is a file containing a list of HGR graphics) # 2 for DHGR slideshow (key is a file containing a list of DHGR graphics) # 3 for self-running demo (key is an executable binary file) # # Blank lines and lines beginning with '#' are ignored (like this one!) # A line beginning with '[' terminates the parsing # SHORT.CONF=1 FAVORITES.CONF=1 #WAVY.NAVY=3 AB.CONF=1 BRODERBUND.CONF=1 DHGR.CONF=2 ACTIVISION.CONF=1 CD.CONF=1 ATARI.CONF=1 EFG.CONF=1 SIERRA.CONF=1 DATAMOST.CONF=1 HIJKL.CONF=1 DATASOFT.CONF=1 MNO.CONF=1 MICROFUN.CONF=1 PQR.CONF=1 PICCADILLY.CONF=1 S.CONF=1 SIRIUS.CONF=1 T.CONF=1 [eof]

1
res/fx.conf Normal file
View File

@ -0,0 +1 @@
# # transition effects for HGR slideshows # IRIS FIZZLE INTERLOCK.UD DIAGONAL SPIRAL INTERLOCK.LR [eof]

View File

@ -0,0 +1,6 @@
DIAGONAL=Type(06),AuxType(6000),Access(C3)
FIZZLE=Type(06),AuxType(6000),Access(C3)
INTERLOCK.UD=Type(06),AuxType(6000),Access(C3)
INTERLOCK.LR=Type(06),AuxType(6000),Access(C3)
IRIS=Type(06),AuxType(6000),Access(C3)
SPIRAL=Type(06),AuxType(6000),Access(C3)

View File

@ -35,7 +35,7 @@
inc @FM+5
bne @FM
+
jmp Start
jmp OneTimeSetup
@no64K
ldy #@no64Klen
@ -57,41 +57,56 @@ ProRWTSBuffer
*=ProRWTSBuffer+512 ; ProRWTS needs a 512-byte buffer for its init function
; so we reuse as much of the 1-time code as possible
; and fill the rest with zeros
OneTimeSetup
lda hddopendir+1 ; save current directory as 'root'
ldy hddopendir+3
+STAY gRootDirectory
jsr LoadFile ; load games list
!word kGameListConfFile
jsr ParseGamesList ; parse games list
!word gGamesListStore
!word ldrlo2 ; (ldrlo2) points to load address
+LDAY SRC
+STAY gFXStore ; save pointer to free space for next store
jsr LoadFile ; load transition effects list
!word kFXConfFile
jsr ParseKeyValueList ; parse transition effects list
!word gFXStore
!word ldrlo2 ; (ldrlo2) points to load address
+LDAY SRC
+STAY gAttractModeStore ; save pointer to free space for next store
jsr LoadFile ; load attract-mode configuration
!word kAttractModeConfFile
jsr ParseKeyValueList ; parse attract-mode configuration
!word gAttractModeStore
!word ldrlo2 ; (ldrlo2) points to load address
+LDAY SRC
+STAY gSlideshowStore ; save pointer to free space for next store
jmp Main
kGameListConfFile
!byte @kGameListConfFile_e-@kGameListConfFile_b
@kGameListConfFile_b
!text "GAMES.CONF"
@kGameListConfFile_e
kFXConfFile
!byte @kFXConfFile_e-@kFXConfFile_b
@kFXConfFile_b
!text "FX.CONF"
@kFXConfFile_e
kAttractModeConfFile
!byte @kAttractModeConfFile_e-@kAttractModeConfFile_b
@kAttractModeConfFile_b
!text "ATTRACT.CONF"
@kAttractModeConfFile_e
FirstMover
!pseudopc $D000 {
!zone
Reenter ; self-running demos should call this to exit back to 4cade
+READ_RAM1_WRITE_RAM1
Main
ldx #$FF
txs
+READ_RAM1_WRITE_RAM1
jmp Main
Start
lda hddopendir+1
ldy hddopendir+3
+STAY gRootDirectory ; save current directory as 'root'
jsr LoadFile ; load games list from file
!word kGameListConfFile
jsr ParseGamesList ; parse games list
!word gGamesListStore
!word ldrlo2 ; (ldrlo2) points to load address
+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 ldrlo2 ; (ldrlo2) points to load address
+LDAY SRC
+STAY gSlideshowStore ; save pointer to free space for next store
Main
bit $C010
jsr BlankHGR
jsr AttractMode
@ -124,69 +139,21 @@ AttractMode
ldy #1
lda (PTR),y
and #$0F
cmp #$01
clc
beq @Slideshow
cmp #$02
sec
beq @Slideshow
cmp #$03
bne AttractMode
beq @SelfRunningDemo
bne @Slideshow
@Slideshow
php
jsr ResetPath
+LDADDR kAttractModeSlideshowDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY @key
jsr AddToPath
jsr LoadFile ; load attract module configuration file
!word gPathname
+LOAD_FILE kDemoDirectory, @key
jsr ParseKeyValueList ; parse slideshow configuration
!word gSlideshowStore
!word ldrlo2 ; (ldrlo2) points to load address
plp ; carry clear = HGR, carry set = DHGR
bcs @DHGRSlideshow
;@HGRSlideshow
jsr okvs_iter
!word gSlideshowStore
!word HGRLoad
rts
@DHGRSlideshow
jsr BlankDHGR
jsr okvs_iter
!word gSlideshowStore
!word DHGRLoad
jmp BlankHGR
@SelfRunningDemo
jsr ResetPath
+LDADDR kDemoDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY @key
jsr AddToPath
jsr LoadFile ; load attract module configuration file
!word gPathname
ldx #(@end-@start-1)
- lda @start,x
ldx #(@end_prelaunch-@prelaunch-1)
- lda @prelaunch,x ; copy pre-launch code to main memory
sta $100,x
dex
bpl -
jmp $100
@start
; this runs from main memory
jmp $100 ; jump to pre-launch code
@prelaunch ; this runs from main memory
+READ_ROM_NO_WRITE
jsr $FE89
jsr $FE93
jsr $FE89 ; initialize machine like a cold boot
jsr $FE93 ; (many games assume a 'clean slate')
sta $C000
sta $C002
sta $C004
@ -196,23 +163,60 @@ AttractMode
jsr $FC58
ldx #$FF
txs
jmp (ldrlo2)
@end
jmp (ldrlo2) ; jump to entry point
@end_prelaunch
@Slideshow
pha ; save module type
+LOAD_FILE kAttractModeSlideshowDirectory, @key
jsr ParseKeyValueList ; parse slideshow configuration
!word gSlideshowStore
!word ldrlo2 ; (ldrlo2) points to load address
pla ; restore module type
cmp #$01
beq @HGRSlideshow
;@DHGRSlideshow
jsr BlankDHGR
jsr okvs_iter
!word gSlideshowStore
!word DHGRLoad
jmp BlankHGR
@HGRSlideshow
jsr okvs_nth ; get filename of transition effect code
!word gFXStore
@fxindex !byte 0
+STAY @fxkey
inc @fxindex ; increment transition effect index for next time
jsr okvs_len
!word gFXStore
cmp @fxindex
bne +
lda #0
sta @fxindex
+
; load transition effect code at $6000
+LOAD_FILE kFXDirectory, @fxkey
jsr okvs_iter
!word gSlideshowStore
!word HGRLoad
rts
@fxkey !word $FDFD
HGRLoad
ldx $C000
bmi Exit
+STAY PTR
jsr ResetPath
+LDADDR kHGRScreenshotDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY PTR
jsr AddToPath
jsr LoadFile
!word gPathname
jsr IrisHGR;SpiralHGR;DiagonalHGR;InterlockingVerticalHGR;FizzleHGR;InterlockingHorizontalHGR;
; load HGR screenshot at $4000
+LOAD_FILE kHGRScreenshotDirectory, PTR
jsr $6000 ; transition effect code was loaded here earlier
jmp WaitOnScreenshot
DHGRLoad
@ -308,31 +312,14 @@ ClearHGR1
bne @a
rts
kGameListConfFile
!byte @kGameListConfFile_e-@kGameListConfFile_b
@kGameListConfFile_b
!text "GAMES.CONF"
@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/wait.a"
!source "src/parse.common.a"
!source "src/parse.games.a"
!source "src/fx.hgr.common.a"
!source "src/fx.hgr.fizzle.a"
!source "src/fx.hgr.spiral.a"
!source "src/fx.hgr.diagonal.a"
!source "src/fx.hgr.iris.a"
!source "src/fx.hgr.interlockingvertical.a"
!source "src/fx.hgr.interlockinghorizontal.a"
!source "src/fx.dhgr.fizzle.a"
!source "src/fx/fx.dhgr.fizzle.a"
gGamesListStore
!word *+2 ; address of first okvs store
}

View File

@ -51,18 +51,3 @@ HGRBlockCopy
dex
bne @loop
rts
WaitForKeyWithTimeout
; in: A = timeout length (like standard $FCA8 wait routine)
; out: A clobbered
; X/Y preserved
sec
@wait1 pha
@wait2 sbc #1
bne @wait2
pla
bit $C000
bmi @exit
sbc #1
bne @wait1
@exit rts

View File

@ -1,4 +1,7 @@
DiagonalHGR
!cpu 6502
!to "build/FX/DIAGONAL",plain
*=$6000
lda #$27
sta $FB
lda #$17
@ -35,3 +38,5 @@ DiagonalHGR
sta $FB
bpl @loop
@exit rts
!source "src/fx/fx.hgr.common.a"

View File

@ -1,7 +1,10 @@
;license:MIT
;(c) 2017-2018 by qkumba
FizzleHGR
!cpu 6502
!to "build/FX/FIZZLE",plain
*=$6000
;init RNG
ldx #1

View File

@ -1,7 +1,10 @@
!cpu 6502
!to "build/FX/INTERLOCK.LR",plain
*=$6000
index1 = $FE
index2 = $FF
InterlockingHorizontalHGR
lda #$27
sta index1
lda #$00
@ -66,3 +69,5 @@ InterlockingHorizontalHGR
!hex A8A8A8A828282828A8A8A8A828282828
!hex 80808080000000008080808000000000
!hex 80808080000000008080808000000000
!source "src/wait.a"

View File

@ -1,8 +1,10 @@
!zone {
!cpu 6502
!to "build/FX/INTERLOCK.UD",plain
*=$6000
row1 = $fe
row2 = $ff
InterlockingVerticalHGR
lda #$00
sta row1
lda #$5F
@ -33,4 +35,6 @@ InterlockingVerticalHGR
dec row2
bpl @loop
@exit rts
}
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"

View File

@ -1,8 +1,10 @@
!zone {
round = $F0
block = $F1
!cpu 6502
!to "build/FX/IRIS",plain
*=$6000
round = $FC
block = $FD
IrisHGR
lda #$00
sta round
@outerloop
@ -18,7 +20,7 @@ IrisHGR
@innerloop
ldy block
lda ($fe),y
bmi @nextround
bmi @nextround ; exit condition
tax
iny
lda ($fe),y
@ -27,7 +29,7 @@ IrisHGR
jsr HGRBlockCopy
inc block
inc block
bne @innerloop ; always branches
bne @innerloop ; always branches (only exit condition is the BMI above)
@nextround
lda #$40
jsr WaitForKeyWithTimeout
@ -93,4 +95,6 @@ IrisHGR
@round25 !byte 0,2, 0,37, 1,1, 1,38, 2,0, 2,39, 21,0, 21,39, 22,1, 22,38, 23,2, 23,37, 255
@round26 !byte 0,1, 0,38, 1,0, 1,39, 22,0, 22,39, 23,1, 23,38, 255
@round27 !byte 0,0, 0,39, 23,0, 23,39, 255
}
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"

View File

@ -1,4 +1,7 @@
SpiralHGR
!cpu 6502
!to "build/FX/SPIRAL",plain
*=$6000
lda #$27
sta $FB
lda #$17
@ -67,3 +70,6 @@ SpiralHGR
inc $FA
bne @outerloop ; always branches
@exit rts
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"

View File

@ -133,8 +133,8 @@ traverse
;read next directory block when we reach the end of this block
lda readbuff + NEXT_BLOCK_LO
ldx readbuff + NEXT_BLOCK_HI
lda hdddirbuf + NEXT_BLOCK_LO
ldx hdddirbuf + NEXT_BLOCK_HI
bcs +
@myfoundname

View File

@ -81,3 +81,15 @@
!macro READ_ROM_NO_WRITE {
bit $C082
}
!macro LOAD_FILE .subdirectory, .filename {
jsr ResetPath
+LDADDR .subdirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY .filename
jsr AddToPath
jsr LoadFile
!word gPathname
}

View File

@ -9,6 +9,8 @@
gAttractModeStore
!word $FDFD
gFXStore
!word $FDFD
gSlideshowStore
!word $FDFD
@ -59,7 +61,7 @@ ParseKeyValueList
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)
stx gValLen ; initialize value length (in case this line has no value)
jsr IncAndGetChar
cmp #$0D ; CR in first position (blank line) -> no key
beq @newkey

View File

@ -30,6 +30,10 @@ kDemoDirectory
!byte 4
!raw "DEMO"
kFXDirectory
!byte 2
!raw "FX"
;------------------------------------------------------------------------------
; ResetPath
; reset gPathname to length 0

17
src/wait.a Normal file
View File

@ -0,0 +1,17 @@
; This file is included from multiple assembly targets,
; so it should only have 1 function.
;
WaitForKeyWithTimeout
; in: A = timeout length (like standard $FCA8 wait routine)
; out: A clobbered
; X/Y preserved
sec
@wait1 pha
@wait2 sbc #1
bne @wait2
pla
bit $C000
bmi @exit
sbc #1
bne @wait1
@exit rts