working SHR slideshows

This commit is contained in:
4am 2019-01-13 18:55:40 -05:00
parent 752791c33c
commit 418c5e0245
13 changed files with 321 additions and 33 deletions

View File

@ -64,12 +64,12 @@ asm: md
$(ACME) src/fx/fx.hgr.ripple.a
$(ACME) src/fx/fx.hgr.ripple2.a
$(ACME) src/fx/fx.hgr.star.a
$(ACME) src/fx/fx.shr.fizzle.a
dsk: md asm
$(CADIUS) CREATEVOLUME build/"$(DISK)" "${VOLUME}" 32766KB >>build/log
cp res/_FileInformation.txt build/ >>build/log
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "build/LAUNCHER.SYSTEM" >>build/log
# cp res/prefs-sample.conf build/PREFS.CONF >>build/log
cp res/prefs.conf build/PREFS.CONF >>build/log
bin/padto 512 build/PREFS.CONF
$(CADIUS) ADDFILE build/"$(DISK)" "/${VOLUME}/" "res/COVER" >>build/log

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 global prefs file. # # Format: # key=value # # |key| must be unique within this file # # |value| must be one of # 0 for self-running demo (|key| is an executable binary file in /demo/) # 1 for title slideshow (|key| is a file containing a list of HGR graphics in /hgr/) # 2 for action slideshow (|key| is a file containing a list of HGR graphics in /action/) # 3 for DHGR title slideshow (|key| is a file containing a list of DHGR graphics in /dhgr/) # # Blank lines and lines beginning with '#' are ignored (like this one!) # A line beginning with '[' terminates the parsing # FAVORITES1.CONF=1 BURGERTIME=0 ACTIONPOP.CONF=2 DHGR.CONF=3 STELLAR.7=0 ACTIONCD1.CONF=2 FAVORITES4.CONF=1 CONAN=0 SYNERGIST.CONF=1 ACTIONMNO1.CONF=2 HARD.HAT.MACK=0 ACTIONCLR1.CONF=2 IDSI.CONF=1 AQUATRON=0 BALLY.CONF=1 MR.DO.CONF=2 BOUNCING.KMNGAS=0 ACTIONS3.CONF=2 FAVORITES3.CONF=1 DUNG.BEETLES=0 BRODERBUND.CONF=1 ACTIONCLR2.CONF=2 JUNGLE.HUNT=0 ACTIONAB1.CONF=2 T.CONF=1 MR.COOL=0 SIRIUS.CONF=1 ACTIONCLR3.CONF=2 MATTEL.CONF=1 THUNDERBOMBS=0 FAVORITES2.CONF=1 ACTIONAB2.CONF=2 VINDICATOR=0 ACTIONBURG.CONF=2 ATARI.CONF=1 ROBOTRON=0 OTHER1.CONF=1 ACTIONEFG2.CONF=2 REPTON=0 ACTIONCLR4.CONF=2 DATAMOST.CONF=1 AGENT.USA=0 MNO.CONF=1 ACTIONPQR1.CONF=2 ALIEN.DOWNPOUR=0 ACTIONT1.CONF=2 SIERRA.CONF=1 POOYAN=0 CD.CONF=1 ACTIONCLR5.CONF=2 CEILING.ZERO=0 ACTIONPQR2.CONF=2 MICROFUN.CONF=1 GAMMA.GOBLINS=0 OTHER2.CONF=1 ACTIONT3.CONF=2 WAVY.NAVY=0 ACTIONT2.CONF=2 SYNAPSE.CONF=1 WARP.DESTROYER=0 PICCADILLY.CONF=1 ACTIONMNO2.CONF=2 CHOPLIFTER=0 ACTIONEFG1.CONF=2 DATAEAST.CONF=1 PEST.PATROL=0 EA.CONF=1 ACTIONEFG3.CONF=2 KARATEKA=0 ACTIONS2.CONF=2 SEGA.CONF=1 LOST.TOMB=0 HIJKL.CONF=1 ACTIONHIJ2.CONF=2 ALIEN.RAIN=0 ACTIONCD2.CONF=2 ACTIVISION.CONF=1 DINO.EGGS=0 TAITO.CONF=1 ACTIONAB3.CONF=2 FLIP.OUT=0 ACTIONHIJ1.CONF=2 PENGUIN.CONF=1 PACMAN=0 DATASOFT.CONF=1 ACTIONS1.CONF=2 ORILEYS.MINE=0 ACTIONCD3.CONF=2 SUBLOGIC.CONF=1 HIGH.RISE=0 EFG.CONF=1 ALIEN.AMBUSH=0 EPYX.CONF=1 BOLO=0 AB.CONF=1 CHAMP.LODERUN=0 PQR.CONF=1 GUMBALL=0 OTHER3.CONF=1 GOONIES=0 S.CONF=1 LADY.TUT=0 PIEMAN=0 SPYS.DEMISE=0 STARGATE=0 PLASMANIA=0 SPARE.CHANGE=0 SAMMY.LIGHTFOOT=0 SNEAKERS=0 LODE.RUNNER=0 SPY.HUNTER=0 NIBBLER=0 SERPENTINE=0 PITFALL.II=0 CIDER.SPIDER=0 FIREBIRD=0 TUBEWAY=0 BUZZARD.BAIT=0 SNAKE.BYTE=0 TRACK.AND.FIELD=0 #FORMULA.1=0 #SPIDER.RAID=0 [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 global prefs file. # # Format: # key=value # # |key| must be unique within this file # # |value| must be one of # 0 for self-running demo (|key| is an executable binary file in /demo/) # 1 for title slideshow (|key| is a file containing a list of HGR graphics in /hgr/) # 2 for action slideshow (|key| is a file containing a list of HGR graphics in /action/) # 3 for DHGR title slideshow (|key| is a file containing a list of DHGR graphics in /dhgr/) # 4 for SHR box art slideshow (|key| is a file containing a list of SHR graphics in /shr/) # # Blank lines and lines beginning with '#' are ignored (like this one!) # A line beginning with '[' terminates the parsing # SHR.CONF=4 FAVORITES1.CONF=1 BURGERTIME=0 ACTIONPOP.CONF=2 DHGR.CONF=3 STELLAR.7=0 ACTIONCD1.CONF=2 FAVORITES4.CONF=1 CONAN=0 SYNERGIST.CONF=1 ACTIONMNO1.CONF=2 HARD.HAT.MACK=0 ACTIONCLR1.CONF=2 IDSI.CONF=1 AQUATRON=0 BALLY.CONF=1 MR.DO.CONF=2 BOUNCING.KMNGAS=0 ACTIONS3.CONF=2 FAVORITES3.CONF=1 DUNG.BEETLES=0 BRODERBUND.CONF=1 ACTIONCLR2.CONF=2 JUNGLE.HUNT=0 ACTIONAB1.CONF=2 T.CONF=1 MR.COOL=0 SIRIUS.CONF=1 ACTIONCLR3.CONF=2 MATTEL.CONF=1 THUNDERBOMBS=0 FAVORITES2.CONF=1 ACTIONAB2.CONF=2 VINDICATOR=0 ACTIONBURG.CONF=2 ATARI.CONF=1 ROBOTRON=0 OTHER1.CONF=1 ACTIONEFG2.CONF=2 REPTON=0 ACTIONCLR4.CONF=2 DATAMOST.CONF=1 AGENT.USA=0 MNO.CONF=1 ACTIONPQR1.CONF=2 ALIEN.DOWNPOUR=0 ACTIONT1.CONF=2 SIERRA.CONF=1 POOYAN=0 CD.CONF=1 ACTIONCLR5.CONF=2 CEILING.ZERO=0 ACTIONPQR2.CONF=2 MICROFUN.CONF=1 GAMMA.GOBLINS=0 OTHER2.CONF=1 ACTIONT3.CONF=2 WAVY.NAVY=0 ACTIONT2.CONF=2 SYNAPSE.CONF=1 WARP.DESTROYER=0 PICCADILLY.CONF=1 ACTIONMNO2.CONF=2 CHOPLIFTER=0 ACTIONEFG1.CONF=2 DATAEAST.CONF=1 PEST.PATROL=0 EA.CONF=1 ACTIONEFG3.CONF=2 KARATEKA=0 ACTIONS2.CONF=2 SEGA.CONF=1 LOST.TOMB=0 HIJKL.CONF=1 ACTIONHIJ2.CONF=2 ALIEN.RAIN=0 ACTIONCD2.CONF=2 ACTIVISION.CONF=1 DINO.EGGS=0 TAITO.CONF=1 ACTIONAB3.CONF=2 FLIP.OUT=0 ACTIONHIJ1.CONF=2 PENGUIN.CONF=1 PACMAN=0 DATASOFT.CONF=1 ACTIONS1.CONF=2 ORILEYS.MINE=0 ACTIONCD3.CONF=2 SUBLOGIC.CONF=1 HIGH.RISE=0 EFG.CONF=1 ALIEN.AMBUSH=0 EPYX.CONF=1 BOLO=0 AB.CONF=1 CHAMP.LODERUN=0 PQR.CONF=1 GUMBALL=0 OTHER3.CONF=1 GOONIES=0 S.CONF=1 LADY.TUT=0 PIEMAN=0 SPYS.DEMISE=0 STARGATE=0 PLASMANIA=0 SPARE.CHANGE=0 SAMMY.LIGHTFOOT=0 SNEAKERS=0 LODE.RUNNER=0 SPY.HUNTER=0 NIBBLER=0 SERPENTINE=0 PITFALL.II=0 CIDER.SPIDER=0 FIREBIRD=0 TUBEWAY=0 BUZZARD.BAIT=0 SNAKE.BYTE=0 TRACK.AND.FIELD=0 #FORMULA.1=0 #SPIDER.RAID=0 [eof]

View File

@ -41,3 +41,4 @@ DHGR.RADIAL4=Type(06),AuxType(6000),Access(C3)
DHGR.RADIAL5=Type(06),AuxType(6000),Access(C3)
DHGR.STAR=Type(06),AuxType(6000),Access(C3)
DHGR.CORNER=Type(06),AuxType(6000),Access(C3)
SHR.FIZZLE=Type(06),AuxType(A000),Access(C3)

View File

@ -1 +0,0 @@
# 4cade preferences file # Do not edit by hand. # Or do. I'm a comment, not a cop. # value=game directory listed in GAMES.CONF, or empty LASTPLAYED=SAMMY.LIGHTFOOT # value=attract mode module listed in ATTRACT.CONF, or empty NEXTATTRACT=FAVORITES.CONF # value=transition effect listed in FX.CONF, or empty NEXTFX=RIPPLE # value=transition effect listed in DFX.CONF, or empty NEXTDFX=DHGR.STAR [eof]

1
res/ss/SHR.CONF Normal file
View File

@ -0,0 +1 @@
# # super hi-res slideshow # APPLE.PANIC BRUCE.LEE CHAMP.LODERUN CANYON.CLIMBER BOUNCING.KMNGAS PRINCEUNP SNAKE.BYTE AGENT.USA CANNONBALL.BLTZ ALCAZAR ALIEN.AMBUSH BCS.QUEST BOLO BRAINTEASERBLVD CHOPLIFTER CONAN CRISIS.MOUNTAIN CROSSFIRE [eof]

View File

@ -13,11 +13,17 @@
jsr $FC58
jsr Has64K ; check for 64K (required)
bcs @no64K
jsr DisableAccelerator ; set to 1 MHz
jsr Has128K ; check for 128K (absence is OK, we just filter out some games)
jsr DisableAccelerator ; set to 1 MHz (supports IIgs and many common accelerator cards)
jsr IsGS ; check for IIgs (allows super hi-res artwork)
ror MachineStatus
jsr HasJoystick ; check for joystick (absence is OK, we just filter out some games)
ror MachineStatus ; now bit 6 = 1 if 128K
jsr HasVidHDCard ; check for VidHD card (allows super hi-res artwork even on non-IIgs machines)
ror MachineStatus
jsr Has128K ; check for 128K (allows DHGR slideshows and 128K games)
ror MachineStatus
jsr HasJoystick ; check for joystick (absence is OK but we filter out some games that require a joystick)
ror MachineStatus ; now bit 4 = 1 if IIgs
; bit 5 = 1 if VidHD
; bit 6 = 1 if 128K
; bit 7 = 1 if joystick
jsr init ; initialize ProRWTS2 (bye bye ProDOS)
@ -50,6 +56,8 @@
!source "src/prorwts2.a"
ProRWTSBuffer
; these routines will only be called once, from main memory, before relocating to language card
!source "src/hw.iigs.a"
!source "src/hw.vidhd.a"
!source "src/hw.memcheck.a"
!source "src/hw.joystick.a"
!source "src/hw.normfast.a"

View File

@ -24,6 +24,8 @@ HTAB = $24
VTAB = $25
MachineStatus =$F0 ; bit 7 = 1 if machine has joystick
; bit 6 = 1 if machine has 128K
; bit 5 = 1 if machine has a VidHD card
; bit 4 = 1 if machine is a IIgs
; $FE ; used by ParseGamesList
; $FF ; used by ParseGamesList

95
src/fx/fx.shr.fizzle.a Normal file
View File

@ -0,0 +1,95 @@
;license:MIT
;(c) 2019 by qkumba
!cpu 6502
!to "build/FX/SHR.FIZZLE",plain
*=$a000
;init RNG
ldy #1
sty @rnd1+1
dey
sty @rnd2+1
;copy SCB and palette
lda #$9d
sta $3d
sty $3c
ldx #$23 ; copy SCB+palette+this code to auxmem
sta $c005
@copystuff
lda ($3c),y
sta ($3c),y
iny
bne @copystuff
inc $3d
dex
bne @copystuff
;force write offset 0 otherwise it will be missed
lda $2000
sta $2000
sta $c004
;iterate
@loop
ldy @rnd1+1
ldx @rnd2+1
lsr @rnd2+1
ror @rnd1+1
bcc +
;feedback polynomial forms #$4001 for period of 32767
lda @rnd1+1
eor #1
sta @rnd1+1
lda @rnd2+1
eor #$40
sta @rnd2+1
;don't rewrite SCB or palette
;it will make the fizzle take longer than obviously needed
+ cpx #$7d
bcs +
sty $26
sty $3c
txa
;select address
clc
adc #$20
sta $27
sta $3d
;copy pixel from other page to this page
ldy #0
lda ($3c),y
sta $c005
sta ($26),y
sta $c004
;wait while checking for keypress
+ ldx #2
@wait lda $c000
bmi @exit
dex
bne @wait
;and exit condition
@rnd2 lda #0
bne @loop
@rnd1 lda #0
cmp #1
bne @loop
@exit rts

20
src/hw.iigs.a Normal file
View File

@ -0,0 +1,20 @@
;------------------------------------------------------------------------------
; IsGS
; detect IIgs by running CPU-specific magic
;
; in: none
; out: C set if running on a IIgs
; C clear otherwise
; A clobbered
; X/Y preserved
;------------------------------------------------------------------------------
IsGS
lda #0 ; set Z flag
!cpu 65816
rep #2 ; clear Z flag on 65816 only
!cpu 6502
beq @no
@yes sec
+HIDE_NEXT_BYTE
@no clc
rts

View File

@ -13,7 +13,6 @@
; (c) 1989 Broderbund Software
; https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/master/01%20POP%20Source/Source/GRAFIX.S#L1225
;------------------------------------------------------------------------------
!zone {
HasJoystick
lda #0
sta @joyX
@ -39,4 +38,3 @@ HasJoystick
bpl @nextpdl ; kill time
@joyX !byte 0
@joyY !byte 0
}

33
src/hw.vidhd.a Normal file
View File

@ -0,0 +1,33 @@
;------------------------------------------------------------------------------
; HasVidHDCard
; detect VidHD card by searching for magic bytes across all slots
;
; in: none
; out: C set if VidHD card found in any slot
; if card was found, X = #$Cn where n is the slot number of the card
; C clear if no VidHD card found
; other flags clobbered
; A/Y clobbered
;------------------------------------------------------------------------------
HasVidHDCard
ldx #$c7
@slotLoop
stx @byteLoop+2
ldy #$02
@byteLoop
lda $FD00, y ; SMC (high byte)
cmp @kVidHDMagicBytes, y
bne @nextSlot
dey
bpl @byteLoop
sec ; found
rts
@nextSlot
dex
cpx #$c0
bne @slotLoop
clc ; not found
rts
@kVidHDMagicBytes
!byte $00, $00, $00
; !byte $24, $EA, $4C

View File

@ -26,6 +26,10 @@ kDHGRTitleDirectory
!byte 4
!raw "DHGR"
kSHRArtworkDirectory
!byte 3
!raw "SHR"
kAttractModeSlideshowDirectory
!byte 2
!raw "SS"

View File

@ -128,34 +128,54 @@ gAttractIndex
!byte 0
pla ; restore module type
cmp #$01
beq @HGRTitleSlideshow
cmp #$02
beq @HGRActionSlideshow
asl
tax
lda @slideshows-2,x
sta @jmp+1
lda @slideshows-1,x
sta @jmp+2
@jmp jmp $FDFD ; SMC
@slideshows
!word HGRTitleSlideshow
!word HGRActionSlideshow
!word DHGRTitleSlideshow
!word SHRArtworkSlideshow
@DHGRTitleSlideshow
HGRTitleSlideshow
jsr LoadHGRTransition ; load transition effect code at $6000
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
!word HGRTitleCallback ; address of callback (called on each file)
rts ; exit with last picture still visible
HGRActionSlideshow
jsr LoadHGRTransition ; load transition effect code at $6000
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
!word HGRActionCallback ; address of callback (called on each file)
rts ; exit with last picture still visible
DHGRTitleSlideshow
bit MachineStatus ; only run DHGR slideshow if we have 128K
bvc @exit
jsr LoadDHGRTransition ; load transition effect code at $6000
bvs +
rts
+ jsr LoadDHGRTransition ; load transition effect code at $6000
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
jsr okvs_iter ; cycle through all listed DHGR files
!word gSlideshowStore
!word DHGRTitleCallback ; address of callback (called on each file)
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
@HGRTitleSlideshow
jsr LoadHGRTransition ; load transition effect code at $6000
jsr okvs_iter ; cycle through all listed HGR files
SHRArtworkSlideshow
lda MachineStatus ; only run SHR slideshow on IIgs or if we have a VidHD card
and #%00110000
bne +
rts
+ jsr LoadSHRTransition
jsr okvs_iter
!word gSlideshowStore
!word HGRTitleCallback ; address of callback (called on each file)
@exit rts ; exit with last picture still visible
@HGRActionSlideshow
jsr LoadHGRTransition ; load transition effect code at $6000
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
!word HGRActionCallback ; address of callback (called on each file)
rts ; exit with last picture still visible
!word SHRArtworkCallback
jmp BlankHGR
kAttractModeConfFile
!byte @kAttractModeConfFile_e-*-1
@ -386,7 +406,6 @@ HGRActionCallback
; in: A/Y contains address of filename (name only, path is always /DHGR/)
; X contains 0-based index of the current record in gSlideshowStore
; gGamesListStore must be initialized
; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
@ -415,7 +434,9 @@ DHGRTitleCallback
ExecuteTransition
jsr $6000 ; call transition effect code to display picture
; execution falls through here
WaitAfterTransition
ldx #$20 ; picture is already showing so just wait
- lda #0
jsr WaitForKeyWithTimeout
@ -424,6 +445,43 @@ ExecuteTransition
bpl -
+ rts
;------------------------------------------------------------------------------
; SHRArtworkCallback
; callback called by okvs_iter on gSlideshowStore
; to load and display a single SHR graphic
; in: A/Y contains address of filename (name only, path is always /SHR/)
; X contains 0-based index of the current record in gSlideshowStore
; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------
SHRArtworkCallback
+STAY PTR
lda $C000
bpl +
rts
+
stx gCurrentlyVisibleSlideshowIndex
jsr BlankSHR
; load SHR artwork at $2000/main (not aux)
jsr ResetPath
+LDADDR kSHRArtworkDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY PTR
jsr AddToPath
jsr LoadFile
!word gPathname
jsr $A000
jmp WaitAfterTransition
;------------------------------------------------------------------------------
; LoadHGRTransition
; looks up name of next HGR transition effect in FX.CONF and loads that file
@ -487,8 +545,7 @@ gFXIndex
rts
@fxkey !word $FDFD
kFXConfFile
!byte @kFXConfFile_e-@kFXConfFile_b
@kFXConfFile_b
!byte @kFXConfFile_e-*-1
!text "FX.CONF"
@kFXConfFile_e
@ -555,11 +612,30 @@ gDFXIndex
rts
@dfxkey !word $FDFD
kDFXConfFile
!byte @kDFXConfFile_e-@kDFXConfFile_b
@kDFXConfFile_b
!byte @kDFXConfFile_e-*-1
!text "DFX.CONF"
@kDFXConfFile_e
;------------------------------------------------------------------------------
; LoadSHGRTransition
; [TODO] for now there is only 1 SHR transition so this always load the same file
; [TODO] but eventually it should look up name of next SHR transition effect in
; [TODO] SFX.CONF or something and loads that file at $A000
;
; in: gSFXStore has been initialized
; gGlobalPrefsStore has been initialized
; out: all registers and flags clobbered
; $A000..$BFFF/main contains transition effect code
;------------------------------------------------------------------------------
LoadSHRTransition
jsr LoadFile
!word kSFXFizzleFile
rts
kSFXFizzleFile
!byte @kSFXFizzleFile_e-*-1
!text "FX/SHR.FIZZLE"
@kSFXFizzleFile_e
;------------------------------------------------------------------------------
; BlankHGR
; clear and show HGR page 1 without flickering
@ -599,6 +675,50 @@ BlankDHGR
sta $c05e
rts
;------------------------------------------------------------------------------
; BlankSHR
; clear and show SHR mode without flickering
;
; in: machine is a IIgs or has a VidHD card that responds appropriately to
; IIgs-specific softswitches for graphics and memory modes
; NOTE: THIS ROUTINE WILL CRASH ON AN APPLE //C due to writing $C029,
; so it is imperative that the caller ensure the machine type
; out: text page clobbered (but screen holes preserved)
; $2000..$9FFF/aux cleared
;------------------------------------------------------------------------------
BlankSHR
jsr Home
lda $C029 ; set GS NEWVIDEO mode to turn off linearize
ora #$40
sta $C029
sta $C005 ; writes go to auxmem
lda $C035 ; enable auxmem-to-bank-E1 shadowing on IIgs
and #$F7
sta $C035
lda #$20 ; clear $2000..$9FFF in auxmem
sta @a+2
ldx #$80
lda #0
tay
@a sta $2000,y
iny
bne @a
inc @a+2
dex
bne @a
sta $C004 ; writes go to main memory
lda $C029 ; set GS NEWVIDEO mode to turn on SHR mode
ora #$81
sta $C029
rts
;------------------------------------------------------------------------------
; ClearHGR1
; clear $2000..$3FFF in current memory bank (main or auxmem)
@ -645,6 +765,13 @@ Home
jsr $FB2F ; TEXT
jsr $FC58 ; HOME
+READ_RAM1_WRITE_RAM1
lda MachineStatus
and #%00110000
beq @noSHR
lda $C029
and #$7F
sta $C029 ; get out of SHR mode
@noSHR
rts
@end