4cade/src/ui.attract.dgr.a

125 lines
4.5 KiB
Plaintext
Raw Normal View History

;license:MIT
;(c) 2021 by 4am
;
; DGR action slideshows
;
; Public functions
; - DGRActionSlideshow
; - DGRSingle
2021-12-12 21:57:27 +00:00
; - BlankDGR
; - LoadIndexedDGRFile
;
;------------------------------------------------------------------------------
; DGRActionSlideshow
; display a slideshow of double lo-res action screenshots
;
; safe to call if machine only has 64K (does nothing and exits)
;
; in: none
; out: everything clobbered
; graphics mode set to display hi-res screen, which is blank
;------------------------------------------------------------------------------
DGRActionSlideshow
bit MachineStatus ; only run DGR slideshow if we have 128K
bvc DGRRTS
jsr LoadDGRTransition ; load transition effect code at $6000
jsr BlankDGR ; switch to DGR mode with initial blank screen
jsr okvs_iter ; cycle through all listed DGR files
!word gSlideshowStore
!word DGRActionCallback ; address of callback (called on each file)
2021-12-12 21:57:27 +00:00
jmp BlankHGRNoHome ; switch back to HGR mode with initial blank screen on exit
;------------------------------------------------------------------------------
; DGRSingle
; display a single lo-res screenshot, with transition effect
;
; in: none
; out: everything clobbered
; graphics mode set to display hi-res screen
;------------------------------------------------------------------------------
DGRSingle
+ST16 IndexedDGRFilename
jsr BlankDGR ; switch to DGR mode with initial blank screen
jsr LoadIndexedDGRFile ; load DGR screen at $4000
jsr LoadDGRTransition ; load transition effect code at $6000
jsr ExecuteTransitionAt6000AndWait
2021-12-12 21:57:27 +00:00
jmp BlankHGRNoHome ; switch back to HGR mode with initial blank screen on exit
;------------------------------------------------------------------------------
; LoadDGRTransition [private]
;
; in: none
; out: all registers and flags clobbered
; $6000..$BFFF/main contains transition effect code (probably not all
; of that, but no promises)
;------------------------------------------------------------------------------
LoadDGRTransition
jsr LoadIndexedFile
!word $6000
!word kDGRFizzleRecord
DGRRTS rts
;------------------------------------------------------------------------------
; DGRActionCallback [private]
; callback called by okvs_iter on gSlideshowStore
; to load and display a single DGR action screenshot
; in: A/Y contains address of filename (name only, path is always /ACTION.DGR/)
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------
DGRActionCallback
bit KBD
bmi DGRRTS
+ST16 IndexedDGRFilename
jsr FindGame
; if game name is not found (C will be set here), it means the game
; can't be played due to memory or joystick requirements, so we hide
; it from slideshows
bcs DGRRTS
jsr LoadIndexedDGRFile
jmp ExecuteTransitionAt6000AndWait
2021-12-12 21:57:27 +00:00
BlankDGR
jsr BlankDHGR ; clear and display DHGR screen
ldy #$2C ; BIT
sty PageFrom ; now clear DGR screen
ldx #$04
stx PageTo+2
jsr ClearToBlack
sta WRITEAUXMEM
ldx #$04
stx PageTo+2
jsr ClearToBlack
sta WRITEMAINMEM
lda #1
sta OffscreenPage
bit $C056 ; display DGR screen
rts
LoadIndexedDGRFile
; in: caller has set IndexedDGRFilename
; out: all flags & registers clobbered
2021-12-13 03:13:46 +00:00
jsr LoadIndexedFile ; load index file into $4000
- !word $4000
!word kDGRActionIndexRecord
jsr okvs_find
!word -
IndexedDGRFilename
!word $FDFD ; SMC
+ST16 @indexRecordPtr
2021-12-13 03:13:46 +00:00
jsr LoadIndexedFile ; load entire DGR screenshot at $7C00
!word $7C00 ; because that's where the transition code expects to find it
; auxmem half is first, mainmem second
@indexRecordPtr
!word $FDFD ; SMC
rts