From c0521157f27dac7993c3879f0f0e632dc144a86e Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Fri, 11 Jan 2019 14:32:49 -0800 Subject: [PATCH] GS to init phase --- src/constants.a | 2 +- src/pitchdark.init.a | 26 ++++++++++++++++++++------ src/prodos.mli.a | 2 +- src/ui.artwork.a | 19 +++++-------------- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/constants.a b/src/constants.a index 9f98b23..e67a745 100644 --- a/src/constants.a +++ b/src/constants.a @@ -17,7 +17,7 @@ ;~7400...... - program data (approximate) ; -kPitchDarkBinaryAddress = $3F2F +kPitchDarkBinaryAddress = $3F25 kGameInfoBuffer = $0800 ; used by LoadGameInfo kProDOSFileBuffer = $1C00 ; 1K buffer for ProDOS MLI calls diff --git a/src/pitchdark.init.a b/src/pitchdark.init.a index bde5ec6..568ee0d 100644 --- a/src/pitchdark.init.a +++ b/src/pitchdark.init.a @@ -57,19 +57,33 @@ 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 + sta PatchVidHD + bne @setSHR ; always + +@kVidHDID + !byte $24, $EA, $4C @nextslot dex cpx #$c0 bne @findVidHD - beq + -@kVidHDID - !byte $24, $EA, $4C + +;------------------------------------------------------------------------------ +; detect IIGS by running CPU-specific magic +;------------------------------------------------------------------------------ + +!cpu 65816 + rep #2 ; clear Z flag on 65816 only +!cpu 65c02 + beq + ; skip GS-specific code on non-GS machines (required, will crash on //c, grr) +@setSHR + inc WeCanHazSHR+1 + lda $C029 + ora #$40 + sta $C029 ; set GS NEWVIDEO mode to turn off linearize + + ;------------------------------------------------------------------------------ ; clear options script and make checksum invalid ;------------------------------------------------------------------------------ diff --git a/src/prodos.mli.a b/src/prodos.mli.a index 1143cdb..182d667 100644 --- a/src/prodos.mli.a +++ b/src/prodos.mli.a @@ -200,7 +200,7 @@ LoadSHRFile bcs close phx -PatchVidHD2 +PatchVidHD bcs copyvidhd !cpu 65816 diff --git a/src/ui.artwork.a b/src/ui.artwork.a index 66b8cf9..63b7f64 100644 --- a/src/ui.artwork.a +++ b/src/ui.artwork.a @@ -23,18 +23,9 @@ kArtworkGSRootDirectory ; length-prefixed pathname of SHGR graphic ; out: all registers and flags clobbered ;------------------------------------------------------------------------------ DisplayArtwork - ldx #0 ; set Z flag always -!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 - sta $C029 ; set GS NEWVIDEO mode to turn off linearize - inx - -+ jsr ResetPath +WeCanHazSHR + ldx #0 ; SMC + jsr ResetPath +LDADDR kArtworkRootDirectory dex bne + @@ -73,7 +64,7 @@ PatchVidHD1 plx bcs - lda $C029 - ora #$C1 + ora #$81 sta $C029 ; set GS NEWVIDEO mode to turn on SHR mode @waitKey @@ -85,6 +76,6 @@ PatchVidHD1 plx bne + lda $C029 - and #$3F + and #$7F sta $C029 ; back to text GS-style + jmp ClearPendingInput