diff --git a/src/disk_io_obj.c b/src/disk_io_obj.c index c603cd7..62846b4 100644 --- a/src/disk_io_obj.c +++ b/src/disk_io_obj.c @@ -146,7 +146,7 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres ChfCondition st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd; } else { /* Check and skip header */ - for ( i = 0; i < hdr_len; i++ ) { + for ( i = 0; i < ( int )hdr_len; i++ ) { by = getc( f ); if ( by == EOF ) { @@ -243,7 +243,7 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char* ChfCondition st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd; } else { /* Write header; replace wildcard character '?' with 'S' */ - for ( i = 0; i < hdr_len; i++ ) { + for ( i = 0; i < ( int )hdr_len; i++ ) { if ( putc( hdr[ i ] == '?' ? 'S' : hdr[ i ], f ) == EOF ) { ChfErrnoCondition; ChfCondition st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd; diff --git a/src/display.c b/src/display.c index 7eaa011..76018d7 100644 --- a/src/display.c +++ b/src/display.c @@ -144,7 +144,7 @@ static char rcs_id[] = "$Id: display.c,v 4.1.1.1 2002/11/11 16:12:46 cibrario Ex Static/Global variables ---------------------------------------------------------------------------*/ -static /*const*/ char nibble_bitmap_data[ NIBBLE_VALUES ][ LCD_MAG ] = { +static /*const*/ unsigned char nibble_bitmap_data[ NIBBLE_VALUES ][ LCD_MAG ] = { #if LCD_MAG == 1 { 0x00 }, /* ---- */ { 0x01 }, /* *--- */ @@ -184,17 +184,14 @@ static /*const*/ char nibble_bitmap_data[ NIBBLE_VALUES ][ LCD_MAG ] = { #endif }; -static /*const*/ struct { - int mask; /* Bit mask */ - int x, y; /* Position */ - int w, h; /* Width, Height */ - char bitmap_data[ 24 ]; /* Bitmap data */ -} - #define ANN_X( i ) ( 8 * LCD_MAG + ( 22 * LCD_MAG + 1 ) * i ) #define ANN_Y( i ) ( 1 + 3 * ( LCD_MAG - 1 ) ) - -ann_data[ N_ANN ] = { +static /*const*/ struct { + int mask; /* Bit mask */ + int x, y; /* Position */ + int w, h; /* Width, Height */ + unsigned char bitmap_data[ 24 ]; /* Bitmap data */ +} ann_data[ N_ANN ] = { {MASK_ANN_LEFT, ANN_X( 0 ), ANN_Y( 0 ), 15, 12, { 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78, 0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 } }, {MASK_ANN_RIGHT, ANN_X( 1 ), ANN_Y( 1 ), 15, 12, { 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60, @@ -256,8 +253,8 @@ static void InitPixmaps( void ) /* Initialize nibble_pixmap */ for ( i = 0; i < NIBBLE_VALUES; i++ ) { - if ( ( nibble_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, nibble_bitmap_data[ i ], 4 * LCD_MAG, LCD_MAG, fg_pixel, - bg_pixel, depth ) ) == None ) { + if ( ( nibble_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, ( char* )nibble_bitmap_data[ i ], 4 * LCD_MAG, LCD_MAG, + fg_pixel, bg_pixel, depth ) ) == None ) { ChfCondition X11_F_X_ERROR, CHF_FATAL ChfEnd; ChfSignal(); } @@ -265,8 +262,8 @@ static void InitPixmaps( void ) /* Initialize ann_pixmap */ for ( i = 0; i < N_ANN; i++ ) { - if ( ( ann_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, ann_data[ i ].bitmap_data, ann_data[ i ].w, ann_data[ i ].h, - fg_pixel, bg_pixel, depth ) ) == None ) { + if ( ( ann_pixmap[ i ] = XCreatePixmapFromBitmapData( display, window, ( char* )ann_data[ i ].bitmap_data, ann_data[ i ].w, + ann_data[ i ].h, fg_pixel, bg_pixel, depth ) ) == None ) { ChfCondition X11_F_X_ERROR, CHF_FATAL ChfEnd; ChfSignal(); } @@ -480,6 +477,7 @@ void DrawLcd( void ) v = FetchNibble( addr++ ); if ( v != lcd_buffer[ y ][ x ] ) { lcd_buffer[ y ][ x ] = v; + XCopyArea( display, nibble_pixmap[ ( int )v ], window, gc, 0, 0, /* src_x, src_y */ 4 * LCD_MAG, LCD_MAG, /* width, height */ x * 4 * LCD_MAG + LCD_X_ORIGIN, y * LCD_MAG + LCD_Y_ORIGIN ); diff --git a/src/emulator.c b/src/emulator.c index b50b597..0c1e524 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -195,7 +195,7 @@ static void EmulatorLoop( void ) /* T2 update */ if ( mod_status.hdw.t2_ctrl & T2_CTRL_TRUN ) { - if ( --mod_status.hdw.t2_val == 0xFFFFFFFF ) { + if ( --mod_status.hdw.t2_val == ( int )0xFFFFFFFF ) { debug1( DEBUG_C_TIMERS, CPU_I_TIMER2_EX, mod_status.hdw.t2_ctrl ); mod_status.hdw.t2_ctrl |= T2_CTRL_SREQ; diff --git a/src/hdw.c b/src/hdw.c index 1794f77..c10da7e 100644 --- a/src/hdw.c +++ b/src/hdw.c @@ -505,6 +505,7 @@ void HdwWrite( Address rel_address, Nibble data ) case 0x29: /* LCD vertical line count (higher 2 bits), others (TBD) */ mod_status.hdw.lcd_vlc &= 0x0F; mod_status.hdw.lcd_vlc |= ( ( ( int )data & 0x03 ) << 4 ); + break; case 0x2E: /* Timer 1 Control */ mod_status.hdw.t1_ctrl = data; diff --git a/src/hw_config.c b/src/hw_config.c index 030131b..5059466 100644 --- a/src/hw_config.c +++ b/src/hw_config.c @@ -155,145 +155,24 @@ static const struct { ModDescription description; } table[] = { {"hp48", - { { - "ROM (ROM)", - 0x00, - 0, - RomInit, - RomSave, - RomRead, - RomWrite, - MOD_CONFIGURED, - 0x00000, - 0xFFFFF, - }, - { - "Hardware Regs. (HDW)", - 0x19, - 5, - HdwInit, - HdwSave, - HdwRead, - HdwWrite, - MOD_SIZE_CONFIGURED, - 0x00000, - 0x00040, - }, - { - "Internal RAM (RAM)", - 0x03, - 4, - RamInit, - RamSave, - RamRead, - RamWrite, - MOD_UNCONFIGURED, - 0, - 0, - }, - { - "Bank Select (CE1)", - 0x05, - 2, - Ce1Init, - Ce1Save, - Ce1Read, - Ce1Write, - MOD_UNCONFIGURED, - 0, - 0, - }, - { - "Port 1 Control (CE2)", - 0x07, - 3, - Ce2Init, - Ce2Save, - Ce2Read, - Ce2Write, - MOD_UNCONFIGURED, - 0, - 0, - }, - { - "Port 2 Control (NCE3)", - 0x01, - 1, - NCe3Init, - NCe3Save, - NCe3Read, - NCe3Write, - MOD_UNCONFIGURED, - 0, - 0, - } } }, + { { "ROM (ROM)", 0x00, 0, RomInit, RomSave, RomRead, RomWrite, MOD_CONFIGURED, 0x00000, 0xFFFFF, 0 }, + { "Hardware Regs. (HDW)", 0x19, 5, HdwInit, HdwSave, HdwRead, HdwWrite, MOD_SIZE_CONFIGURED, 0x00000, 0x00040, 0 }, + { "Internal RAM (RAM)", 0x03, 4, RamInit, RamSave, RamRead, RamWrite, MOD_UNCONFIGURED, 0, 0, 0 }, + { "Bank Select (CE1)", 0x05, 2, Ce1Init, Ce1Save, Ce1Read, Ce1Write, MOD_UNCONFIGURED, 0, 0, 0 }, + { "Port 1 Control (CE2)", 0x07, 3, Ce2Init, Ce2Save, Ce2Read, Ce2Write, MOD_UNCONFIGURED, 0, 0, 0 }, + { "Port 2 Control (NCE3)", 0x01, 1, NCe3Init, NCe3Save, NCe3Read, NCe3Write, MOD_UNCONFIGURED, 0, 0, 0 } }}, {"hp49", - { { - "ROM (ROM)", - 0x00, - 0, - RomInit49, - RomSave49, - RomRead49, - RomWrite49, - MOD_CONFIGURED, - 0x00000, - 0xFFFFF, - }, - { - "Hardware Regs. (HDW)", - 0x19, - 5, - HdwInit, - HdwSave, - HdwRead, - HdwWrite, - MOD_SIZE_CONFIGURED, - 0x00000, - 0x00040, - }, - { - "IRAM (RAM)", - 0x03, - 4, - RamInit49, - RamSave49, - RamRead49, - RamWrite49, - MOD_UNCONFIGURED, - 0, - 0, - }, - { - "Bank Select (CE1)", - 0x05, - 2, - Ce1Init49, - Ce1Save49, - Ce1Read49, - Ce1Write49, - MOD_UNCONFIGURED, - 0, - 0, - }, - { - "ERAM Bank 0 (CE2)", - 0x07, - 3, - Ce2Init49, - Ce2Save49, - Ce2Read49, - Ce2Write49, - MOD_UNCONFIGURED, - 0, - 0, - }, + { { "ROM (ROM)", 0x00, 0, RomInit49, RomSave49, RomRead49, RomWrite49, MOD_CONFIGURED, 0x00000, 0xFFFFF, 0 }, + { "Hardware Regs. (HDW)", 0x19, 5, HdwInit, HdwSave, HdwRead, HdwWrite, MOD_SIZE_CONFIGURED, 0x00000, 0x00040, 0 }, + { "IRAM (RAM)", 0x03, 4, RamInit49, RamSave49, RamRead49, RamWrite49, MOD_UNCONFIGURED, 0, 0, 0 }, + { "Bank Select (CE1)", 0x05, 2, Ce1Init49, Ce1Save49, Ce1Read49, Ce1Write49, MOD_UNCONFIGURED, 0, 0, 0 }, + { "ERAM Bank 0 (CE2)", 0x07, 3, Ce2Init49, Ce2Save49, Ce2Read49, Ce2Write49, MOD_UNCONFIGURED, 0, 0, 0 }, { "ERAM Bank 1 (NCE3)", 0x01, 1, NCe3Init49, NCe3Save49, NCe3Read49, NCe3Write49, MOD_UNCONFIGURED, 0, 0, - MOD_MAP_FLAGS_ABS } }} + MOD_MAP_FLAGS_ABS } } } }; -#define N_DESCRIPTIONS ( sizeof( table ) / sizeof( table[ 0 ] ) ) +#define N_DESCRIPTIONS ( int )( sizeof( table ) / sizeof( table[ 0 ] ) ) /*--------------------------------------------------------------------------- Public functions diff --git a/src/keyb.c b/src/keyb.c index 0a315a8..9beb030 100644 --- a/src/keyb.c +++ b/src/keyb.c @@ -219,14 +219,14 @@ void KeybPress( const char* key ) /* Post an interrupt request to the CPU */ CpuIntRequest( INT_REQUEST_NMI ); } else { - int in_val, out_bit; + unsigned int in_val, out_bit; if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) { ChfCondition MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd; ChfSignal(); - } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { - ChfCondition MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; - ChfSignal(); + /* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */ + /* ChfCondition MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */ + /* ChfSignal(); */ } else { /* Update the cur_in array */ cur_in[ out_bit ] |= in_val; @@ -271,14 +271,14 @@ void KeybRelease( const char* key ) for ( i = 0; i < OUT_BITS; i++ ) cur_in[ i ] &= 0x7FFF; } else { - int in_val, out_bit; + unsigned int in_val, out_bit; if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) { ChfCondition MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd; ChfSignal(); - } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { - ChfCondition MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; - ChfSignal(); + /* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */ + /* ChfCondition MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */ + /* ChfSignal(); */ } else { /* Update the cur_in array */ cur_in[ out_bit ] &= ~in_val; diff --git a/src/main.c b/src/main.c index bc8111b..6352183 100644 --- a/src/main.c +++ b/src/main.c @@ -113,6 +113,7 @@ static char rcs_id[] = "$Id: saturn.c,v 4.1 2000/12/11 09:54:19 cibrario Rel $"; #include "serial.h" #include "args.h" #include "debug.h" +#include "monitor.h" /* Chf condition codes (main program only) */ @@ -253,7 +254,7 @@ int main( int argc, char* argv[] ) /* 3.9: Print out MAIN_M_COPYRIGHT and MAIN_M_LICENSE on stdout now */ fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, "" ), "$Revision: 4.1 $" ); - fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); + /* fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); */ /* Initialize GUI and associated lcd display emulation module */ InitializeGui( argc, argv ); @@ -277,11 +278,10 @@ int main( int argc, char* argv[] ) ChfSignal(); } - if ( args.monitor ) { + if ( args.monitor ) /* Invoke Monitor */ - void Monitor( void ); Monitor(); - } else + else /* Call Emulator directly */ Emulator(); diff --git a/src/monitor.c b/src/monitor.c index 6fe41f9..a9d77cb 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -108,7 +108,7 @@ static char rcs_id[] = "$Id: monitor.c,v 4.1 2000/12/11 09:54:19 cibrario Rel $" static int ReadHexAddress( Address* addr ) { char* p = strtok( ( char* )NULL, TOK_DELIMITERS ); - return ( p == ( char* )NULL || sscanf( p, ADDRESS_FMT, addr ) != 1 ) ? FAILED : OK; + return ( p == ( char* )NULL || sscanf( p, ADDRESS_FMT, ( unsigned int* )addr ) != 1 ) ? FAILED : OK; } /* Read a Nibble from the command line */ @@ -288,7 +288,7 @@ static const struct TEntry table[] = { static int InvokeCommand( char* tk ) { int i; - for ( i = 0; i < TableSize( table ) && strcmp( tk, table[ i ].name ); i++ ) + for ( i = 0; i < ( int )TableSize( table ) && strcmp( tk, table[ i ].name ); i++ ) ; return i == TableSize( table ) ? FAILED : table[ i ].function(); } @@ -297,7 +297,7 @@ static int InvokeCommand( char* tk ) static int Help( void ) { int i; - for ( i = 0; i < TableSize( table ); i++ ) + for ( i = 0; i < ( int )TableSize( table ); i++ ) printf( "%s\t\t%s\n", table[ i ].name, table[ i ].desc ); return OK; diff --git a/src/x11.c b/src/x11.c index 2ecd664..3adb90a 100644 --- a/src/x11.c +++ b/src/x11.c @@ -250,19 +250,19 @@ static FsbContinuation fsb_cont = ( FsbContinuation )NULL; */ static XrmOptionDescRec options[] = { /* option, specifier, argKind, value */ - { "-reset", "*reset", XrmoptionNoArg, "True" }, - { "-monitor", "*monitor", XrmoptionNoArg, "True" }, - { "-batchXfer", "*batchXfer", XrmoptionNoArg, "True" }, - { "-stateDir", "*stateDir", XrmoptionSepArg }, - { "-cpu", "*cpu", XrmoptionSepArg }, - { "-mod", "*mod", XrmoptionSepArg }, - { "-hdw", "*hdw", XrmoptionSepArg }, - { "-rom", "*rom", XrmoptionSepArg }, - { "-ram", "*ram", XrmoptionSepArg }, - { "-port1", "*port1", XrmoptionSepArg }, - { "-port2", "*port2", XrmoptionSepArg }, - { "-face", "*face", XrmoptionSepArg }, - { "-hw", "*hw", XrmoptionSepArg } + {"-reset", "*reset", XrmoptionNoArg, "True"}, + {"-monitor", "*monitor", XrmoptionNoArg, "True"}, + {"-batchXfer", "*batchXfer", XrmoptionNoArg, "True"}, + {"-stateDir", "*stateDir", XrmoptionSepArg, 0 }, + {"-cpu", "*cpu", XrmoptionSepArg, 0 }, + {"-mod", "*mod", XrmoptionSepArg, 0 }, + {"-hdw", "*hdw", XrmoptionSepArg, 0 }, + {"-rom", "*rom", XrmoptionSepArg, 0 }, + {"-ram", "*ram", XrmoptionSepArg, 0 }, + {"-port1", "*port1", XrmoptionSepArg, 0 }, + {"-port2", "*port2", XrmoptionSepArg, 0 }, + {"-face", "*face", XrmoptionSepArg, 0 }, + {"-hw", "*hw", XrmoptionSepArg, 0 } }; #define NUM_OPTIONS XtNumber( options ) @@ -1060,7 +1060,7 @@ static void CheckCompoundString( Widget w ) */ static Widget CreateKey( int k, Widget parent ) { - char container_name[ 8 ]; + char container_name[ 12 ]; Widget w, l, b; XtTranslations t; struct btn_opt opt; @@ -1409,7 +1409,7 @@ static void ResetToggleButtons( Widget w ) debug1( DEBUG_C_TRACE | DEBUG_C_X11, X11_I_HIER_NC, num_children ); - for ( c = 0; c < num_children; c++ ) + for ( c = 0; c < ( int )num_children; c++ ) ResetToggleButtons( children[ c ] ); } } diff --git a/src/x_func.c b/src/x_func.c index 82c1966..781a807 100644 --- a/src/x_func.c +++ b/src/x_func.c @@ -207,7 +207,7 @@ static const struct BinHdrMapping bin_hdr_mapping[] = { {"hp49", "HPHP49-?"} }; -#define N_BIN_HDR_MAPPING ( sizeof( bin_hdr_mapping ) / sizeof( bin_hdr_mapping[ 0 ] ) ) +#define N_BIN_HDR_MAPPING ( int )( sizeof( bin_hdr_mapping ) / sizeof( bin_hdr_mapping[ 0 ] ) ) /* Return the header of binary files for current hw configuration; return NULL if the header cannot be determined. In the latter case, @@ -399,7 +399,7 @@ static const XFunc function[] = { Send /* 2 */ }; -#define N_X_FUNC ( sizeof( function ) / sizeof( function[ 0 ] ) ) +#define N_X_FUNC ( int )( sizeof( function ) / sizeof( function[ 0 ] ) ) /*--------------------------------------------------------------------------- Public functions