mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2025-01-17 12:32:39 +00:00
support VidHD SHR
This commit is contained in:
parent
a3ab7caa71
commit
c57bfdbefa
@ -17,7 +17,7 @@
|
||||
;~7400...... - program data (approximate)
|
||||
;
|
||||
|
||||
kPitchDarkBinaryAddress = $3F55
|
||||
kPitchDarkBinaryAddress = $3F2F
|
||||
|
||||
kGameInfoBuffer = $0800 ; used by LoadGameInfo
|
||||
kProDOSFileBuffer = $1C00 ; 1K buffer for ProDOS MLI calls
|
||||
|
@ -43,6 +43,33 @@
|
||||
dec DEVCNT ; reduce ProDOS device count
|
||||
@noRAMdisk
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; detect VidHD by searching for magic bytes across all slots
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
ldx #$c7
|
||||
@findVidHD
|
||||
stx @matchVidHD+2
|
||||
ldy #2
|
||||
@matchVidHD
|
||||
lda $c700, y ; SMC
|
||||
cmp @kVidHDID, y
|
||||
bne @nextslot
|
||||
dey
|
||||
bpl @matchVidHD
|
||||
dec PatchVidHD1+1 ; affect branch to pretend IIGS
|
||||
lda #$90
|
||||
sta PatchVidHD2 ; affect branch to pretend IIGS
|
||||
ldx #$c1 ; force exit via fall-through
|
||||
|
||||
@nextslot
|
||||
dex
|
||||
cpx #$c0
|
||||
bne @findVidHD
|
||||
beq +
|
||||
@kVidHDID
|
||||
!byte $24, $EA, $4C
|
||||
+
|
||||
;------------------------------------------------------------------------------
|
||||
; clear options script and make checksum invalid
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -184,22 +184,25 @@ LoadSHRFile
|
||||
bne -
|
||||
|
||||
jsr _openfile
|
||||
bcs @exit ; C set on error
|
||||
sta @saverefnum ; store file refnum
|
||||
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
|
||||
sty shrdest+2
|
||||
|
||||
ldx #4 ; four quarters
|
||||
- lda @saverefnum ; file refnum
|
||||
- lda saverefnum ; file refnum
|
||||
jsr _readfile
|
||||
bcs @close
|
||||
bcs close
|
||||
phx
|
||||
|
||||
|
||||
PatchVidHD2
|
||||
bcs copyvidhd
|
||||
|
||||
!cpu 65816
|
||||
xce
|
||||
rep #$30
|
||||
@ -208,29 +211,58 @@ LoadSHRFile
|
||||
lda #$1FFF
|
||||
tax
|
||||
inx
|
||||
@shrdest ldy #$FD00 ; SMC
|
||||
shrdest ldy #$FD00 ; SMC
|
||||
phb
|
||||
mvn 0,$E1
|
||||
plb
|
||||
sty @shrdest+1
|
||||
sty shrdest+1
|
||||
!as
|
||||
!rs
|
||||
sec
|
||||
xce
|
||||
!cpu 65C02
|
||||
|
||||
resumeread
|
||||
plx
|
||||
dex
|
||||
bne -
|
||||
|
||||
@close php ; save flags from readfile
|
||||
@saverefnum=*+1
|
||||
close php ; save flags from readfile
|
||||
saverefnum=*+1
|
||||
lda #$FD ; file refnum (SMC)
|
||||
jsr _closefile
|
||||
plp ; restore flags from readfile
|
||||
@exit rts
|
||||
exit rts
|
||||
|
||||
copyvidhd
|
||||
lda $C035
|
||||
and #$F7 ;Enable SHR shadowing
|
||||
sta $C035
|
||||
lda #$a0
|
||||
sec
|
||||
@calcdest
|
||||
sbc #$20
|
||||
dex
|
||||
bne @calcdest
|
||||
sta $45
|
||||
stx $44
|
||||
ldx #$20
|
||||
ldy #0
|
||||
stx $43
|
||||
sty $42
|
||||
sta $C005 ;CPU writes go to aux 64K
|
||||
@copyshr
|
||||
lda ($42), y
|
||||
sta ($44), y
|
||||
iny
|
||||
bne @copyshr
|
||||
inc $43
|
||||
inc $45
|
||||
dex
|
||||
bne @copyshr
|
||||
sta $C004 ;CPU writes go to main 64K
|
||||
clc
|
||||
bcc resumeread
|
||||
|
||||
;-------------------------------
|
||||
; SaveFile
|
||||
; save a file to disk all at once, using ProDOS MLI calls
|
||||
;
|
||||
|
@ -27,6 +27,7 @@ DisplayArtwork
|
||||
!cpu 65816
|
||||
rep #2 ; clear Z flag on 65816 only
|
||||
!cpu 65c02
|
||||
PatchVidHD1
|
||||
beq + ; skip GS-specific code on non-GS machines (required, will crash on //c, grr)
|
||||
lda $C029
|
||||
ora #$40
|
||||
|
Loading…
x
Reference in New Issue
Block a user