Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Andrea Odetti 2021-01-17 20:11:20 +00:00
commit 094e09a6d1
27 changed files with 520 additions and 412 deletions

View file

@ -997,10 +997,6 @@
RelativePath=".\source\Windows\WinFrame.cpp"
>
</File>
<File
RelativePath=".\source\Windows\WinFrame.h"
>
</File>
</Filter>
<Filter
Name="Configuration"

View file

@ -121,7 +121,6 @@
<ClInclude Include="source\Windows\AppleWin.h" />
<ClInclude Include="source\Windows\DirectInput.h" />
<ClInclude Include="source\Windows\Win32Frame.h" />
<ClInclude Include="source\Windows\WinFrame.h" />
<ClInclude Include="source\YamlHelper.h" />
<ClInclude Include="source\z80emu.h" />
<ClInclude Include="source\Z80VICE\daa.h" />

View file

@ -501,9 +501,6 @@
<ClInclude Include="source\Windows\DirectInput.h">
<Filter>Source Files\Windows</Filter>
</ClInclude>
<ClInclude Include="source\Windows\WinFrame.h">
<Filter>Source Files\Windows</Filter>
</ClInclude>
<ClInclude Include="source\Core.h">
<Filter>Source Files</Filter>
</ClInclude>

View file

@ -25,6 +25,11 @@ page, then this drop-down menu can be used to specify the clone type.<br>
NB. Pravets 82, 8M and 8A are Bulgarian Apple II clones;
TK3000 is a Brazilian //e clone;
Base 64A is a Taiwanese Apple II clone.<br>
<ul>
<li>Pravets 8A: Use F10 for the Pravets Caps Lock (and the PC's Caps Lock key controls Cyrillic/Latin lock).
<li>TK3000: Use Scroll Lock for the 'mode' key. Use to switch between standard Apple II and accented characters.
<li>Base 64A: Use Delete for the 'F2' key (eg. press F2, release F2 then press a key to auto-type a BASIC keyword).
</ul>
</p>
<p><strong>Printer settings </strong>(Printer is emulated in slot 1)
</p>

View file

@ -709,6 +709,47 @@ void CAY8910::sound_ay_overlay( void )
}
}
BYTE CAY8910::sound_ay_read( int reg )
{
reg &= 15;
BYTE val = 0;
bool got = false;
if (ay_change_count)
{
for (int i=ay_change_count-1; i>=0; i--)
{
if (ay_change[i].reg == reg)
{
val = ay_change[i].val; // return the most recently written reg's value
got = true;
}
}
}
if (!got)
val = sound_ay_registers[reg];
switch (reg & 15)
{
case 1:
case 3:
case 5:
case 13:
val &= 15;
break;
case 6:
case 8:
case 9:
case 10:
val &= 31;
break;
}
return val;
}
// AppleWin:TC Holding down ScrollLock will result in lots of AY changes /ay_change_count/
// - since sound_ay_overlay() is called to consume them.
@ -1145,6 +1186,10 @@ bool CAY8910::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, const std::string& su
static CAY8910 g_AY8910[MAX_8910];
static unsigned __int64 g_uLastCumulativeCycles = 0;
BYTE AYReadReg(int chip, int r)
{
return g_AY8910[chip].sound_ay_read(r);
}
void _AYWriteReg(int chip, int r, int v)
{

View file

@ -2,6 +2,8 @@
#define MAX_8910 4
BYTE AYReadReg(int chip, int r); // TC
//-------------------------------------
// MAME interface
@ -40,6 +42,7 @@ public:
void sound_ay_init( void );
void sound_init( const char *device );
BYTE sound_ay_read( int reg ); // TC
void sound_ay_write( int reg, int val, libspectrum_dword now );
void sound_ay_reset( void );
void sound_frame( void );

View file

@ -238,6 +238,11 @@ inline bool IsCopamBase64A(eApple2Type type) // Copam Base64A
return type == A2TYPE_BASE64A;
}
inline bool IsPravets(eApple2Type type)
{
return type == A2TYPE_PRAVETS8M || type == A2TYPE_PRAVETS82 || type == A2TYPE_PRAVETS8A;
}
enum eBUTTON {BUTTON0=0, BUTTON1};
enum eBUTTONSTATE {BUTTON_UP=0, BUTTON_DOWN};

View file

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Log.h"
#include "Memory.h"
#include "Mockingboard.h"
#include "Pravets.h"
#include "Speaker.h"
#include "Registry.h"
#include "SynchronousEventManager.h"
@ -295,3 +296,9 @@ bool SetCurrentImageDir(const std::string& pszImageDir)
return false;
}
Pravets& GetPravets(void)
{
static Pravets pravets;
return pravets;
}

View file

@ -67,6 +67,8 @@ extern bool g_bDisableDirectInput; // Cmd line switch: don't init DI (s
extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so no MB/Speaker support)
extern bool g_bDisableDirectSoundMockingboard; // Cmd line switch: don't init MB support
class Pravets& GetPravets(void);
//#define LOG_PERF_TIMINGS
#ifdef LOG_PERF_TIMINGS
class PerfMarker

View file

@ -45,7 +45,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../NTSC.h"
#include "../SoundCore.h" // SoundCore_SetFade()
#include "../Windows/Win32Frame.h"
#include "../Windows/WinFrame.h"
// #define DEBUG_COMMAND_HELP 1
// #define DEBUG_ASM_HASH 1
@ -2811,7 +2810,9 @@ bool _CmdConfigFont ( int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHe
_tcsncpy( pFont->_sFontName, pFontName, MAX_FONT_NAME-1 );
pFont->_sFontName[ MAX_FONT_NAME-1 ] = 0;
HDC hDC = FrameGetDC();
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
HDC hDC = win32Frame.FrameGetDC();
TEXTMETRIC tm;
GetTextMetrics(hDC, &tm);
@ -2850,7 +2851,7 @@ bool _CmdConfigFont ( int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHe
nFontWidthMax = 7;
}
FrameReleaseDC();
win32Frame.FrameReleaseDC();
// DeleteObject( g_hFontDisasm );
// g_hFontDisasm = hFont;
@ -9659,11 +9660,12 @@ void DebuggerMouseClick( int x, int y )
if (iAltCtrlShift != g_bConfigDisasmClick)
return;
int nFontWidth = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg * GetViewportScale();
int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * GetViewportScale();
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
int nFontWidth = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg * win32Frame.GetViewportScale();
int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * win32Frame.GetViewportScale();
// do picking
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
const int nOffsetX = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : win32Frame.Get3DBorderWidth();
const int nOffsetY = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : win32Frame.Get3DBorderHeight();

View file

@ -35,7 +35,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Core.h"
#include "../Interface.h"
#include "../CPU.h"
#include "../Windows/WinFrame.h"
#include "../Windows/Win32Frame.h"
#include "../LanguageCard.h"
#include "../Memory.h"
@ -552,7 +551,9 @@ HDC GetDebuggerMemDC(void)
{
if (!g_hDebuggerMemDC)
{
HDC hFrameDC = FrameGetDC();
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
HDC hFrameDC = win32Frame.FrameGetDC();
g_hDebuggerMemDC = CreateCompatibleDC(hFrameDC);
// CREATE A BITMAPINFO STRUCTURE FOR THE FRAME BUFFER
@ -591,7 +592,8 @@ void ReleaseDebuggerMemDC(void)
DeleteDC(g_hDebuggerMemDC);
g_hDebuggerMemDC = NULL;
FrameReleaseDC();
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
win32Frame.FrameReleaseDC();
delete [] g_pDebuggerMemFramebufferinfo;
g_pDebuggerMemFramebufferinfo = NULL;
@ -604,7 +606,8 @@ HDC GetConsoleFontDC(void)
{
if (!g_hConsoleFontDC)
{
HDC hFrameDC = FrameGetDC();
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
HDC hFrameDC = win32Frame.FrameGetDC();
g_hConsoleFontDC = CreateCompatibleDC(hFrameDC);
// CREATE A BITMAPINFO STRUCTURE FOR THE FRAME BUFFER
@ -632,7 +635,7 @@ HDC GetConsoleFontDC(void)
// DRAW THE SOURCE IMAGE INTO THE SOURCE BIT BUFFER
HDC tmpDC = CreateCompatibleDC(hFrameDC);
// Pre-scaled bitmap
HBITMAP tmpFont = LoadBitmap(GetFrame().g_hInstance, TEXT("IDB_DEBUG_FONT_7x8")); // Bitmap must be 112x128 as defined above
HBITMAP tmpFont = LoadBitmap(win32Frame.g_hInstance, TEXT("IDB_DEBUG_FONT_7x8")); // Bitmap must be 112x128 as defined above
SelectObject(tmpDC, tmpFont);
BitBlt(g_hConsoleFontDC, 0, 0, CONSOLE_FONT_BITMAP_WIDTH, CONSOLE_FONT_BITMAP_HEIGHT,
tmpDC, 0, 0,
@ -669,18 +672,18 @@ void ReleaseConsoleFontDC(void)
void StretchBltMemToFrameDC(void)
{
int nViewportCX, nViewportCY;
GetViewportCXCY(nViewportCX, nViewportCY);
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
int nViewportCX, nViewportCY;
win32Frame.GetViewportCXCY(nViewportCX, nViewportCY);
int xdest = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : 0;
int ydest = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : 0;
int wdest = nViewportCX;
int hdest = nViewportCY;
BOOL bRes = StretchBlt(
FrameGetDC(), // HDC hdcDest,
win32Frame.FrameGetDC(), // HDC hdcDest,
xdest, ydest, // int nXOriginDest, int nYOriginDest,
wdest, hdest, // int nWidthDest, int nHeightDest,
GetDebuggerMemDC(), // HDC hdcSrc,

View file

@ -38,10 +38,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "YamlHelper.h"
#include "Log.h"
static BYTE asciicode[2][10] = {
static BYTE asciicode[3][10] = {
// VK_LEFT/UP/RIGHT/DOWN/SELECT, VK_PRINT/EXECUTE/SNAPSHOT/INSERT/DELETE
{0x08,0x00,0x15,0x00,0x00, 0x00,0x00,0x00,0x00,0x00}, // Apple II
{0x08,0x0B,0x15,0x0A,0x00, 0x00,0x00,0x00,0x00,0x7F} // Apple //e
{0x08,0x0B,0x15,0x0A,0x00, 0x00,0x00,0x00,0x00,0x7F}, // Apple //e
{0x08,0x00,0x15,0x00,0x00, 0x00,0x00,0x00,0x00,0x7F} // Base 64A (like Apple II but with DELETE)
}; // Convert PC arrow keys to Apple keycodes
bool g_bShiftKey = false;
@ -51,7 +52,6 @@ bool g_bAltKey = false;
static bool g_bTK3KModeKey = false; //TK3000 //e |Mode| key
static bool g_bCapsLock = true; //Caps lock key for Apple2 and Lat/Cyr lock for Pravets8
static bool g_bP8CapsLock = true; //Caps lock key of Pravets 8A/C
static BYTE keycode = 0; // Current Apple keycode
static BOOL keywaiting = 0;
static bool g_bAltGrSendsWM_CHAR = false;
@ -79,12 +79,6 @@ bool KeybGetCapsStatus()
return g_bCapsLock;
}
//===========================================================================
bool KeybGetP8CapsStatus()
{
return g_bP8CapsLock;
}
//===========================================================================
bool KeybGetAltStatus()
{
@ -132,115 +126,43 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
}
GetFrame().g_bFreshReset = false;
if ((key > 0x7F) && !g_bTK3KModeKey) // When in TK3000 mode, we have special keys which need remapping
if (GetApple2Type() == A2TYPE_TK30002E && (key > 0x7F) && !g_bTK3KModeKey) // When in TK3000 mode, we have special keys which need remapping
return;
if (!IS_APPLE2)
// Initially default to non-clone behaviour:
if (IsAppleIIeOrAbove(GetApple2Type()))
{
P8Shift = false;
if (g_bCapsLock && (key >= 'a') && (key <='z'))
{
P8Shift = true;
if (!IS_CLONE() && key > 0x7F) // accented chars, eg. AltGr+A
return;
if (g_bCapsLock && key >= 'a' && key <='z')
keycode = key - 32;
}
else
{
keycode = key;
}
}
else
{
if (!IS_CLONE() && (key == '`' || key >= '{')) // `,{,|,},~,DEL and >0x7F (excludes a..z)
return;
//The latter line should be applied for Pravtes 8A/C only, but not for Pravets 82/M !!!
if ((g_bCapsLock == false) && (key >= 'A') && (key <='Z'))
{
P8Shift = true;
if (g_Apple2Type == A2TYPE_PRAVETS8A)
keycode = key + 32;
}
if (key >= 'a' && key <='z')
keycode = key - 32;
else
keycode = key;
}
//Remap some keys for Pravets82/M
if (g_Apple2Type == A2TYPE_PRAVETS82)
{
if (key == 64)
keycode = 96;
if (key == '^')
keycode = '~';
// Next apply any clone override:
if (IS_CLONE())
{
keycode &= 0x7F; // for accented chars, eg. AltGr+A
if (IsPravets(GetApple2Type()))
keycode = GetPravets().ConvertToKeycode(key, keycode);
if (g_bCapsLock == false) //cyrillic letters
{
if (key == '`') keycode = '^';
if (key == 92) keycode = '@'; // \ to @
if (key == 124) keycode = 92;
}
else //(g_bCapsLock == true) //latin letters
{
if (key == 91) keycode = 123;
if (key == 93) keycode = 125;
if (key == 124) keycode = 92;
}
}
if (g_Apple2Type == A2TYPE_PRAVETS8M) //Pravets 8M charset is still uncertain
{
if (g_bCapsLock == false) //cyrillic letters
{
if (key == '[') keycode = '{';
if (key == ']') keycode = '}';
if (key == '`') keycode = '~'; //96= key `~
if (key == 92) keycode = 96;
}
else //latin letters
{
if (key == '`')
keycode = '^'; //96= key `~
}
}
//Remap some keys for Pravets8A/C, which has a different charset for Pravtes82/M, whose keys MUST NOT be remapped.
if (g_Apple2Type == A2TYPE_PRAVETS8A) //&& (g_bCapsLock == false))
{
if (g_bCapsLock == false) //i.e. cyrillic letters
{
if (key == '[') keycode = '{';
if (key == ']') keycode = '}';
if (key == '`') keycode = '~';
if (key == 92) keycode = 96;
if (GetCapsLockAllowed() == true)
{
if ((key == 92) || (key == 124)) keycode = 96; //Ý to Þ
//This shall be rewriten, so that enabling CAPS_LOCK (i.e. F10) will not invert these keys values)
//The same for latin letters.
if ((key == '{') || (key == '}') || (key == '~') || (key == 124) || (key == '^') || (key == 95))
P8Shift = true;
}
}
else //i.e. latin letters
{
if (GetCapsLockAllowed() == false)
{
if (key == '{') keycode = '[';
if (key == '}') keycode = ']';
if (key == 124)
keycode = 92;
/*if (key == 92)
keycode = 124;*/
//Characters ` and ~ cannot be generated in 7bit character mode, so they are replaced with
}
else
{
if (key == '{') keycode = 91;
if (key == '}') keycode = 93;
if (key == 124) keycode = 92;
if ((key == '[') || (key == ']') || (key == 92) || (key == '^') || (key == 95))
P8Shift= true;
if (key == 96) //This line shall generate sth. else i.e. ` In fact. this character is not generateable by the pravets keyboard.
{
keycode = '^';
P8Shift= true;
}
if (key == 126) keycode = '^';
}
}
}
// Remap for the TK3000 //e, which had a special |Mode| key for displaying accented chars on screen
// Borrowed from Fábio Belavenuto's TK3000e emulator (Copyright (C) 2004) - http://code.google.com/p/tk3000e/
if (g_bTK3KModeKey) // We already switch this on only if the the TK3000 is currently being emulated
if (GetApple2Type() == A2TYPE_TK30002E && g_bTK3KModeKey) // We already switch this on only if the the TK3000 is currently being emulated
{
if ((key >= 0xC0) && (key <= 0xDA)) key += 0x20; // Convert uppercase to lowercase
switch (key)
@ -258,26 +180,14 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
case 0xF5: key = '#'; break; // õ
case 0xFA: key = '|'; break; // ú
}
if (key > 0x7F) return; // Get out
if (key > 0x7F)
return;
if ((key >= 'a') && (key <= 'z') && (g_bCapsLock))
keycode = key - ('a'-'A');
else
keycode = key;
}
}
else
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
}
else
{
if (key >= '`')
keycode = key - 32;
else
keycode = key;
}
}
}
else //(bASCII != ASCII) // WM_KEYDOWN
{
@ -298,7 +208,7 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
if (key == VK_SCROLL)
{ // For the TK3000 //e we use Scroll Lock to switch between Apple ][ and accented chars modes
if (g_Apple2Type == A2TYPE_TK30002E)
if (GetApple2Type() == A2TYPE_TK30002E)
{
g_bTK3KModeKey = (GetKeyState(VK_SCROLL) & 1) ? true : false; // Sync with the Scroll Lock status
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS); // TODO: Implement |Mode| LED in the UI; make it appear only when in TK3000 mode
@ -309,7 +219,8 @@ void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
if (key >= VK_LEFT && key <= VK_DELETE)
{
BYTE n = asciicode[IS_APPLE2 ? 0 : 1][key - VK_LEFT]; // Convert to Apple arrow keycode
UINT model = IsCopamBase64A(GetApple2Type()) ? 2 : IS_APPLE2 ? 0 : 1;
BYTE n = asciicode[model][key - VK_LEFT]; // Convert to Apple arrow keycode
if (!n)
return;
keycode = n;
@ -541,15 +452,6 @@ void KeybToggleCapsLock ()
}
}
//===========================================================================
void KeybToggleP8ACapsLock ()
{
_ASSERT(g_Apple2Type == A2TYPE_PRAVETS8A);
P8CAPS_ON = !P8CAPS_ON;
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
// g_bP8CapsLock= g_bP8CapsLock?false:true; //The same as the upper, but slower
}
//===========================================================================
#define SS_YAML_KEY_LASTKEY "Last Key"

View file

@ -7,7 +7,6 @@ void ClipboardInitiatePaste();
void KeybReset();
void KeybSetAltGrSendsWM_CHAR(bool state);
bool KeybGetCapsStatus();
bool KeybGetP8CapsStatus();
bool KeybGetAltStatus();
bool KeybGetCtrlStatus();
bool KeybGetShiftStatus();

View file

@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "MouseInterface.h"
#include "NTSC.h"
#include "NoSlotClock.h"
#include "Pravets.h"
#include "ParallelPrinter.h"
#include "Registry.h"
#include "SAM.h"
@ -466,7 +467,7 @@ static BYTE __stdcall IORead_C02x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
static BYTE __stdcall IOWrite_C02x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
{
return IO_Null(pc, addr, bWrite, d, nExecutedCycles); // $C020 TAPEOUT
return TapeWrite(pc, addr, bWrite, d, nExecutedCycles); // $C020 TAPEOUT
}
//-------------------------------------
@ -559,11 +560,7 @@ static BYTE __stdcall IORead_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
{
switch (addr & 0x7) // address bit 4 is ignored (UTAIIe:7-5)
{
//In Pravets8A/C if SETMODE (8bit character encoding) is enabled, bit6 in $C060 is 0; Else it is 1
//If (CAPS lOCK of Pravets8A/C is on or Shift is pressed) and (MODE is enabled), bit7 in $C000 is 1; Else it is 0
//Writing into $C060 sets MODE on and off. If bit 0 is 0 the the MODE is set 0, if bit 0 is 1 then MODE is set to 1 (8-bit)
case 0x0: return TapeRead(pc, addr, bWrite, d, nExecutedCycles); // $C060 TAPEIN
case 0x0: return TapeRead(pc, addr, bWrite, d, nExecutedCycles); //$C060 TAPEIN
case 0x1: return JoyReadButton(pc, addr, bWrite, d, nExecutedCycles); //$C061 Digital input 0 (If bit 7=1 then JoyButton 0 or OpenApple is pressed)
case 0x2: return JoyReadButton(pc, addr, bWrite, d, nExecutedCycles); //$C062 Digital input 1 (If bit 7=1 then JoyButton 1 or ClosedApple is pressed)
case 0x3: return JoyReadButton(pc, addr, bWrite, d, nExecutedCycles); //$C063 Digital input 2
@ -582,11 +579,11 @@ static BYTE __stdcall IOWrite_C06x(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULON
{
case 0x0:
if (g_Apple2Type == A2TYPE_PRAVETS8A)
return TapeWrite (pc, addr, bWrite, d, nExecutedCycles);
return GetPravets().SetCapsLockAllowed(d);
else
return IO_Null(pc, addr, bWrite, d, nExecutedCycles); //Apple2 value
return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
}
return IO_Null(pc, addr, bWrite, d, nExecutedCycles); //Apple2 value
return IO_Null(pc, addr, bWrite, d, nExecutedCycles);
}
//-------------------------------------

View file

@ -321,6 +321,7 @@ static void AY8910_Write(BYTE nDevice, BYTE /*nReg*/, BYTE nValue, BYTE nAYDevic
break;
case AY_READ: // 5: READ FROM PSG (need to set DDRA to input)
pMB->sy6522.ORA = AYReadReg(nDevice+2*nAYDevice, pMB->nAYCurrentRegister) & (pMB->sy6522.DDRA ^ 0xff);
break;
case AY_WRITE: // 6: WRITE TO PSG

View file

@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "ParallelPrinter.h"
#include "Core.h"
#include "Memory.h"
#include "Pravets.h"
#include "Registry.h"
#include "YamlHelper.h"
@ -158,70 +159,20 @@ static BYTE __stdcall PrintStatus(WORD, WORD, BYTE, BYTE, ULONG)
//===========================================================================
static BYTE __stdcall PrintTransmit(WORD, WORD, BYTE, BYTE value, ULONG)
{
char Lat8A[]= "abwgdevzijklmnoprstufhc~{}yx`q|]";
char Lat82[]= "abwgdevzijklmnoprstufhc^[]yx@q{}~`";
char Kir82[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞß[]^@";
char Kir8ACapital[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞßÝ";
char Kir8ALowerCase[]= "àáâãäåæçèéêëìíîïðñòóôõö÷øùúüþÿý";
if (!CheckPrint())
return 0;
BYTE c = value & 0x7F;
if (IsPravets(GetApple2Type()))
{
return 0;
if (g_bConvertEncoding)
c = GetPravets().ConvertToPrinterChar(value);
}
char c = 0;
if ((g_Apple2Type == A2TYPE_PRAVETS8A) && g_bConvertEncoding) //This is print conversion for Pravets 8A/C. Print conversion for Pravets82/M is still to be done.
{
if ((value > 90) && (value < 128)) //This range shall be set more precisely
{
c = value;
int loop = 0;
while (loop < 31)
{
if (c== Lat8A[loop])
c= 0 + Kir8ALowerCase [loop] ;
loop++;
} //End loop
}//End if (value < 128)
else if ((value >64) && (value <91))
{
c = value + 32;
}
else
{
c = value & 0x7F;
int loop = 0;
while (loop < 31)
{
if (c== Lat8A[loop]) c= 0 + Kir8ACapital [loop];
loop++;
}
}
} //End if (g_Apple2Type == A2TYPE_PRAVETS8A)
else if (((g_Apple2Type == A2TYPE_PRAVETS82) || (g_Apple2Type == A2TYPE_PRAVETS8M)) && g_bConvertEncoding)
{
c = value & 0x7F;
int loop = 0;
while (loop < 34)
{
if (c == Lat82[loop])
c= Kir82 [loop];
loop++;
} //end while
}
else //Apple II
{
c = value & 0x7F;
}
if ((g_bFilterUnprintable == false) || (c>31) || (c==13) || (c==10) || (c<0)) //c<0 is needed for cyrillic characters
fwrite(&c, 1, 1, file); //break;
if ((g_bFilterUnprintable == false) || (c>31) || (c==13) || (c==10) || (c>0x7F)) //c>0x7F is needed for cyrillic characters
fwrite(&c, 1, 1, file);
/*else
{
char c = value & 0x7F;
fwrite(&c, 1, 1, file);
}*/
return 0;
}

View file

@ -34,16 +34,228 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Keyboard.h"
#include "Tape.h"
//Pravets 8A/C variables
bool P8CAPS_ON = false;
bool P8Shift = false;
void PravetsReset(void)
Pravets::Pravets(void)
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
// Pravets 8A
bool g_CapsLockAllowed = false;
// Pravets 8A/8C
P8CAPS_ON = false;
P8Shift = false;
}
void Pravets::Reset(void)
{
if (GetApple2Type() == A2TYPE_PRAVETS8A)
{
P8CAPS_ON = false;
TapeWrite(0, 0, 0, 0 ,0);
g_CapsLockAllowed = false;
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS);
}
}
//In Pravets8A/C if SETMODE (8bit character encoding) is enabled, bit6 in $C060 is 0; Else it is 1
//If (CAPS lOCK of Pravets8A/C is on or Shift is pressed) and (MODE is enabled), bit7 in $C000 is 1; Else it is 0
//Writing into $C060 sets MODE on and off. If bit 0 is 0 the the MODE is set 0, if bit 0 is 1 then MODE is set to 1 (8-bit)
BYTE Pravets::GetKeycode(BYTE floatingBus) // Read $C060
{
const BYTE uCurrentKeystroke = KeybGetKeycode();
BYTE C060 = floatingBus;
if (GetApple2Type() == A2TYPE_PRAVETS8A && g_CapsLockAllowed) //8bit keyboard mode
{
if ((!P8CAPS_ON && !P8Shift) || (P8CAPS_ON && P8Shift)) //LowerCase
{
if ((uCurrentKeystroke<65) //|| ((uCurrentKeystroke>90) && (uCurrentKeystroke<96))
|| ((uCurrentKeystroke>126) && (uCurrentKeystroke<193)))
C060 |= 1 << 7; //Sets bit 7 to 1 for special keys (arrows, return, etc) and for control+ key combinations.
else
C060 &= 0x7F; //sets bit 7 to 0
}
else //UpperCase
{
C060 |= 1 << 7;
}
}
else //7bit keyboard mode
{
C060 &= 0xBF; //Sets bit 6 to 0; I am not sure if this shall be done, because its value is disregarded in this case.
C060 |= 1 << 7; //Sets bit 7 to 1
}
return C060;
}
BYTE Pravets::SetCapsLockAllowed(BYTE value) // Write $C060
{
if (GetApple2Type() == A2TYPE_PRAVETS8A)
{
//If bit0 of the input byte is 0, it will forbid 8-bit characters (Default)
//If bit0 of the input byte is 1, it will allow 8-bit characters
if (value & 1)
g_CapsLockAllowed = true;
else
g_CapsLockAllowed = false;
}
return 0;
}
BYTE Pravets::ConvertToKeycode(WPARAM key, BYTE keycode)
{
if (KeybGetCapsStatus() && (key >= 'a') && (key <='z'))
P8Shift = true;
else
P8Shift = false;
//The latter line should be applied for Pravtes 8A/C only, but not for Pravets 82/M !!!
if ((KeybGetCapsStatus() == false) && (key >= 'A') && (key <='Z'))
{
P8Shift = true;
if (GetApple2Type() == A2TYPE_PRAVETS8A)
keycode = key + 32;
}
//Remap some keys for Pravets82/M
if (GetApple2Type() == A2TYPE_PRAVETS82)
{
if (key == 64)
keycode = 96;
if (key == '^')
keycode = '~';
if (KeybGetCapsStatus() == false) //cyrillic letters
{
if (key == '`') keycode = '^';
if (key == 92) keycode = '@'; // \ to @
if (key == 124) keycode = 92;
}
else //(g_bCapsLock == true) //latin letters
{
if (key == 91) keycode = 123;
if (key == 93) keycode = 125;
if (key == 124) keycode = 92;
}
}
if (GetApple2Type() == A2TYPE_PRAVETS8M) //Pravets 8M charset is still uncertain
{
if (KeybGetCapsStatus() == false) //cyrillic letters
{
if (key == '[') keycode = '{';
if (key == ']') keycode = '}';
if (key == '`') keycode = '~'; //96= key `~
if (key == 92) keycode = 96;
}
else //latin letters
{
if (key == '`')
keycode = '^'; //96= key `~
}
}
//Remap some keys for Pravets8A/C, which has a different charset for Pravtes82/M, whose keys MUST NOT be remapped.
if (GetApple2Type() == A2TYPE_PRAVETS8A) //&& (g_bCapsLock == false))
{
if (KeybGetCapsStatus() == false) //i.e. cyrillic letters
{
if (key == '[') keycode = '{';
if (key == ']') keycode = '}';
if (key == '`') keycode = '~';
if (key == 92) keycode = 96;
if (g_CapsLockAllowed == true)
{
if ((key == 92) || (key == 124)) keycode = 96; //Ý to Þ
//This shall be rewriten, so that enabling CAPS_LOCK (i.e. F10) will not invert these keys values)
//The same for latin letters.
if ((key == '{') || (key == '}') || (key == '~') || (key == 124) || (key == '^') || (key == 95))
P8Shift = true;
}
}
else //i.e. latin letters
{
if (g_CapsLockAllowed == false)
{
if (key == '{') keycode = '[';
if (key == '}') keycode = ']';
if (key == 124)
keycode = 92;
/*if (key == 92)
keycode = 124;*/
//Characters ` and ~ cannot be generated in 7bit character mode, so they are replaced with
}
else
{
if (key == '{') keycode = 91;
if (key == '}') keycode = 93;
if (key == 124) keycode = 92;
if ((key == '[') || (key == ']') || (key == 92) || (key == '^') || (key == 95))
P8Shift = true;
if (key == 96) //This line shall generate sth. else i.e. ` In fact. this character is not generateable by the pravets keyboard.
{
keycode = '^';
P8Shift = true;
}
if (key == 126) keycode = '^';
}
}
}
return keycode;
}
BYTE Pravets::ConvertToPrinterChar(BYTE value)
{
char Lat8A[]= "abwgdevzijklmnoprstufhc~{}yx`q|]";
char Lat82[]= "abwgdevzijklmnoprstufhc^[]yx@q{}~`";
char Kir82[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞß[]^@";
char Kir8ACapital[]= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÜÞßÝ";
char Kir8ALowerCase[]= "àáâãäåæçèéêëìíîïðñòóôõö÷øùúüþÿý";
BYTE c = 0;
if (GetApple2Type() == A2TYPE_PRAVETS8A) //This is print conversion for Pravets 8A/C. Print conversion for Pravets82/M is still to be done.
{
if ((value > 90) && (value < 128)) //This range shall be set more precisely
{
c = value;
int loop = 0;
while (loop < 31)
{
if (c == Lat8A[loop])
c = Kir8ALowerCase[loop];
loop++;
}
}
else if ((value > 64) && (value < 91))
{
c = value + 32;
}
else
{
c = value & 0x7F;
int loop = 0;
while (loop < 31)
{
if (c == Lat8A[loop])
c = Kir8ACapital[loop];
loop++;
}
}
}
else if (GetApple2Type() == A2TYPE_PRAVETS82 || GetApple2Type() == A2TYPE_PRAVETS8M)
{
c = value & 0x7F;
int loop = 0;
while (loop < 34)
{
if (c == Lat82[loop])
c = Kir82[loop];
loop++;
}
}
return c;
}

View file

@ -1,7 +1,23 @@
#pragma once
//Pravets 8A/C only variables
extern bool P8CAPS_ON;
extern bool P8Shift;
class Pravets
{
public:
Pravets(void);
~Pravets(void){}
void PravetsReset(void);
void Reset(void);
void ToggleP8ACapsLock(void) { P8CAPS_ON = !P8CAPS_ON; }
BYTE SetCapsLockAllowed(BYTE value);
BYTE GetKeycode(BYTE floatingBus);
BYTE ConvertToKeycode(WPARAM key, BYTE keycode);
BYTE ConvertToPrinterChar(BYTE value);
private:
bool g_CapsLockAllowed;
bool P8CAPS_ON;
bool P8Shift;
};

View file

@ -466,7 +466,7 @@ static void Snapshot_LoadState_v2(void)
//m_ConfigNew.m_bEnableTheFreezesF8Rom = ?; // todo: when support saving config
MemReset(); // Also calls CpuInitialize()
PravetsReset();
GetPravets().Reset();
if (GetCardMgr().IsSSCInstalled())
{

View file

@ -21,8 +21,7 @@ along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Description: This module is created for emulation of the 8bit character mode (mode 1) switch,
* which is located in $c060, and so far does not intend to emulate a tape device.
/* Description: Tape interface.
*
* Author: Various
*
@ -31,78 +30,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h"
#include "Core.h"
#include "Tape.h"
#include "Keyboard.h"
#include "Memory.h"
#include "Pravets.h"
static bool g_CapsLockAllowed = false;
//---------------------------------------------------------------------------
BYTE __stdcall TapeRead(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles)
BYTE __stdcall TapeRead(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles) // $C060 TAPEIN
{
/*
If retrieving KeybGetKeycode(); causes problems uCurrentKeystroke shall be added
in the submission variables and it shall be added by the TapeRead caller
i.e. BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles) shall become
BYTE __stdcall TapeRead (WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles, BYTE uCurrentKeystroke)
*/
if (g_Apple2Type == A2TYPE_PRAVETS8A)
return GetPravets().GetKeycode( MemReadFloatingBus(nExecutedCycles) );
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
const BYTE uCurrentKeystroke = KeybGetKeycode();
BYTE C060 = MemReadFloatingBus(nExecutedCycles);
if (g_CapsLockAllowed) //8bit keyboard mode
{
if (((P8CAPS_ON == false) && (P8Shift == false)) || ((P8CAPS_ON ) && (P8Shift ))) //LowerCase
{
if ((uCurrentKeystroke<65) //|| ((uCurrentKeystroke>90) && (uCurrentKeystroke<96))
|| ((uCurrentKeystroke>126) && (uCurrentKeystroke<193)))
C060 |= 1 << 7; //Sets bit 7 to 1 for special keys (arrows, return, etc) and for control+ key combinations.
else
C060 &= 127; //sets bit 7 to 0
}
else //UpperCase
{
C060 |= 1 << 7;
}
}
else //7bit keyboard mode
{
C060 &= 191; //Sets bit 6 to 0; I am not sure if this shall be done, because its value is disregarded in this case.
C060 |= 1 << 7; //Sets bit 7 to 1
}
return C060;
}
return MemReadFloatingBus(1, nExecutedCycles); // TAPEIN has high bit 1 when input is low or not connected (UTAIIe page 7-5, 7-6)
}
/*
In case s.o. decides to develop tape device emulation, this function may be renamed,
because tape is not written in $C060
*/
BYTE __stdcall TapeWrite(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nExecutedCycles)
BYTE __stdcall TapeWrite(WORD, WORD address, BYTE, BYTE, ULONG nExecutedCycles) // $C020 TAPEOUT
{
if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
if (value & 1)
g_CapsLockAllowed = true;
else
g_CapsLockAllowed = false;
//If bit0 of the input byte is 0, it will forbid 8-bit characters (Default)
//If bit0 of the input byte is 1, it will allow 8-bit characters
return 0;
}
return MemReadFloatingBus(nExecutedCycles);
}
bool GetCapsLockAllowed(void)
{
return g_CapsLockAllowed;
return 0;
}

View file

@ -1,5 +1,4 @@
#pragma once
extern BYTE __stdcall TapeRead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
extern BYTE __stdcall TapeWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
extern bool GetCapsLockAllowed(void);
BYTE __stdcall TapeRead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
BYTE __stdcall TapeWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);

View file

@ -532,7 +532,7 @@ void ResetMachineState()
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
MemReset(); // calls CpuInitialize(), CNoSlotClock.Reset()
PravetsReset();
GetPravets().Reset();
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Boot();
GetVideo().VideoResetState();
@ -580,7 +580,7 @@ void CtrlReset()
MemAnnunciatorReset();
}
PravetsReset();
GetPravets().Reset();
GetCardMgr().GetDisk2CardMgr().Reset();
HD_Reset();
KeybReset();

View file

@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Speech.h"
#endif
#include "Windows/Win32Frame.h"
#include "Windows/WinFrame.h"
#include "RGBMonitor.h"
#include "NTSC.h"
@ -143,7 +142,7 @@ static void ContinueExecution(void)
bool bScrollLock_FullSpeed = false;
if (GetPropertySheet().GetScrollLockToggle())
{
bScrollLock_FullSpeed = g_bScrollLock_FullSpeed;
bScrollLock_FullSpeed = Win32Frame::GetWin32Frame().g_bScrollLock_FullSpeed;
}
else
{

View file

@ -1,7 +1,6 @@
#include "StdAfx.h"
#include "Windows/Win32Frame.h"
#include "Windows/WinFrame.h"
#include "Interface.h"
#include "Core.h"
#include "CPU.h"
@ -37,6 +36,43 @@ Win32Frame::Win32Frame()
g_win_fullscreen_scale = 1;
g_win_fullscreen_offsetx = 0;
g_win_fullscreen_offsety = 0;
btnfacebrush = (HBRUSH)0;
btnfacepen = (HPEN)0;
btnhighlightpen = (HPEN)0;
btnshadowpen = (HPEN)0;
buttonactive = -1;
buttondown = -1;
buttonover = -1;
buttonx = BUTTONX;
buttony = BUTTONY;
g_hFrameDC = (HDC)0;
memset(&framerect, 0, sizeof(framerect));
helpquit = 0;
smallfont = (HFONT)0;
tooltipwindow = (HWND)0;
viewportx = VIEWPORTX; // Default to Normal (non-FullScreen) mode
viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
g_bScrollLock_FullSpeed = false;
g_nTrackDrive1 = -1;
g_nTrackDrive2 = -1;
g_nSectorDrive1 = -1;
g_nSectorDrive2 = -1;
strcpy_s(g_sTrackDrive1, sizeof(g_sTrackDrive1), "??");
strcpy_s(g_sTrackDrive2, sizeof(g_sTrackDrive1), "??");
strcpy_s(g_sSectorDrive1, sizeof(g_sTrackDrive1), "??");
strcpy_s(g_sSectorDrive2, sizeof(g_sTrackDrive1), "??");
g_eStatusDrive1 = DISK_STATUS_OFF;
g_eStatusDrive2 = DISK_STATUS_OFF;
g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
}
void Win32Frame::videoCreateDIBSection(Video & video)

View file

@ -1,6 +1,7 @@
#pragma once
#include "FrameBase.h"
#include "DiskImage.h"
class Video;
@ -10,12 +11,24 @@ class Video;
#define FULLSCREEN_SCALE_TYPE int
#endif
// 3D border around the 560x384 Apple II display
#define VIEWPORTX 5
#define VIEWPORTY 5
#define BUTTONX (g_nViewportCX + VIEWPORTX*2)
#define BUTTONY 0
#define BUTTONCX 45
#define BUTTONCY 45
#define BUTTONS 8
class Win32Frame : public FrameBase
{
public:
Win32Frame();
static Win32Frame& GetWin32Frame();
static LRESULT CALLBACK FrameWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
virtual void FrameDrawDiskLEDS();
virtual void FrameDrawDiskStatus();
@ -44,11 +57,19 @@ public:
void ChooseMonochromeColor(void);
UINT Get3DBorderWidth(void);
UINT Get3DBorderHeight(void);
int GetViewportScale(void);
void GetViewportCXCY(int& nViewportCX, int& nViewportCY);
void ApplyVideoModeChange(void);
LRESULT WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
HDC FrameGetDC();
void FrameReleaseDC();
bool g_bScrollLock_FullSpeed;
private:
static BOOL CALLBACK DDEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext);
LRESULT WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);
void videoCreateDIBSection(Video& video);
void VideoDrawLogoBitmap(HDC hDstDC, int xoff, int yoff, int srcw, int srch, int scale);
@ -64,6 +85,8 @@ private:
void DrawCrosshairs(int x, int y);
void DrawFrameWindow(bool bPaintingWindow = false);
void DrawStatusArea(HDC passdc, int drawflags);
void Draw3dRect(HDC dc, int x1, int y1, int x2, int y2, BOOL out);
void DrawBitmapRect(HDC dc, int x, int y, LPRECT rect, HBITMAP bitmap);
void ProcessButtonClick(int button, bool bFromButtonUI = false);
bool ConfirmReboot(bool bFromButtonUI);
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive);
@ -79,8 +102,10 @@ private:
void DrawCrosshairsMouse();
void FrameSetCursorPosByMousePos(int x, int y, int dx, int dy, bool bLeavingAppleScreen);
void CreateGdiObjects(void);
void DeleteGdiObjects(void);
void FrameShowCursor(BOOL bShow);
void FullScreenRevealCursor(void);
void GetWidthHeight(int& nWidth, int& nHeight);
bool g_bAltEnter_ToggleFullScreen; // Default for ALT+ENTER is to toggle between windowed and full-screen modes
bool g_bIsFullScreen;
@ -108,4 +133,56 @@ private:
GUID draw_device_guid[MAX_DRAW_DEVICES];
int num_draw_devices;
LPDIRECTDRAW g_lpDD;
HBITMAP buttonbitmap[BUTTONS];
HBRUSH btnfacebrush;
HPEN btnfacepen;
HPEN btnhighlightpen;
HPEN btnshadowpen;
int buttonactive;
int buttondown;
int buttonover;
int buttonx;
int buttony;
HDC g_hFrameDC;
RECT framerect;
BOOL helpquit;
HFONT smallfont;
HWND tooltipwindow;
int viewportx; // Default to Normal (non-FullScreen) mode
int viewporty; // Default to Normal (non-FullScreen) mode
RECT g_main_window_saved_rect;
int g_main_window_saved_style;
int g_main_window_saved_exstyle;
HBITMAP g_hCapsLockBitmap[2];
HBITMAP g_hHardDiskBitmap[2];
//Pravets8 only
HBITMAP g_hCapsBitmapP8[2];
HBITMAP g_hCapsBitmapLat[2];
//HBITMAP charsetbitmap [4]; //The idea was to add a charset indicator on the front panel, but it was given up. All charsetbitmap occurences must be REMOVED!
//===========================
HBITMAP g_hDiskWindowedLED[NUM_DISK_STATUS];
int g_nTrackDrive1;
int g_nTrackDrive2;
int g_nSectorDrive1;
int g_nSectorDrive2;
TCHAR g_sTrackDrive1[8];
TCHAR g_sTrackDrive2[8];
TCHAR g_sSectorDrive1[8];
TCHAR g_sSectorDrive2[8];
Disk_Status_e g_eStatusDrive1;
Disk_Status_e g_eStatusDrive2;
static const int kDEFAULT_VIEWPORT_SCALE = 2;
int g_nViewportCX;
int g_nViewportCY;
int g_nViewportScale; // saved REGSAVE
int g_nMaxViewportScale; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
};

View file

@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h"
#include "Windows/WinFrame.h"
#include "Windows/Win32Frame.h"
#include "Windows/AppleWin.h"
#include "Interface.h"
@ -40,6 +39,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Windows/DirectInput.h"
#include "NTSC.h"
#include "ParallelPrinter.h"
#include "Pravets.h"
#include "Registry.h"
#include "SaveState.h"
#include "SerialComms.h"
@ -56,45 +56,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#define ENABLE_MENU 0
#define DEBUG_KEY_MESSAGES 0
// 3D border around the 560x384 Apple II display
#define VIEWPORTX 5
#define VIEWPORTY 5
static const int kDEFAULT_VIEWPORT_SCALE = 2;
int g_nViewportCX = GetVideo().GetFrameBufferBorderlessWidth() * kDEFAULT_VIEWPORT_SCALE;
int g_nViewportCY = GetVideo().GetFrameBufferBorderlessHeight() * kDEFAULT_VIEWPORT_SCALE;
static int g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE
static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; // Max scale in Windowed mode with borders, buttons etc (full-screen may be +1)
#define BUTTONX (g_nViewportCX + VIEWPORTX*2)
#define BUTTONY 0
#define BUTTONCX 45
#define BUTTONCY 45
#define BUTTONS 8
static HBITMAP g_hCapsLockBitmap[2];
static HBITMAP g_hHardDiskBitmap[2];
//Pravets8 only
static HBITMAP g_hCapsBitmapP8[2];
static HBITMAP g_hCapsBitmapLat[2];
//static HBITMAP charsetbitmap [4]; //The idea was to add a charset indicator on the front panel, but it was given up. All charsetbitmap occurences must be REMOVED!
//===========================
static HBITMAP g_hDiskWindowedLED[ NUM_DISK_STATUS ];
static int g_nTrackDrive1 = -1;
static int g_nTrackDrive2 = -1;
static int g_nSectorDrive1 = -1;
static int g_nSectorDrive2 = -1;
static TCHAR g_sTrackDrive1 [8] = TEXT("??");
static TCHAR g_sTrackDrive2 [8] = TEXT("??");
static TCHAR g_sSectorDrive1[8] = TEXT("??");
static TCHAR g_sSectorDrive2[8] = TEXT("??");
Disk_Status_e g_eStatusDrive1 = DISK_STATUS_OFF;
Disk_Status_e g_eStatusDrive2 = DISK_STATUS_OFF;
static bool FileExists(std::string strFilename);
// Must keep in sync with Disk_Status_e g_aDiskFullScreenColors
static DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] =
static const DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] =
{
RGB( 0, 0, 0), // DISK_STATUS_OFF BLACK
RGB( 0,255, 0), // DISK_STATUS_READ GREEN
@ -103,36 +68,6 @@ static DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] =
// RGB( 0, 0,255) // DISK_STATUS_PROT -blue-
};
static HBITMAP buttonbitmap[BUTTONS];
static HBRUSH btnfacebrush = (HBRUSH)0;
static HPEN btnfacepen = (HPEN)0;
static HPEN btnhighlightpen = (HPEN)0;
static HPEN btnshadowpen = (HPEN)0;
static int buttonactive = -1;
static int buttondown = -1;
static int buttonover = -1;
static int buttonx = BUTTONX;
static int buttony = BUTTONY;
static HDC g_hFrameDC = (HDC)0;
static RECT framerect = {0,0,0,0};
static BOOL helpquit = 0;
static HFONT smallfont = (HFONT)0;
static HWND tooltipwindow = (HWND)0;
static int viewportx = VIEWPORTX; // Default to Normal (non-FullScreen) mode
static int viewporty = VIEWPORTY; // Default to Normal (non-FullScreen) mode
static bool FileExists(std::string strFilename);
bool g_bScrollLock_FullSpeed = false;
static RECT g_main_window_saved_rect;
static int g_main_window_saved_style;
static int g_main_window_saved_exstyle;
// ==========================================================================
void Win32Frame::SetAltEnterToggleFullScreen(bool mode)
{
g_bAltEnter_ToggleFullScreen = mode;
@ -300,7 +235,7 @@ void Win32Frame::CreateGdiObjects(void)
}
//===========================================================================
static void DeleteGdiObjects(void)
void Win32Frame::DeleteGdiObjects(void)
{
for (int loop = 0; loop < BUTTONS; loop++)
_ASSERT(DeleteObject(buttonbitmap[loop]));
@ -326,7 +261,7 @@ static void DeleteGdiObjects(void)
// Draws an 3D box around the main apple screen
//===========================================================================
static void Draw3dRect (HDC dc, int x1, int y1, int x2, int y2, BOOL out)
void Win32Frame::Draw3dRect(HDC dc, int x1, int y1, int x2, int y2, BOOL out)
{
SelectObject(dc,GetStockObject(NULL_BRUSH));
SelectObject(dc,out ? btnshadowpen : btnhighlightpen);
@ -342,7 +277,7 @@ static void Draw3dRect (HDC dc, int x1, int y1, int x2, int y2, BOOL out)
}
//===========================================================================
static void DrawBitmapRect (HDC dc, int x, int y, LPRECT rect, HBITMAP bitmap) {
void Win32Frame::DrawBitmapRect (HDC dc, int x, int y, LPRECT rect, HBITMAP bitmap) {
HDC memdc = CreateCompatibleDC(dc);
SelectObject(memdc,bitmap);
BitBlt(dc,x,y,
@ -805,7 +740,6 @@ void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
int x = buttonx;
int y = buttony+BUTTONS*BUTTONCY+1;
const bool bCaps = KeybGetCapsStatus();
//const bool bP8Caps = KeybGetP8CapsStatus(); // TODO: FIXME: Not used ?! Should show the LED status ...
#if HD_LED
// 1.19.0.0 Hard Disk Status/Indicator Light
@ -953,7 +887,7 @@ void Win32Frame::EraseButton (int number) {
//===========================================================================
LRESULT CALLBACK FrameWndProc(
LRESULT CALLBACK Win32Frame::FrameWndProc(
HWND window,
UINT message,
WPARAM wparam,
@ -1234,7 +1168,7 @@ LRESULT Win32Frame::WndProc(
}
else if (g_Apple2Type == A2TYPE_PRAVETS8A)
{
KeybToggleP8ACapsLock (); // F10: Toggles Pravets8A Capslock
GetPravets().ToggleP8ACapsLock(); // F10: Toggles Pravets8A Capslock
}
}
else if (wparam == VK_F11 && !KeybGetCtrlStatus()) // Save state (F11)
@ -2289,7 +2223,7 @@ void Win32Frame::SetUsingCursor (BOOL bNewValue)
}
}
int GetViewportScale(void)
int Win32Frame::GetViewportScale(void)
{
return g_nViewportScale;
}
@ -2329,7 +2263,7 @@ void Win32Frame::SetupTooltipControls(void)
// SM_CXPADDEDBORDER is not supported on 2000 & XP, but GetSystemMetrics() returns 0 for unknown values, so this use of SM_CXPADDEDBORDER works on 2000 & XP too:
// http://msdn.microsoft.com/en-nz/library/windows/desktop/ms724385(v=vs.85).aspx
// NB. GetSystemMetrics(SM_CXPADDEDBORDER) returns 0 for Win7, when built with VS2008 (see GH#571)
static void GetWidthHeight(int& nWidth, int& nHeight)
void Win32Frame::GetWidthHeight(int& nWidth, int& nHeight)
{
nWidth = g_nViewportCX + VIEWPORTX*2
+ BUTTONCX
@ -2502,19 +2436,19 @@ void Win32Frame::FrameCreateWindow(void)
}
//===========================================================================
HDC FrameGetDC () {
HDC Win32Frame::FrameGetDC () {
if (!g_hFrameDC) {
g_hFrameDC = GetDC(GetFrame().g_hFrameWindow);
g_hFrameDC = GetDC(g_hFrameWindow);
SetViewportOrgEx(g_hFrameDC,viewportx,viewporty,NULL);
}
return g_hFrameDC;
}
//===========================================================================
void FrameReleaseDC () {
void Win32Frame::FrameReleaseDC () {
if (g_hFrameDC) {
SetViewportOrgEx(g_hFrameDC,0,0,NULL);
ReleaseDC(GetFrame().g_hFrameWindow,g_hFrameDC);
ReleaseDC(g_hFrameWindow,g_hFrameDC);
g_hFrameDC = (HDC)0;
}
}
@ -2731,7 +2665,7 @@ void Win32Frame::UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY
}
}
void GetViewportCXCY(int& nViewportCX, int& nViewportCY)
void Win32Frame::GetViewportCXCY(int& nViewportCX, int& nViewportCY)
{
nViewportCX = g_nViewportCX;
nViewportCY = g_nViewportCY;

View file

@ -1,22 +0,0 @@
#pragma once
// Win32
extern int g_nViewportCX;
extern int g_nViewportCY;
// Emulator
extern bool g_bScrollLock_FullSpeed;
// Prototypes
HDC FrameGetDC ();
void FrameReleaseDC ();
int GetViewportScale(void);
void GetViewportCXCY(int& nViewportCX, int& nViewportCY);
LRESULT CALLBACK FrameWndProc (
HWND window,
UINT message,
WPARAM wparam,
LPARAM lparam );