Add support for PAL/European or custom 8K video ROMs (#596)

Added new cmd-line switch: -videorom <file> to replace the video ROM for the Enhanced //e.
- Support video ROM sizes of 4K, 8K and 16K (top 8K only).
- NB. The rocker switch is set to European video ROM.
F10 (for //e or Enhanced //e models) emulates the PAL //e's rocker switch (under the keyboard) to toggle between European or US video ROM.

Other:
- Fixed debugger's view of the AltCharSet soft-switch (it was showing the opposite state).
This commit is contained in:
TomCh
2018-11-17 16:29:17 +00:00
committed by GitHub
parent 14e0bb7b71
commit aa59c71847
9 changed files with 208 additions and 20 deletions
+99 -1
View File
@@ -21,10 +21,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h"
#include "Applewin.h"
#include "Video.h"
#include "NTSC_CharSet.h"
unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e
unsigned char csbits_enhanced2e[2][256][8]; // Enhanced //e (2732 4K video ROM)
static unsigned char csbits_enhanced2e_pal[2][256][8]; // PAL Enhanced //e (2764 8K video ROM - top 4K) via rocker switch under keyboard
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
@@ -86,6 +88,91 @@ static void get_csbits(csbits_t csbits, const char* resourceName, const UINT cy0
delete [] pBuffer;
}
//-------------------------------------
// ROM address (RA):
// -----------------
// . RA10,..,RA3;SEGC,SEGB,SEGA => [2^8][2^3] => 256 chars of 8 lines (total = 2KiB)
// . VID7,..,VID0 is the 8-bit video character (eg. from TEXT/$400 memory)
//
// UTAIIe:8-13, Table 8.2:
//
// ALTCHRSET | RA10 | RA9
//------------------------------------------
// 0 | VID7 + VID6.FLASH | VID6.VID7
// 1 | VID7 | VID6
//
// FLASH toggles every 16 VBLs, so alternates between selecting NORMAL control/special and INVERSE control/special
//
void userVideoRom4K(csbits_t csbits, const BYTE* pVideoRom)
{
int RA = 0; // rom address
int i = 0;
// regular char set
for (; i<64; i++, RA+=8) // [00..3F] INVERSE / [40..7F] FLASH
{
for (int y=0; y<8; y++)
{
csbits[0][i][y] = pVideoRom[RA+y] ^ 0xff; // UTAIIe:8-11 "dot patterns in the video ROM are inverted..."
csbits[0][i+64][y] = pVideoRom[RA+y] ^ 0xff; // UTAIIe:8-14 (Table 8.3) we use FLASH=0, so RA=00ccccccsss
}
}
RA = (1<<10 | 0<<9); // UTAIIe:8-14 (Table 8.3)
for (i=128; i<256; i++, RA+=8) // [80..BF] NORMAL
{
for (int y=0; y<8; y++)
{
csbits[0][i][y] = pVideoRom[RA+y] ^ 0xff; // UTAIIe:8-11 "dot patterns in the video ROM are inverted..."
}
}
RA = (1<<10 | 1<<9); // UTAIIe:8-14 (Table 8.3)
for (i=192; i<256; i++, RA+=8) // [C0..FF] NORMAL
{
for (int y=0; y<8; y++)
{
csbits[0][i][y] = pVideoRom[RA+y] ^ 0xff; // UTAIIe:8-11 "dot patterns in the video ROM are inverted..."
}
}
// alt char set
RA = 0;
for (i=0; i<256; i++, RA+=8) // [00..7F] INVERSE / [80..FF] NORMAL
{
for (int y=0; y<8; y++)
{
csbits[1][i][y] = pVideoRom[RA+y] ^ 0xff; // UTAIIe:8-11 "dot patterns in the video ROM are inverted..."
}
}
}
void userVideoRom(void)
{
const BYTE* pVideoRom;
UINT size = GetVideoRom(pVideoRom); // 4K or 8K
if (!size)
return;
if (size == kVideoRomSize4K)
{
userVideoRom4K(&csbits_enhanced2e[0], pVideoRom);
return;
}
userVideoRom4K(&csbits_enhanced2e_pal[0], pVideoRom);
userVideoRom4K(&csbits_enhanced2e[0], &pVideoRom[4*1024]);
}
//-------------------------------------
void make_csbits(void)
{
get_csbits(&csbits_enhanced2e[0], TEXT("CHARSET40"), 0); // Enhanced //e: Alt char set off
@@ -99,4 +186,15 @@ void make_csbits(void)
// Original //e is just Enhanced //e with the 32 mousetext chars [0x40..0x5F] replaced by the non-alt charset chars [0x40..0x5F]
memcpy(csbits_2e, csbits_enhanced2e, sizeof(csbits_enhanced2e));
memcpy(&csbits_2e[1][64], &csbits_2e[0][64], 32*8);
// Try to use any user-provided video ROM for Enhanced //e
userVideoRom();
}
csbits_t GetEnhanced2e_csbits(void)
{
if (IsVideoRom4K())
return csbits_enhanced2e;
return GetVideoRomRockerSwitch() == false ? csbits_enhanced2e : csbits_enhanced2e_pal;
}