1
0
mirror of https://github.com/makarcz/vm6502.git synced 2024-06-16 10:29:30 +00:00

Version 2.0

New features. Bug fixes.
This commit is contained in:
Marek Karcz 2016-03-14 00:28:53 -04:00
parent 67f1a62596
commit 32f2b2d12c
29 changed files with 19035 additions and 19022 deletions

View File

@ -325,7 +325,7 @@ Regs *VMachine::Step()
char c = -1; char c = -1;
mCharIO = false; mCharIO = false;
while ((c = mpRAM->GetCharOut()) != -1) { while ((c = mpRAM->GetCharOut()) != -1) {
mOpInterrupt = (c == OPINTERRUPT); mOpInterrupt = mOpInterrupt || (c == OPINTERRUPT);
if (!mOpInterrupt) { if (!mOpInterrupt) {
mpDisp->PutChar(c); mpDisp->PutChar(c);
mCharIO = true; mCharIO = true;
@ -903,13 +903,26 @@ unsigned short VMachine::GetRunAddr()
*-------------------------------------------------------------------- *--------------------------------------------------------------------
* Method: SetOpInterrupt() * Method: SetOpInterrupt()
* Purpose: Set the flag indicating operator interrupt. * Purpose: Set the flag indicating operator interrupt.
* Arguments: n/a * Arguments: bool - new value of the flag
* Returns: n/a * Returns: n/a
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
void VMachine::SetOpInterrupt() void VMachine::SetOpInterrupt(bool opint)
{ {
mOpInterrupt = true; mOpInterrupt = opint;
}
/*
*--------------------------------------------------------------------
* Method: IsOpInterrupt()
* Purpose: Return the flag indicating operator interrupt status.
* Arguments: n/a
* Returns: bool - true if operator interrupt flag was set
*--------------------------------------------------------------------
*/
bool VMachine::IsOpInterrupt()
{
return mOpInterrupt;
} }
/* /*

View File

@ -56,7 +56,8 @@ class VMachine
unsigned short GetROMEnd(); unsigned short GetROMEnd();
bool IsROMEnabled(); bool IsROMEnabled();
unsigned short GetRunAddr(); unsigned short GetRunAddr();
void SetOpInterrupt(); void SetOpInterrupt(bool opint);
bool IsOpInterrupt();
queue<string> GetExecHistory(); queue<string> GetExecHistory();
unsigned short Disassemble(unsigned short addr, char *buf); unsigned short Disassemble(unsigned short addr, char *buf);

View File

@ -43,7 +43,7 @@ void trap_signal(int signum)
{ {
cout << "Signal caught: " << dec << signum << endl; cout << "Signal caught: " << dec << signum << endl;
if (NULL != pvm && NULL != preg) { if (NULL != pvm && NULL != preg) {
pvm->SetOpInterrupt(); pvm->SetOpInterrupt(true);
opbrk = true; opbrk = true;
} }
//exit(signum); //exit(signum);
@ -73,7 +73,7 @@ BOOL CtrlHandler(DWORD fdwCtrlType)
case CTRL_C_EVENT: case CTRL_C_EVENT:
//Beep( 750, 300 ); //Beep( 750, 300 );
if (NULL != pvm && NULL != preg) { if (NULL != pvm && NULL != preg) {
pvm->SetOpInterrupt(); pvm->SetOpInterrupt(true);
opbrk = true; opbrk = true;
} }
return TRUE; return TRUE;
@ -87,7 +87,7 @@ BOOL CtrlHandler(DWORD fdwCtrlType)
case CTRL_BREAK_EVENT: case CTRL_BREAK_EVENT:
//Beep( 900, 200 ); //Beep( 900, 200 );
if (NULL != pvm && NULL != preg) { if (NULL != pvm && NULL != preg) {
pvm->SetOpInterrupt(); pvm->SetOpInterrupt(true);
opbrk = true; opbrk = true;
} }
return TRUE; return TRUE;
@ -271,7 +271,7 @@ void ShowMenu()
bool cls = false; \ bool cls = false; \
brk = preg->SoftIrq; \ brk = preg->SoftIrq; \
lrts = preg->LastRTS; \ lrts = preg->LastRTS; \
while(step && nsteps > 1 && !brk && !lrts) { \ while(step && nsteps > 1 && !brk && !lrts && !opbrk) { \
cout << "addr: $" << hex << preg->PtrAddr << ", step: " << dec << stct; \ cout << "addr: $" << hex << preg->PtrAddr << ", step: " << dec << stct; \
cout << " \r"; \ cout << " \r"; \
preg = pvm->Step(); \ preg = pvm->Step(); \
@ -283,6 +283,7 @@ void ShowMenu()
this_thread::sleep_for(chrono::milliseconds(delay)); \ this_thread::sleep_for(chrono::milliseconds(delay)); \
} \ } \
brk = preg->SoftIrq; \ brk = preg->SoftIrq; \
lrts = preg->LastRTS; \
nsteps--; \ nsteps--; \
stct++; \ stct++; \
} \ } \
@ -348,17 +349,15 @@ int main(int argc, char** argv) {
cout << endl; cout << endl;
if (opbrk) { if (opbrk) {
cout << "Interrupted at " << hex << preg->PtrAddr << endl; cout << "Interrupted at " << hex << preg->PtrAddr << endl;
opbrk = brk = stop = lrts = false;
} else if (brk) { } else if (brk) {
cout << "BRK at " << hex << preg->PtrAddr << endl; cout << "BRK at " << hex << preg->PtrAddr << endl;
opbrk = brk = stop = lrts = false;
} else if (lrts) { } else if (lrts) {
cout << "FINISHED at " << hex << ((newaddr > 0xFFFF) ? preg->PtrAddr : newaddr) << endl; cout << "FINISHED at " << hex << ((newaddr > 0xFFFF) ? preg->PtrAddr : newaddr) << endl;
opbrk = brk = stop = lrts = false;
} else if (stop) { } else if (stop) {
cout << "STOPPED at " << hex << ((newaddr > 0xFFFF) ? preg->PtrAddr : newaddr) << endl; cout << "STOPPED at " << hex << ((newaddr > 0xFFFF) ? preg->PtrAddr : newaddr) << endl;
opbrk = brk = stop = lrts = false;
} }
opbrk = brk = stop = lrts = false;
pvm->SetOpInterrupt(false);
ShowRegs(preg,pvm,ioecho,true); ShowRegs(preg,pvm,ioecho,true);
} }
ShowMenu(); ShowMenu();

View File

@ -63,7 +63,7 @@
; 1/14/2012 ; 1/14/2012
; Modified Daryl Rictor's port to run on MKHBC-8-R1 homebrew ; Modified Daryl Rictor's port to run on MKHBC-8-R1 homebrew
; computer under MKHBCOS (derivative of M.O.S. by Scott ; computer under MKHBCOS (derivative of M.O.S. by Scott
Chidester). ; Chidester).
; ;
; 3/11/2016 ; 3/11/2016
; Adapted to run in MKBASIC (V65) emulator. ; Adapted to run in MKBASIC (V65) emulator.

Binary file not shown.