mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-16 09:30:00 +00:00
Mouse wheel support
many scrolling fixes general cleanup of globals
This commit is contained in:
parent
2fc141b1b6
commit
6cdd30700f
@ -50,7 +50,7 @@ static int lastmode = MODE_LOGO;
|
||||
DWORD needsprecision = 0; // Redundant
|
||||
TCHAR g_sProgramDir[MAX_PATH] = TEXT("");
|
||||
TCHAR g_sCurrentDir[MAX_PATH] = TEXT(""); // Also Starting Dir
|
||||
BOOL resettiming = 0; // Redundant
|
||||
bool g_bResetTiming = false; // Redundant
|
||||
BOOL restart = 0;
|
||||
|
||||
DWORD g_dwSpeed = SPEED_NORMAL; // Affected by Config dialog's speed slider bar
|
||||
|
@ -18,7 +18,7 @@ extern DWORD needsprecision;
|
||||
extern TCHAR g_sProgramDir[MAX_PATH];
|
||||
extern TCHAR g_sCurrentDir[MAX_PATH];
|
||||
|
||||
extern BOOL resettiming;
|
||||
extern bool g_bResetTiming;
|
||||
extern BOOL restart;
|
||||
|
||||
extern DWORD g_dwSpeed;
|
||||
|
@ -51,24 +51,30 @@ enum AppMode_e
|
||||
#define BTN_DEBUG 6
|
||||
#define BTN_SETUP 7
|
||||
|
||||
#define MAXIMAGES 16
|
||||
#define TITLE TEXT("Apple //e Emulator")
|
||||
#define MAXIMAGES 16
|
||||
// TODO: Move to StringTable.h
|
||||
#define TITLE_APPLE_2 TEXT("Apple ][ Emulator")
|
||||
#define TITLE_APPLE_2_PLUS TEXT("Apple ][+ Emulator")
|
||||
#define TITLE_APPLE_2_E TEXT("Apple //e Emulator")
|
||||
#define TITLE TITLE_APPLE_2_E
|
||||
#define TITLE_PAUSED TEXT(" Paused ")
|
||||
#define TITLE_STEPPING TEXT("Stepping")
|
||||
|
||||
#define LOAD(a,b) RegLoadValue(TEXT("Configuration"),a,1,b)
|
||||
#define SAVE(a,b) RegSaveValue(TEXT("Configuration"),a,1,b)
|
||||
|
||||
// Configuration
|
||||
#define REGVALUE_SPKR_VOLUME "Speaker Volume"
|
||||
#define REGVALUE_MB_VOLUME "Mockingboard Volume"
|
||||
#define REGVALUE_SOUNDCARD_TYPE "Soundcard Type"
|
||||
#define REGVALUE_SPKR_VOLUME "Speaker Volume"
|
||||
#define REGVALUE_MB_VOLUME "Mockingboard Volume"
|
||||
#define REGVALUE_SOUNDCARD_TYPE "Soundcard Type"
|
||||
#define REGVALUE_KEYB_BUFFER_ENABLE "Keyboard Buffer Enable"
|
||||
#define REGVALUE_SAVESTATE_FILENAME "Save State Filename"
|
||||
#define REGVALUE_SAVE_STATE_ON_EXIT "Save State On Exit"
|
||||
#define REGVALUE_HDD_ENABLED "Harddisk Enable"
|
||||
#define REGVALUE_HDD_IMAGE1 "Harddisk Image 1"
|
||||
#define REGVALUE_HDD_IMAGE2 "Harddisk Image 2"
|
||||
#define REGVALUE_PDL_XTRIM "PDL X-Trim"
|
||||
#define REGVALUE_PDL_YTRIM "PDL Y-Trim"
|
||||
#define REGVALUE_HDD_ENABLED "Harddisk Enable"
|
||||
#define REGVALUE_HDD_IMAGE1 "Harddisk Image 1"
|
||||
#define REGVALUE_HDD_IMAGE2 "Harddisk Image 2"
|
||||
#define REGVALUE_PDL_XTRIM "PDL X-Trim"
|
||||
#define REGVALUE_PDL_YTRIM "PDL Y-Trim"
|
||||
|
||||
// Preferences
|
||||
#define REGVALUE_PREF_START_DIR TEXT("Starting Directory")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ using namespace std;
|
||||
|
||||
// Breakpoints
|
||||
extern int g_nBreakpoints;
|
||||
extern Breakpoint_t g_aBreakpoints[ NUM_BREAKPOINTS ];
|
||||
extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
||||
|
||||
extern const TCHAR *g_aBreakpointSource [ NUM_BREAKPOINT_SOURCES ];
|
||||
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];
|
||||
@ -97,6 +97,9 @@ using namespace std;
|
||||
|
||||
// Prototypes _______________________________________________________________
|
||||
|
||||
// Bookmarks
|
||||
bool Bookmark_Find( const WORD nAddress );
|
||||
|
||||
// Breakpoints
|
||||
bool GetBreakpointInfo ( WORD nOffset, bool & bBreakpointActive_, bool & bBreakpointEnable_ );
|
||||
|
||||
@ -131,8 +134,6 @@ using namespace std;
|
||||
LPCTSTR FindSymbolFromAddress (WORD nAdress, int * iTable_ = NULL );
|
||||
LPCTSTR GetSymbol (WORD nAddress, int nBytes);
|
||||
|
||||
bool Get6502Targets ( WORD nAddress, int *pTemp_, int *pFinal_, int *pBytes_ );
|
||||
|
||||
Update_t DebuggerProcessCommand( const bool bEchoConsoleInput );
|
||||
|
||||
// Prototypes _______________________________________________________________
|
||||
|
@ -366,7 +366,43 @@ Fx BEQ r SBC (d),Y sbc (d) --- --- SBC d,X INC d,X --- SED SBC a,Y
|
||||
|
||||
|
||||
//===========================================================================
|
||||
int _6502GetOpmodeOpbytes( const int iAddress, int & iOpmode_, int & nOpbytes_ )
|
||||
bool _6502_CalcRelativeOffset( int nOpcode, int nBaseAddress, int nTargetAddress, WORD * pTargetOffset_ )
|
||||
{
|
||||
if (_6502_IsOpcodeBranch( nOpcode))
|
||||
{
|
||||
// Branch is
|
||||
// a) relative to address+2
|
||||
// b) in 2's compliment
|
||||
//
|
||||
// i.e.
|
||||
// 300: D0 7F -> BNE $381 0x381 - 0x300 = 0x81 +129
|
||||
// 300: D0 80 -> BNE $282 0x282 - 0x300 = -126
|
||||
//
|
||||
// 300: D0 7E BNE $380
|
||||
// ^ ^ ^ ^
|
||||
// | | | TargetAddress
|
||||
// | | TargetOffset
|
||||
// | Opcode
|
||||
// BaseAddress
|
||||
int nDistance = nTargetAddress - nBaseAddress;
|
||||
if (pTargetOffset_)
|
||||
*pTargetOffset_ = (BYTE)(nDistance - 2);
|
||||
|
||||
if ((nDistance - 2) > _6502_BRANCH_POS)
|
||||
m_iAsmAddressMode = NUM_OPMODES; // signal bad
|
||||
|
||||
if ((nDistance - 2) < _6502_BRANCH_NEG)
|
||||
m_iAsmAddressMode = NUM_OPMODES; // signal bad
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
int _6502_GetOpmodeOpbytes ( const int iAddress, int & iOpmode_, int & nOpbytes_ )
|
||||
{
|
||||
int iOpcode_ = *(mem + iAddress);
|
||||
iOpmode_ = g_aOpcodes[ iOpcode_ ].nAddressMode;
|
||||
@ -384,11 +420,259 @@ int _6502GetOpmodeOpbytes( const int iAddress, int & iOpmode_, int & nOpbytes_ )
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void _6502GetOpcodeOpmodeOpbytes( int & iOpcode_, int & iOpmode_, int & nOpbytes_ )
|
||||
void _6502_GetOpcodeOpmodeOpbytes ( int & iOpcode_, int & iOpmode_, int & nOpbytes_ )
|
||||
{
|
||||
iOpcode_ = _6502GetOpmodeOpbytes( regs.pc, iOpmode_, nOpbytes_ );
|
||||
iOpcode_ = _6502_GetOpmodeOpbytes( regs.pc, iOpmode_, nOpbytes_ );
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool _6502_GetStackReturnAddress ( WORD & nAddress_ )
|
||||
{
|
||||
unsigned nStack = regs.sp;
|
||||
nStack++;
|
||||
|
||||
if (nStack <= (_6502_STACK_END - 1))
|
||||
{
|
||||
nAddress_ = 0;
|
||||
nAddress_ = (unsigned)*(LPBYTE)(mem + nStack);
|
||||
nStack++;
|
||||
|
||||
nAddress_ += ((unsigned)*(LPBYTE)(mem + nStack)) << 8;
|
||||
nAddress_++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPointer_, int * pTargetBytes_, bool bIgnoreJSRJMP, bool bIgnoreBranch )
|
||||
{
|
||||
bool bStatus = false;
|
||||
|
||||
if (! pTargetPartial_)
|
||||
return bStatus;
|
||||
|
||||
if (! pTargetPointer_)
|
||||
return bStatus;
|
||||
|
||||
// if (! pTargetBytes_)
|
||||
// return bStatus;
|
||||
|
||||
*pTargetPartial_ = NO_6502_TARGET;
|
||||
*pTargetPointer_ = NO_6502_TARGET;
|
||||
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 0;
|
||||
|
||||
bStatus = true;
|
||||
|
||||
BYTE nOpcode = *(LPBYTE)(mem + nAddress );
|
||||
BYTE nTarget8 = *(LPBYTE)(mem + nAddress + 1);
|
||||
WORD nTarget16 = *(LPWORD)(mem + nAddress + 1);
|
||||
|
||||
int eMode = g_aOpcodes[ nOpcode ].nAddressMode;
|
||||
|
||||
switch (eMode)
|
||||
{
|
||||
case AM_A: // $Absolute
|
||||
*pTargetPointer_ = nTarget16;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_IAX: // Indexed (Absolute) Indirect
|
||||
nTarget16 += regs.x;
|
||||
*pTargetPartial_ = nTarget16;
|
||||
*pTargetPointer_ = *(LPWORD)(mem + nTarget16);
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_AX: // Absolute, X
|
||||
nTarget16 += regs.x;
|
||||
*pTargetPointer_ = nTarget16;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_AY: // Absolute, Y
|
||||
nTarget16 += regs.y;
|
||||
*pTargetPointer_ = nTarget16;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_NA: // Indirect (Absolute) i.e. JMP
|
||||
*pTargetPartial_ = nTarget16;
|
||||
*pTargetPointer_ = *(LPWORD)(mem + nTarget16);
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_IZX: // Indexed (Zeropage Indirect, X)
|
||||
nTarget8 += regs.x;
|
||||
*pTargetPartial_ = nTarget8;
|
||||
*pTargetPointer_ = *(LPWORD)(mem + nTarget8);
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_NZY: // Indirect (Zeropage) Indexed, Y
|
||||
*pTargetPartial_ = nTarget8;
|
||||
*pTargetPointer_ = (*(LPWORD)(mem + nTarget8)) + regs.y;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 1;
|
||||
break;
|
||||
|
||||
case AM_NZ: // Indirect (Zeropage)
|
||||
*pTargetPartial_ = nTarget8;
|
||||
*pTargetPointer_ = *(LPWORD)(mem + nTarget8);
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 2;
|
||||
break;
|
||||
|
||||
case AM_R:
|
||||
if (! bIgnoreBranch)
|
||||
{
|
||||
*pTargetPartial_ = nTarget8;
|
||||
*pTargetPointer_ = nAddress + 2;
|
||||
|
||||
if (nTarget8 <= _6502_BRANCH_POS)
|
||||
*pTargetPointer_ += nTarget8; // +
|
||||
else
|
||||
*pTargetPointer_ -= nTarget8; // -
|
||||
|
||||
*pTargetPointer_ &= _6502_MEM_END;
|
||||
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case AM_Z: // Zeropage
|
||||
*pTargetPointer_ = nTarget8;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 1;
|
||||
break;
|
||||
|
||||
case AM_ZX: // Zeropage, X
|
||||
*pTargetPointer_ = (nTarget8 + regs.x) & 0xFF; // .21 Bugfix: shouldn't this wrap around? Yes.
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 1;
|
||||
break;
|
||||
|
||||
case AM_ZY: // Zeropage, Y
|
||||
*pTargetPointer_ = (nTarget8 + regs.y) & 0xFF; // .21 Bugfix: shouldn't this wrap around? Yes.
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bIgnoreJSRJMP)
|
||||
{
|
||||
// If 6502 is jumping, don't show byte [nAddressTarget]
|
||||
if ((*pTargetPointer_ >= 0) && (
|
||||
(nOpcode == OPCODE_JSR ) || // 0x20
|
||||
(nOpcode == OPCODE_JMP_A ))) // 0x4C
|
||||
// (nOpcode == OPCODE_JMP_NA ) || // 0x6C
|
||||
// (nOpcode == OPCODE_JMP_IAX))) // 0x7C
|
||||
{
|
||||
*pTargetPointer_ = NO_6502_TARGET;
|
||||
if (pTargetBytes_)
|
||||
*pTargetBytes_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return bStatus;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool _6502_GetTargetAddress ( const WORD & nAddress, WORD & nTarget_ )
|
||||
{
|
||||
int iOpcode;
|
||||
int iOpmode;
|
||||
int nOpbytes;
|
||||
iOpcode = _6502_GetOpmodeOpbytes( nAddress, iOpmode, nOpbytes );
|
||||
|
||||
// Composite string that has the target nAddress
|
||||
// WORD nTarget = 0;
|
||||
int nTargetOffset_ = 0;
|
||||
|
||||
if ((iOpmode != AM_IMPLIED) &&
|
||||
(iOpmode != AM_1) &&
|
||||
(iOpmode != AM_2) &&
|
||||
(iOpmode != AM_3))
|
||||
{
|
||||
int nTargetPartial;
|
||||
int nTargetPointer;
|
||||
WORD nTargetValue = 0; // de-ref
|
||||
int nTargetBytes;
|
||||
_6502_GetTargets( nAddress, &nTargetPartial, &nTargetPointer, &nTargetBytes, false, false );
|
||||
|
||||
// if (nTargetPointer == NO_6502_TARGET)
|
||||
// {
|
||||
// if (_6502_IsOpcodeBranch( nOpcode )
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
if (nTargetPointer != NO_6502_TARGET)
|
||||
// else
|
||||
{
|
||||
nTarget_ = nTargetPointer & _6502_MEM_END;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool _6502_IsOpcodeBranch ( int iOpcode )
|
||||
{
|
||||
// 76543210 Bit
|
||||
// xxx10000 Branch
|
||||
if (iOpcode == OPCODE_BRA)
|
||||
return true;
|
||||
|
||||
if ((iOpcode & 0x1F) != 0x10) // low nibble not zero?
|
||||
return false;
|
||||
|
||||
if ((iOpcode >> 4) & 1)
|
||||
return true;
|
||||
|
||||
// (nOpcode == 0x10) || // BPL
|
||||
// (nOpcode == 0x30) || // BMI
|
||||
// (nOpcode == 0x50) || // BVC
|
||||
// (nOpcode == 0x70) || // BVS
|
||||
// (nOpcode == 0x90) || // BCC
|
||||
// (nOpcode == 0xB0) || // BCS
|
||||
// (nOpcode == 0xD0) || // BNE
|
||||
// (nOpcode == 0xF0) || // BEQ
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool _6502_IsOpcodeValid ( int iOpcode )
|
||||
{
|
||||
if ((iOpcode & 0x3) == 0x3)
|
||||
return false;
|
||||
|
||||
if (islower( g_aOpcodes6502[ iOpcode ].sMnemonic[ 0 ] ))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Assembler ________________________________________________________________
|
||||
|
||||
|
||||
//===========================================================================
|
||||
int AssemblerHashMnemonic ( const TCHAR * pMnemonic )
|
||||
@ -505,69 +789,6 @@ void _CmdAssembleHashDump ()
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool AssemblerOpcodeIsBranch( int nOpcode )
|
||||
{
|
||||
// 76543210 Bit
|
||||
// xxx10000 Branch
|
||||
|
||||
if (nOpcode == OPCODE_BRA)
|
||||
return true;
|
||||
|
||||
if ((nOpcode & 0x1F) != 0x10) // low nibble not zero?
|
||||
return false;
|
||||
|
||||
if ((nOpcode >> 4) & 1)
|
||||
return true;
|
||||
|
||||
// (nOpcode == 0x10) || // BPL
|
||||
// (nOpcode == 0x30) || // BMI
|
||||
// (nOpcode == 0x50) || // BVC
|
||||
// (nOpcode == 0x70) || // BVS
|
||||
// (nOpcode == 0x90) || // BCC
|
||||
// (nOpcode == 0xB0) || // BCS
|
||||
// (nOpcode == 0xD0) || // BNE
|
||||
// (nOpcode == 0xF0) || // BEQ
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool Calc6502RelativeOffset( int nOpcode, int nBaseAddress, int nTargetAddress, WORD * pTargetOffset_ )
|
||||
{
|
||||
if (AssemblerOpcodeIsBranch( nOpcode))
|
||||
{
|
||||
// Branch is
|
||||
// a) relative to address+2
|
||||
// b) in 2's compliment
|
||||
//
|
||||
// i.e.
|
||||
// 300: D0 7F -> BNE $381 0x381 - 0x300 = 0x81 +129
|
||||
// 300: D0 80 -> BNE $282 0x282 - 0x300 = -126
|
||||
//
|
||||
// 300: D0 7E BNE $380
|
||||
// ^ ^ ^ ^
|
||||
// | | | TargetAddress
|
||||
// | | TargetOffset
|
||||
// | Opcode
|
||||
// BaseAddress
|
||||
int nDistance = nTargetAddress - nBaseAddress;
|
||||
if (pTargetOffset_)
|
||||
*pTargetOffset_ = (BYTE)(nDistance - 2);
|
||||
|
||||
if ((nDistance - 2) > 127)
|
||||
m_iAsmAddressMode = NUM_OPMODES; // signal bad
|
||||
|
||||
if ((nDistance - 2) < -128)
|
||||
m_iAsmAddressMode = NUM_OPMODES; // signal bad
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
int AssemblerPokeAddress( const int Opcode, const int nOpmode, const WORD nBaseAddress, const WORD nTargetOffset )
|
||||
@ -949,7 +1170,7 @@ bool AssemblerUpdateAddressingMode()
|
||||
m_nAsmTargetValue = m_nAsmTargetAddress;
|
||||
|
||||
int nOpcode = m_vAsmOpcodes.at( 0 ); // branch opcodes don't vary (only 1 Addressing Mode)
|
||||
if (Calc6502RelativeOffset( nOpcode, m_nAsmBaseAddress, m_nAsmTargetAddress, & m_nAsmTargetValue ))
|
||||
if (_6502_CalcRelativeOffset( nOpcode, m_nAsmBaseAddress, m_nAsmTargetAddress, & m_nAsmTargetValue ))
|
||||
{
|
||||
if (m_iAsmAddressMode == NUM_OPMODES)
|
||||
return false;
|
||||
@ -1008,7 +1229,7 @@ void AssemblerProcessDelayedSymols()
|
||||
// BaseAddress
|
||||
WORD nTargetValue = nTargetAddress;
|
||||
|
||||
if (Calc6502RelativeOffset( nOpcode, pTarget->m_nBaseAddress, nTargetAddress, & nTargetValue ))
|
||||
if (_6502_CalcRelativeOffset( nOpcode, pTarget->m_nBaseAddress, nTargetAddress, & nTargetValue ))
|
||||
{
|
||||
if (m_iAsmAddressMode == NUM_OPMODES)
|
||||
{
|
||||
|
@ -41,9 +41,15 @@
|
||||
|
||||
// Prototypes _______________________________________________________________
|
||||
|
||||
int _6502GetOpmodeOpbytes ( const int iAddress, int & iOpmode_, int & nOpbytes_ );
|
||||
// void _6502GetOpcodeOpmode ( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
||||
void _6502GetOpcodeOpmodeOpbytes ( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
||||
int _6502_GetOpmodeOpbytes( const int iAddress, int & iOpmode_, int & nOpbytes_ );
|
||||
// void _6502_GetOpcodeOpmode( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
||||
void _6502_GetOpcodeOpmodeOpbytes( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
||||
bool _6502_GetStackReturnAddress( WORD & nAddress_ );
|
||||
bool _6502_GetTargets( WORD nAddress, int *pTargetPartial_, int *pTargetPointer_, int * pBytes_
|
||||
, const bool bIgnoreJSRJMP = true, bool bIgnoreBranch = true );
|
||||
bool _6502_GetTargetAddress( const WORD & nAddress, WORD & nTarget_ );
|
||||
bool _6502_IsOpcodeBranch( int nOpcode );
|
||||
bool _6502_IsOpcodeValid( int nOpcode );
|
||||
|
||||
int AssemblerHashMnemonic ( const TCHAR * pMnemonic );
|
||||
void AssemblerHashOpcodes ();
|
||||
|
@ -373,7 +373,7 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||
int nTargetPointer;
|
||||
WORD nTargetValue = 0; // de-ref
|
||||
int nTargetBytes;
|
||||
Get6502Targets( nBaseAddress, &nTargetPartial, &nTargetPointer, &nTargetBytes );
|
||||
_6502_GetTargets( nBaseAddress, &nTargetPartial, &nTargetPointer, &nTargetBytes );
|
||||
|
||||
if (nTargetPointer != NO_6502_TARGET)
|
||||
{
|
||||
@ -563,7 +563,7 @@ void DrawBreakpoints (HDC dc, int line)
|
||||
rect.bottom += g_nFontHeight;
|
||||
|
||||
int iBreakpoint;
|
||||
for (iBreakpoint = 0; iBreakpoint < NUM_BREAKPOINTS; iBreakpoint++ )
|
||||
for (iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++ )
|
||||
{
|
||||
Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
|
||||
WORD nLength = pBP->nLength;
|
||||
@ -577,6 +577,9 @@ void DrawBreakpoints (HDC dc, int line)
|
||||
bool bEnabled = pBP->bEnabled;
|
||||
WORD nAddress1 = pBP->nAddress;
|
||||
WORD nAddress2 = nAddress1 + nLength - 1;
|
||||
|
||||
if (! bSet)
|
||||
continue;
|
||||
|
||||
RECT rect2;
|
||||
rect2 = rect;
|
||||
@ -784,7 +787,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
int iOpcode;
|
||||
int iOpmode;
|
||||
int nOpbytes;
|
||||
iOpcode = _6502GetOpmodeOpbytes( nBaseAddress, iOpmode, nOpbytes );
|
||||
iOpcode = _6502_GetOpmodeOpbytes( nBaseAddress, iOpmode, nOpbytes );
|
||||
|
||||
const int CHARS_FOR_ADDRESS = 8; // 4 digits plus null
|
||||
|
||||
@ -897,6 +900,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
bool bBreakpointEnable;
|
||||
GetBreakpointInfo( nBaseAddress, bBreakpointActive, bBreakpointEnable );
|
||||
bool bAddressAtPC = (nBaseAddress == regs.pc);
|
||||
bool bAddressIsBookmark = Bookmark_Find( nBaseAddress );
|
||||
|
||||
DebugColors_e iBackground = BG_DISASM_1;
|
||||
DebugColors_e iForeground = FG_DISASM_MNEMONIC; // FG_DISASM_TEXT;
|
||||
@ -965,14 +969,34 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
|
||||
iForeground = FG_DISASM_MNEMONIC;
|
||||
}
|
||||
}
|
||||
SetBkColor( dc, DebuggerGetColor( iBackground ) );
|
||||
SetTextColor( dc, DebuggerGetColor( iForeground ) );
|
||||
|
||||
if (bAddressIsBookmark)
|
||||
{
|
||||
SetBkColor( dc, DebuggerGetColor( BG_DISASM_BOOKMARK ) );
|
||||
SetTextColor( dc, DebuggerGetColor( FG_DISASM_BOOKMARK ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBkColor( dc, DebuggerGetColor( iBackground ) );
|
||||
SetTextColor( dc, DebuggerGetColor( iForeground ) );
|
||||
}
|
||||
|
||||
// Address
|
||||
if (! bCursorLine)
|
||||
SetTextColor( dc, DebuggerGetColor( FG_DISASM_ADDRESS ) );
|
||||
// else
|
||||
// {
|
||||
// SetBkColor( dc, DebuggerGetColor( FG_DISASM_BOOKMARK ) ); // swapped
|
||||
// SetTextColor( dc, DebuggerGetColor( BG_DISASM_BOOKMARK ) ); // swapped
|
||||
// }
|
||||
DebugDrawTextHorz( (LPCTSTR) sAddress, linerect );
|
||||
|
||||
if (bAddressIsBookmark)
|
||||
{
|
||||
SetBkColor( dc, DebuggerGetColor( iBackground ) );
|
||||
SetTextColor( dc, DebuggerGetColor( iForeground ) );
|
||||
}
|
||||
|
||||
// Address Seperator
|
||||
if (! bCursorLine)
|
||||
SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) );
|
||||
@ -1576,7 +1600,7 @@ void DrawTargets (HDC dc, int line)
|
||||
return;
|
||||
|
||||
int aTarget[2];
|
||||
Get6502Targets( regs.pc, &aTarget[0],&aTarget[1], NULL );
|
||||
_6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1], NULL );
|
||||
|
||||
RECT rect;
|
||||
|
||||
|
@ -435,7 +435,7 @@ Update_t CmdHelpSpecific (int nArgs)
|
||||
break;
|
||||
// Breakpoints
|
||||
case CMD_BREAKPOINT:
|
||||
wsprintf( sText, " Maximum breakpoints: %d", NUM_BREAKPOINTS );
|
||||
wsprintf( sText, " Maximum breakpoints: %d", MAX_BREAKPOINTS );
|
||||
ConsoleBufferPush( sText );
|
||||
wsprintf( sText, TEXT(" Usage: [%s | %s | %s]")
|
||||
, g_aParameters[ PARAM_LOAD ].m_sName
|
||||
|
@ -134,11 +134,22 @@
|
||||
};
|
||||
|
||||
|
||||
// Bookmarks ______________________________________________________________________________________
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_BOOKMARKS = 10
|
||||
};
|
||||
|
||||
extern vector<int> g_aBookmarks;
|
||||
|
||||
|
||||
// Breakpoints ____________________________________________________________________________________
|
||||
|
||||
enum
|
||||
{
|
||||
NUM_BREAKPOINTS = 5
|
||||
// NUMBREAKPOINTS = 15
|
||||
MAX_BREAKPOINTS = 15
|
||||
};
|
||||
|
||||
/*
|
||||
@ -290,6 +301,9 @@
|
||||
, BG_DISASM_PC_X // Dim Yellow (not cursor)
|
||||
, FG_DISASM_PC_X // White (not cursor)
|
||||
|
||||
, BG_DISASM_BOOKMARK // Lite Blue (always)
|
||||
, FG_DISASM_BOOKMARK // White addr (always)
|
||||
|
||||
, FG_DISASM_ADDRESS // White addr
|
||||
, FG_DISASM_OPERATOR // Gray192 : $ (also around instruction addressing g_nAppMode)
|
||||
, FG_DISASM_OPCODE // Yellow xx xx xx
|
||||
@ -655,6 +669,7 @@
|
||||
Update_t CmdConfigSetFont (int nArgs);
|
||||
Update_t CmdConfigGetFont (int nArgs);
|
||||
// Cursor
|
||||
Update_t CmdCursorFollowTarget(int nArgs);
|
||||
Update_t CmdCursorLineDown (int nArgs);
|
||||
Update_t CmdCursorLineUp (int nArgs);
|
||||
Update_t CmdCursorJumpPC (int nArgs);
|
||||
@ -961,6 +976,8 @@
|
||||
|
||||
// Memory _________________________________________________________________________________________
|
||||
|
||||
extern const int _6502_BRANCH_POS ;//= +127
|
||||
extern const int _6502_BRANCH_NEG ;//= -128
|
||||
extern const unsigned int _6502_ZEROPAGE_END ;//= 0x00FF;
|
||||
extern const unsigned int _6502_STACK_END ;//= 0x01FF;
|
||||
extern const unsigned int _6502_IO_BEGIN ;//= 0xC000;
|
||||
|
@ -56,7 +56,8 @@ static HBITMAP diskbitmap[ NUM_DISK_STATUS ];
|
||||
|
||||
static HBITMAP buttonbitmap[BUTTONS];
|
||||
|
||||
static BOOL active = 0;
|
||||
//static BOOL active = 0;
|
||||
static bool g_bAppActive = false;
|
||||
static HBRUSH btnfacebrush = (HBRUSH)0;
|
||||
static HPEN btnfacepen = (HPEN)0;
|
||||
static HPEN btnhighlightpen = (HPEN)0;
|
||||
@ -328,78 +329,96 @@ void DrawFrameWindow () {
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void DrawStatusArea (HDC passdc, int drawflags) {
|
||||
FrameReleaseDC();
|
||||
HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
|
||||
int x = buttonx;
|
||||
int y = buttony+BUTTONS*BUTTONCY+1;
|
||||
int iDrive1Status = DISK_STATUS_OFF;
|
||||
int iDrive2Status = DISK_STATUS_OFF;
|
||||
BOOL caps = 0;
|
||||
DiskGetLightStatus(&iDrive1Status,&iDrive2Status);
|
||||
KeybGetCapsStatus(&caps);
|
||||
if (fullscreen) {
|
||||
SelectObject(dc,smallfont);
|
||||
SetBkMode(dc,OPAQUE);
|
||||
SetBkColor(dc,RGB(0,0,0));
|
||||
SetTextAlign(dc,TA_LEFT | TA_TOP);
|
||||
SetTextColor(dc,RGB((iDrive1Status==2 ? 255 : 0),(iDrive1Status==1 ? 255 : 0),0));
|
||||
TextOut(dc,x+ 3,y+2,TEXT("1"),1);
|
||||
SetTextColor(dc,RGB((iDrive2Status==2 ? 255 : 0),(iDrive2Status==1 ? 255 : 0),0));
|
||||
TextOut(dc,x+13,y+2,TEXT("2"),1);
|
||||
if (g_bApple2e) {
|
||||
SetTextAlign(dc,TA_RIGHT | TA_TOP);
|
||||
SetTextColor(dc,(caps ? RGB(128,128,128) :
|
||||
RGB( 0, 0, 0)));
|
||||
TextOut(dc,x+BUTTONCX,y+2,TEXT("Caps"),4);
|
||||
}
|
||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
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,(g_nAppMode == MODE_PAUSED ? TEXT(" Paused ") :
|
||||
TEXT("Stepping")),8);
|
||||
}
|
||||
else {
|
||||
if (drawflags & DRAW_BACKGROUND) {
|
||||
SelectObject(dc,GetStockObject(NULL_PEN));
|
||||
SelectObject(dc,btnfacebrush);
|
||||
Rectangle(dc,x,y,x+BUTTONCX+2,y+35);
|
||||
Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+31,0);
|
||||
SelectObject(dc,smallfont);
|
||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
SetTextColor(dc,RGB(0,0,0));
|
||||
SetBkMode(dc,TRANSPARENT);
|
||||
TextOut(dc,x+ 7,y+7,TEXT("1"),1);
|
||||
TextOut(dc,x+25,y+7,TEXT("2"),1);
|
||||
}
|
||||
if (drawflags & DRAW_LEDS) {
|
||||
RECT rect = {0,0,8,8};
|
||||
DrawBitmapRect(dc,x+12,y+8,&rect,diskbitmap[iDrive1Status]);
|
||||
DrawBitmapRect(dc,x+30,y+8,&rect,diskbitmap[iDrive2Status]);
|
||||
if (g_bApple2e) {
|
||||
RECT rect = {0,0,30,8};
|
||||
DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[caps != 0]);
|
||||
}
|
||||
}
|
||||
if (drawflags & DRAW_TITLE) {
|
||||
TCHAR title[40];
|
||||
_tcscpy(title,g_bApple2e ? TITLE : (g_bApple2plus ? TEXT("Apple ][+ Emulator")
|
||||
: TEXT("Apple ][ Emulator")));
|
||||
switch (g_nAppMode) {
|
||||
case MODE_PAUSED: _tcscat(title,TEXT(" [Paused]")); break;
|
||||
case MODE_STEPPING: _tcscat(title,TEXT(" [Stepping]")); break;
|
||||
}
|
||||
SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)title);
|
||||
}
|
||||
if (drawflags & DRAW_BUTTON_DRIVES)
|
||||
void DrawStatusArea (HDC passdc, int drawflags)
|
||||
{
|
||||
FrameReleaseDC();
|
||||
HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow));
|
||||
int x = buttonx;
|
||||
int y = buttony+BUTTONS*BUTTONCY+1;
|
||||
int iDrive1Status = DISK_STATUS_OFF;
|
||||
int iDrive2Status = DISK_STATUS_OFF;
|
||||
bool bCaps = KeybGetCapsStatus();
|
||||
DiskGetLightStatus(&iDrive1Status,&iDrive2Status);
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
DrawButton(dc, BTN_DRIVE1);
|
||||
DrawButton(dc, BTN_DRIVE2);
|
||||
SelectObject(dc,smallfont);
|
||||
SetBkMode(dc,OPAQUE);
|
||||
SetBkColor(dc,RGB(0,0,0));
|
||||
SetTextAlign(dc,TA_LEFT | TA_TOP);
|
||||
SetTextColor(dc,RGB((iDrive1Status==2 ? 255 : 0),(iDrive1Status==1 ? 255 : 0),0));
|
||||
TextOut(dc,x+ 3,y+2,TEXT("1"),1);
|
||||
SetTextColor(dc,RGB((iDrive2Status==2 ? 255 : 0),(iDrive2Status==1 ? 255 : 0),0));
|
||||
TextOut(dc,x+13,y+2,TEXT("2"),1);
|
||||
if (g_bApple2e)
|
||||
{
|
||||
SetTextAlign(dc,TA_RIGHT | TA_TOP);
|
||||
SetTextColor(dc,(bCaps
|
||||
? RGB(128,128,128)
|
||||
: RGB( 0, 0, 0) ));
|
||||
TextOut(dc,x+BUTTONCX,y+2,TEXT("Caps"),4);
|
||||
}
|
||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
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,(g_nAppMode == MODE_PAUSED
|
||||
? TITLE_PAUSED
|
||||
: TITLE_STEPPING) ,8);
|
||||
}
|
||||
}
|
||||
if (!passdc)
|
||||
ReleaseDC(g_hFrameWindow,dc);
|
||||
else
|
||||
{
|
||||
if (drawflags & DRAW_BACKGROUND)
|
||||
{
|
||||
SelectObject(dc,GetStockObject(NULL_PEN));
|
||||
SelectObject(dc,btnfacebrush);
|
||||
Rectangle(dc,x,y,x+BUTTONCX+2,y+35);
|
||||
Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+31,0);
|
||||
SelectObject(dc,smallfont);
|
||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||
SetTextColor(dc,RGB(0,0,0));
|
||||
SetBkMode(dc,TRANSPARENT);
|
||||
TextOut(dc,x+ 7,y+7,TEXT("1"),1);
|
||||
TextOut(dc,x+25,y+7,TEXT("2"),1);
|
||||
}
|
||||
if (drawflags & DRAW_LEDS)
|
||||
{
|
||||
RECT rect = {0,0,8,8};
|
||||
DrawBitmapRect(dc,x+12,y+8,&rect,diskbitmap[iDrive1Status]);
|
||||
DrawBitmapRect(dc,x+30,y+8,&rect,diskbitmap[iDrive2Status]);
|
||||
if (g_bApple2e)
|
||||
{
|
||||
RECT rect = {0,0,30,8};
|
||||
DrawBitmapRect(dc,x+7,y+19,&rect,capsbitmap[bCaps != 0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawflags & DRAW_TITLE)
|
||||
{
|
||||
TCHAR title[40];
|
||||
_tcscpy(title,g_bApple2e
|
||||
? TITLE_APPLE_2
|
||||
: (g_bApple2plus
|
||||
? TITLE_APPLE_2_PLUS
|
||||
: TITLE_APPLE_2 ));
|
||||
|
||||
switch (g_nAppMode)
|
||||
{
|
||||
case MODE_PAUSED : _tcscat(title,TEXT(" [")); _tcscat(title,TITLE_PAUSED ); _tcscat(title,TEXT("]")); break;
|
||||
case MODE_STEPPING: _tcscat(title,TEXT(" [")); _tcscat(title,TITLE_STEPPING); _tcscat(title,TEXT("]")); break;
|
||||
}
|
||||
|
||||
SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)title);
|
||||
}
|
||||
if (drawflags & DRAW_BUTTON_DRIVES)
|
||||
{
|
||||
DrawButton(dc, BTN_DRIVE1);
|
||||
DrawButton(dc, BTN_DRIVE2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!passdc)
|
||||
ReleaseDC(g_hFrameWindow,dc);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -413,20 +432,21 @@ void EraseButton (int number) {
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam) {
|
||||
|
||||
switch (message) {
|
||||
|
||||
LRESULT CALLBACK FrameWndProc (
|
||||
HWND window,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_ACTIVATE:
|
||||
JoyReset();
|
||||
SetUsingCursor(0);
|
||||
break;
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
active = wparam;
|
||||
g_bAppActive = (wparam ? true : false);
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
@ -444,15 +464,18 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) ||
|
||||
((g_nAppMode == MODE_STEPPING) && (wparam != TEXT('\x1B'))))
|
||||
KeybQueueKeypress((int)wparam,ASCII);
|
||||
else if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
// DebugProcessChar((TCHAR)wparam);
|
||||
DebuggerInputConsoleChar((TCHAR)wparam);
|
||||
|
||||
break;
|
||||
case WM_CHAR:
|
||||
if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_LOGO) ||
|
||||
((g_nAppMode == MODE_STEPPING) && (wparam != TEXT('\x1B'))))
|
||||
{
|
||||
KeybQueueKeypress((int)wparam,ASCII);
|
||||
}
|
||||
else
|
||||
if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
DebuggerInputConsoleChar((TCHAR)wparam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
g_hFrameWindow = window;
|
||||
@ -537,90 +560,94 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_KEYDOWN:
|
||||
KeybUpdateCtrlShiftStatus();
|
||||
if ((wparam >= VK_F1) && (wparam <= VK_F8) && (buttondown == -1)) {
|
||||
SetUsingCursor(0);
|
||||
buttondown = wparam-VK_F1;
|
||||
if (fullscreen && (buttonover != -1)) {
|
||||
if (buttonover != buttondown)
|
||||
EraseButton(buttonover);
|
||||
buttonover = -1;
|
||||
}
|
||||
DrawButton((HDC)0,buttondown);
|
||||
}
|
||||
else if (wparam == VK_F9) {
|
||||
videotype++; // Cycle through available video modes
|
||||
if (videotype >= VT_NUM_MODES)
|
||||
videotype = 0;
|
||||
VideoReinitialize();
|
||||
if ((g_nAppMode != MODE_LOGO) || ((g_nAppMode == MODE_DEBUG) && (g_bDebuggerViewingAppleOutput))) // +PATCH
|
||||
case WM_KEYDOWN:
|
||||
KeybUpdateCtrlShiftStatus();
|
||||
if ((wparam >= VK_F1) && (wparam <= VK_F8) && (buttondown == -1))
|
||||
{
|
||||
VideoRedrawScreen();
|
||||
g_bDebuggerViewingAppleOutput = true; // +PATCH
|
||||
SetUsingCursor(0);
|
||||
buttondown = wparam-VK_F1;
|
||||
if (fullscreen && (buttonover != -1)) {
|
||||
if (buttonover != buttondown)
|
||||
EraseButton(buttonover);
|
||||
buttonover = -1;
|
||||
}
|
||||
DrawButton((HDC)0,buttondown);
|
||||
}
|
||||
RegSaveValue(TEXT("Configuration"),TEXT("Video Emulation"),1,videotype);
|
||||
}
|
||||
else if ((wparam == VK_F11) && (GetKeyState(VK_CONTROL) >= 0)) // Save state (F11)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, true))
|
||||
else if (wparam == VK_F9)
|
||||
{
|
||||
Snapshot_SaveState();
|
||||
videotype++; // Cycle through available video modes
|
||||
if (videotype >= VT_NUM_MODES)
|
||||
videotype = 0;
|
||||
VideoReinitialize();
|
||||
if ((g_nAppMode != MODE_LOGO) || ((g_nAppMode == MODE_DEBUG) && (g_bDebuggerViewingAppleOutput))) // +PATCH
|
||||
{
|
||||
VideoRedrawScreen();
|
||||
g_bDebuggerViewingAppleOutput = true; // +PATCH
|
||||
}
|
||||
RegSaveValue(TEXT("Configuration"),TEXT("Video Emulation"),1,videotype);
|
||||
}
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
else if (wparam == VK_F12) // Load state (F12 or Ctrl+F12)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, false))
|
||||
else if ((wparam == VK_F11) && (GetKeyState(VK_CONTROL) >= 0)) // Save state (F11)
|
||||
{
|
||||
Snapshot_LoadState();
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, true))
|
||||
{
|
||||
Snapshot_SaveState();
|
||||
}
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
else if (wparam == VK_CAPITAL)
|
||||
KeybToggleCapsLock();
|
||||
else if (wparam == VK_PAUSE) {
|
||||
SetUsingCursor(0);
|
||||
switch (g_nAppMode)
|
||||
else if (wparam == VK_F12) // Load state (F12 or Ctrl+F12)
|
||||
{
|
||||
case MODE_RUNNING:
|
||||
g_nAppMode = MODE_PAUSED;
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
break;
|
||||
case MODE_PAUSED:
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
break;
|
||||
case MODE_STEPPING:
|
||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||
break;
|
||||
}
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
VideoRedrawScreen();
|
||||
resettiming = 1;
|
||||
}
|
||||
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)) && (g_nAppMode != MODE_LOGO))
|
||||
KeybQueueKeypress((int)wparam,NOT_ASCII);
|
||||
}
|
||||
else if (g_nAppMode == MODE_DEBUG)
|
||||
// DebugProcessCommand(wparam);
|
||||
DebuggerProcessKey(wparam);
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
if(PSP_SaveStateSelectImage(window, false))
|
||||
{
|
||||
Snapshot_LoadState();
|
||||
}
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
else if (wparam == VK_CAPITAL)
|
||||
KeybToggleCapsLock();
|
||||
else if (wparam == VK_PAUSE)
|
||||
{
|
||||
SetUsingCursor(0);
|
||||
switch (g_nAppMode)
|
||||
{
|
||||
case MODE_RUNNING:
|
||||
g_nAppMode = MODE_PAUSED;
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
break;
|
||||
case MODE_PAUSED:
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
break;
|
||||
case MODE_STEPPING:
|
||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||
break;
|
||||
}
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
if ((g_nAppMode != MODE_LOGO) && (g_nAppMode != MODE_DEBUG))
|
||||
VideoRedrawScreen();
|
||||
g_bResetTiming = true;
|
||||
}
|
||||
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)) && (g_nAppMode != MODE_LOGO))
|
||||
KeybQueueKeypress((int)wparam,NOT_ASCII);
|
||||
}
|
||||
else if (g_nAppMode == MODE_DEBUG)
|
||||
DebuggerProcessKey(wparam);
|
||||
|
||||
if (wparam == VK_F10) {
|
||||
SetUsingCursor(0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
if (wparam == VK_F10)
|
||||
{
|
||||
SetUsingCursor(0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
if ((wparam >= VK_F1) && (wparam <= VK_F8) && (buttondown == (int)wparam-VK_F1)) {
|
||||
@ -707,6 +734,26 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
break;
|
||||
}
|
||||
|
||||
// VSCROLL
|
||||
// SB_LINEUP // Line Scrolling
|
||||
// SB_PAGEUP // Page Scrolling
|
||||
case WM_MOUSEWHEEL:
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
{
|
||||
KeybUpdateCtrlShiftStatus();
|
||||
int zDelta = (short) HIWORD( wparam );
|
||||
if (zDelta > 0)
|
||||
{
|
||||
DebuggerProcessKey( VK_UP );
|
||||
}
|
||||
else
|
||||
{
|
||||
DebuggerProcessKey( VK_DOWN );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case WM_NOTIFY:
|
||||
if(((LPNMTTDISPINFO)lparam)->hdr.hwndFrom == tooltipwindow &&
|
||||
((LPNMTTDISPINFO)lparam)->hdr.code == TTN_GETDISPINFO)
|
||||
@ -793,7 +840,7 @@ LRESULT CALLBACK FrameWndProc (HWND window,
|
||||
case WM_SYSCOMMAND:
|
||||
switch (wparam & 0xFFF0) {
|
||||
case SC_KEYMENU:
|
||||
if (fullscreen && active)
|
||||
if (fullscreen && g_bAppActive)
|
||||
return 0;
|
||||
break;
|
||||
case SC_MINIMIZE:
|
||||
@ -889,7 +936,7 @@ void ProcessButtonClick (int button) {
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
VideoRedrawScreen();
|
||||
resettiming = 1;
|
||||
g_bResetTiming = true;
|
||||
break;
|
||||
|
||||
case BTN_DRIVE1:
|
||||
@ -1168,7 +1215,7 @@ HDC FrameGetDC () {
|
||||
|
||||
//===========================================================================
|
||||
HDC FrameGetVideoDC (LPBYTE *addr, LONG *pitch) {
|
||||
if (fullscreen && active && !painting) {
|
||||
if (fullscreen && g_bAppActive && !painting) {
|
||||
RECT rect = {FSVIEWPORTX,
|
||||
FSVIEWPORTY,
|
||||
FSVIEWPORTX+VIEWPORTCX,
|
||||
@ -1222,7 +1269,7 @@ void FrameReleaseDC () {
|
||||
|
||||
//===========================================================================
|
||||
void FrameReleaseVideoDC () {
|
||||
if (fullscreen && active && !painting) {
|
||||
if (fullscreen && g_bAppActive && !painting) {
|
||||
|
||||
// THIS IS CORRECT ACCORDING TO THE DIRECTDRAW DOCS
|
||||
RECT rect = {FSVIEWPORTX,
|
||||
|
@ -33,12 +33,15 @@ static bool g_bKeybBufferEnable = false;
|
||||
|
||||
#define KEY_OLD
|
||||
|
||||
static BYTE asciicode[2][10] = {{0x08,0x0D,0x15,0x2F,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x08,0x0B,0x15,0x0A,0x00,0x00,0x00,0x00,0x00,0x7F}}; // Convert PC arrow keys to Apple keycodes
|
||||
static BYTE asciicode[2][10] = {
|
||||
{0x08,0x0D,0x15,0x2F,0x00,0x00,0x00,0x00,0x00,0x00},
|
||||
{0x08,0x0B,0x15,0x0A,0x00,0x00,0x00,0x00,0x00,0x7F}
|
||||
}; // Convert PC arrow keys to Apple keycodes
|
||||
|
||||
static bool gbShiftKey = false; // +PATCH MJP
|
||||
static bool gbCtrlKey = false; // +PATCH MJP
|
||||
static BOOL capslock = 1;
|
||||
static bool g_bShiftKey = false;
|
||||
static bool g_bCtrlKey = false;
|
||||
static bool g_bAltKey = false;
|
||||
static bool g_bCapsLock = true;
|
||||
static int lastvirtkey = 0; // Current PC keycode
|
||||
static BYTE keycode = 0; // Current Apple keycode
|
||||
static DWORD keyboardqueries = 0;
|
||||
@ -103,28 +106,35 @@ void KeybReset()
|
||||
//}
|
||||
|
||||
//===========================================================================
|
||||
void KeybGetCapsStatus (BOOL *status)
|
||||
bool KeybGetAltStatus ()
|
||||
{
|
||||
*status = capslock;
|
||||
return g_bAltKey;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool KeybGetShiftStatus ()
|
||||
bool KeybGetCapsStatus ()
|
||||
{
|
||||
return gbShiftKey;
|
||||
return g_bCapsLock;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool KeybGetCtrlStatus ()
|
||||
{
|
||||
return gbCtrlKey;
|
||||
return g_bCtrlKey;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool KeybGetShiftStatus ()
|
||||
{
|
||||
return g_bShiftKey;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void KeybUpdateCtrlShiftStatus()
|
||||
{
|
||||
gbShiftKey = (GetKeyState( VK_SHIFT ) & 0x8000) ? true : false;
|
||||
gbCtrlKey = (GetKeyState( VK_CONTROL) & 0x8000) ? true : false;
|
||||
g_bShiftKey = (GetKeyState( VK_SHIFT ) & KF_UP) ? true : false; // 0x8000 KF_UP
|
||||
g_bCtrlKey = (GetKeyState( VK_CONTROL) & KF_UP) ? true : false;
|
||||
g_bAltKey = (GetKeyState( VK_MENU ) & KF_UP) ? true : false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -144,7 +154,7 @@ DWORD KeybGetNumQueries () // Used in determining 'idleness' of Apple system
|
||||
//===========================================================================
|
||||
void KeybQueueKeypress (int key, BOOL bASCII)
|
||||
{
|
||||
static bool bFreshReset;
|
||||
static bool bFreshReset;
|
||||
|
||||
if (bASCII == ASCII)
|
||||
{
|
||||
@ -157,7 +167,7 @@ void KeybQueueKeypress (int key, BOOL bASCII)
|
||||
return;
|
||||
|
||||
if (g_bApple2e)
|
||||
if (capslock && (key >= 'a') && (key <='z'))
|
||||
if (g_bCapsLock && (key >= 'a') && (key <='z'))
|
||||
keycode = key - 32;
|
||||
else
|
||||
keycode = key;
|
||||
@ -377,7 +387,7 @@ void KeybToggleCapsLock ()
|
||||
{
|
||||
if (g_bApple2e)
|
||||
{
|
||||
capslock = (GetKeyState(VK_CAPITAL) & 1);
|
||||
g_bCapsLock = (GetKeyState(VK_CAPITAL) & 1);
|
||||
FrameRefreshStatus(DRAW_LEDS);
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,10 @@
|
||||
void ClipboardInitiatePaste();
|
||||
|
||||
void KeybReset();
|
||||
void KeybGetCapsStatus (BOOL *);
|
||||
bool KeybGetShiftStatus();
|
||||
bool KeybGetAltStatus();
|
||||
bool KeybGetCapsStatus();
|
||||
bool KeybGetCtrlStatus();
|
||||
bool KeybGetShiftStatus();
|
||||
void KeybUpdateCtrlShiftStatus();
|
||||
BYTE KeybGetKeycode ();
|
||||
DWORD KeybGetNumQueries ();
|
||||
|
@ -1,3 +1,13 @@
|
||||
#define WIN32_LEAN_AND_ME
|
||||
|
||||
// Mouse Wheel is not supported on Win95.
|
||||
// If we didn't care about supporting Win95 (compile/run-time errors)
|
||||
// we would just define the minmimum windows version to support.
|
||||
// #define _WIN32_WINDOWS 0x0401
|
||||
#ifndef WM_MOUSEWHEEL
|
||||
#define WM_MOUSEWHEEL 0x020A
|
||||
#endif
|
||||
|
||||
// Not needed in VC7.1, but needed in VC Express
|
||||
#include <tchar.h>
|
||||
|
||||
@ -11,7 +21,9 @@
|
||||
#include <string.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <winuser.h> // WM_MOUSEWHEEL
|
||||
#include <commctrl.h>
|
||||
#include <ddraw.h>
|
||||
#include <htmlhelp.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user