mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-06-08 00:29:29 +00:00
show SHR art on IIGS
This commit is contained in:
parent
9fba3b0760
commit
6f4219f8fb
|
@ -6,6 +6,7 @@
|
|||
; Public functions
|
||||
; - LoadFile
|
||||
; - LoadDHRFile
|
||||
; - LoadSHRFile
|
||||
; - SaveFile
|
||||
; - SetPrefix
|
||||
; - GetFileInfo
|
||||
|
@ -152,6 +153,83 @@ LoadDHRFile
|
|||
plp ; restore flags from readfile
|
||||
@exit rts
|
||||
|
||||
;-------------------------------
|
||||
; LoadSHRFile
|
||||
; load uncompressed SHR file into memory from .PIC file
|
||||
; 1. load first quarter ($2000 bytes)
|
||||
; 2. copy to graphics memory
|
||||
; 3. load second quarter ($2000 bytes)
|
||||
; 4. copy to graphics memory
|
||||
; 5. load third quarter ($2000 bytes)
|
||||
; 6. copy to graphics memory
|
||||
; 7. load fourth quarter ($2000 bytes)
|
||||
; 8. copy to graphics memory
|
||||
;
|
||||
; in: stack contains 4 bytes of parameters:
|
||||
; +1 address of pathname
|
||||
; +3 address of ProDOS file buffer
|
||||
; out: if C set, load failed
|
||||
; if C clear, load succeeded
|
||||
; all other flags clobbered
|
||||
; all registers clobbered
|
||||
; stack set to next instruction after parameters
|
||||
;-------------------------------
|
||||
LoadSHRFile
|
||||
+PARAMS_ON_STACK 4
|
||||
|
||||
ldy #$04
|
||||
- lda (PARAM),y
|
||||
sta mliparam,y
|
||||
dey
|
||||
bne -
|
||||
|
||||
jsr _openfile
|
||||
bcs @exit ; C set on error
|
||||
sta @saverefnum ; store file refnum
|
||||
|
||||
ldy #$20
|
||||
stz mliparam+2 ; read into $2000 in main mem
|
||||
sty mliparam+3
|
||||
stz mliparam+4 ; read length = $2000 bytes (one quarter of file)
|
||||
sty mliparam+5
|
||||
sty @shrdest+2
|
||||
|
||||
ldx #4 ; four quarters
|
||||
- lda @saverefnum ; file refnum
|
||||
jsr _readfile
|
||||
bcs @close
|
||||
phx
|
||||
|
||||
!cpu 65816
|
||||
xce
|
||||
rep #$30
|
||||
!rl
|
||||
!al
|
||||
lda #$1FFF
|
||||
tax
|
||||
inx
|
||||
@shrdest ldy #$FD00 ; SMC
|
||||
phb
|
||||
mvn 0,$E1
|
||||
plb
|
||||
sty @shrdest+1
|
||||
!as
|
||||
!rs
|
||||
sec
|
||||
xce
|
||||
!cpu 65C02
|
||||
|
||||
plx
|
||||
dex
|
||||
bne -
|
||||
|
||||
@close php ; save flags from readfile
|
||||
@saverefnum=*+1
|
||||
lda #$FD ; file refnum (SMC)
|
||||
jsr _closefile
|
||||
plp ; restore flags from readfile
|
||||
@exit rts
|
||||
|
||||
;-------------------------------
|
||||
; SaveFile
|
||||
; save a file to disk all at once, using ProDOS MLI calls
|
||||
|
|
|
@ -11,6 +11,10 @@ kArtworkRootDirectory ; length-prefixed pathname of DHGR graphic
|
|||
!byte 8
|
||||
!raw "ARTWORK/"
|
||||
|
||||
kArtworkGSRootDirectory ; length-prefixed pathname of SHGR graphic files
|
||||
!byte 10
|
||||
!raw "ARTWORKGS/"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; DisplayArtwork
|
||||
; load and display double hi-res artwork, then wait for key or mouse click
|
||||
|
@ -19,7 +23,7 @@ kArtworkRootDirectory ; length-prefixed pathname of DHGR graphic
|
|||
; out: all registers and flags clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
DisplayArtwork
|
||||
lda #0 ; set Z flag always
|
||||
ldx #0 ; set Z flag always
|
||||
!cpu 65816
|
||||
rep #2 ; clear Z flag on 65816 only
|
||||
!cpu 65c02
|
||||
|
@ -27,21 +31,30 @@ DisplayArtwork
|
|||
lda $C029
|
||||
and #$1F
|
||||
sta $C029 ; set GS NEWVIDEO mode to turn off linearize
|
||||
inx
|
||||
|
||||
+ jsr ResetPath
|
||||
+LDADDR kArtworkRootDirectory
|
||||
dex
|
||||
bne +
|
||||
+LDADDR kArtworkGSRootDirectory
|
||||
+ phx
|
||||
jsr AddToPath
|
||||
|
||||
jsr okvs_get
|
||||
!word gGlobalPrefsStore
|
||||
!word kLastPlayed
|
||||
jsr AddToPath ; gPathname = 'ARTWORK/<game shortname>'
|
||||
jsr AddToPath ; gPathname = 'ARTWORK[GS]/<game shortname>'
|
||||
plx
|
||||
phx
|
||||
beq @loadSHR
|
||||
|
||||
jsr LoadDHRFile ; load artwork from file
|
||||
!word gPathname
|
||||
!word kProDOSFileBuffer
|
||||
plx
|
||||
bcc +
|
||||
jmp SoftBell
|
||||
- jmp SoftBell
|
||||
+ sta $C000 ; display double hi-res page 1
|
||||
sta $C00D
|
||||
sta $C05E
|
||||
|
@ -50,7 +63,19 @@ DisplayArtwork
|
|||
sta $C052
|
||||
sta $C054
|
||||
sta $C050
|
||||
bcc @waitKey
|
||||
|
||||
@loadSHR
|
||||
jsr LoadSHRFile ; load artwork from file
|
||||
!word gPathname
|
||||
!word kProDOSFileBuffer
|
||||
plx
|
||||
bcs -
|
||||
lda $C029
|
||||
ora #$C1
|
||||
sta $C029 ; set GS NEWVIDEO mode to turn on SHR mode
|
||||
|
||||
@waitKey phx
|
||||
jsr ClearPendingInput
|
||||
- ldx #WGPendingClick
|
||||
jsr WeeGUI
|
||||
|
@ -59,4 +84,9 @@ DisplayArtwork
|
|||
lda $C000
|
||||
bpl -
|
||||
+ sta $C051 ; back to text
|
||||
jmp ClearPendingInput
|
||||
plx
|
||||
bne +
|
||||
lda $C029
|
||||
and #$3F
|
||||
sta $C029 ; back to text GS-style
|
||||
+ jmp ClearPendingInput
|
||||
|
|
Loading…
Reference in New Issue
Block a user