Compare commits
5 commits
27e7cb5957
...
9b0150b6a1
Author | SHA1 | Date | |
---|---|---|---|
|
9b0150b6a1 | ||
|
adf3512f3e | ||
|
b138240450 | ||
|
fe99044a96 | ||
|
014c10a6bd |
8 changed files with 21 additions and 98 deletions
10
Makefile
10
Makefile
|
@ -17,6 +17,12 @@ LIBS = -lm -lChf -lXm -lutil
|
|||
X11CFLAGS = $(shell pkg-config --cflags x11 xext)
|
||||
X11LIBS = $(shell pkg-config --libs x11 xext xt)
|
||||
|
||||
SDLCFLAGS = $(shell pkg-config --cflags sdl2)
|
||||
SDLLIBS = $(shell pkg-config --libs sdl2)
|
||||
|
||||
NCURSESCFLAGS = $(shell pkg-config --cflags ncursesw)
|
||||
NCURSESDLLIBS = $(shell pkg-config --libs ncursesw)
|
||||
|
||||
FULL_WARNINGS = no
|
||||
|
||||
DOTOS = src/cpu.o \
|
||||
|
@ -88,6 +94,8 @@ override CFLAGS := -std=c11 \
|
|||
$(call cc-option,-Wno-unknown-warning-option) \
|
||||
$(EXTRA_WARNING_FLAGS) \
|
||||
$(X11CFLAGS) \
|
||||
$(SDLCFLAGS) \
|
||||
$(NCURSESCFLAGS) \
|
||||
$(CFLAGS)
|
||||
|
||||
override CPPFLAGS := -I./src/ -D_GNU_SOURCE=1 \
|
||||
|
@ -102,7 +110,7 @@ libChf/libChf.a:
|
|||
make -C libChf
|
||||
|
||||
dist/saturn: $(DOTOS) libChf/libChf.a
|
||||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(X11LIBS)
|
||||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(X11LIBS) $(SDLLIBS) $(NCURSESLIBS)
|
||||
|
||||
dist/pack: src/pack.o src/disk_io.o src/debug.o libChf/libChf.a
|
||||
# UNUSED
|
||||
|
|
24
src/config.h
24
src/config.h
|
@ -151,30 +151,6 @@
|
|||
*/
|
||||
#define DEBUG_LEVEL DEBUG_C_REVISION
|
||||
|
||||
/* CPU_SPIN_SHUTDN
|
||||
If this symbol is defined, the cpu module implements the SHUTDN
|
||||
instruction as a spin loop; when the instruction is encountered in the
|
||||
run stream, the program counter is reset to the starting nibble of its
|
||||
opcode.
|
||||
|
||||
If this symbol is not defined, the cpu module implements the SHUTDN
|
||||
instruction signaling a Chf condition; the main emulator loop
|
||||
condition handler works in concert with the GUI module to implement
|
||||
an idle loop when this condition is handled.
|
||||
|
||||
This option MUST be defined if the revision of either the cpu emulation
|
||||
module (cpu.c) or the GUI module (x11.c) is less than 3.1.
|
||||
|
||||
Starting from release 3.1, this option is disabled by default, to
|
||||
waste as little (real) cpu time as possible; however, expect a
|
||||
loss of timing accuracy.
|
||||
|
||||
Notice also that when this function is defined the CpuHaltRequest()
|
||||
and CpuRunRequest() functions are disabled; as a consequence, all
|
||||
interactive emulator's extended functions will be disabled as well.
|
||||
*/
|
||||
/* #define CPU_SPIN_SHUTDN */
|
||||
|
||||
/* 2.1: FORCE_NONMODAL
|
||||
If this symbol is defined, nonmodal navigation is forced in the
|
||||
OSF/Motif GUI, by setting navigationType to XmNONE and traversalOn
|
||||
|
|
46
src/cpu.c
46
src/cpu.c
|
@ -362,24 +362,12 @@ static void ExecSHUTDN( void )
|
|||
{
|
||||
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "SHUTDN" );
|
||||
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
/* If the CPU_SPIN_SHUTDN symbol is defined, the CPU module implements
|
||||
SHUTDN as a spin loop; the program counter is reset to the starting
|
||||
nibble of the SHUTDN opcode.
|
||||
*/
|
||||
cpu_status.PC -= 3;
|
||||
#endif
|
||||
|
||||
/* Set shutdown flag */
|
||||
cpu_status.shutdn = 1;
|
||||
|
||||
#ifndef CPU_SPIN_SHUTDN
|
||||
/* If the CPU_SPIN_SHUTDN symbol is not defined, the CPU module implements
|
||||
SHUTDN signalling the condition CPU_I_SHUTDN
|
||||
*/
|
||||
/* the CPU module implements SHUTDN signalling the condition CPU_I_SHUTDN */
|
||||
ChfCondition CPU_I_SHUTDN, CHF_INFO ChfEnd;
|
||||
ChfSignal();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
@ -2527,11 +2515,6 @@ void CpuReset( void )
|
|||
/* Set inner_loop and inner_loop_max to default values */
|
||||
cpu_status.inner_loop = INNER_LOOP_MED;
|
||||
cpu_status.inner_loop_max = 0;
|
||||
|
||||
/* Reset reset_req if necessary */
|
||||
#ifdef CPU_SPIN_LOOP
|
||||
cpu_status.reset_req = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
@ -2700,11 +2683,6 @@ void CpuWake( void )
|
|||
/* Clear SHUTDN flag */
|
||||
cpu_status.shutdn = 0;
|
||||
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
/* Adjust PC if SHUTDN is implemented using a spin loop */
|
||||
cpu_status.PC += 3;
|
||||
#endif
|
||||
|
||||
/* Clear PC if necessary */
|
||||
/* if(cpu_status.OUT == (OutputRegister)0)
|
||||
cpu_status.PC = (Address)0;
|
||||
|
@ -2768,12 +2746,6 @@ int CpuHaltRequest( void )
|
|||
{
|
||||
debug1( DEBUG_C_TRACE | DEBUG_C_INT, CPU_I_CALLED, "CpuHaltRequest" );
|
||||
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
ChfCondition CPU_E_NO_HALT, CHF_ERROR ChfEnd;
|
||||
ChfSignal();
|
||||
return -1;
|
||||
|
||||
#else
|
||||
if ( cpu_status.halt++ == 0 ) {
|
||||
debug0( DEBUG_C_INT, CPU_I_HALT );
|
||||
|
||||
|
@ -2786,8 +2758,6 @@ int CpuHaltRequest( void )
|
|||
}
|
||||
|
||||
return cpu_status.halt;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
@ -2822,12 +2792,6 @@ int CpuRunRequest( void )
|
|||
{
|
||||
debug1( DEBUG_C_TRACE | DEBUG_C_INT, CPU_I_CALLED, "CpuRunRequest" );
|
||||
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
ChfCondition CPU_E_NO_HALT, CHF_ERROR ChfEnd;
|
||||
ChfSignal();
|
||||
return -1;
|
||||
|
||||
#else
|
||||
if ( cpu_status.halt > 0 )
|
||||
if ( --cpu_status.halt == 0 ) {
|
||||
debug0( DEBUG_C_INT, CPU_I_RUN );
|
||||
|
@ -2837,8 +2801,6 @@ int CpuRunRequest( void )
|
|||
}
|
||||
|
||||
return cpu_status.halt;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
@ -2866,13 +2828,7 @@ int CpuHaltAllowed( void )
|
|||
{
|
||||
debug1( DEBUG_C_TRACE | DEBUG_C_INT, CPU_I_CALLED, "CpuHaltAllowed" );
|
||||
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
return 0;
|
||||
|
||||
#else
|
||||
return 1;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
|
|
@ -270,10 +270,6 @@ struct CpuStatus {
|
|||
#define INNER_LOOP_MAX 26
|
||||
#define INNER_LOOP_MED 13
|
||||
#define INNER_LOOP_MIN 2
|
||||
|
||||
#ifdef CPU_SPIN_LOOP
|
||||
int reset_req; /* Reset req. after shutdn */
|
||||
#endif
|
||||
};
|
||||
|
||||
enum ExitOption /* 2.1: EmulatorExit() option */
|
||||
|
|
|
@ -280,17 +280,6 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
|
|||
if ( ChfGetModuleId( d ) == CPU_CHF_MODULE_ID ) {
|
||||
/* Condition from CPU modules; check Condition Code */
|
||||
switch ( ChfGetConditionCode( d ) ) {
|
||||
#ifdef CPU_SPIN_SHUTDN
|
||||
case CPU_I_SHUTDN:
|
||||
/* CPU shutdown signalled with CPU_SPIN_SHUTDN defined;
|
||||
Fatal error.
|
||||
*/
|
||||
ChfCondition CPU_F_BAD_SHUTDN, CHF_FATAL ChfEnd;
|
||||
ChfSignal();
|
||||
|
||||
act = CHF_RESIGNAL;
|
||||
break;
|
||||
#else
|
||||
case CPU_I_SHUTDN:
|
||||
{
|
||||
/* 3.1: CPU_SPIN_SHUTDN is not defined, and the cpu emulator
|
||||
|
@ -467,7 +456,6 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
|
|||
act = CHF_CONTINUE;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case CPU_I_EMULATOR_INT:
|
||||
/* Emulator interrupt; unwind */
|
||||
|
@ -539,9 +527,9 @@ void Emulator( void )
|
|||
|
||||
/* Activate emulator loop */
|
||||
EmulatorLoop();
|
||||
} else {
|
||||
/* Unwinding after an emulator interrupt */
|
||||
}
|
||||
} /* else { */
|
||||
/* /\* Unwinding after an emulator interrupt *\/ */
|
||||
/* } */
|
||||
}
|
||||
|
||||
/* .+
|
||||
|
@ -640,7 +628,6 @@ void EmulatorInit( void )
|
|||
void EmulatorExit( enum ExitOption opt )
|
||||
{
|
||||
switch ( opt ) {
|
||||
|
||||
case SAVE_AND_EXIT:
|
||||
/* Save state of cpu and modules subsystems */
|
||||
ModSave();
|
||||
|
|
|
@ -147,11 +147,11 @@ typedef void ( *FsbContinuation )( int proceed, char* file_name );
|
|||
Function prototypes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
void HandleXEvents( void );
|
||||
void IdleXLoop( unsigned long max_wait );
|
||||
void HandleXEvents( void ); /* used in emulator.c */
|
||||
void IdleXLoop( unsigned long max_wait ); /* used in emulator.c */
|
||||
|
||||
void InitializeGui( int argc, char* argv[] );
|
||||
void InitializeGui( int argc, char* argv[] ); /* used in main.c */
|
||||
|
||||
void ActivateFSB( char* title, char* file_name, FsbContinuation continuation );
|
||||
void ActivateFSB( char* title, char* file_name, FsbContinuation continuation ); /* used in x_func.c */
|
||||
|
||||
#endif /*!_X11_H*/
|
||||
|
|
|
@ -87,9 +87,9 @@
|
|||
Function prototypes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
void InitLcd( Display* lcd_display, Window lcd_window, unsigned long lcd_fg_pixel, unsigned long lcd_bg_pixel );
|
||||
void InitLcd( Display* lcd_display, Window lcd_window, unsigned long lcd_fg_pixel, unsigned long lcd_bg_pixel ); /* used in x11.c */
|
||||
|
||||
void DrawLcd( void );
|
||||
void RefreshLcd( void );
|
||||
void DrawLcd( void ); /* used in emulator.c */
|
||||
void RefreshLcd( void ); /* used in x11.c */
|
||||
|
||||
#endif /*!_DISPLAY_H*/
|
||||
|
|
|
@ -108,6 +108,6 @@
|
|||
Function prototypes
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
void ExtendedFunction( Nibble function_code );
|
||||
void ExtendedFunction( Nibble function_code ); /* used in hdw.c */
|
||||
|
||||
#endif /*!_X_FUNC_H*/
|
||||
|
|
Loading…
Reference in a new issue