mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-09-07 15:54:29 +00:00
Fixed BRKOP, BRK # to enter debugger
Pressing F7 after triggered break stops on next break Fixed global "mode" to comply with coding convention: g_nAppMode
This commit is contained in:
parent
dcb358aaa3
commit
2b1e0c76a4
@ -31,8 +31,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
char VERSIONSTRING[] = "xx.yy.zz.ww";
|
||||
|
||||
BOOL apple2e = 1;
|
||||
BOOL apple2plus = 1;
|
||||
bool apple2e = true;
|
||||
bool apple2plus = true;
|
||||
|
||||
BOOL behind = 0; // Redundant
|
||||
DWORD cumulativecycles = 0; // Wraps after ~1hr 9mins
|
||||
DWORD cyclenum = 0; // Used by SpkrToggle() for non-wave sound
|
||||
@ -42,7 +43,9 @@ bool g_bFullSpeed = false;
|
||||
HINSTANCE instance = (HINSTANCE)0;
|
||||
static DWORD lastfastpaging = 0;
|
||||
static DWORD lasttrimimages = 0;
|
||||
int mode = MODE_LOGO;
|
||||
|
||||
AppMode_e g_nAppMode = MODE_LOGO;
|
||||
|
||||
static int lastmode = MODE_LOGO;
|
||||
DWORD needsprecision = 0; // Redundant
|
||||
TCHAR progdir[MAX_PATH] = TEXT("");
|
||||
@ -188,7 +191,7 @@ void ContinueExecution()
|
||||
{
|
||||
g_dwCyclesThisFrame -= dwClksPerFrame;
|
||||
|
||||
if(mode != MODE_LOGO)
|
||||
if(g_nAppMode != MODE_LOGO)
|
||||
{
|
||||
VideoUpdateFlash();
|
||||
|
||||
@ -310,27 +313,38 @@ LRESULT CALLBACK DlgProc (HWND window,
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void EnterMessageLoop () {
|
||||
MSG message;
|
||||
while (GetMessage(&message,0,0,0)) {
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
while ((mode == MODE_RUNNING) || (mode == MODE_STEPPING))
|
||||
if (PeekMessage(&message,0,0,0,PM_REMOVE)) {
|
||||
if (message.message == WM_QUIT)
|
||||
return;
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
}
|
||||
else if (mode == MODE_STEPPING)
|
||||
DebugContinueStepping();
|
||||
else {
|
||||
ContinueExecution();
|
||||
if (g_bFullSpeed)
|
||||
ContinueExecution();
|
||||
}
|
||||
}
|
||||
while (PeekMessage(&message,0,0,0,PM_REMOVE)) ;
|
||||
void EnterMessageLoop ()
|
||||
{
|
||||
MSG message;
|
||||
|
||||
while (GetMessage(&message,0,0,0))
|
||||
{
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
|
||||
while ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
if (PeekMessage(&message,0,0,0,PM_REMOVE))
|
||||
{
|
||||
if (message.message == WM_QUIT)
|
||||
return;
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
}
|
||||
else if (g_nAppMode == MODE_STEPPING)
|
||||
DebugContinueStepping();
|
||||
else
|
||||
{
|
||||
ContinueExecution();
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
if (g_bFullSpeed)
|
||||
ContinueExecution();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (PeekMessage(&message,0,0,0,PM_REMOVE))
|
||||
; // intentional null statement
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -542,7 +556,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
}
|
||||
else if((strcmp(lpCmdLine, "-l") == 0) && (g_fh == NULL))
|
||||
{
|
||||
g_fh = fopen("AppleWin.log", "a+t"); // Open log file (append & text mode)
|
||||
g_fh = fopen("AppleWin.log", "a+t"); // Open log file (append & text g_nAppMode)
|
||||
CHAR aDateStr[80], aTimeStr[80];
|
||||
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aDateStr, sizeof(aDateStr));
|
||||
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aTimeStr, sizeof(aTimeStr));
|
||||
@ -633,7 +647,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
FrameRegisterClass();
|
||||
ImageInitialize();
|
||||
DiskInitialize();
|
||||
CreateColorMixMap(); // For tv emulation mode
|
||||
CreateColorMixMap(); // For tv emulation g_nAppMode
|
||||
|
||||
//
|
||||
|
||||
@ -654,7 +668,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
{
|
||||
// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
|
||||
restart = 0;
|
||||
mode = MODE_LOGO;
|
||||
g_nAppMode = MODE_LOGO;
|
||||
LoadConfiguration();
|
||||
DebugInitialize();
|
||||
JoyInitialize();
|
||||
|
@ -2,15 +2,18 @@
|
||||
|
||||
extern char VERSIONSTRING[]; // Contructed in WinMain()
|
||||
|
||||
extern BOOL apple2e;
|
||||
extern BOOL apple2plus;
|
||||
extern bool apple2e;
|
||||
extern bool apple2plus;
|
||||
|
||||
extern BOOL behind;
|
||||
extern DWORD cumulativecycles;
|
||||
extern DWORD cyclenum;
|
||||
extern DWORD emulmsec;
|
||||
extern bool g_bFullSpeed;
|
||||
extern HINSTANCE instance;
|
||||
extern int mode;
|
||||
|
||||
extern AppMode_e g_nAppMode;
|
||||
|
||||
extern DWORD needsprecision;
|
||||
extern TCHAR progdir[MAX_PATH];
|
||||
extern BOOL resettiming;
|
||||
|
1305
source/CPU.cpp
1305
source/CPU.cpp
File diff suppressed because it is too large
Load Diff
@ -18,11 +18,20 @@ const DWORD dwClksPerFrame = uCyclesPerLine * uLinesPerFrame; // 17030
|
||||
// Assume base freqs are 44.1KHz & 48KHz
|
||||
const DWORD SPKR_SAMPLE_RATE = 44100;
|
||||
|
||||
#define MODE_LOGO 0
|
||||
#define MODE_PAUSED 1
|
||||
#define MODE_RUNNING 2
|
||||
#define MODE_DEBUG 3
|
||||
#define MODE_STEPPING 4
|
||||
enum AppMode_e
|
||||
{
|
||||
MODE_LOGO = 0
|
||||
, MODE_PAUSED
|
||||
, MODE_RUNNING
|
||||
, MODE_DEBUG
|
||||
, MODE_STEPPING
|
||||
};
|
||||
|
||||
//#define MODE_LOGO 0
|
||||
//#define MODE_PAUSED 1
|
||||
//#define MODE_RUNNING 2
|
||||
//#define MODE_DEBUG 3
|
||||
//#define MODE_STEPPING 4
|
||||
|
||||
#define SPEED_MIN 0
|
||||
#define SPEED_NORMAL 10
|
||||
|
@ -52,8 +52,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// Breakpoints ________________________________________________________________
|
||||
|
||||
// Full-Speed debugging
|
||||
int g_nDebugOnBreakInvalid = 0;
|
||||
int g_iDebugOnOpcode = 0;
|
||||
int g_nDebugOnBreakInvalid = 0;
|
||||
int g_iDebugOnOpcode = 0;
|
||||
bool g_bDebugDelayBreakCheck = false;
|
||||
|
||||
int g_nBreakpoints = 0;
|
||||
Breakpoint_t g_aBreakpoints[ NUM_BREAKPOINTS ];
|
||||
@ -969,14 +970,14 @@ Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
|
||||
|
||||
if (g_iDebugOnOpcode == 0)
|
||||
// Show what the current break opcode is
|
||||
wsprintf( sText, TEXT("%s break on opcode: None")
|
||||
wsprintf( sText, TEXT("%s full speed Break on Opcode: None")
|
||||
, sAction
|
||||
, g_iDebugOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugOnOpcode ].sMnemonic
|
||||
);
|
||||
else
|
||||
// Show what the current break opcode is
|
||||
wsprintf( sText, TEXT("%s break on opcode: %02X %s")
|
||||
wsprintf( sText, TEXT("%s full speed Break on Opcode: %02X %s")
|
||||
, sAction
|
||||
, g_iDebugOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugOnOpcode ].sMnemonic
|
||||
@ -1442,7 +1443,7 @@ Update_t CmdBenchmarkStop (int nArgs)
|
||||
{
|
||||
g_bBenchmarking = false;
|
||||
DebugEnd();
|
||||
mode = MODE_RUNNING;
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
VideoRedrawScreen();
|
||||
DWORD currtime = GetTickCount();
|
||||
@ -5084,7 +5085,7 @@ Update_t CmdGo (int nArgs)
|
||||
// if (!g_nDebugStepUntil)
|
||||
// g_nDebugStepUntil = GetAddress(g_aArgs[1].sArg);
|
||||
|
||||
mode = MODE_STEPPING;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY; // TODO: Verify // 0;
|
||||
@ -5141,7 +5142,7 @@ Update_t CmdTrace (int nArgs)
|
||||
g_nDebugStepCycles = 0;
|
||||
g_nDebugStepStart = regs.pc;
|
||||
g_nDebugStepUntil = -1;
|
||||
mode = MODE_STEPPING;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
DebugContinueStepping();
|
||||
|
||||
@ -5169,7 +5170,7 @@ Update_t CmdTraceLine (int nArgs)
|
||||
g_nDebugStepStart = regs.pc;
|
||||
g_nDebugStepUntil = -1;
|
||||
|
||||
mode = MODE_STEPPING;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
DebugContinueStepping();
|
||||
|
||||
@ -6146,7 +6147,7 @@ Update_t ExecuteCommand (int nArgs)
|
||||
ArgsGetValue( pArg, & nAddress );
|
||||
|
||||
regs.pc = nAddress;
|
||||
mode = MODE_RUNNING; // exit the debugger
|
||||
g_nAppMode = MODE_RUNNING; // exit the debugger
|
||||
|
||||
nFound = 1;
|
||||
g_iCommand = CMD_CONFIG_ECHO; // hack: don't cook args
|
||||
@ -6759,7 +6760,7 @@ void DebugBegin ()
|
||||
MemSetFastPaging(0);
|
||||
}
|
||||
|
||||
mode = MODE_DEBUG;
|
||||
g_nAppMode = MODE_DEBUG;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
|
||||
if (apple2e)
|
||||
@ -6787,15 +6788,15 @@ void DebugContinueStepping ()
|
||||
{
|
||||
if ((regs.pc >= g_nDebugSkipStart) && (regs.pc < (g_nDebugSkipStart + g_nDebugSkipLen)))
|
||||
{
|
||||
// Enter turbo debugger mode -- UI not updated, etc.
|
||||
// Enter turbo debugger g_nAppMode -- UI not updated, etc.
|
||||
g_nDebugSteps = -1;
|
||||
mode = MODE_STEPPING;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enter normal debugger mode -- UI updated every instruction, etc.
|
||||
// Enter normal debugger g_nAppMode -- UI updated every instruction, etc.
|
||||
g_nDebugSteps = 1;
|
||||
mode = MODE_STEPPING;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6830,7 +6831,7 @@ void DebugContinueStepping ()
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = MODE_DEBUG;
|
||||
g_nAppMode = MODE_DEBUG;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
// BUG: PageUp, Trace - doesn't center cursor
|
||||
|
||||
@ -7123,10 +7124,12 @@ void DebugInitialize ()
|
||||
void DebuggerInputConsoleChar( TCHAR ch )
|
||||
//void DebugProcessChar (TCHAR ch)
|
||||
{
|
||||
if ((mode == MODE_STEPPING) && (ch == DEBUG_EXIT_KEY))
|
||||
if ((g_nAppMode == MODE_STEPPING) && (ch == DEBUG_EXIT_KEY))
|
||||
{
|
||||
g_nDebugSteps = 0; // Exit Debugger
|
||||
}
|
||||
|
||||
if (mode != MODE_DEBUG)
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
return;
|
||||
|
||||
if (g_bConsoleBufferPaused)
|
||||
@ -7295,14 +7298,14 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput )
|
||||
void DebuggerProcessKey( int keycode )
|
||||
//void DebugProcessCommand (int keycode)
|
||||
{
|
||||
if (mode != MODE_DEBUG)
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
return;
|
||||
|
||||
if (g_bDebuggerViewingAppleOutput)
|
||||
{
|
||||
// Normally any key press takes us out of "Viewing Apple Output" mode
|
||||
// VK_F# are already processed, so we can't use them to cycle next video mode
|
||||
// if ((mode != MODE_LOGO) && (mode != MODE_DEBUG))
|
||||
// Normally any key press takes us out of "Viewing Apple Output" g_nAppMode
|
||||
// VK_F# are already processed, so we can't use them to cycle next video g_nAppMode
|
||||
// if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
g_bDebuggerViewingAppleOutput = false;
|
||||
UpdateDisplay( UPDATE_ALL ); // 1
|
||||
return;
|
||||
@ -7331,7 +7334,7 @@ void DebuggerProcessKey( int keycode )
|
||||
}
|
||||
else
|
||||
// If have console input, don't invoke cursor movement
|
||||
// TODO: Probably should disable all "movement" keys to map them to line editing mode
|
||||
// TODO: Probably should disable all "movement" keys to map them to line editing g_nAppMode
|
||||
if ((keycode == VK_SPACE) && g_nConsoleInputChars)
|
||||
return;
|
||||
else if (keycode == VK_ESCAPE)
|
||||
|
@ -26,8 +26,9 @@ using namespace std;
|
||||
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];
|
||||
|
||||
// Full-Speed debugging
|
||||
extern int g_nDebugOnBreakInvalid;
|
||||
extern int g_iDebugOnOpcode ;
|
||||
extern int g_nDebugOnBreakInvalid;
|
||||
extern int g_iDebugOnOpcode ;
|
||||
extern bool g_bDebugDelayBreakCheck;
|
||||
|
||||
// Commands
|
||||
extern const int NUM_COMMANDS_WITH_ALIASES; // = sizeof(g_aCommands) / sizeof (Command_t); // Determined at compile-time ;-)
|
||||
|
@ -126,7 +126,7 @@ bool CanDrawDebugger()
|
||||
if (g_bDebuggerViewingAppleOutput)
|
||||
return false;
|
||||
|
||||
if ((mode == MODE_DEBUG) || (mode == MODE_STEPPING))
|
||||
if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
+---------------------+--------------------------+
|
||||
| mode | assembler format |
|
||||
| g_nAppMode | assembler format |
|
||||
+=====================+==========================+
|
||||
| Immediate | #aa |
|
||||
| Absolute | aaaa |
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
Opcode: opc aaa od
|
||||
opc...od = Mnemonic / Opcode
|
||||
...aaa.. = Addressing mode
|
||||
...aaa.. = Addressing g_nAppMode
|
||||
od = 00
|
||||
000 #Immediate
|
||||
001 Zero page
|
||||
@ -291,7 +291,7 @@
|
||||
, FG_DISASM_PC_X // White (not cursor)
|
||||
|
||||
, FG_DISASM_ADDRESS // White addr
|
||||
, FG_DISASM_OPERATOR // Gray192 : $ (also around instruction addressing mode)
|
||||
, FG_DISASM_OPERATOR // Gray192 : $ (also around instruction addressing g_nAppMode)
|
||||
, FG_DISASM_OPCODE // Yellow xx xx xx
|
||||
, FG_DISASM_MNEMONIC // White LDA
|
||||
, FG_DISASM_TARGET // Orange FAC8
|
||||
|
@ -319,9 +319,9 @@ void DrawFrameWindow () {
|
||||
ReleaseDC(g_hFrameWindow,dc);
|
||||
|
||||
// DRAW THE CONTENTS OF THE EMULATED SCREEN
|
||||
if (mode == MODE_LOGO)
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
VideoDisplayLogo();
|
||||
else if (mode == MODE_DEBUG)
|
||||
else if (g_nAppMode == MODE_DEBUG)
|
||||
DebugDisplay(1);
|
||||
else
|
||||
VideoRedrawScreen();
|
||||
@ -354,10 +354,10 @@ void DrawStatusArea (HDC passdc, int drawflags) {
|
||||
TextOut(dc,x+BUTTONCX,y+2,TEXT("Caps"),4);
|
||||
}
|
||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
SetTextColor(dc,(mode == MODE_PAUSED ||
|
||||
mode == MODE_STEPPING ? RGB(255,255,255) :
|
||||
SetTextColor(dc,(g_nAppMode == MODE_PAUSED ||
|
||||
g_nAppMode == MODE_STEPPING ? RGB(255,255,255) :
|
||||
RGB( 0, 0, 0)));
|
||||
TextOut(dc,x+BUTTONCX/2,y+13,(mode == MODE_PAUSED ? TEXT(" Paused ") :
|
||||
TextOut(dc,x+BUTTONCX/2,y+13,(g_nAppMode == MODE_PAUSED ? TEXT(" Paused ") :
|
||||
TEXT("Stepping")),8);
|
||||
}
|
||||
else {
|
||||
@ -386,7 +386,7 @@ void DrawStatusArea (HDC passdc, int drawflags) {
|
||||
TCHAR title[40];
|
||||
_tcscpy(title,apple2e ? TITLE : (apple2plus ? TEXT("Apple ][+ Emulator")
|
||||
: TEXT("Apple ][ Emulator")));
|
||||
switch (mode) {
|
||||
switch (g_nAppMode) {
|
||||
case MODE_PAUSED: _tcscat(title,TEXT(" [Paused]")); break;
|
||||
case MODE_STEPPING: _tcscat(title,TEXT(" [Stepping]")); break;
|
||||
}
|
||||
@ -445,10 +445,10 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
if ((mode == MODE_RUNNING) || (mode == MODE_LOGO) ||
|
||||
((mode == MODE_STEPPING) && (wparam != TEXT('\x1B'))))
|
||||
if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) ||
|
||||
((g_nAppMode == MODE_STEPPING) && (wparam != TEXT('\x1B'))))
|
||||
KeybQueueKeypress((int)wparam,ASCII);
|
||||
else if ((mode == MODE_DEBUG) || (mode == MODE_STEPPING))
|
||||
else if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
// DebugProcessChar((TCHAR)wparam);
|
||||
DebuggerInputConsoleChar((TCHAR)wparam);
|
||||
|
||||
@ -554,7 +554,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
if (videotype >= VT_NUM_MODES)
|
||||
videotype = 0;
|
||||
VideoReinitialize();
|
||||
if ((mode != MODE_LOGO) || ((mode == MODE_DEBUG) && (g_bDebuggerViewingAppleOutput))) // +PATCH
|
||||
if ((g_nAppMode != MODE_LOGO) || ((g_nAppMode == MODE_DEBUG) && (g_bDebuggerViewingAppleOutput))) // +PATCH
|
||||
{
|
||||
VideoRedrawScreen();
|
||||
g_bDebuggerViewingAppleOutput = true; // +PATCH
|
||||
@ -583,14 +583,14 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
KeybToggleCapsLock();
|
||||
else if (wparam == VK_PAUSE) {
|
||||
SetUsingCursor(0);
|
||||
switch (mode)
|
||||
switch (g_nAppMode)
|
||||
{
|
||||
case MODE_RUNNING:
|
||||
mode = MODE_PAUSED;
|
||||
g_nAppMode = MODE_PAUSED;
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
break;
|
||||
case MODE_PAUSED:
|
||||
mode = MODE_RUNNING;
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
break;
|
||||
case MODE_STEPPING:
|
||||
@ -598,21 +598,21 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
}
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
if ((mode != MODE_LOGO) && (mode != MODE_DEBUG))
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
VideoRedrawScreen();
|
||||
resettiming = 1;
|
||||
}
|
||||
else if ((mode == MODE_RUNNING) || (mode == MODE_LOGO) || (mode == MODE_STEPPING))
|
||||
else if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) || (g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
// Note about Alt Gr (Right-Alt):
|
||||
// . WM_KEYDOWN[Left-Control], then:
|
||||
// . WM_KEYDOWN[Right-Alt]
|
||||
BOOL autorep = ((lparam & 0x40000000) != 0);
|
||||
BOOL extended = ((lparam & 0x01000000) != 0);
|
||||
if ((!JoyProcessKey((int)wparam,extended,1,autorep)) && (mode != MODE_LOGO))
|
||||
if ((!JoyProcessKey((int)wparam,extended,1,autorep)) && (g_nAppMode != MODE_LOGO))
|
||||
KeybQueueKeypress((int)wparam,NOT_ASCII);
|
||||
}
|
||||
else if (mode == MODE_DEBUG)
|
||||
else if (g_nAppMode == MODE_DEBUG)
|
||||
// DebugProcessCommand(wparam);
|
||||
DebuggerProcessKey(wparam);
|
||||
|
||||
@ -652,7 +652,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
else
|
||||
JoySetButton(0,1);
|
||||
else if ((x < buttonx) && JoyUsingMouse() &&
|
||||
((mode == MODE_RUNNING) || (mode == MODE_STEPPING)))
|
||||
((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING)))
|
||||
SetUsingCursor(1);
|
||||
}
|
||||
RelayEvent(WM_LBUTTONDOWN,wparam,lparam);
|
||||
@ -813,7 +813,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
|
||||
case WM_USER_BENCHMARK: {
|
||||
if (mode != MODE_LOGO)
|
||||
if (g_nAppMode != MODE_LOGO)
|
||||
if (MessageBox(g_hFrameWindow,
|
||||
TEXT("Running the benchmarks will reset the state of ")
|
||||
TEXT("the emulated machine, causing you to lose any ")
|
||||
@ -824,7 +824,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
UpdateWindow(window);
|
||||
ResetMachineState();
|
||||
mode = MODE_LOGO;
|
||||
g_nAppMode = MODE_LOGO;
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
HCURSOR oldcursor = SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
VideoBenchmark();
|
||||
@ -836,7 +836,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
case WM_USER_RESTART:
|
||||
// . Changed Apple computer type (][+ or //e)
|
||||
// . Changed disk speed (normal or enhanced)
|
||||
if (mode != MODE_LOGO)
|
||||
if (g_nAppMode != MODE_LOGO)
|
||||
if (MessageBox(g_hFrameWindow,
|
||||
TEXT("Restarting the emulator will reset the state ")
|
||||
TEXT("of the emulated machine, causing you to lose any ")
|
||||
@ -880,13 +880,13 @@ void ProcessButtonClick (int button) {
|
||||
break;
|
||||
|
||||
case BTN_RUN:
|
||||
if (mode == MODE_LOGO)
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
DiskBoot();
|
||||
else if (mode == MODE_RUNNING)
|
||||
else if (g_nAppMode == MODE_RUNNING)
|
||||
ResetMachineState();
|
||||
if ((mode == MODE_DEBUG) || (mode == MODE_STEPPING))
|
||||
if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
DebugEnd();
|
||||
mode = MODE_RUNNING;
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
VideoRedrawScreen();
|
||||
resettiming = 1;
|
||||
@ -911,15 +911,25 @@ void ProcessButtonClick (int button) {
|
||||
break;
|
||||
|
||||
case BTN_DEBUG:
|
||||
if (mode == MODE_LOGO)
|
||||
ResetMachineState();
|
||||
if (mode == MODE_STEPPING)
|
||||
if (g_nAppMode == MODE_LOGO)
|
||||
{
|
||||
ResetMachineState();
|
||||
}
|
||||
|
||||
if (g_nAppMode == MODE_STEPPING)
|
||||
{
|
||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||
else if (mode == MODE_DEBUG)
|
||||
ProcessButtonClick(BTN_RUN);
|
||||
else {
|
||||
DebugBegin();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
{
|
||||
g_bDebugDelayBreakCheck = true;
|
||||
ProcessButtonClick(BTN_RUN);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugBegin();
|
||||
}
|
||||
break;
|
||||
|
||||
case BTN_SETUP:
|
||||
@ -930,7 +940,7 @@ void ProcessButtonClick (int button) {
|
||||
|
||||
}
|
||||
|
||||
if((mode != MODE_DEBUG) && (mode != MODE_PAUSED))
|
||||
if((g_nAppMode != MODE_DEBUG) && (g_nAppMode != MODE_PAUSED))
|
||||
{
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
|
@ -12,3 +12,9 @@ void FrameRefreshStatus (int);
|
||||
void FrameRegisterClass ();
|
||||
void FrameReleaseDC ();
|
||||
void FrameReleaseVideoDC ();
|
||||
|
||||
LRESULT CALLBACK FrameWndProc (
|
||||
HWND window,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam );
|
||||
|
@ -224,7 +224,7 @@ static void ConfigDlg_OK(HWND window, BOOL afterclose)
|
||||
{
|
||||
videotype = newvidtype;
|
||||
VideoReinitialize();
|
||||
if ((mode != MODE_LOGO) && (mode != MODE_DEBUG))
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
VideoRedrawScreen();
|
||||
}
|
||||
CommSetSerialPort(window,newserialport);
|
||||
|
@ -411,7 +411,7 @@ void SoundCore_SetFade(eFADE FadeType)
|
||||
{
|
||||
static int nLastMode = -1;
|
||||
|
||||
if(mode == MODE_DEBUG)
|
||||
if(g_nAppMode == MODE_DEBUG)
|
||||
return;
|
||||
|
||||
// Fade in/out just for speaker, the others are demuted/muted
|
||||
@ -419,9 +419,9 @@ void SoundCore_SetFade(eFADE FadeType)
|
||||
{
|
||||
for(UINT i=0; i<g_uNumVoices; i++)
|
||||
{
|
||||
// Note: Kludge for fading speaker if curr/last mode is/was MODE_LOGO:
|
||||
// Note: Kludge for fading speaker if curr/last g_nAppMode is/was MODE_LOGO:
|
||||
// . Bug in DirectSound? SpeakerVoice.lpDSBvoice->SetVolume() doesn't work without this!
|
||||
if((g_pVoices[i]->bIsSpeaker) && (mode != MODE_LOGO) && (nLastMode != MODE_LOGO))
|
||||
if((g_pVoices[i]->bIsSpeaker) && (g_nAppMode != MODE_LOGO) && (nLastMode != MODE_LOGO))
|
||||
{
|
||||
g_pVoices[i]->lpDSBvoice->GetVolume(&g_pVoices[i]->nFadeVolume);
|
||||
g_FadeType = FadeType;
|
||||
@ -449,7 +449,7 @@ void SoundCore_SetFade(eFADE FadeType)
|
||||
}
|
||||
}
|
||||
|
||||
nLastMode = mode;
|
||||
nLastMode = g_nAppMode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -509,7 +509,7 @@ void SpkrUpdate (DWORD totalcycles)
|
||||
else if(g_nCumulativeCycles - g_nSpkrQuietCycleCount > (unsigned __int64)g_fCurrentCLK6502/5)
|
||||
{
|
||||
// After 0.2 sec of Apple time, deactivate spkr voice
|
||||
// . This allows emulator to auto-switch to full-speed mode for fast disk access
|
||||
// . This allows emulator to auto-switch to full-speed g_nAppMode for fast disk access
|
||||
Spkr_SetActive(false);
|
||||
}
|
||||
}
|
||||
@ -616,7 +616,7 @@ static DWORD dwByteOffset = (DWORD)-1;
|
||||
static int nNumSamplesError = 0;
|
||||
static int nDbgSpkrCnt = 0;
|
||||
|
||||
// FullSpeed mode, 2 cases:
|
||||
// FullSpeed g_nAppMode, 2 cases:
|
||||
// i) Short burst of full-speed, so PlayCursor doesn't complete sound from previous fixed-speed session.
|
||||
// ii) Long burst of full-speed, so PlayCursor completes sound from previous fixed-speed session.
|
||||
|
||||
|
@ -93,7 +93,7 @@ enum Color_Palette_Index_e
|
||||
, PINK
|
||||
, AQUA
|
||||
|
||||
// CUSTOM HGR COLORS (don't change order) - For tv emulation mode
|
||||
// CUSTOM HGR COLORS (don't change order) - For tv emulation g_nAppMode
|
||||
, HGR_BLACK
|
||||
, HGR_WHITE
|
||||
, HGR_BLUE
|
||||
@ -149,7 +149,7 @@ enum Color_Palette_Index_e
|
||||
framebufferinfo->bmiColors[i].rgbGreen = g; \
|
||||
framebufferinfo->bmiColors[i].rgbBlue = b;
|
||||
|
||||
#define HGR_MATRIX_YOFFSET 2 // For tv emulation mode
|
||||
#define HGR_MATRIX_YOFFSET 2 // For tv emulation g_nAppMode
|
||||
|
||||
// video scanner constants
|
||||
int const kHBurstClock = 53; // clock when Color Burst starts
|
||||
@ -188,7 +188,7 @@ static LPBYTE sourceoffsettable[512];
|
||||
static LPBYTE textauxptr;
|
||||
static LPBYTE textmainptr;
|
||||
|
||||
// For tv emulation mode
|
||||
// For tv emulation g_nAppMode
|
||||
// 2 extra pixels on end?
|
||||
static BYTE hgrpixelmatrix[280][192 + 2 * HGR_MATRIX_YOFFSET];
|
||||
static BYTE colormixbuffer[6];
|
||||
@ -286,7 +286,7 @@ void CreateIdentityPalette () {
|
||||
SETFRAMECOLOR(PINK, 0xFF,0x90,0x80);
|
||||
SETFRAMECOLOR(AQUA, 0x40,0xFF,0x90);
|
||||
|
||||
SETFRAMECOLOR(HGR_BLACK, 0x00,0x00,0x00); // For tv emulation mode
|
||||
SETFRAMECOLOR(HGR_BLACK, 0x00,0x00,0x00); // For tv emulation g_nAppMode
|
||||
SETFRAMECOLOR(HGR_WHITE, 0xFF,0xFF,0xFE);
|
||||
SETFRAMECOLOR(HGR_BLUE, 0x00,0x80,0xFF);
|
||||
SETFRAMECOLOR(HGR_RED, 0xF0,0x50,0x00);
|
||||
@ -516,7 +516,7 @@ void DrawDHiResSource () {
|
||||
{
|
||||
/***
|
||||
activate for fringe reduction on white hgr text
|
||||
drawback: loss of color mix patterns in hgr mode.
|
||||
drawback: loss of color mix patterns in hgr g_nAppMode.
|
||||
select videotype by index
|
||||
***/
|
||||
|
||||
@ -623,7 +623,7 @@ void DrawHiResSourceHalfShiftDim ()
|
||||
{
|
||||
/***
|
||||
activate for fringe reduction on white hgr text -
|
||||
drawback: loss of color mix patterns in hgr mode.
|
||||
drawback: loss of color mix patterns in hgr g_nAppMode.
|
||||
select videotype by index exclusion
|
||||
***/
|
||||
|
||||
@ -792,7 +792,7 @@ void DrawHiResSource ()
|
||||
{
|
||||
/***
|
||||
activate for fringe reduction on white hgr text -
|
||||
drawback: loss of color mix patterns in hgr mode.
|
||||
drawback: loss of color mix patterns in hgr g_nAppMode.
|
||||
select videotype by index exclusion
|
||||
***/
|
||||
|
||||
@ -1037,7 +1037,7 @@ BOOL UpdateDHiResCell (int x, int y, int xpixel, int ypixel, int offset) {
|
||||
|
||||
|
||||
//===========================================================================
|
||||
BYTE MixColors(BYTE c1, BYTE c2) { // For tv emulation mode
|
||||
BYTE MixColors(BYTE c1, BYTE c2) { // For tv emulation g_nAppMode
|
||||
#define COMBINATION(c1,c2,ref1,ref2) (((c1)==(ref1)&&(c2)==(ref2)) || ((c1)==(ref2)&&(c2)==(ref1)))
|
||||
|
||||
if (c1 == c2)
|
||||
@ -1062,7 +1062,7 @@ BYTE MixColors(BYTE c1, BYTE c2) { // For tv emulation mode
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void CreateColorMixMap() { // For tv emulation mode
|
||||
void CreateColorMixMap() { // For tv emulation g_nAppMode
|
||||
#define FROM_NEIGHBOUR 0x00
|
||||
|
||||
int t,m,b;
|
||||
@ -1102,7 +1102,7 @@ void CreateColorMixMap() { // For tv emulation mode
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void __stdcall MixColorsVertical(int matx, int maty) { // For tv emulation mode
|
||||
void __stdcall MixColorsVertical(int matx, int maty) { // For tv emulation g_nAppMode
|
||||
|
||||
WORD twoHalfPixel;
|
||||
int bot1idx, bot2idx;
|
||||
@ -1141,7 +1141,7 @@ void __stdcall MixColorsVertical(int matx, int maty) { // For tv emulation mode
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void __stdcall CopyMixedSource (int x, int y, int sourcex, int sourcey) { // For tv emulation mode
|
||||
void __stdcall CopyMixedSource (int x, int y, int sourcex, int sourcey) { // For tv emulation g_nAppMode
|
||||
|
||||
LPBYTE currsourceptr = sourceoffsettable[sourcey]+sourcex;
|
||||
LPBYTE currdestptr = frameoffsettable[y<<1] + (x<<1);
|
||||
@ -1576,7 +1576,7 @@ void VideoChooseColor () {
|
||||
if (ChooseColor(&cc)) {
|
||||
monochrome = cc.rgbResult;
|
||||
VideoReinitialize();
|
||||
if ((mode != MODE_LOGO) && (mode != MODE_DEBUG))
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
VideoRedrawScreen();
|
||||
RegSaveValue(TEXT("Configuration"),TEXT("Monochrome Color"),1,monochrome);
|
||||
}
|
||||
@ -2010,7 +2010,7 @@ void VideoUpdateFlash()
|
||||
nTextFlashCnt = 0;
|
||||
g_bTextFlashState = !g_bTextFlashState;
|
||||
|
||||
// Redraw any FLASHing chars if any text showing. NB. No FLASH mode for 80 cols
|
||||
// Redraw any FLASHing chars if any text showing. NB. No FLASH g_nAppMode for 80 cols
|
||||
if((SW_TEXT || SW_MIXED) && !SW_80COL)
|
||||
g_bTextFlashFlag = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user