remove all DEBUG code

This commit is contained in:
Gwenhael Le Moine 2023-05-03 10:10:53 +02:00
parent ba5a83e730
commit 9202d2bd3f
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
6 changed files with 5 additions and 525 deletions

View file

@ -1,9 +1,3 @@
/* #define DEBUG_INTERRUPT 1 */
/* #define DEBUG_KBD_INT 1 */
/* #define DEBUG_SHUTDOWN 1 */
/* #define DEBUG_CONFIG 1 */
/* #define DEBUG_ID 1 */
#include "config.h"
#include <stdio.h>
@ -40,9 +34,6 @@ void do_in( void ) {
for ( i = 0; i < 9; i++ )
if ( out & ( 1 << i ) )
in |= saturn.keybuf.rows[ i ];
#ifdef DEBUG_INOUT
fprintf( stderr, "saturn.OUT=%.3x, saturn.IN=%.4x\n", out, in );
#endif
// PATCH
// http://svn.berlios.de/wsvn/x48?op=comp&compare[]=/trunk@12&compare[]=/trunk@13
@ -150,19 +141,6 @@ void do_reset( void ) {
saturn.mem_cntl[ i ].config[ 0 ] = 0x0;
saturn.mem_cntl[ i ].config[ 1 ] = 0x0;
}
#ifdef DEBUG_CONFIG
fprintf( stderr, "%.5lx: RESET\n", saturn.PC );
for ( i = 0; i < 6; i++ ) {
if ( saturn.mem_cntl[ i ].unconfigured )
fprintf( stderr, "MEMORY CONTROLLER %d is unconfigured\n", i );
else
fprintf( stderr,
"MEMORY CONTROLLER %d is configured to %.5lx, %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif
}
void do_inton( void ) { saturn.kbd_ien = 1; }
@ -171,21 +149,11 @@ void do_intoff( void ) { saturn.kbd_ien = 0; }
void do_return_interupt( void ) {
if ( saturn.int_pending ) {
#ifdef DEBUG_INTERRUPT
fprintf( stderr, "PC = %.5lx: RTI SERVICE PENDING INTERRUPT\n",
saturn.PC );
#endif
saturn.int_pending = 0;
saturn.intenable = 0;
saturn.PC = 0xf;
} else {
#ifdef DEBUG_INTERRUPT
fprintf( stderr, "PC = %.5lx: RETURN INTERRUPT to ", saturn.PC );
#endif
saturn.PC = pop_return_addr();
#ifdef DEBUG_INTERRUPT
fprintf( stderr, "%.5lx\n", saturn.PC );
#endif
saturn.intenable = 1;
if ( adj_time_pending ) {
@ -198,9 +166,6 @@ void do_return_interupt( void ) {
void do_interupt( void ) {
interrupt_called = 1;
if ( saturn.intenable ) {
#ifdef DEBUG_INTERRUPT
fprintf( stderr, "PC = %.5lx: INTERRUPT\n", saturn.PC );
#endif
push_return_addr( saturn.PC );
saturn.PC = 0xf;
saturn.intenable = 0;
@ -210,16 +175,10 @@ void do_interupt( void ) {
void do_kbd_int( void ) {
interrupt_called = 1;
if ( saturn.intenable ) {
#ifdef DEBUG_KBD_INT
fprintf( stderr, "PC = %.5lx: KBD INT\n", saturn.PC );
#endif
push_return_addr( saturn.PC );
saturn.PC = 0xf;
saturn.intenable = 0;
} else {
#ifdef DEBUG_KBD_INT
fprintf( stderr, "PC = %.5lx: KBD INT PENDING\n", saturn.PC );
#endif
saturn.int_pending = 1;
}
}
@ -261,19 +220,6 @@ void do_unconfigure( void ) {
break;
}
}
#ifdef DEBUG_CONFIG
fprintf( stderr, "%.5lx: UNCNFG %.5x:\n", saturn.PC, conf );
for ( i = 0; i < 6; i++ ) {
if ( saturn.mem_cntl[ i ].unconfigured )
fprintf( stderr, "MEMORY CONTROLLER %d is unconfigured\n", i );
else
fprintf( stderr,
"MEMORY CONTROLLER %d is configured to %.5lx, %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif
}
void do_configure( void ) {
@ -294,18 +240,6 @@ void do_configure( void ) {
break;
}
}
#ifdef DEBUG_CONFIG
fprintf( stderr, "%.5lx: CONFIG %.5lx:\n", saturn.PC, conf );
for ( i = 0; i < 6; i++ ) {
if ( saturn.mem_cntl[ i ].unconfigured )
fprintf( stderr, "MEMORY CONTROLLER %d is unconfigured\n", i );
else
fprintf( stderr, "MEMORY CONTROLLER %d at %.5lx, %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif
}
int get_identification( void ) {
@ -323,26 +257,6 @@ int get_identification( void ) {
else
id = 0;
#ifdef DEBUG_ID
fprintf( stderr, "%.5lx: C=ID, returning: %x\n", saturn.PC, id );
for ( i = 0; i < 6; i++ ) {
if ( saturn.mem_cntl[ i ].unconfigured == 2 )
fprintf( stderr, "MEMORY CONTROLLER %d is unconfigured\n", i );
else if ( saturn.mem_cntl[ i ].unconfigured == 1 ) {
if ( i == 0 )
fprintf( stderr, "MEMORY CONTROLLER %d unconfigured\n", i );
else
fprintf( stderr,
"MEMORY CONTROLLER %d configured to ????? %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 1 ] );
} else
fprintf( stderr,
"MEMORY CONTROLLER %d configured to %.5lx, %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif
for ( i = 0; i < 3; i++ ) {
saturn.C[ i ] = id & 0x0f;
id >>= 4;
@ -369,20 +283,10 @@ void do_shutdown( void ) {
start_timer( IDLE_TIMER );
if ( is_zero_register( saturn.OUT, OUT_FIELD ) ) {
#ifdef DEBUG_SHUTDOWN
fprintf( stderr, "%.5lx: SHUTDN: PC = 0\n", saturn.PC );
#endif
saturn.intenable = 1;
saturn.int_pending = 0;
}
#ifdef DEBUG_SHUTDOWN
fprintf( stderr, "%.5lx:\tSHUTDN: Timer 1 Control = %x, Timer 1 = %d\n",
saturn.PC, saturn.t1_ctrl, saturn.timer1 );
fprintf( stderr, "%.5lx:\tSHUTDN: Timer 2 Control = %x, Timer 2 = %ld\n",
saturn.PC, saturn.t2_ctrl, saturn.timer2 );
#endif
if ( in_debugger )
wake = 1;
else
@ -512,24 +416,9 @@ void push_return_addr( long addr ) {
saturn.rstkp--;
}
saturn.rstk[ saturn.rstkp ] = addr;
#ifdef DEBUG_RSTK
fprintf( stderr, "PUSH %.5x:\n", addr );
for ( i = saturn.rstkp; i >= 0; i-- ) {
fprintf( stderr, "RSTK[%d] %.5x\n", i, saturn.rstk[ i ] );
}
#endif
}
long pop_return_addr( void ) {
#ifdef DEBUG_RSTK
int i;
for ( i = saturn.rstkp; i >= 0; i-- ) {
fprintf( stderr, "RSTK[%d] %.5x\n", i, saturn.rstk[ i ] );
}
fprintf( stderr, "POP %.5x:\n",
( saturn.rstkp >= 0 ) ? saturn.rstk[ saturn.rstkp ] : 0 );
#endif
if ( saturn.rstkp < 0 )
return 0;
return saturn.rstk[ saturn.rstkp-- ];

View file

@ -15,12 +15,6 @@
#endif
extern int throttle;
#if 0
#define DEBUG_TIMER
#define DEBUG_SCHED 1
#define DEBUG_DISP_SCHED
#endif
static long jumpaddr;
unsigned long instructions = 0;
@ -2249,10 +2243,6 @@ inline void schedule( void ) {
steps = instructions - old_sched_instr;
old_sched_instr = instructions;
#ifdef DEBUG_SCHED
fprintf( stderr, "schedule called after %ld instructions\n", steps );
#endif
if ( ( sched_timer2 -= steps ) <= 0 ) {
if ( !saturn.intenable ) {
sched_timer2 = SCHED_TIMER2;
@ -2270,11 +2260,6 @@ inline void schedule( void ) {
}
schedule_event = sched_timer2;
#ifdef DEBUG_SCHED
fprintf( stderr, "next timer 2 step: %ld, event: %ld\n", sched_timer2,
schedule_event );
#endif
if ( device_check ) {
device_check = 0;
if ( ( sched_display -= steps ) <= 0 ) {
@ -2282,10 +2267,6 @@ inline void schedule( void ) {
device.display_touched -= steps;
if ( device.display_touched < 0 )
device.display_touched = 1;
#ifdef DEBUG_DISP_SCHED
fprintf( stderr, "check_device: disp_when %d, disp_touched %d\n",
sched_display, device.display_touched );
#endif
}
check_devices();
sched_display = SCHED_NEVER;
@ -2306,11 +2287,6 @@ inline void schedule( void ) {
if ( sched_receive < schedule_event )
schedule_event = sched_receive;
#ifdef DEBUG_SCHED
fprintf( stderr, "next receive: %ld, event: %ld\n", sched_receive,
schedule_event );
#endif
if ( ( sched_adjtime -= steps ) <= 0 ) {
sched_adjtime = SCHED_ADJTIME;
@ -2348,11 +2324,6 @@ inline void schedule( void ) {
if ( sched_adjtime < schedule_event )
schedule_event = sched_adjtime;
#ifdef DEBUG_SCHED
fprintf( stderr, "next adjtime: %ld, event: %ld\n", sched_adjtime,
schedule_event );
#endif
if ( ( sched_timer1 -= steps ) <= 0 ) {
if ( !saturn.intenable ) {
sched_timer1 = SCHED_TIMER1;
@ -2369,11 +2340,6 @@ inline void schedule( void ) {
if ( sched_timer1 < schedule_event )
schedule_event = sched_timer1;
#ifdef DEBUG_SCHED
fprintf( stderr, "next timer 1 step: %ld, event: %ld\n", sched_timer1,
schedule_event );
#endif
if ( ( sched_statistics -= steps ) <= 0 ) {
sched_statistics = SCHED_STATISTICS;
run = get_timer( RUN_TIMER );
@ -2402,28 +2368,10 @@ inline void schedule( void ) {
saturn.t1_tick = t1_i_per_tick;
saturn.t2_tick = t2_i_per_tick;
#ifdef DEBUG_TIMER
if ( delta_t_1 > 0 ) {
#if 0
fprintf(stderr, "I/s = %ld, T1 I/TICK = %d (%ld), T2 I/TICK = %d (%ld)\n",
saturn.i_per_s, saturn.t1_tick, t1_i_per_tick,
saturn.t2_tick, t2_i_per_tick);
#else
fprintf(
stderr, "I/s = %ld, T1 I/TICK = %d, T2 I/TICK = %d (%ld)\n",
saturn.i_per_s, saturn.t1_tick, saturn.t2_tick, t2_i_per_tick );
#endif
}
#endif
}
if ( sched_statistics < schedule_event )
schedule_event = sched_statistics;
#ifdef DEBUG_SCHED
fprintf( stderr, "next statistics: %ld, event: %ld\n", sched_statistics,
schedule_event );
#endif
if ( ( sched_instr_rollover -= steps ) <= 0 ) {
sched_instr_rollover = SCHED_INSTR_ROLLOVER;
instructions = 1;
@ -2435,11 +2383,6 @@ inline void schedule( void ) {
if ( sched_instr_rollover < schedule_event )
schedule_event = sched_instr_rollover;
#ifdef DEBUG_SCHED
fprintf( stderr, "next instruction rollover: %ld, event: %ld\n",
sched_instr_rollover, schedule_event );
#endif
schedule_event--;
if ( got_alarm ) {

View file

@ -20,17 +20,6 @@ extern long port1_mask;
extern short port2_is_ram;
extern long port2_mask;
#define DEBUG_UNKNOWN 1
/* #define DEBUG_SERIAL 1 */
/* #define DEBUG_SERIALb 1 */
/* #define DEBUG_DISPLAY 1 */
/* #define DEBUG_IR 1 */
/* #define DEBUG_CONTRAST 1 */
/* #define DEBUG_CARDS 1 */
/* #define DEBUG_BAD_MEM 1 */
/* #define DEBUG_BASE_NIBBLE 1 */
/* #define DEBUG_BANK_SWITCH 1 */
long nibble_masks[ 16 ] = { 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000,
0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000,
0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000,
@ -71,36 +60,21 @@ void write_dev_mem( long addr, int val ) {
( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
#ifdef DEBUG_DISPLAY
fprintf( stderr, "%.5lx: DISP ON: %x\n", saturn.PC, display.on );
#endif
return;
case 0x101: /* CONTRAST CONTROL */
saturn.contrast_ctrl = val;
display.contrast &= ~0x0f;
display.contrast |= val;
#ifdef DEBUG_CONTRAST
fprintf( stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC,
display.contrast );
#endif
device.contrast_touched = 1;
return;
case 0x102: /* DISPLAY TEST */
display.contrast &= ~0xf0;
display.contrast |= ( ( val & 0x1 ) << 4 );
#ifdef DEBUG_CONTRAST
fprintf( stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC,
display.contrast );
#endif
device.contrast_touched = 1;
/* Fall through */
case 0x103: /* DISPLAY TEST */
saturn.disp_test &= ~nibble_masks[ addr - 0x102 ];
saturn.disp_test |= val << ( ( addr - 0x102 ) * 4 );
#ifdef DEBUG_DISPLAY
fprintf( stderr, "%.5lx: DISP TEST: %x\n", saturn.PC,
saturn.disp_test );
#endif
device.disp_test_touched = 1;
return;
case 0x104:
@ -132,10 +106,6 @@ void write_dev_mem( long addr, int val ) {
case 0x10d: /* BAUD */
saturn.baud = val;
device.baud_touched = 1;
#ifdef DEBUG_SERIALb
fprintf( stderr, "%.5lx: BAUD write: %x\n", saturn.PC,
saturn.baud );
#endif
return;
case 0x10e: /* CARD CONTROL */
saturn.card_ctrl = val;
@ -144,42 +114,21 @@ void write_dev_mem( long addr, int val ) {
if ( saturn.card_ctrl & 0x01 )
do_interupt();
device.card_ctrl_touched = 1;
#ifdef DEBUG_CARDS
fprintf( stderr, "%.5lx: CardControl write: %x\n", saturn.PC,
saturn.card_ctrl );
#endif
return;
case 0x10f: /* CARD STATUS */
#ifdef DEBUG_CARDS
fprintf( stderr, "%.5lx: CardStatus write: %x\n", saturn.PC,
saturn.card_status );
#endif
return;
case 0x110: /* IO CONTROL */
saturn.io_ctrl = val;
device.ioc_touched = 1;
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: IOC write: %x\n", saturn.PC,
saturn.io_ctrl );
#endif
return;
case 0x111: /* RCS */
saturn.rcs = val;
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: RCS: %x\n", saturn.PC, saturn.rcs );
#endif
return;
case 0x112: /* TCS */
saturn.tcs = val;
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: TCS: %x\n", saturn.PC, saturn.tcs );
#endif
return;
case 0x113: /* CRER */
saturn.rcs &= 0x0b;
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: CRER, RCS: %x\n", saturn.PC, saturn.rcs );
#endif
return;
case 0x114:
case 0x115: /* RBR */
@ -196,18 +145,10 @@ void write_dev_mem( long addr, int val ) {
saturn.sreq &= ~nibble_masks[ addr - 0x118 ];
saturn.sreq |= val << ( ( addr - 0x118 ) * 4 );
device.sreq_touched = 1;
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: SREQ? write: %x\n", saturn.PC,
saturn.sreq );
#endif
return;
case 0x11a: /* IR CONTROL */
saturn.ir_ctrl = val;
device.ir_ctrl_touched = 1;
#ifdef DEBUG_IR
fprintf( stderr, "%.5lx: IRC write: %x\n", saturn.PC,
saturn.ir_ctrl );
#endif
return;
case 0x11b: /* BASE NIB OFFSET */
saturn.base_off = val;
@ -216,16 +157,10 @@ void write_dev_mem( long addr, int val ) {
case 0x11c: /* LED CONTROL */
saturn.lcr = val;
device.lcr_touched = 1;
#ifdef DEBUG_IR
fprintf( stderr, "%.5lx: LCR write: %x\n", saturn.PC, saturn.lcr );
#endif
return;
case 0x11d: /* LED BUFFER */
saturn.lbr = val;
device.lbr_touched = 1;
#ifdef DEBUG_IR
fprintf( stderr, "%.5lx: LBR write: %x\n", saturn.PC, saturn.lbr );
#endif
return;
case 0x11e: /* SCRATCH PAD */
saturn.scratch = val;
@ -234,11 +169,6 @@ void write_dev_mem( long addr, int val ) {
case 0x11f: /* BASENIBBLE */
saturn.base_nibble = val;
device.base_nibble_touched = 1;
#ifdef DEBUG_BASE_NIBBLE
if ( opt_gx )
fprintf( stderr, "%.5lx: BASENIB: %x\n", saturn.PC,
saturn.base_nibble );
#endif
return;
case 0x120:
case 0x121:
@ -254,12 +184,6 @@ void write_dev_mem( long addr, int val ) {
( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
#ifdef DEBUG_DISPLAY
fprintf( stderr, "%.5lx: DISPLAY: %lx\n", saturn.PC,
display.disp_start );
fprintf( stderr, "%.5lx: DISP END: %lx\n", saturn.PC,
display.disp_end );
#endif
return;
case 0x125:
case 0x126:
@ -279,12 +203,6 @@ void write_dev_mem( long addr, int val ) {
( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
#ifdef DEBUG_DISPLAY
fprintf( stderr, "%.5lx: DISP LINE SIZE: %x\n", saturn.PC,
display.nibs_per_line );
fprintf( stderr, "%.5lx: DISP END: %lx\n", saturn.PC,
display.disp_end );
#endif
return;
case 0x128:
case 0x129: /* LINE_COUNT */
@ -301,12 +219,6 @@ void write_dev_mem( long addr, int val ) {
( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
#ifdef DEBUG_DISPLAY
fprintf( stderr, "%.5lx: DISP LINES: %x\n", saturn.PC,
display.lines );
fprintf( stderr, "%.5lx: DISP END: %lx\n", saturn.PC,
display.disp_end );
#endif
return;
case 0x12a:
case 0x12b:
@ -314,10 +226,6 @@ void write_dev_mem( long addr, int val ) {
case 0x12d: /* Dont know yet */
saturn.unknown &= ~nibble_masks[ addr - 0x12a ];
saturn.unknown |= val << ( ( addr - 0x12a ) * 4 );
#ifdef DEBUG_UNKNOWN
fprintf( stderr, "Unknown device @0x%ld: %.4x\n", addr,
saturn.unknown );
#endif
device.unknown_touched = 1;
return;
case 0x12e: /* TIMER 1 CONTROL */
@ -345,10 +253,6 @@ void write_dev_mem( long addr, int val ) {
case 0x136: /* Dont know yet 2 */
saturn.unknown2 &= ~nibble_masks[ addr - 0x135 ];
saturn.unknown2 |= val << ( ( addr - 0x135 ) * 4 );
#ifdef DEBUG_UNKNOWN
fprintf( stderr, "Unknown device @0x%ld: %.2x\n", addr,
saturn.unknown2 );
#endif
device.unknown2_touched = 1;
return;
case 0x137: /* TIMER1 */
@ -399,29 +303,16 @@ int read_dev_mem( long addr ) {
case 0x10c: /* ANNUNC */
return ( saturn.annunc >> ( ( addr - 0x10b ) * 4 ) ) & 0x0f;
case 0x10d: /* BAUD */
#ifdef DEBUG_SERIALb
fprintf( stderr, "%.5lx: BAUD read: %x\n", saturn.PC, saturn.baud );
#endif
return saturn.baud & 0x0f;
case 0x10e: /* CARD CONTROL */
return saturn.card_ctrl & 0x0f;
case 0x10f: /* CARD STATUS */
return saturn.card_status & 0x0f;
case 0x110: /* IO CONTROL */
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: IOC read: %x\n", saturn.PC,
saturn.io_ctrl );
#endif
return saturn.io_ctrl & 0x0f;
case 0x111: /* RCS */
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: RCS read: %x\n", saturn.PC, saturn.rcs );
#endif
return saturn.rcs & 0x0f;
case 0x112: /* TCS */
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: TCS read: %x\n", saturn.PC, saturn.tcs );
#endif
return saturn.tcs & 0x0f;
case 0x113: /* CRER */
return 0x00;
@ -437,32 +328,14 @@ int read_dev_mem( long addr ) {
return 0x00;
case 0x118:
case 0x119: /* SERVICE REQ */
#ifdef DEBUG_SERIAL
fprintf( stderr, "%.5lx: SREQ? read: %x\n", saturn.PC,
saturn.sreq );
#endif
return ( saturn.sreq >> ( ( addr - 0x118 ) * 4 ) ) & 0x0f;
case 0x11a: /* IR CONTROL */
#ifdef DEBUG_IR
fprintf( stderr, "%.5lx: IRC read: %x\n", saturn.PC,
saturn.ir_ctrl );
#endif
return saturn.ir_ctrl & 0x0f;
case 0x11b: /* BASE NIB OFFSET */
return saturn.base_off & 0x0f;
case 0x11c: /* LED CONTROL */
#if 0
#ifdef DEBUG_IR
fprintf(stderr, "%.5lx: LCR read: %x\n", saturn.PC, saturn.lcr);
#endif
#endif
return saturn.lcr & 0x0f;
case 0x11d: /* LED BUFFER */
#if 0
#ifdef DEBUG_IR
fprintf(stderr, "%.5lx: LBR read: %x\n", saturn.PC, saturn.lbr);
#endif
#endif
return saturn.lbr & 0x0f;
case 0x11e: /* SCRATCH PAD */
return saturn.scratch & 0x0f;
@ -534,10 +407,6 @@ void write_nibble_sx( long addr, int val ) {
write_dev_mem( addr, val );
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 1:
case 2:
@ -545,10 +414,6 @@ void write_nibble_sx( long addr, int val ) {
case 4:
case 5:
case 6:
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 7:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) {
@ -568,10 +433,6 @@ void write_nibble_sx( long addr, int val ) {
break;
}
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 8:
case 9:
@ -587,10 +448,6 @@ void write_nibble_sx( long addr, int val ) {
saturn.port2[ ( addr - 0x80000 ) & port2_mask ] = val;
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xc:
case 0xd:
@ -605,10 +462,6 @@ void write_nibble_sx( long addr, int val ) {
saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] = val;
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xf:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0xf0000 ) {
@ -625,10 +478,6 @@ void write_nibble_sx( long addr, int val ) {
saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] = val;
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
if ( device.display_touched || !disp.mapped )
@ -653,60 +502,32 @@ void write_nibble_gx( long addr, int val ) {
write_dev_mem( addr, val );
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 1:
case 2:
case 3:
case 5:
case 6:
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: BAD WRITE TO ROM AT ADDRESS %.5lx\n",
saturn.PC, addr );
#endif
return;
case 4:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x40000 ) {
saturn.ram[ addr - 0x40000 ] = val;
break;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: BAD WRITE TO ROM AT ADDRESS %.5lx\n",
saturn.PC, addr );
#endif
return;
case 7:
if ( addr >= 0x7f000 &&
saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) {
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: write to bank switch at %.5lx\n",
saturn.PC, addr );
#endif
return;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: write to port 1 at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: write to port 2 at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 8:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) {
@ -731,18 +552,10 @@ void write_nibble_gx( long addr, int val ) {
break;
}
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 9:
if ( saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x90000 ) {
if ( addr < 0x91000 ) {
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: write to bank switch at %.5lx\n",
saturn.PC, addr );
#endif
return;
}
}
@ -752,10 +565,6 @@ void write_nibble_gx( long addr, int val ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xa:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 )
@ -769,10 +578,6 @@ void write_nibble_gx( long addr, int val ) {
saturn.port1[ ( addr - 0xa0000 ) & port1_mask ] = val;
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xb:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 )
@ -796,10 +601,6 @@ void write_nibble_gx( long addr, int val ) {
*/
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xc:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) {
@ -836,10 +637,6 @@ void write_nibble_gx( long addr, int val ) {
*/
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xd:
case 0xe:
@ -872,10 +669,6 @@ void write_nibble_gx( long addr, int val ) {
*/
return;
}
#ifdef DEBUG_BAD_MEM
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
if ( device.display_touched || !disp.mapped )
@ -982,34 +775,18 @@ int read_nibble_gx( long addr ) {
saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) {
if ( addr == 0x7f000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x7f040 && addr < 0x7f080 ) {
saturn.bank_switch = ( addr - 0x7f040 ) / 2;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: switch to bank %d\n", saturn.PC,
saturn.bank_switch );
#endif
}
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: read from port 1 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: read from port 2 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
return saturn.rom[ addr ];
@ -1032,17 +809,9 @@ int read_nibble_gx( long addr ) {
if ( addr < 0x91000 ) {
if ( addr == 0x90000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x90040 && addr < 0x90080 ) {
saturn.bank_switch = ( addr - 0x90040 ) / 2;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: switch to bank %d\n",
saturn.PC, saturn.bank_switch );
#endif
}
return 0x7;
}
@ -1231,34 +1000,18 @@ int read_nibble_crc_gx( long addr ) {
saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) {
if ( addr == 0x7f000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x7f040 && addr < 0x7f080 ) {
saturn.bank_switch = ( addr - 0x7f040 ) / 2;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: switch to bank %d\n", saturn.PC,
saturn.bank_switch );
#endif
}
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: read from port 1 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
#ifdef DEBUG_PORTS
fprintf( stderr, "%.5lx: read from port 2 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
return calc_crc( saturn.rom[ addr ] );
@ -1281,17 +1034,9 @@ int read_nibble_crc_gx( long addr ) {
if ( addr < 0x91000 ) {
if ( addr == 0x90000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x90040 && addr < 0x90080 ) {
saturn.bank_switch = ( addr - 0x90040 ) / 2;
#ifdef DEBUG_BANK_SWITCH
fprintf( stderr, "%.5lx: switch to bank %d\n",
saturn.PC, saturn.bank_switch );
#endif
}
return 0x7;
}

View file

@ -24,8 +24,6 @@ extern int rece_instr;
static char* wire_name = ( char* )0;
static char* ir_name = ( char* )0;
/* #define DEBUG_SERIAL */
void update_connection_display( void ) {
if ( wire_fd == -1 ) {
if ( wire_name )
@ -384,10 +382,6 @@ void serial_baud( int baud ) {
}
void transmit_char( void ) {
#ifdef DEBUG_SERIALx
fprintf( stderr, "XMT %s\n", ( saturn.ir_ctrl & 0x04 ) ? "IR" : "wire" );
#endif
if ( saturn.ir_ctrl & 0x04 ) {
if ( ir_fd == -1 ) {
saturn.tcs &= 0x0e;
@ -406,14 +400,6 @@ void transmit_char( void ) {
}
}
#ifdef DEBUG_SERIAL
if ( isprint( saturn.tbr ) ) {
fprintf( stderr, "-> \'%c\'\n", saturn.tbr );
} else {
fprintf( stderr, "-> %x\n", saturn.tbr );
}
#endif
if ( saturn.ir_ctrl & 0x04 ) {
if ( write( ir_fd, &saturn.tbr, 1 ) == 1 ) {
saturn.tcs &= 0x0e;
@ -459,10 +445,6 @@ void receive_char() {
static unsigned char buf[ NR_BUFFER + 1 ];
static int nrd = 0, bp = 0;
#ifdef DEBUG_SERIALx
fprintf( stderr, "RCV %s\n", ( saturn.ir_ctrl & 0x04 ) ? "IR" : "wire" );
#endif
rece_instr = 0;
if ( saturn.ir_ctrl & 0x04 ) {
@ -490,9 +472,6 @@ void receive_char() {
}
if ( ( nfd = select( nfd, &rfds, ( fd_set* )0, ( fd_set* )0, &tout ) ) >
0 ) {
#ifdef DEBUG_SERIAL
fprintf( stderr, "select = %d\n", nfd );
#endif
if ( saturn.ir_ctrl & 0x04 ) {
if ( FD_ISSET( ir_fd, &rfds ) ) {
nrd = read( ir_fd, buf, NR_BUFFER );

View file

@ -11,9 +11,6 @@
#include <assert.h>
/* #define DEBUG_TIMER 1 */
/* #define DEBUG_TIMER_ADJUST 1 */
typedef struct x48_timer_t {
word_1 run;
word_64 start;
@ -185,10 +182,6 @@ void start_timer( int timer ) {
timers[ timer ].start <<= 13;
timers[ timer ].start += ( tv.tv_usec << 7 ) / 15625;
}
#ifdef DEBUG_TIMER
fprintf( stderr, "Timer%c[%d] start at 0x%lx\n",
timer == T1_TIMER ? '*' : ' ', timer, timers[ timer ].start );
#endif
}
void restart_timer( int timer ) {
@ -222,10 +215,6 @@ void restart_timer( int timer ) {
timers[ timer ].start <<= 13;
timers[ timer ].start += ( tv.tv_usec << 7 ) / 15625;
}
#ifdef DEBUG_TIMER
fprintf( stderr, "Timer[%d] restart at 0x%lx\n", timer,
timers[ timer ].start );
#endif
}
void stop_timer( int timer ) {
@ -262,11 +251,6 @@ void stop_timer( int timer ) {
timers[ timer ].value += timers[ timer ].stop - timers[ timer ].start;
// add_sub_64(&timers[timer].stop, &timers[timer].start,
// &timers[timer].value);
#ifdef DEBUG_TIMER
fprintf( stderr, "Timer[%d] stop at 0x%llx, value 0x%llx\n", timer,
timers[ timer ].stop, timers[ timer ].value );
#endif
}
void reset_timer( int timer ) {
@ -276,9 +260,6 @@ void reset_timer( int timer ) {
timers[ timer ].start = 0;
timers[ timer ].stop = 0;
timers[ timer ].value = 0;
#ifdef DEBUG_TIMER
fprintf( stderr, "Timer[%d] reset\n", timer );
#endif
}
static word_64 zero = 0;
@ -415,14 +396,6 @@ t1_t2_ticks get_t1_t2( void ) {
set_0_time += adj_time;
time_offset += adj_time;
access_time -= adj_time;
#ifdef DEBUG_TIMER_ADJUST
fprintf( stderr, "Time adjusted by " );
fprintf( stderr, "%lX", adj_time );
fprintf( stderr, " TICKS, Total offset " );
fprintf( stderr, "%lX", set_0_time );
fprintf( stderr, " TICKS\n" );
#endif
}
if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) ||

View file

@ -88,14 +88,6 @@ unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP,
KBD_UPLINE;
#endif
#if 0
#define DEBUG_XEVENT 1
#define DEBUG_BUTTONS 1
#define DEBUG_FOCUS 1
#define DEBUG_BACKING_STORE 1
#define DEBUG_SHM 1
#endif
#if defined( GUI_IS_X11 )
typedef struct keypad_t {
unsigned int width;
@ -1425,10 +1417,6 @@ int InitDisplay( int argc, char** argv ) {
* Does the Xserver do backing-store?
*/
does_backing_store = XDoesBackingStore( XScreenOfDisplay( dpy, screen ) );
#ifdef DEBUG_BACKING_STORE
fprintf( stderr, "XServer does%sBackingStore\n",
does_backing_store ? " " : " not do " );
#endif
#ifdef HAVE_XSHM
/*
@ -3440,10 +3428,7 @@ int button_pressed( int b ) {
saturn.keybuf.rows[ r ] |= c;
}
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Button pressed %d (%s)\n", buttons[ b ].code,
buttons[ b ].name );
#endif
return 0;
}
@ -3462,10 +3447,6 @@ int button_released( int b ) {
c = 1 << ( code & 0xf );
saturn.keybuf.rows[ r ] &= ~c;
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Button released %d (%s)\n", buttons[ b ].code,
buttons[ b ].name );
#endif
return 0;
}
@ -3473,14 +3454,8 @@ static int button_release_all( void ) {
int code;
int b;
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Buttons released " );
#endif
for ( b = BUTTON_A; b <= LAST_BUTTON; b++ ) {
if ( buttons[ b ].pressed ) {
#ifdef DEBUG_BUTTONS
fprintf( stderr, "%d (%s) ", buttons[ b ].code, buttons[ b ].name );
#endif
code = buttons[ b ].code;
if ( code == 0x8000 ) {
int i;
@ -3496,9 +3471,7 @@ static int button_release_all( void ) {
DrawButton( b );
}
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "\n" );
#endif
return 0;
}
@ -3525,11 +3498,6 @@ int key_event( int b, XEvent* xev ) {
saturn.keybuf.rows[ r ] |= c;
}
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Key pressed %d (%s) %x\n", buttons[ b ].code,
buttons[ b ].name ),
c;
#endif
} else {
if ( code == 0x8000 ) {
for ( i = 0; i < 9; i++ )
@ -3542,11 +3510,8 @@ int key_event( int b, XEvent* xev ) {
}
buttons[ b ].pressed = 0;
DrawButton( b );
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Key released %d (%s)\n", buttons[ b ].code,
buttons[ b ].name );
#endif
}
return 0;
}
@ -4147,18 +4112,10 @@ int button_pressed( int b ) {
if ( saturn.kbd_ien ) {
do_kbd_int();
}
#ifdef DEBUG_BUTTONS
if ( ( saturn.keybuf.rows[ r ] & c ) ) {
fprintf( stderr, "bug\n" );
}
#endif
saturn.keybuf.rows[ r ] |= c;
}
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Button pressed %d (%s)\n", buttons[ b ].code,
buttons[ b ].name );
#endif
return 0;
}
@ -4181,10 +4138,7 @@ int button_released( int b ) {
c = 1 << ( code & 0xf );
saturn.keybuf.rows[ r ] &= ~c;
}
#ifdef DEBUG_BUTTONS
fprintf( stderr, "Button released %d (%s)\n", buttons[ b ].code,
buttons[ b ].name );
#endif
return 0;
}
@ -6626,9 +6580,6 @@ int get_ui_event( void ) {
default:
#ifdef DEBUG_XEVENT
printf( "Event: %d\n", xev.type );
#endif
case KeymapNotify:
case ConfigureNotify:
case ReparentNotify: