Compare commits
2 commits
0dfb431aa3
...
2076cfd1c9
Author | SHA1 | Date | |
---|---|---|---|
|
2076cfd1c9 | ||
|
90b23a8613 |
5 changed files with 183 additions and 187 deletions
|
@ -2057,7 +2057,7 @@ static void ExecGroup_80( void )
|
||||||
case 0xB: /* BUSCC */
|
case 0xB: /* BUSCC */
|
||||||
debug1( CPU_CHF_MODULE_ID, DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCC" );
|
debug1( CPU_CHF_MODULE_ID, DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCC" );
|
||||||
// FIXME: 49g bugs here on display change
|
// FIXME: 49g bugs here on display change
|
||||||
DEBUG_print_cpu_instruction();
|
// DEBUG_print_cpu_instruction();
|
||||||
|
|
||||||
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "BUSCC" );
|
ChfGenerate( CPU_CHF_MODULE_ID, __FILE__, __LINE__, CPU_F_INTERR, CHF_WARNING, "BUSCC" );
|
||||||
ChfSignal( CPU_CHF_MODULE_ID );
|
ChfSignal( CPU_CHF_MODULE_ID );
|
||||||
|
@ -2818,7 +2818,7 @@ void DEBUG_print_cpu_instruction( void )
|
||||||
|
|
||||||
/* Dump PC and current instruction */
|
/* Dump PC and current instruction */
|
||||||
( void )Disassemble( cpu_status.PC, dob );
|
( void )Disassemble( cpu_status.PC, dob );
|
||||||
fprintf( stderr, "\n%s\n\n", dob );
|
fprintf( stderr, "%s\n", dob );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2853,6 +2853,7 @@ void OneStep( void )
|
||||||
Address offset;
|
Address offset;
|
||||||
|
|
||||||
debug1( CPU_CHF_MODULE_ID, DEBUG_C_TRACE, CPU_I_EXECUTING, cpu_status.PC );
|
debug1( CPU_CHF_MODULE_ID, DEBUG_C_TRACE, CPU_I_EXECUTING, cpu_status.PC );
|
||||||
|
DEBUG_print_cpu_instruction();
|
||||||
|
|
||||||
/* Get first instruction nibble */
|
/* Get first instruction nibble */
|
||||||
n = GetNibble( cpu_status.PC++ );
|
n = GetNibble( cpu_status.PC++ );
|
||||||
|
|
|
@ -258,20 +258,7 @@ static void EmulatorLoop( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Condition handler for the EmulatorLoop */
|
static ChfAction do_SHUTDN( void )
|
||||||
static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s, void* _ctx )
|
|
||||||
{
|
|
||||||
ChfAction act;
|
|
||||||
|
|
||||||
/* Check Chf state */
|
|
||||||
switch ( s ) {
|
|
||||||
/* 2.1: Chf release 2 fixed the spelling of 'SIGNALING' */
|
|
||||||
case CHF_SIGNALING:
|
|
||||||
/* ChfSignal() in progress */
|
|
||||||
if ( d->module_id == CPU_CHF_MODULE_ID ) {
|
|
||||||
/* Condition from CPU modules; check Condition Code */
|
|
||||||
switch ( d->condition_code ) {
|
|
||||||
case CPU_I_SHUTDN:
|
|
||||||
{
|
{
|
||||||
/* 3.1: CPU_SPIN_SHUTDN is not defined, and the cpu emulator
|
/* 3.1: CPU_SPIN_SHUTDN is not defined, and the cpu emulator
|
||||||
has just executed a shutdown instruction.
|
has just executed a shutdown instruction.
|
||||||
|
@ -352,10 +339,8 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
|
||||||
int ela;
|
int ela;
|
||||||
int ela_ticks;
|
int ela_ticks;
|
||||||
|
|
||||||
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T1 (during SHUTDN)", mod_status.hdw.t1_ctrl,
|
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T1 (during SHUTDN)", mod_status.hdw.t1_ctrl, mod_status.hdw.t1_val );
|
||||||
mod_status.hdw.t1_val );
|
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T2 (during SHUTDN)", mod_status.hdw.t2_ctrl, mod_status.hdw.t2_val );
|
||||||
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T2 (during SHUTDN)", mod_status.hdw.t2_ctrl,
|
|
||||||
mod_status.hdw.t2_val );
|
|
||||||
|
|
||||||
/* Determine which timer will expire first */
|
/* Determine which timer will expire first */
|
||||||
if ( mod_status.hdw.t1_ctrl & ( T1_CTRL_INT | T1_CTRL_WAKE ) ) {
|
if ( mod_status.hdw.t1_ctrl & ( T1_CTRL_INT | T1_CTRL_WAKE ) ) {
|
||||||
|
@ -368,8 +353,7 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
|
||||||
ms = mst;
|
ms = mst;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( mod_status.hdw.t2_ctrl & T2_CTRL_TRUN ) &&
|
if ( ( mod_status.hdw.t2_ctrl & T2_CTRL_TRUN ) && ( mod_status.hdw.t2_ctrl & ( T2_CTRL_INT | T2_CTRL_WAKE ) ) ) {
|
||||||
( mod_status.hdw.t2_ctrl & ( T2_CTRL_INT | T2_CTRL_WAKE ) ) ) {
|
|
||||||
/* T2 is running and will do something on expiration */
|
/* T2 is running and will do something on expiration */
|
||||||
mst = ( ( unsigned long )mod_status.hdw.t2_val + 1 ) / T2_MS_DIVISOR;
|
mst = ( ( unsigned long )mod_status.hdw.t2_val + 1 ) / T2_MS_DIVISOR;
|
||||||
|
|
||||||
|
@ -442,13 +426,27 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T1 (after SHUTDN)", mod_status.hdw.t1_ctrl,
|
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T1 (after SHUTDN)", mod_status.hdw.t1_ctrl, mod_status.hdw.t1_val );
|
||||||
mod_status.hdw.t1_val );
|
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T2 (after SHUTDN)", mod_status.hdw.t2_ctrl, mod_status.hdw.t2_val );
|
||||||
debug3( CPU_CHF_MODULE_ID, DEBUG_C_TIMERS, CPU_I_TIMER_ST, "T2 (after SHUTDN)", mod_status.hdw.t2_ctrl,
|
|
||||||
mod_status.hdw.t2_val );
|
|
||||||
|
|
||||||
act = CHF_CONTINUE;
|
return CHF_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Condition handler for the EmulatorLoop */
|
||||||
|
static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s, void* _ctx )
|
||||||
|
{
|
||||||
|
ChfAction act;
|
||||||
|
|
||||||
|
/* Check Chf state */
|
||||||
|
switch ( s ) {
|
||||||
|
/* 2.1: Chf release 2 fixed the spelling of 'SIGNALING' */
|
||||||
|
case CHF_SIGNALING:
|
||||||
|
/* ChfSignal() in progress */
|
||||||
|
if ( d->module_id == CPU_CHF_MODULE_ID ) {
|
||||||
|
/* Condition from CPU modules; check Condition Code */
|
||||||
|
switch ( d->condition_code ) {
|
||||||
|
case CPU_I_SHUTDN:
|
||||||
|
act = do_SHUTDN();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CPU_I_EMULATOR_INT:
|
case CPU_I_EMULATOR_INT:
|
||||||
|
|
|
@ -201,9 +201,8 @@ void ModSelectDescription( int model )
|
||||||
ModRegisterDescription( hw49_description );
|
ModRegisterDescription( hw49_description );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_NO_MATCH, CHF_ERROR, config.hw ); */
|
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_NO_MATCH, CHF_ERROR, "Unknown model" );
|
||||||
/* ChfSignal( MOD_CHF_MODULE_ID ); */
|
ChfSignal( MOD_CHF_MODULE_ID );
|
||||||
fprintf( stderr, "Error: Unknown model %i\n", model );
|
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ void ModConfig( Address config_info )
|
||||||
if ( mod == N_MOD ) {
|
if ( mod == N_MOD ) {
|
||||||
/* All modules are configured - Signal a warning */
|
/* All modules are configured - Signal a warning */
|
||||||
// FIXME: 48gx bugs here when running VERSION
|
// FIXME: 48gx bugs here when running VERSION
|
||||||
DEBUG_print_cpu_instruction();
|
// DEBUG_print_cpu_instruction();
|
||||||
|
|
||||||
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_CONFIG, CHF_WARNING, config_info );
|
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_W_BAD_CONFIG, CHF_WARNING, config_info );
|
||||||
ChfSignal( MOD_CHF_MODULE_ID );
|
ChfSignal( MOD_CHF_MODULE_ID );
|
||||||
|
|
|
@ -144,9 +144,7 @@ void RomInit( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE, mod_status_rom ) ) {
|
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE, mod_status_rom ) ) {
|
||||||
/* ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL ); */
|
// To load 48SX ROM, try again with half the size this time.
|
||||||
/* ChfSignal( MOD_CHF_MODULE_ID ); */
|
|
||||||
// HACK: To load 48SX ROM, try again with half the size this time.
|
|
||||||
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE / 2, mod_status_rom ) ) {
|
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE / 2, mod_status_rom ) ) {
|
||||||
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL );
|
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_F_ROM_INIT, CHF_FATAL );
|
||||||
ChfSignal( MOD_CHF_MODULE_ID );
|
ChfSignal( MOD_CHF_MODULE_ID );
|
||||||
|
@ -233,7 +231,7 @@ void RomWrite( Address rel_address, Nibble datum )
|
||||||
debug1( MOD_CHF_MODULE_ID, DEBUG_C_TRACE, MOD_I_CALLED, "RomWrite" );
|
debug1( MOD_CHF_MODULE_ID, DEBUG_C_TRACE, MOD_I_CALLED, "RomWrite" );
|
||||||
|
|
||||||
// FIXME: 48gx: saturn48gx-Mid <12>d (src/romram.c,235)-E-Write into ROM A[1B632] D[9]
|
// FIXME: 48gx: saturn48gx-Mid <12>d (src/romram.c,235)-E-Write into ROM A[1B632] D[9]
|
||||||
DEBUG_print_cpu_instruction();
|
// DEBUG_print_cpu_instruction();
|
||||||
|
|
||||||
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum );
|
ChfGenerate( MOD_CHF_MODULE_ID, __FILE__, __LINE__, MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum );
|
||||||
ChfSignal( MOD_CHF_MODULE_ID );
|
ChfSignal( MOD_CHF_MODULE_ID );
|
||||||
|
|
Loading…
Add table
Reference in a new issue