From 749e1514bde23fd025cc5cf7d60a7767e5f4cc22 Mon Sep 17 00:00:00 2001 From: tomcw Date: Tue, 12 Apr 2016 23:21:05 +0100 Subject: [PATCH] Use correct resource BMP for each model's character set (Apple ][, original //e and Pravets) Also resized the Pravets BMPs to be either 256 or 512 pixels in height. --- ApplewinExpress9.00.vcproj | 8 +++++ resource/Applewin.rc | 2 +- resource/CHARSET82.bmp | Bin 10302 -> 8254 bytes resource/CHARSET8C.bmp | Bin 24638 -> 16446 bytes resource/CHARSET8M.bmp | Bin 10302 -> 8254 bytes source/Applewin.cpp | 18 ++++++----- source/Common.h | 12 ++++--- source/NTSC.cpp | 21 ++++++++++++- source/NTSC_CharSet.cpp | 62 ++++++++++++++++++------------------- source/NTSC_CharSet.h | 10 +++++- source/Video.cpp | 10 +++--- 11 files changed, 91 insertions(+), 52 deletions(-) diff --git a/ApplewinExpress9.00.vcproj b/ApplewinExpress9.00.vcproj index 5542a063..c46b645f 100644 --- a/ApplewinExpress9.00.vcproj +++ b/ApplewinExpress9.00.vcproj @@ -1078,6 +1078,10 @@ /> + + @@ -1106,6 +1110,10 @@ RelativePath=".\resource\CHARSET8C.bmp" > + + diff --git a/resource/Applewin.rc b/resource/Applewin.rc index 2ba7acc2..5260254e 100644 --- a/resource/Applewin.rc +++ b/resource/Applewin.rc @@ -69,7 +69,7 @@ LED_CAPSON_P8_BITMAP BITMAP "LED_CAPS_ON_P8.BMP" LED_LATOFF_BITMAP BITMAP "LED_CAPS_OFF_LAT.BMP" LED_LATON_BITMAP BITMAP "LED_CAPS_ON_LAT.BMP" CHARSET82 BITMAP "CHARSET82.BMP" -CHARSET8M BITMAP "CHARSET8C.BMP" +CHARSET8M BITMAP "CHARSET8M.BMP" CHARSET8C BITMAP "CHARSET8C.BMP" HELP_BUTTON BITMAP "HELP.BMP" DRIVESWAP_BUTTON BITMAP "DRIVESWAP.BMP" diff --git a/resource/CHARSET82.bmp b/resource/CHARSET82.bmp index 0396611b624a2bb352432ca56d0272bfd46df6c2..808fc2e1bcf09d79392cd73d677db9487440a33d 100644 GIT binary patch delta 71 xcmdlNu+PEH$=6PS0SxSbqy~t^2*HeC29T`)#8AKlq(K-2{{R2au-J}60RRpv2h0Ef delta 79 zcmdnzurI*Q$=6PU0SxSbB$&y_z~BJHj6etmKtW+{2xbBbfG`OB|Noz1vV(y9=2(G; I>=9b*a1lm5Q`CrnL!kY0R#yQ48q(H%mn0uFbMqr|9^8W$3f=F zIzp0@{aH9B$Fs>#u49p7vj04J9*Fv|c^}IxCPw4Qk?i$MHXkP6Vz*;5FxV``p~6C< zp2<=iDVysg?lDh}kx-gkCnLvnfM@bN5XC=vpG-Sr{bV;;dB*>n(_}v}GMr+q_Q(=r%O9lcg+FCnrhCPA-t*hhQF-g?0`Aw%k=9 diff --git a/resource/CHARSET8M.bmp b/resource/CHARSET8M.bmp index 53efbb337f3993f9d8bb7bb9638953fe9dbdf615..91dc9dec112be1209d9c7bc2827903ec51f6468e 100644 GIT binary patch delta 71 xcmdlNu+PEH$=6PS0SxSbqy~t^2*HeC29T`)#8AKlq(K-2{{R2au-J}60RRpv2h0Ef delta 79 zcmdnzurI*Q$=6PU0SxSbB$&y_z~BJHj6etmKtW+{2xbBbfG`OB|Noz1vV(y9=2(G; I>= A2TYPE_MAX) || (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE)) dwComputerType = A2TYPE_APPLE2EENHANCED; + // Remap the bad Pravets models (before AppleWin v1.26) + if (dwComputerType == A2TYPE_BAD_PRAVETS82) dwComputerType = A2TYPE_PRAVETS82; + if (dwComputerType == A2TYPE_BAD_PRAVETS8M) dwComputerType = A2TYPE_PRAVETS8M; + apple2Type = (eApple2Type) dwComputerType; } else // Support older AppleWin registry entries diff --git a/source/Common.h b/source/Common.h index 2bc2a071..d69a9647 100644 --- a/source/Common.h +++ b/source/Common.h @@ -166,7 +166,7 @@ enum eIRQSRC {IS_6522=0, IS_SPEECH, IS_SSC, IS_MOUSE}; #define IS_APPLE2C (g_Apple2Type & APPLE2C_MASK) #define IS_CLONE() (g_Apple2Type & APPLECLONE_MASK) -// NB. These get persisted to the Registry & save-state file, so don't change the values for these enums! +// NB. These get persisted to the Registry, so don't change the values for these enums! enum eApple2Type { A2TYPE_APPLE2=0, A2TYPE_APPLE2PLUS, @@ -178,10 +178,12 @@ enum eApple2Type { // // Clones start here: A2TYPE_CLONE=APPLECLONE_MASK, - A2TYPE_PRAVETS=APPLECLONE_MASK|APPLE2E_MASK, - A2TYPE_PRAVETS82=A2TYPE_PRAVETS, - A2TYPE_PRAVETS8M, - A2TYPE_PRAVETS8A, + A2TYPE_PRAVETS=APPLECLONE_MASK, + A2TYPE_PRAVETS82=A2TYPE_PRAVETS, // Apple ][ clone + A2TYPE_PRAVETS8M, // Apple ][ clone + A2TYPE_BAD_PRAVETS82=A2TYPE_PRAVETS|APPLE2E_MASK, // Wrongly tagged as Apple //e clone (< AppleWin 1.26) + A2TYPE_BAD_PRAVETS8M, // Wrongly tagged as Apple //e clone (< AppleWin 1.26) + A2TYPE_PRAVETS8A, // Apple //e clone A2TYPE_MAX }; diff --git a/source/NTSC.cpp b/source/NTSC.cpp index b3c7d521..38f78394 100644 --- a/source/NTSC.cpp +++ b/source/NTSC.cpp @@ -379,6 +379,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ,{ 255, 255, 255 } // 15 }; + static csbits_t csbits; // charset, optionally followed by alt charset // Prototypes // prototype from CPU.h @@ -433,6 +434,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA static void updateScreenText40 ( long cycles6502 ); static void updateScreenText80 ( long cycles6502 ); +//=========================================================================== +static void set_csbits() +{ + // NB. For models that don't have an alt charset then set /g_nVideoCharSet/ to zero + switch ( GetApple2Type() ) + { + case A2TYPE_APPLE2: csbits = &csbits_a2[0]; g_nVideoCharSet = 0; break; + case A2TYPE_APPLE2PLUS: csbits = &csbits_a2[0]; g_nVideoCharSet = 0; break; + case A2TYPE_APPLE2E: csbits = &csbits_2e[0]; break; + case A2TYPE_APPLE2EENHANCED:csbits = &csbits_enhanced2e[0]; break; + case A2TYPE_PRAVETS82: csbits = &csbits_pravets82[0]; g_nVideoCharSet = 0; break; // Apple ][ clone + case A2TYPE_PRAVETS8M: csbits = &csbits_pravets8M[0]; g_nVideoCharSet = 0; break; // Apple ][ clone + case A2TYPE_PRAVETS8A: csbits = &csbits_pravets8C[0]; break; // Apple //e clone + default: csbits = &csbits_enhanced2e[0]; break; + } +} //=========================================================================== inline float clampZeroOne( const float & x ) @@ -1685,13 +1702,15 @@ void NTSC_VideoReinitialize( DWORD cyclesThisFrame ) //=========================================================================== void NTSC_VideoInitAppleType () { - int model = g_Apple2Type; + int model = GetApple2Type(); // anything other than low bit set means not II/II+ (TC: include Pravets machines too?) if (model & 0xFFFE) g_pHorzClockOffset = APPLE_IIE_HORZ_CLOCK_OFFSET; else g_pHorzClockOffset = APPLE_IIP_HORZ_CLOCK_OFFSET; + + set_csbits(); } //=========================================================================== diff --git a/source/NTSC_CharSet.cpp b/source/NTSC_CharSet.cpp index 89201001..93a670f7 100644 --- a/source/NTSC_CharSet.cpp +++ b/source/NTSC_CharSet.cpp @@ -21,7 +21,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "NTSC_CharSet.h" -unsigned char csbits[2][256][8]; +unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e +unsigned char csbits_2e[2][256][8]; // Original //e (no mousetext) +unsigned char csbits_a2[1][256][8]; // ][ and ][+ +unsigned char csbits_pravets82[1][256][8]; // Pravets 82 +unsigned char csbits_pravets8M[1][256][8]; // Pravets 8M +unsigned char csbits_pravets8C[2][256][8]; // Pravets 8A & 8C #if 1 @@ -33,9 +38,8 @@ static const UINT charWidth = 16; static const UINT charWidthBytes = 16/8; static const UINT charHeight = 16; -void get_csbits_xy (UINT charset, UINT ch, UINT cx, UINT cy, const BYTE* pBitmap) +void get_csbits_xy (csbits_t csbits, UINT ch, UINT cx, UINT cy, const BYTE* pBitmap) { - _ASSERT(charset < 2); _ASSERT(ch < 256); _ASSERT((cx < bitmapWidth/charWidth) && (cy < bitmapHeight/charHeight)); @@ -53,56 +57,50 @@ void get_csbits_xy (UINT charset, UINT ch, UINT cx, UINT cy, const BYTE* pBitmap n >>= 1; } - csbits[charset][ch][y] = n; + csbits[0][ch][y] = n; pBitmap += bitmapWidthBytes*2; } } -void make_csbits (void) +void get_csbits (csbits_t csbits, const char* resourceName, const UINT cy0) { - HBITMAP hCharBitmap = LoadBitmap(g_hInstance, TEXT("CHARSET40")); - const UINT bufferSize = bitmapWidthBytes*bitmapHeight; BYTE* pBuffer = new BYTE [bufferSize]; + + HBITMAP hCharBitmap = LoadBitmap(g_hInstance, resourceName); GetBitmapBits(hCharBitmap, bufferSize, pBuffer); - // Enhanced //e: Alt char set off - for (UINT cy=0, ch=0; cy<16; cy++) + for (UINT cy=cy0, ch=0; cy