preserve screen holes across demo

This commit is contained in:
Peter Ferrie 2018-11-26 11:43:39 -08:00
parent 6765fa976f
commit fe3493d2b3
4 changed files with 62 additions and 0 deletions

View File

@ -13,6 +13,7 @@ FirstMover
Reenter ; self-running demos should call this to exit back to 4cade
+READ_RAM1_WRITE_RAM1
jsr CloseHandles ; close any open handles to restore ProRWTS state to original
jsr SaveScreenHoles ; restore screen hole contents from saved copy
Main
ldx #$FF
txs

View File

@ -51,6 +51,11 @@ ProRWTSBuffer
; so we reuse as much of the 1-time code as possible
; and fill the rest with zeros
OneTimeSetup
lda MachineStatus
sta oldstatus
jsr SaveScreenHoles ; save initial copy of screen hole content
lda #$91
sta holepatch ; enable restoring of copy from now on
lda hddopendir+1 ; save current directory as 'root'
ldy hddopendir+3
+STAY gRootDirectory

View File

@ -7,6 +7,8 @@
; - LoadFile
; - LoadDHRFile
; - SaveSmallFile
; - CloseHandles
; - SaveScreenHoles
;
; A general note about paths:
;
@ -240,6 +242,15 @@ traverse
@go
rts
;------------------------------------------------------------------------------
; promote [private]
;
; tiny ProDOS-style interface for ProRWTS
; in: whatever ProDOS expects for the supported functions
; out: carry clear, A=0
; X, Y, and other flags clobbered
;------------------------------------------------------------------------------
promote
!pseudopc $bf00 {
lda $c08b
@ -269,6 +280,50 @@ ProDOS_prefix=$bfd0
}
end_promote
;------------------------------------------------------------------------------
; SaveScreenHoles
; preserve screen hole contents across demo execution
; to avoid crashing later on disk access
;
; in: nothing
; out: all flags clobbered
; all registers clobbered
;------------------------------------------------------------------------------
SaveScreenHoles
lda #4
sta namhi
ldx #0
stx namlo
sta bloklo
-- ldy #$78
- lda (namlo),y
pha
lda holey_stuff,x
holepatch ;sta->lda
lda (namlo),y
pla
sta holey_stuff,x
inx
tya
eor #$80
tay
bmi -
iny
bpl -
inc namhi
dec bloklo
bne --
lda oldstatus
ldx MachineStatus
sta MachineStatus
sta oldstatus
rts
oldstatus
!byte 0
holey_stuff
!fill 64
;------------------------------------------------------------------------------
; ProDOS_enter
; intercept certain ProDOS requests

View File

@ -82,6 +82,7 @@ gAttractIndex
+LOAD_FILE_IMM @key
jsr SaveScreenHoles ; save screen hole contents in case game changes them
ldx #(End_Prelaunch-Prelaunch-1)
- lda Prelaunch,x ; copy pre-launch code to main memory
sta $100,x