From c2d41958aba4dd39c1c41df74308d8eeb94e7b7e Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 19 Dec 2022 11:16:08 -0500 Subject: [PATCH] TR sync --- src/4cade.init.a | 23 +++++++++++++++++++++++ src/constants.a | 2 ++ src/hw.mockingboard.a | 15 +++++++-------- src/macros.a | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/src/4cade.init.a b/src/4cade.init.a index 7954ea4..5c12fc6 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -94,6 +94,29 @@ ; bit 7 = 1 if joystick ; and all other bits are 0 (we'll set bit 3 after copying it to LC RAM) + ; IIgs fix for Alternate Display Mode (clear shadow page 2) + lda zpMachineStatus + and #IS_IIGS + beq + + ldx #0 + txa +!cpu 65816 +- sta $E00800,x ; when Alternate Display Mode is turned off, the "2"s + sta $E00900,x ; displayed on the screen live at $E00800 + sta $E00A00,x ; (page "2"/$0800 of IIgs bank $E0) + sta $E00B00,x ; They are initialized by the IIgs boot ROM + inx + bne - +!cpu 6502 + + ; Since we know we are on IIgs, let's also force Mono Mode off + lda NEWVIDEO + and #$DF + sta NEWVIDEO ; Bit 5=1 for B/W double hi-res + lda #$00 + sta MONOCOLOR ; bit 7=1 disables color ++ + ; increase text window width so we can print to the edge of the screen without scrolling inc $21 ; print version or build number in lower right corner diff --git a/src/constants.a b/src/constants.a index 2d5ebb9..0363299 100644 --- a/src/constants.a +++ b/src/constants.a @@ -88,6 +88,7 @@ CLR80VID = $C00C ; 40 columns (also used to get out of DHGR mode) SET80VID = $C00D ; 80 columns (also used to get into DHGR mode) PRIMARYCHARSET= $C00E ; no mousetext for you SLOT3STATUS = $C017 ; bit 7 only +MONOCOLOR = $C021 ; IIgs bit 7 switches composite mono/color modes TBCOLOR = $C022 ; IIgs text foreground and background colors (also VidHD but write-only) NEWVIDEO = $C029 ; IIgs graphics modes (also VidHD) SPEAKER = $C030 ; chirp chirp @@ -108,6 +109,7 @@ ROM_TEXT = $FB2F ROM_MACHINEID =$FBB3 ROM_MACHINE2C =$FBC0 ROM_HOME = $FC58 +ROM_WAIT = $FCA8 ROM_COUT = $FDED ROM_NORMAL = $FE84 ; NORMAL text (instead of INVERSE or FLASH) ROM_IN0 = $FE89 ; SETKBD diff --git a/src/hw.mockingboard.a b/src/hw.mockingboard.a index 18a6680..0db8b99 100644 --- a/src/hw.mockingboard.a +++ b/src/hw.mockingboard.a @@ -32,6 +32,12 @@ MAGIC_Z80_LOCATION=$FFD GetMockingboardStuff +ST16 @callback+1 + lda ROM_MACHINEID + cmp #$06 + bne @not_iic + ldx ROM_MACHINE2C + bne @not_iic + ; from mgcaret ; https://github.com/a2-4am/4cade/issues/483 ; the Mockingboard init can accidentally enable the Softcard Z80 @@ -48,14 +54,7 @@ GetMockingboardStuff sta MAGIC_Z80_LOCATION, x dex bpl - - - lda ROM_MACHINEID - cmp #$06 - bne @not_iic - ldx ROM_MACHINE2C - bne @not_iic - dex ; enable Mockingboard 4C support - stx $C403 + stx $C403 ; enable Mockingboard 4C support stx $C404 @not_iic diff --git a/src/macros.a b/src/macros.a index dd81d7b..b772e99 100755 --- a/src/macros.a +++ b/src/macros.a @@ -352,9 +352,9 @@ +READ_ROM_NO_WRITE } -!macro USES_TEXT_PAGE_2 { - lda ROM_MACHINEID - cmp #$06 +!macro USES_TEXT_PAGE_2 { ; If we know we are going into a game one-time + lda ROM_MACHINEID ; only we can just blindly turn on TEXT2COPY, as + cmp #$06 ; Alternate Display Mode turns off on reset or reboot. bne + sec jsr $FE1F ; check for IIgs @@ -364,6 +364,32 @@ + } +!macro TEST_TEXT_PAGE_2 { ; On a ROM3 IIgs we can test if Alternate Display Mode + lda ROM_MACHINEID ; is already on. ROM0 and ROM1 versions of ADM use + cmp #$06 ; interrupts and can cause hangs, so safer to just + bne ++ ; leave it turned off, especially in ATTRACT/DEMO mode. + sec + jsr $FE1F ; check for IIgs + bcs ++ + tya ; GS ID routine returns with ROM version in Y + cmp #0 ; ROM 0? + beq ++ + cmp #1 ; ROM 1? + beq ++ + lda #$20 + sta $0800 ; check if Alternate Display Mode is already on + lda #$FF + jsr ROM_WAIT ; skip a VBL cycle +!cpu 65816 + lda $E00800 ; did we shadow copy data to bank $E0? + cmp #$20 + beq + ; only call TEXT2COPY if we know it's off +!cpu 6502 ; https://archive.org/details/develop-04_9010_October_1990/page/n51/mode/1up + jsr ROM_TEXT2COPY ; set alternate display mode on IIgs (required for some games) ++ cli ; enable VBL interrupts +++ +} + !macro RESET_VECTOR .addr { lda #<.addr sta $3F2 @@ -408,7 +434,7 @@ sta $3F4 } ; for games that clobber $100-$105, the prelaunch code constructs a new reset vector -; somewhere else and sets its +; somewhere else and sets the reset vector to point at it. !macro NEW_RESET_VECTOR .addr { ldx #5 - lda $100,x