home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ST-Computer Leser 2002 January
/
STC_CD_01_2002.iso
/
JAGUAR
/
JAG_SRC
/
SOURCE
/
CPU.C
< prev
next >
Wrap
C/C++ Source or Header
|
2001-08-17
|
3KB
|
81 lines
////////////////////////////////////////////////////////////////////////////////
// Jagulator: Atari Jaguar Console Emulation Project (cpu.c)
// -----------------------------------------------------------------------------
// Jagulator is the Copyright (c) RealityMan 1998-2001 and is provided "as is"
// without any expressed or implied warranty. I have no Trademarks, Legal or
// otherwise. Atari, Jaguar and the Atari Logo are copyright Hasbro Inc. All
// other Copyrights and Trademarks are acknowledged. This project is in no way
// linked to Atari/Hasbro or other associated Atari companies.
#include "core.h"
////////////////////////////////////////////////////////////////////////////////
// Macro Definitions
#define EXEC_STEP 5000 // Execution Cycle Burst
#define VIDEO_REFRESH 217714 // Cycles Per Video Refresh
////////////////////////////////////////////////////////////////////////////////
// Globals
BOOL emulating; // Emulation Active Flag
dword count; // Cycle Counter
////////////////////////////////////////////////////////////////////////////////
// Execute Complete Console CPU Emulation
dword cpu_exec( void )
{
// Check if Emulation can Proceed
if( !st.readytogo )
{
emulating = FALSE;
return( emulating );
}
else
{
emulating = TRUE;
count = 0;
}
// Main Emulation Loop
while( emulating )
{
s68000exec( EXEC_STEP ); // Execute 68K Step Cycle
count += EXEC_STEP; // Increment Cycle Counter
if( count >= VIDEO_REFRESH ) // Check for Video Refresh
{
// Check if Video Interrupt is Enabled
if( *(word *)(st.tom + 0xE0) & 0x0001 )
{
s68000releaseTimeslice();
s68000interrupt( 1, 64 );
//while( gst.olista ) ;
object_exec(); // Execute Display List
count = 0;
flushdisplay();
}
}
// Check to See if Exit has been Requested
if( GetAsyncKeyState( VK_ESCAPE ) )
{
wsprintf( sbbuf, "Emulation Stopped..." );
SendMessage( hwndStatus, SB_SETTEXT, 0, (LPARAM)sbbuf );
emulating = FALSE;
}
}
return( TRUE );
}