From e116014742f122fb70305ffcb6de49d8fa0dbd37 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Wed, 31 Dec 2014 14:13:36 -0800 Subject: [PATCH] First pass of NTSC integration --- ApplewinExpress10.00.vcxproj | 2 + source/Applewin.cpp | 3 +- source/CPU.cpp | 33 ++++--- source/CPU/cpu6502.h | 13 +++ source/CPU/cpu65C02.h | 13 +++ source/CPU/cpu65d02.h | 13 +++ source/Configuration/PageConfig.cpp | 2 +- source/Frame.h | 7 ++ source/SaveState.cpp | 5 + source/StdAfx.h | 1 + source/Video.cpp | 144 ++++++++++++++++------------ source/Video.h | 61 +++++++----- 12 files changed, 191 insertions(+), 106 deletions(-) diff --git a/ApplewinExpress10.00.vcxproj b/ApplewinExpress10.00.vcxproj index e6fadecf..48c2bca6 100644 --- a/ApplewinExpress10.00.vcxproj +++ b/ApplewinExpress10.00.vcxproj @@ -265,6 +265,7 @@ + Create Create @@ -392,6 +393,7 @@ + diff --git a/source/Applewin.cpp b/source/Applewin.cpp index a4d5ee05..6e80f7cd 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Speech.h" #endif #include "Video.h" +#include "NTSC.h" #include "Configuration\About.h" #include "Configuration\PropertySheet.h" @@ -408,7 +409,7 @@ void LoadConfiguration(void) case A2TYPE_PRAVETS8M: g_nCharsetType = 3; break; //This charset has a very small difference with the PRAVETS82 one an probably has some misplaced characters. Still the Pravets82 charset is used, because setting charset to 3 results in some problems. } - // + NTSC_VideoInitAppleType(); if (!REGLOAD(TEXT(REGVALUE_JOYSTICK0_EMU_TYPE), &joytype[JN_JOYSTICK0])) LoadConfigOldJoystick(JN_JOYSTICK0); diff --git a/source/CPU.cpp b/source/CPU.cpp index fadaecbb..faf45fbf 100644 --- a/source/CPU.cpp +++ b/source/CPU.cpp @@ -96,6 +96,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Speech.h" #endif #include "Video.h" +#include "NTSC.h" #include "z80emu.h" #include "Z80VICE\z80.h" @@ -103,25 +104,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Debugger\Debug.h" - -#define AF_SIGN 0x80 -#define AF_OVERFLOW 0x40 -#define AF_RESERVED 0x20 -#define AF_BREAK 0x10 -#define AF_DECIMAL 0x08 -#define AF_INTERRUPT 0x04 -#define AF_ZERO 0x02 -#define AF_CARRY 0x01 +// 6502 Accumulator Bit Flags + #define AF_SIGN 0x80 + #define AF_OVERFLOW 0x40 + #define AF_RESERVED 0x20 + #define AF_BREAK 0x10 + #define AF_DECIMAL 0x08 + #define AF_INTERRUPT 0x04 + #define AF_ZERO 0x02 + #define AF_CARRY 0x01 #define SHORTOPCODES 22 #define BENCHOPCODES 33 -// What is this 6502 code? -static BYTE benchopcode[BENCHOPCODES] = {0x06,0x16,0x24,0x45,0x48,0x65,0x68,0x76, - 0x84,0x85,0x86,0x91,0x94,0xA4,0xA5,0xA6, - 0xB1,0xB4,0xC0,0xC4,0xC5,0xE6, - 0x19,0x6D,0x8D,0x99,0x9D,0xAD,0xB9,0xBD, - 0xDD,0xED,0xEE}; +// What is this 6502 code? Compressed 6502 code -- see: CpuSetupBenchmark() +static BYTE benchopcode[BENCHOPCODES] = { + 0x06,0x16,0x24,0x45,0x48,0x65,0x68,0x76, + 0x84,0x85,0x86,0x91,0x94,0xA4,0xA5,0xA6, + 0xB1,0xB4,0xC0,0xC4,0xC5,0xE6, + 0x19,0x6D,0x8D,0x99,0x9D,0xAD,0xB9,0xBD, + 0xDD,0xED,0xEE +}; regsrec regs; unsigned __int64 g_nCumulativeCycles = 0; diff --git a/source/CPU/cpu6502.h b/source/CPU/cpu6502.h index eb140bac..a22aa764 100644 --- a/source/CPU/cpu6502.h +++ b/source/CPU/cpu6502.h @@ -44,6 +44,11 @@ static DWORD Cpu6502 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; +// NTSC_BEGIN + ULONG uElapsedCycles; + ULONG uPreviousCycles = uExecutedCycles; +// NTSC_END + if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) @@ -315,6 +320,14 @@ static DWORD Cpu6502 (DWORD uTotalCycles) } } +// NTSC_BEGIN + uElapsedCycles = uExecutedCycles - uPreviousCycles; + if( g_bFullSpeed ) + NTSC_VideoUpdateCycles( uElapsedCycles ); + else + g_pNTSC_FuncVideoUpdate( uElapsedCycles ); +// NTSC_END + CheckInterruptSources(uExecutedCycles); NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); diff --git a/source/CPU/cpu65C02.h b/source/CPU/cpu65C02.h index 43223ef9..6a9c30f3 100644 --- a/source/CPU/cpu65C02.h +++ b/source/CPU/cpu65C02.h @@ -47,6 +47,11 @@ static DWORD Cpu65C02 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; +// NTSC_BEGIN + ULONG uElapsedCycles; + ULONG uPreviousCycles = uExecutedCycles; +// NTSC_END + if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) @@ -319,6 +324,14 @@ static DWORD Cpu65C02 (DWORD uTotalCycles) #undef $ } +// NTSC_BEGIN + uElapsedCycles = uExecutedCycles - uPreviousCycles; + if( g_bFullSpeed ) + NTSC_VideoUpdateCycles( uElapsedCycles ); + else + g_pNTSC_FuncVideoUpdate( uElapsedCycles ); +// NTSC_END + CheckInterruptSources(uExecutedCycles); NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); diff --git a/source/CPU/cpu65d02.h b/source/CPU/cpu65d02.h index 80b800fa..120cbd5b 100644 --- a/source/CPU/cpu65d02.h +++ b/source/CPU/cpu65d02.h @@ -106,6 +106,11 @@ static DWORD Cpu65D02 (DWORD uTotalCycles) UINT uExtraCycles = 0; BYTE iOpcode; +// NTSC_BEGIN + ULONG uElapsedCycles; + ULONG uPreviousCycles = uExecutedCycles; +// NTSC_END + if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) @@ -648,6 +653,14 @@ static DWORD Cpu65D02 (DWORD uTotalCycles) } #undef $ +// NTSC_BEGIN + uElapsedCycles = uExecutedCycles - uPreviousCycles; + if( g_bFullSpeed ) + NTSC_VideoUpdateCycles( uElapsedCycles ); + else + g_pNTSC_FuncVideoUpdate( uElapsedCycles ); +// NTSC_END + CheckInterruptSources(uExecutedCycles); NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index 78ba4116..a5c47884 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -114,7 +114,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM break; case IDC_MONOCOLOR: - VideoChooseColor(); + VideoChooseMonochromeColor(); break; case IDC_CHECK_CONFIRM_REBOOT: diff --git a/source/Frame.h b/source/Frame.h index 322820b7..47af25a1 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -12,8 +12,15 @@ // 560 = Double Hi-Res // 384 = Doule Scan Line +// NTSC_BEGIN +#if 0 #define FRAMEBUFFER_W 560 #define FRAMEBUFFER_H 384 +#else + #define FRAMEBUFFER_W 600 + #define FRAMEBUFFER_H 420 +#endif +// NTSC_END // Direct Draw -- For Full Screen extern LPDIRECTDRAW g_pDD; diff --git a/source/SaveState.cpp b/source/SaveState.cpp index 5c38beed..6587e458 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -40,6 +40,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Speaker.h" #include "Video.h" +// Prototypes (Public) + // Note: This is here and not in Video.h to prevent header include bloat. + // i.e. so we don't need to incude "Structs.h" for NTSC.cpp + DWORD VideoGetSnapshot(SS_IO_Video* pSS); + DWORD VideoSetSnapshot(SS_IO_Video* pSS); #define DEFAULT_SNAPSHOT_NAME "SaveState.aws" diff --git a/source/StdAfx.h b/source/StdAfx.h index 2e0d77a7..010d50f8 100644 --- a/source/StdAfx.h +++ b/source/StdAfx.h @@ -25,6 +25,7 @@ #include #include #include +#include // uint8_t #include #include // WM_MOUSEWHEEL diff --git a/source/Video.cpp b/source/Video.cpp index ca6dbfee..a653c44b 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Memory.h" #include "Registry.h" #include "Video.h" +#include "NTSC.h" #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" @@ -195,17 +196,6 @@ const BYTE DoubleHiresPalIndex[16] = { const int SRCOFFS_DHIRES = (SRCOFFS_HIRES + 512); // 1168 const int SRCOFFS_TOTAL = (SRCOFFS_DHIRES + 2560); // 3278 - enum VideoFlag_e - { - VF_80COL = 0x00000001, - VF_DHIRES = 0x00000002, - VF_HIRES = 0x00000004, - VF_80STORE= 0x00000008, - VF_MIXED = 0x00000010, - VF_PAGE2 = 0x00000020, - VF_TEXT = 0x00000040 - }; - #define SW_80COL (g_uVideoMode & VF_80COL) #define SW_DHIRES (g_uVideoMode & VF_DHIRES) #define SW_HIRES (g_uVideoMode & VF_HIRES) @@ -223,6 +213,13 @@ const BYTE DoubleHiresPalIndex[16] = { #define HGR_MATRIX_YOFFSET 2 // For tv emulation HGR Video Mode +// Globals (Public) + + uint8_t *g_pFramebufferbits = NULL; // last drawn frame + int g_nAltCharSetOffset = 0; // alternate character set + +// Globals (Private) + // video scanner constants int const kHBurstClock = 53; // clock when Color Burst starts int const kHBurstClocks = 4; // clocks per Color Burst duration @@ -246,7 +243,6 @@ static COLORREF customcolors[256]; // MONOCHROME is last custom color static HBITMAP g_hDeviceBitmap; static HDC g_hDeviceDC; - LPBYTE g_pFramebufferbits = NULL; // last drawn frame static LPBITMAPINFO g_pFramebufferinfo = NULL; static LPBYTE g_aFrameBufferOffset[FRAMEBUFFER_H]; // array of pointers to start of each scanline @@ -270,7 +266,6 @@ static BYTE colormixbuffer[6]; static WORD colormixmap[6][6][6]; // -static int g_nAltCharSetOffset = 0; // alternate character set static /*bool*/ UINT g_VideoForceFullRedraw = 1; static bool g_bVideoUpdatedThisFrame = false; @@ -451,6 +446,9 @@ void CreateFrameOffsetTable (LPBYTE addr, LONG pitch) //=========================================================================== void VideoInitialize () { + // RESET THE VIDEO MODE SWITCHES AND THE CHARACTER SET OFFSET + VideoResetState(); + // CREATE A BUFFER FOR AN IMAGE OF THE LAST DRAWN MEMORY vidlastmem = (LPBYTE)VirtualAlloc(NULL,0x10000,MEM_COMMIT,PAGE_READWRITE); ZeroMemory(vidlastmem,0x10000); @@ -466,47 +464,15 @@ void VideoInitialize () PAGE_READWRITE); ZeroMemory(g_pFramebufferinfo,sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)); - g_pFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - g_pFramebufferinfo->bmiHeader.biWidth = FRAMEBUFFER_W; - g_pFramebufferinfo->bmiHeader.biHeight = FRAMEBUFFER_H; - g_pFramebufferinfo->bmiHeader.biPlanes = 1; - g_pFramebufferinfo->bmiHeader.biBitCount = 8; - g_pFramebufferinfo->bmiHeader.biClrUsed = 256; + g_pFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + g_pFramebufferinfo->bmiHeader.biWidth = FRAMEBUFFER_W; + g_pFramebufferinfo->bmiHeader.biHeight = FRAMEBUFFER_H; + g_pFramebufferinfo->bmiHeader.biPlanes = 1; + g_pFramebufferinfo->bmiHeader.biBitCount = 32; + g_pFramebufferinfo->bmiHeader.biCompression = BI_RGB; + g_pFramebufferinfo->bmiHeader.biClrUsed = 0; - // CREATE A BITMAPINFO STRUCTURE FOR THE SOURCE IMAGE - g_pSourceHeader = (LPBITMAPINFO)VirtualAlloc( - NULL, - sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD), - MEM_COMMIT, - PAGE_READWRITE); - - ZeroMemory(g_pSourceHeader,sizeof(BITMAPINFOHEADER)); - g_pSourceHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - g_pSourceHeader->bmiHeader.biWidth = SRCOFFS_TOTAL; - g_pSourceHeader->bmiHeader.biHeight = 512; - g_pSourceHeader->bmiHeader.biPlanes = 1; - g_pSourceHeader->bmiHeader.biBitCount = 8; - g_pSourceHeader->bmiHeader.biClrUsed = 256; - - // VideoReinitialize() ... except we set the frame buffer palette.... - V_CreateIdentityPalette(); - - //RGB() -> none - //PALETTERGB() -> PC_EXPLICIT - //??? RGB() -> PC_NOCOLLAPSE - for( int iColor = 0; iColor < NUM_COLOR_PALETTE; iColor++ ) - customcolors[ iColor ] = ((DWORD)PC_EXPLICIT << 24) | RGB( - g_pFramebufferinfo->bmiColors[iColor].rgbRed, - g_pFramebufferinfo->bmiColors[iColor].rgbGreen, - g_pFramebufferinfo->bmiColors[iColor].rgbBlue - ); - - // CREATE THE FRAME BUFFER DIB SECTION AND DEVICE CONTEXT, - // CREATE THE SOURCE IMAGE DIB SECTION AND DRAW INTO THE SOURCE BIT BUFFER - V_CreateDIBSections(); - - // RESET THE VIDEO MODE SWITCHES AND THE CHARACTER SET OFFSET - VideoResetState(); + NTSC_VideoCreateDIBSection(); } //=========================================================================== @@ -2329,8 +2295,9 @@ BYTE VideoCheckVbl (WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles) return (r & ~0x80) | ((bVblBar) ? 0x80 : 0); } +// This is called from PageConfig //=========================================================================== -void VideoChooseColor () +void VideoChooseMonochromeColor () { CHOOSECOLOR cc; ZeroMemory(&cc,sizeof(CHOOSECOLOR)); @@ -2595,6 +2562,20 @@ VideoUpdateFuncPtr_t VideoRefreshScreen () DebugRefresh(0); #endif +// NTSC_BEGIN: wsVideoRefresh() + LPBYTE pDstFrameBufferBits = 0; + LONG pitch = 0; + HDC hFrameDC = FrameGetVideoDC(&pDstFrameBufferBits,&pitch); + + if (hFrameDC) + { +// StretchBlt(hFrameDC,0,0,VIEWPORTCX,VIEWPORTCY,g_hDeviceDC,0,0,FRAMEBUFFER_W,FRAMEBUFFER_H,SRCCOPY); + StretchBlt(hFrameDC,0,0,FRAMEBUFFER_W,FRAMEBUFFER_H,g_hDeviceDC,0,0,FRAMEBUFFER_W,FRAMEBUFFER_H,SRCCOPY); + GdiFlush(); + } + return NULL; +// NTSC_END + // CHECK EACH CELL FOR CHANGED BYTES. REDRAW PIXELS FOR THE CHANGED BYTES // IN THE FRAME BUFFER. MARK CELLS IN WHICH REDRAWING HAS TAKEN PLACE AS // DIRTY. @@ -2779,8 +2760,8 @@ void _Video_RedrawScreen( VideoUpdateFuncPtr_t pfUpdate, bool bMixed ) //=========================================================================== void VideoReinitialize () { - V_CreateIdentityPalette(); - V_CreateDIBSections(); + NTSC_VideoInitAppleType(); + NTSC_SetVideoStyle(); } @@ -2803,10 +2784,10 @@ BYTE VideoSetMode (WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles) switch (address) { - case 0x00: g_uVideoMode &= ~VF_80STORE; break; - case 0x01: g_uVideoMode |= VF_80STORE; break; - case 0x0C: if (!IS_APPLE2) g_uVideoMode &= ~VF_80COL; break; - case 0x0D: if (!IS_APPLE2) g_uVideoMode |= VF_80COL; break; + case 0x00: g_uVideoMode &= ~VF_80STORE; ; break; + case 0x01: g_uVideoMode |= VF_80STORE; ; break; + case 0x0C: if (!IS_APPLE2) g_uVideoMode &= ~VF_80COL; NTSC_SetVideoTextMode(40); break; + case 0x0D: if (!IS_APPLE2) g_uVideoMode |= VF_80COL; NTSC_SetVideoTextMode(80); break; case 0x0E: if (!IS_APPLE2) g_nAltCharSetOffset = 0; break; // Alternate char set off case 0x0F: if (!IS_APPLE2) g_nAltCharSetOffset = 256; break; // Alternate char set on case 0x50: g_uVideoMode &= ~VF_TEXT; break; @@ -2821,6 +2802,10 @@ BYTE VideoSetMode (WORD, WORD address, BYTE write, BYTE, ULONG uExecutedCycles) case 0x5F: if (!IS_APPLE2) g_uVideoMode &= ~VF_DHIRES; break; } +// NTSC_BEGIN + NTSC_SetVideoMode( g_uVideoMode ); +// NTSC_END + if (SW_80STORE) g_uVideoMode &= ~VF_PAGE2; @@ -3316,7 +3301,7 @@ void Video_MakeScreenShot(FILE *pFile) // Write Pixel Data // No need to use GetDibBits() since we already have http://msdn.microsoft.com/en-us/library/ms532334.aspx // @reference: "Storing an Image" http://msdn.microsoft.com/en-us/library/ms532340(VS.85).aspx - pSrc = ((u8*)g_pFramebufferbits); + pSrc = ((uint8_t*)g_pFramebufferbits); nLen = g_tBmpHeader.nWidthPixels * g_tBmpHeader.nHeightPixels * g_tBmpHeader.nBitsPerPixel / 8; if( g_iScreenshotType == SCREENSHOT_280x192 ) @@ -3351,10 +3336,10 @@ void Video_MakeScreenShot(FILE *pFile) TargaHeader_t *pHeader = &g_tTargaHeader; memset( (void*)pHeader, 0, sizeof( TargaHeader_t ) ); - pHeader->iImageType = TARGA_RGB; + pHeader->iImageType = TARGA_RGB; pHeader->nWidthPixels = FRAMEBUFFER_W; pHeader->nHeightPixels = FRAMEBUFFER_H; - pHeader->nBitsPerPixel = 24; + pHeader->nBitsPerPixel = 24; #endif // SCREENSHOT_TGA } @@ -3393,3 +3378,36 @@ void Config_Save_Video() REGSAVE(TEXT(REGVALUE_VIDEO_HALF_SCAN_LINES),g_uHalfScanLines); REGSAVE(TEXT(REGVALUE_VIDEO_MONO_COLOR ),monochrome); } + +// ____________________________________________________________________ + +//=========================================================================== +void NTSC_VideoCreateDIBSection() +{ + // CREATE THE DEVICE CONTEXT + HWND window = GetDesktopWindow(); + HDC dc = GetDC(window); + if (g_hDeviceDC) + { + DeleteDC(g_hDeviceDC); + } + g_hDeviceDC = CreateCompatibleDC(dc); + + // CREATE THE FRAME BUFFER DIB SECTION + if (g_hDeviceBitmap) + DeleteObject(g_hDeviceBitmap); + g_hDeviceBitmap = CreateDIBSection( + dc, + g_pFramebufferinfo, + DIB_RGB_COLORS, + (LPVOID *)&g_pFramebufferbits,0,0 + ); + SelectObject(g_hDeviceDC,g_hDeviceBitmap); + + // CREATE THE OFFSET TABLE FOR EACH SCAN LINE IN THE FRAME BUFFER + // DRAW THE SOURCE IMAGE INTO THE SOURCE BIT BUFFER + ZeroMemory( g_pFramebufferbits, FRAMEBUFFER_W*FRAMEBUFFER_H*4 ); + + NTSC_VideoInit( g_pFramebufferbits ); +} + diff --git a/source/Video.h b/source/Video.h index 9aa270b9..1fb3075e 100644 --- a/source/Video.h +++ b/source/Video.h @@ -8,8 +8,8 @@ { VT_MONO_HALFPIXEL_REAL // uses custom monochrome , VT_COLOR_STANDARD - , VT_COLOR_TEXT_OPTIMIZED - , VT_COLOR_TVEMU + , VT_COLOR_TEXT_OPTIMIZED + , VT_COLOR_TVEMU , VT_MONO_AMBER // now half pixel , VT_MONO_GREEN // now half pixel , VT_MONO_WHITE // now half pixel @@ -19,28 +19,39 @@ extern TCHAR g_aVideoChoices[]; extern char *g_apVideoModeDesc[ NUM_VIDEO_MODES ]; -enum AppleFont_e -{ - // 40-Column mode is 1x Zoom (default) - // 80-Column mode is ~0.75x Zoom (7 x 16) - // Tiny mode is 0.5 zoom (7x8) for debugger - APPLE_FONT_WIDTH = 14, // in pixels - APPLE_FONT_HEIGHT = 16, // in pixels + enum VideoFlag_e + { + VF_80COL = 0x00000001, + VF_DHIRES = 0x00000002, + VF_HIRES = 0x00000004, + VF_80STORE= 0x00000008, // was called VF_MASK2 + VF_MIXED = 0x00000010, + VF_PAGE2 = 0x00000020, + VF_TEXT = 0x00000040 + }; - // Each cell has a reserved aligned pixel area (grid spacing) - APPLE_FONT_CELL_WIDTH = 16, - APPLE_FONT_CELL_HEIGHT = 16, + enum AppleFont_e + { + // 40-Column mode is 1x Zoom (default) + // 80-Column mode is ~0.75x Zoom (7 x 16) + // Tiny mode is 0.5 zoom (7x8) for debugger + APPLE_FONT_WIDTH = 14, // in pixels + APPLE_FONT_HEIGHT = 16, // in pixels - // The bitmap contains 3 regions - // Each region is 256x256 pixels = 16x16 chars - APPLE_FONT_X_REGIONSIZE = 256, // in pixelx - APPLE_FONT_Y_REGIONSIZE = 256, // in pixels + // Each cell has a reserved aligned pixel area (grid spacing) + APPLE_FONT_CELL_WIDTH = 16, + APPLE_FONT_CELL_HEIGHT = 16, - // Starting Y offsets (pixels) for the regions - APPLE_FONT_Y_APPLE_2PLUS = 0, // ][+ - APPLE_FONT_Y_APPLE_80COL = 256, // //e (inc. Mouse Text) - APPLE_FONT_Y_APPLE_40COL = 512, // ][ -}; + // The bitmap contains 3 regions + // Each region is 256x256 pixels = 16x16 chars + APPLE_FONT_X_REGIONSIZE = 256, // in pixelx + APPLE_FONT_Y_REGIONSIZE = 256, // in pixels + + // Starting Y offsets (pixels) for the regions + APPLE_FONT_Y_APPLE_2PLUS = 0, // ][+ + APPLE_FONT_Y_APPLE_80COL = 256, // //e (inc. Mouse Text) + APPLE_FONT_Y_APPLE_40COL = 512, // ][ + }; // Globals __________________________________________________________ @@ -49,7 +60,8 @@ extern HBITMAP g_hLogoBitmap; extern COLORREF monochrome; // saved extern DWORD g_eVideoType; // saved extern DWORD g_uHalfScanLines; // saved -extern LPBYTE g_pFramebufferbits; +extern uint8_t *g_pFramebufferbits; +extern int g_nAltCharSetOffset; // alternate character set typedef bool (*VideoUpdateFuncPtr_t)(int,int,int,int,int); @@ -59,7 +71,7 @@ void CreateColorMixMap(); BOOL VideoApparentlyDirty (); void VideoBenchmark (); -void VideoChooseColor (); +void VideoChooseMonochromeColor (); // FIXME: Should be moved to PageConfig and call VideoSetMonochromeColor() void VideoDestroy (); void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale); void VideoDisplayLogo (); @@ -85,9 +97,6 @@ bool VideoGetSWAltCharSet(void); void VideoSetForceFullRedraw(void); -DWORD VideoGetSnapshot(SS_IO_Video* pSS); -DWORD VideoSetSnapshot(SS_IO_Video* pSS); - void _Video_Dirty(); void _Video_RedrawScreen( VideoUpdateFuncPtr_t update, bool bMixed = false ); void _Video_SetupBanks( bool bBank2 );