;license:MIT ;(c) 2018-2020 by 4am ; ; Super hi-res slideshows ; ; Public functions ; - SHRSlideshow ; - SHRSingle ; ;------------------------------------------------------------------------------ ; SHRSlideshow ; execute a slideshow of super hi-res artwork ; ; safe to call if machine can not display super hi-res graphics (does nothing ; and exits) ; ; in: none ; out: everything clobbered ; graphics mode reset to display hi-res screen, which is blank ;------------------------------------------------------------------------------ SHRSlideshow lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card and #SUPPORTS_SHR bne + SHRRTS rts + jsr LoadSHRTransition jsr okvs_iter !word gSlideshowStore !word SHRArtworkCallback jmp BlankHGR ;------------------------------------------------------------------------------ ; SHRSlideshow ; display a single super hi-res artwork ; ; safe to call if machine can not display super hi-res graphics (does nothing ; and exits) ; ; in: none ; out: everything clobbered ; graphics mode reset to display hi-res screen, which is blank ;------------------------------------------------------------------------------ SHRSingle +STAY + lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card and #SUPPORTS_SHR beq SHRRTS jsr BlankSHR jsr LoadFile !word kRootDirectory + !word $FDFD ; SMC !word $1FF8 jsr DecompressSHR jsr LoadSHRTransition jsr ExecuteTransitionAtA000AndWait jmp BlankHGR ;------------------------------------------------------------------------------ ; LoadSHGRTransition [private] ; ; in: none ; out: all registers and flags clobbered ; $A000..$BFFF/main contains transition effect code ;------------------------------------------------------------------------------ LoadSHRTransition jsr LoadFile !word kFXDirectory !word kSFXFizzleFile !word $A000 rts ;------------------------------------------------------------------------------ ; SHRArtworkCallback [private] ; 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 /ARTWORK.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 bit KBD bmi SHRRTS +STAY @sfname jsr GetGameInfo ; if game is not found (C will be set here), it means it can't be played on ; this machine due to memory or joystick requirements, so we don't display ; it in slideshows bcs SHRRTS stx gGameToLaunch jsr BlankSHR ; load compressed SHR artwork at $1FF0/main (not aux) jsr LoadFile !word kSHRArtworkDirectory @sfname !word $FDFD !word $1FF8 jsr DecompressSHR jmp ExecuteTransitionAtA000AndWait ;------------------------------------------------------------------------------ ; BlankSHR [private] ; 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 to $C029, ; so it is imperative that the caller ensures the machine type. ; Thanks to John Brooks for explaining all of this to me. Twice. ; out: text page clobbered (but screen holes preserved) ; $2000..$9FFF/aux cleared ;------------------------------------------------------------------------------ BlankSHR jsr Home lda NEWVIDEO ; set GS NEWVIDEO mode to turn on linearize ora #%01000000 ; can't use TSB here - might not be 65816 sta NEWVIDEO sta WRITEAUXMEM ; writes go to auxmem lda SHADOW ; enable auxmem-to-bank-E1 shadowing on IIgs and #$F7 ; can't use TRB here - might not be 65816 sta SHADOW lda #$20 ; clear $2000..$9FFF in auxmem ldx #$80 jsr ClearMem sta WRITEMAINMEM ; writes go to main memory lda NEWVIDEO ; set GS NEWVIDEO mode to turn on SHR mode ora #%10000001 ; can't use TSB here - might not be 65816 sta NEWVIDEO rts ;------------------------------------------------------------------------------ ; DecompressSHR [private] ; ; in: compressed SHR loaded to $1FF8+ ; file size in sizelo2/sizehi2 as set by ProRWTS2 ; out: decompressed SHR at $2000..$9FFF ; $00A7..$00A8 clobbered by decompressor ; $00AE..$00AF clobbered by decompressor ; $00FC..$00FF clobbered by decompressor ; $0200..$03CB clobbered by decompressor ;------------------------------------------------------------------------------ DecompressSHR lda #$1F jmp DecompressCommon