add and use .clang-format

This commit is contained in:
Gwenhael Le Moine 2023-04-27 12:15:59 +02:00
parent 4c454f9783
commit 4d8afad2c4
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
45 changed files with 17053 additions and 16385 deletions

18
.clang-format Normal file
View file

@ -0,0 +1,18 @@
---
IndentCaseLabels: 'true'
IndentPPDirectives: None
IndentWidth: '4'
PointerAlignment: Left
SortIncludes: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'true'
SpacesInCStyleCastParentheses: 'true'
SpacesInContainerLiterals: 'true'
SpacesInParentheses: 'true'
SpacesInSquareBrackets: 'true'
...

View file

@ -1,24 +1,15 @@
"*iconic: False",
"*visual: Default",
"*mono: False",
"*gray: False",
"*monoIcon: False",
"*useXShm: True",
"*iconic: False", "*visual: Default",
"*mono: False", "*gray: False",
"*monoIcon: False", "*useXShm: True",
"*smallLabelFont: -*-fixed-bold-r-normal-*-14-*-*-*-*-*-iso8859-1",
"*mediumLabelFont: -*-fixed-bold-r-normal-*-15-*-*-*-*-*-iso8859-1",
"*largeLabelFont: -*-fixed-medium-r-normal-*-20-*-*-*-*-*-iso8859-1",
"*connectionFont: -*-fixed-medium-r-normal-*-12-*-*-*-*-*-iso8859-1",
"*verbose: False",
"*quiet: False",
"*printVersion: False",
"*printCopyright: False",
"*printWarranty: False",
"*useTerminal: True",
"*useSerial: False",
"*serialLine: /dev/ttyS0",
"*completeInitialize: False",
"*resetOnStartup: False",
"*verbose: False", "*quiet: False",
"*printVersion: False", "*printCopyright: False",
"*printWarranty: False", "*useTerminal: True",
"*useSerial: False", "*serialLine: /dev/ttyS0",
"*completeInitialize: False", "*resetOnStartup: False",
"*romFileName: rom.dump",
"*homeDirectory: .hp48",
"*useDebugger: True",
"*homeDirectory: .hp48", "*useDebugger: True",
"*disassemblerMnemonics: class",

View file

@ -96,6 +96,8 @@ extern long nibble_masks[16];
int got_alarm;
int first_press = 1; // PATCH
int conf_bank1 = 0x00000;
int conf_bank2 = 0x00000;
@ -115,6 +117,24 @@ void do_in(void) {
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
// PAS TERRIBLE VISIBLEMENT
if ( saturn.PC == 0x00E31 && !first_press &&
( ( out & 0x10 && in & 0x1 ) || // keys are Backspace
( out & 0x40 && in & 0x7 ) || // right, left & down
( out & 0x80 && in & 0x2 ) ) ) // up arrows
{
for ( i = 0; i < 9; i++ )
if ( out & ( 1 << i ) )
saturn.keybuf.rows[ i ] = 0;
first_press = 1;
} else
first_press = 0;
// FIN PATCH
for ( i = 0; i < 4; i++ ) {
saturn.IN[ i ] = in & 0xf;
in >>= 4;
@ -173,7 +193,9 @@ void set_register_nibble(unsigned char *reg, int n, unsigned char val) {
reg[ n ] = val;
}
unsigned char get_register_nibble(unsigned char *reg, int n) { return reg[n]; }
unsigned char get_register_nibble( unsigned char* reg, int n ) {
return reg[ n ];
}
void set_register_bit( unsigned char* reg, int n ) {
reg[ n / 4 ] |= ( 1 << ( n % 4 ) );
@ -208,8 +230,10 @@ void do_reset(void) {
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]);
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
}
@ -221,7 +245,8 @@ 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);
fprintf( stderr, "PC = %.5lx: RTI SERVICE PENDING INTERRUPT\n",
saturn.PC );
#endif
saturn.int_pending = 0;
saturn.intenable = 0;
@ -316,8 +341,10 @@ void do_unconfigure(void) {
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]);
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
}
@ -335,7 +362,8 @@ void do_configure(void) {
for ( i = 0; i < 6; i++ ) {
if ( saturn.mem_cntl[ i ].unconfigured ) {
saturn.mem_cntl[ i ].unconfigured--;
saturn.mem_cntl[i].config[saturn.mem_cntl[i].unconfigured] = conf;
saturn.mem_cntl[ i ].config[ saturn.mem_cntl[ i ].unconfigured ] =
conf;
break;
}
}
@ -347,14 +375,16 @@ void do_configure(void) {
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]);
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif
}
int get_identification( void ) {
int i;
static int chip_id[] = {0, 0, 0, 0, 0x05, 0xf6, 0x07, 0xf8, 0x01, 0xf2, 0, 0};
static int chip_id[] = { 0, 0, 0, 0, 0x05, 0xf6,
0x07, 0xf8, 0x01, 0xf2, 0, 0 };
int id;
for ( i = 0; i < 6; i++ ) {
@ -375,11 +405,14 @@ int get_identification(void) {
if ( i == 0 )
fprintf( stderr, "MEMORY CONTROLLER %d unconfigured\n", i );
else
fprintf(stderr, "MEMORY CONTROLLER %d configured to ????? %.5lx\n", i,
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]);
fprintf( stderr,
"MEMORY CONTROLLER %d configured to %.5lx, %.5lx\n", i,
saturn.mem_cntl[ i ].config[ 0 ],
saturn.mem_cntl[ i ].config[ 1 ] );
}
#endif

View file

@ -46,115 +46,115 @@
#define menu_label_width 24
#define menu_label_height 11
static unsigned char menu_label_bits[] = {
0xfe, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x7f};
0xfe, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x7f };
#define up_width 11
#define up_height 11
static unsigned char up_bits[] = {
0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8, 0x00,
0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07};
0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8,
0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07 };
#define down_width 11
#define down_height 11
static unsigned char down_bits[] = {
0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8, 0x00,
0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00};
0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8,
0x00, 0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00 };
#define left_width 11
#define left_height 11
static unsigned char left_bits[] = {
0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff, 0x07,
0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04};
0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff,
0x07, 0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04 };
#define right_width 11
#define right_height 11
static unsigned char right_bits[] = {
0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07,
0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00};
0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff,
0x07, 0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00 };
#define sqrt_width 20
#define sqrt_height 11
static unsigned char sqrt_bits[] = {
0x00, 0xff, 0x0f, 0x00, 0x01, 0x08, 0x00, 0x01, 0x08, 0x80, 0x8c, 0x01,
0x80, 0x58, 0x01, 0x80, 0x38, 0x00, 0x47, 0x30, 0x00, 0x4c, 0x30, 0x00,
0x58, 0x78, 0x00, 0x30, 0x6a, 0x01, 0x20, 0xc6, 0x00};
0x00, 0xff, 0x0f, 0x00, 0x01, 0x08, 0x00, 0x01, 0x08, 0x80, 0x8c,
0x01, 0x80, 0x58, 0x01, 0x80, 0x38, 0x00, 0x47, 0x30, 0x00, 0x4c,
0x30, 0x00, 0x58, 0x78, 0x00, 0x30, 0x6a, 0x01, 0x20, 0xc6, 0x00 };
#define power_width 17
#define power_height 14
static unsigned char power_bits[] = {
0x00, 0x8c, 0x01, 0x00, 0x58, 0x01, 0x00, 0x38, 0x00, 0xc8, 0x30, 0x00,
0x9c, 0x30, 0x00, 0x98, 0x78, 0x00, 0x58, 0x6a, 0x01, 0x58, 0xc6, 0x00,
0x38, 0x00, 0x00, 0x30, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00,
0x05, 0x00, 0x00, 0x03, 0x00, 0x00};
0x00, 0x8c, 0x01, 0x00, 0x58, 0x01, 0x00, 0x38, 0x00, 0xc8, 0x30,
0x00, 0x9c, 0x30, 0x00, 0x98, 0x78, 0x00, 0x58, 0x6a, 0x01, 0x58,
0xc6, 0x00, 0x38, 0x00, 0x00, 0x30, 0x00, 0x00, 0x10, 0x00, 0x00,
0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00 };
#define inv_width 18
#define inv_height 13
static unsigned char inv_bits[] = {
0x0c, 0x04, 0x00, 0x0f, 0x06, 0x00, 0x0c, 0x02, 0x00, 0x0c, 0x03, 0x00,
0x0c, 0x01, 0x00, 0x8c, 0x19, 0x03, 0x8c, 0xb0, 0x02, 0xcc, 0x70, 0x00,
0x40, 0x60, 0x00, 0x60, 0x60, 0x00, 0x20, 0xf0, 0x00, 0x30, 0xd4, 0x02,
0x10, 0x8c, 0x01};
0x0c, 0x04, 0x00, 0x0f, 0x06, 0x00, 0x0c, 0x02, 0x00, 0x0c,
0x03, 0x00, 0x0c, 0x01, 0x00, 0x8c, 0x19, 0x03, 0x8c, 0xb0,
0x02, 0xcc, 0x70, 0x00, 0x40, 0x60, 0x00, 0x60, 0x60, 0x00,
0x20, 0xf0, 0x00, 0x30, 0xd4, 0x02, 0x10, 0x8c, 0x01 };
#define neg_width 21
#define neg_height 11
static unsigned char neg_bits[] = {
0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x18, 0x30, 0x00, 0xff, 0x18, 0x00,
0xff, 0x18, 0x00, 0x18, 0x0c, 0x00, 0x18, 0x0c, 0x00, 0x18, 0xc6, 0x1f,
0x00, 0xc6, 0x1f, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00};
0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x18, 0x30, 0x00, 0xff, 0x18,
0x00, 0xff, 0x18, 0x00, 0x18, 0x0c, 0x00, 0x18, 0x0c, 0x00, 0x18,
0xc6, 0x1f, 0x00, 0xc6, 0x1f, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00 };
#define bs_width 11
#define bs_height 11
static unsigned char bs_bits[] = {
0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff, 0x07,
0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00};
0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff,
0x07, 0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00 };
#define alpha_width 12
#define alpha_height 10
static unsigned char alpha_bits[] = {
0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83, 0x05, 0x83, 0x05, 0x83, 0x03,
0x83, 0x01, 0x83, 0x01, 0x46, 0x09, 0x3c, 0x06};
static unsigned char alpha_bits[] = { 0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83,
0x05, 0x83, 0x05, 0x83, 0x03, 0x83, 0x01,
0x83, 0x01, 0x46, 0x09, 0x3c, 0x06 };
#define div_width 10
#define div_height 10
static unsigned char div_bits[] = {
0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00};
static unsigned char div_bits[] = { 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x03, 0xff, 0x03, 0x00, 0x00,
0x00, 0x00, 0x30, 0x00, 0x30, 0x00 };
#define shl_width 24
#define shl_height 14
static unsigned char shl_bits[] = {
0xfe, 0xff, 0x7f, 0xff, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x3f, 0xfe, 0xff,
0x1f, 0xff, 0xff, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xf8, 0x0f, 0x00, 0xf0,
0x1f, 0xff, 0xf1, 0x3f, 0xfe, 0xf1, 0x7f, 0xfc, 0xf1, 0xff, 0xfc, 0xf1,
0xff, 0xff, 0xf1, 0xfe, 0xff, 0x71};
0xfe, 0xff, 0x7f, 0xff, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x3f, 0xfe,
0xff, 0x1f, 0xff, 0xff, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xf8, 0x0f,
0x00, 0xf0, 0x1f, 0xff, 0xf1, 0x3f, 0xfe, 0xf1, 0x7f, 0xfc, 0xf1,
0xff, 0xfc, 0xf1, 0xff, 0xff, 0xf1, 0xfe, 0xff, 0x71 };
#define mul_width 10
#define mul_height 10
static unsigned char mul_bits[] = {
0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00, 0x78, 0x00,
0xfc, 0x00, 0xce, 0x01, 0x87, 0x03, 0x03, 0x03};
static unsigned char mul_bits[] = { 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc,
0x00, 0x78, 0x00, 0x78, 0x00, 0xfc, 0x00,
0xce, 0x01, 0x87, 0x03, 0x03, 0x03 };
#define shr_width 24
#define shr_height 14
static unsigned char shr_bits[] = {
0xfe, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x7f, 0xfc,
0xff, 0xff, 0xf8, 0x3f, 0x00, 0xf0, 0x1f, 0x00, 0xe0, 0x0f, 0x00, 0xf0,
0x8f, 0xff, 0xf8, 0x8f, 0x7f, 0xfc, 0x8f, 0x3f, 0xfe, 0x8f, 0x3f, 0xff,
0x8f, 0xff, 0xff, 0x8e, 0xff, 0x7f};
0xfe, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x7f,
0xfc, 0xff, 0xff, 0xf8, 0x3f, 0x00, 0xf0, 0x1f, 0x00, 0xe0, 0x0f,
0x00, 0xf0, 0x8f, 0xff, 0xf8, 0x8f, 0x7f, 0xfc, 0x8f, 0x3f, 0xfe,
0x8f, 0x3f, 0xff, 0x8f, 0xff, 0xff, 0x8e, 0xff, 0x7f };
#define minus_width 10
#define minus_height 10
static unsigned char minus_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char minus_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x03, 0xff, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define plus_width 10
#define plus_height 10
static unsigned char plus_bits[] = {
0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xff, 0x03, 0xff, 0x03,
0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00};
static unsigned char plus_bits[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30,
0x00, 0xff, 0x03, 0xff, 0x03, 0x30, 0x00,
0x30, 0x00, 0x30, 0x00, 0x30, 0x00 };
#define last_width 120
#define last_height 6
@ -170,7 +170,7 @@ static unsigned char last_bits[] = {
#define colon_width 2
#define colon_height 10
static unsigned char colon_bits[] = {
0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char colon_bits[] = { 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00 };
#endif /* !_BUTTONS_H */

View file

@ -51,7 +51,8 @@ unsigned short rom_crc, crc;
int verbose = 0;
char* progname;
#define calc_crc(n) (crc = ((crc >> 4) ^ (((crc ^ n) & 0xf) * 0x1081)))
#define calc_crc( n ) \
( crc = ( ( crc >> 4 ) ^ ( ( ( crc ^ n ) & 0xf ) * 0x1081 ) ) )
int main( int argc, char** argv ) {
unsigned char version[ 7 ];
@ -65,7 +66,8 @@ int main(int argc, char **argv) {
}
if ( !read_rom_file( argv[ 1 ], &rom, &rom_size ) ) {
fprintf(stderr, "%s: can\'t read ROM from %s\n", argv[0], argv[1]);
fprintf( stderr, "%s: can\'t read ROM from %s\n", argv[ 0 ],
argv[ 1 ] );
exit( 1 );
}

View file

@ -219,15 +219,18 @@ int check_breakpoint(int type, word_20 addr) {
if ( bp->flags == 0 )
continue;
n--;
if (bp->flags & BP_RANGE && addr >= bp->addr && addr <= bp->end_addr) {
if ( bp->flags & BP_RANGE && addr >= bp->addr &&
addr <= bp->end_addr ) {
goto hit_it;
}
if ( bp->flags & type && addr == bp->addr ) {
hit_it:
if ( type == BP_READ ) {
printf("%.5lX: Read watchpoint %d hit at %.5lX\n", saturn.PC, i, addr);
printf( "%.5lX: Read watchpoint %d hit at %.5lX\n", saturn.PC,
i, addr );
} else if ( type == BP_WRITE ) {
printf("%.5lX: Write watchpoint %d hit at %.5lX\n", saturn.PC, i, addr);
printf( "%.5lX: Write watchpoint %d hit at %.5lX\n", saturn.PC,
i, addr );
} else {
printf( "Breakpoint %d hit at %.5lX\n", i, addr );
}
@ -442,7 +445,8 @@ static int confirm(const char *prompt) {
printf( "%s (y or n) ", prompt );
fflush( stdout );
read_str( ans, sizeof( ans ), 0 );
while (ans[0] != 'y' && ans[0] != 'Y' && ans[0] != 'n' && ans[0] != 'N') {
while ( ans[ 0 ] != 'y' && ans[ 0 ] != 'Y' && ans[ 0 ] != 'n' &&
ans[ 0 ] != 'N' ) {
printf( "Please answer y or n.\n" );
printf( "%s (y or n) ", prompt );
fflush( stdout );
@ -465,12 +469,14 @@ static void do_break(int argc, char **argv) {
if ( bkpt_tbl[ i ].flags == 0 )
continue;
if ( bkpt_tbl[ i ].flags == BP_EXEC ) {
printf("Breakpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[i].addr);
printf( "Breakpoint %d at 0x%.5lX\n", i + 1,
bkpt_tbl[ i ].addr );
} else if ( bkpt_tbl[ i ].flags == BP_RANGE ) {
printf( "Range watchpoint %d at 0x%.5lX - 0x%.5lX\n", i + 1,
bkpt_tbl[ i ].addr, bkpt_tbl[ i ].end_addr );
} else {
printf("Watchpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[i].addr);
printf( "Watchpoint %d at 0x%.5lX\n", i + 1,
bkpt_tbl[ i ].addr );
}
}
} else {
@ -482,7 +488,8 @@ static void do_break(int argc, char **argv) {
if ( bkpt_tbl[ i ].flags == 0 ) {
bkpt_tbl[ i ].flags = BP_EXEC;
bkpt_tbl[ i ].addr = addr;
printf("Breakpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[i].addr);
printf( "Breakpoint %d at 0x%.5lX\n", i + 1,
bkpt_tbl[ i ].addr );
num_bkpts++;
return;
}
@ -503,8 +510,10 @@ static void do_delete(int argc, char **argv) {
printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[ num ].addr );
} else if ( bkpt_tbl[ num ].flags == BP_RANGE ) {
printf("Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[num].addr, bkpt_tbl[num].end_addr);
printf(
"Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n",
num + 1, bkpt_tbl[ num ].addr,
bkpt_tbl[ num ].end_addr );
} else if ( bkpt_tbl[ num ].flags ) {
printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[ num ].addr );
@ -534,8 +543,10 @@ static void do_delete(int argc, char **argv) {
printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[ num ].addr );
} else if ( bkpt_tbl[ num ].flags == BP_RANGE ) {
printf("Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[num].addr, bkpt_tbl[num].end_addr);
printf(
"Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n",
num + 1, bkpt_tbl[ num ].addr,
bkpt_tbl[ num ].end_addr );
} else if ( bkpt_tbl[ num ].flags ) {
printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1,
bkpt_tbl[ num ].addr );
@ -627,7 +638,8 @@ static void do_load(int argc, char **argv) {
static void do_mode( int argc, char** argv ) {
if ( argc < 2 ) {
printf("Disassembler uses %s mnemonics.\n", mode_name[disassembler_mode]);
printf( "Disassembler uses %s mnemonics.\n",
mode_name[ disassembler_mode ] );
} else {
str_to_upper( argv[ 1 ] );
if ( !strcmp( "HP", argv[ 1 ] ) ) {
@ -635,7 +647,8 @@ static void do_mode(int argc, char **argv) {
} else if ( !strcmp( "CLASS", argv[ 1 ] ) ) {
disassembler_mode = CLASS_MNEMONICS;
} else {
printf("Unknown disassembler mode %s. Try \"help\".\n", argv[1]);
printf( "Unknown disassembler mode %s. Try \"help\".\n",
argv[ 1 ] );
}
}
}
@ -654,9 +667,11 @@ static void set_reg(word_64 val, int n, unsigned char *r) {
for ( i = 0; i < n; i++ ) {
#ifdef SIMPLE_64
r[i] = (unsigned char)((val & (0xf << (4 * i))) >> (4 * i));
r[ i ] =
( unsigned char )( ( val & ( 0xf << ( 4 * i ) ) ) >> ( 4 * i ) );
#else
r[i] = (unsigned char)(((i < 8 ? val.lo : val.hi) & (0xf << (4 * i))) >>
r[ i ] = ( unsigned char )( ( ( i < 8 ? val.lo : val.hi ) &
( 0xf << ( 4 * i ) ) ) >>
( 4 * i ) );
#endif
}
@ -762,10 +777,13 @@ static void do_ram(int argc, char **argv) {
if ( saturn.mem_cntl[ i ].unconfigured )
printf( "unconfigured\n" );
else if ( i == 0 )
printf("configured to 0x%.5lx\n", saturn.mem_cntl[i].config[0]);
printf( "configured to 0x%.5lx\n",
saturn.mem_cntl[ i ].config[ 0 ] );
else
printf("configured to 0x%.5lX - 0x%.5lX\n", saturn.mem_cntl[i].config[0],
(saturn.mem_cntl[i].config[0] | ~saturn.mem_cntl[i].config[1]) &
printf( "configured to 0x%.5lX - 0x%.5lX\n",
saturn.mem_cntl[ i ].config[ 0 ],
( saturn.mem_cntl[ i ].config[ 0 ] |
~saturn.mem_cntl[ i ].config[ 1 ] ) &
0xfffff );
}
if ( opt_gx )
@ -1221,7 +1239,8 @@ int debug(void) {
exit_x48( 1 );
if ( enter_debugger & BREAKPOINT_HIT )
if ( verbose )
printf("%s: breakpoint hit at 0x%.5lX ignored\n", progname, saturn.PC);
printf( "%s: breakpoint hit at 0x%.5lX ignored\n", progname,
saturn.PC );
if ( enter_debugger & TRAP_INSTRUCTION )
if ( verbose )
printf( "%s: trap instruction at 0x%.5lX ignored\n", progname,

View file

@ -552,7 +552,8 @@ char *disasm_1(word_20 *addr, char *out) {
fn = read_nibble( ( *addr )++ );
switch ( disassembler_mode ) {
case HP_MNEMONICS:
p = append_str(out, op_str_1[(fn & 7) + 8 * disassembler_mode]);
p = append_str(
out, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] );
p = append_tab( out );
if ( n == 4 ) {
p = append_str( p, ( fn < 8 ) ? "A" : "B" );
@ -581,7 +582,8 @@ char *disasm_1(word_20 *addr, char *out) {
}
}
p = append_tab( out );
p = append_str(p, op_str_1[(fn & 7) + 8 * disassembler_mode]);
p = append_str(
p, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -697,7 +699,8 @@ char *disasm_8(word_20 *addr, char *out) {
switch ( n ) {
case 8:
fn = read_nibble( ( *addr )++ );
if (NULL != (p = in_str_808[fn + 16 * disassembler_mode])) {
if ( NULL !=
( p = in_str_808[ fn + 16 * disassembler_mode ] ) ) {
p = append_str( out, p );
return p;
}
@ -713,7 +716,8 @@ char *disasm_8(word_20 *addr, char *out) {
p = append_str( out, "rsi" );
break;
default:
p = append_str(out, "Unknown disassembler mode");
p = append_str(
out, "Unknown disassembler mode" );
break;
}
}
@ -740,7 +744,8 @@ char *disasm_8(word_20 *addr, char *out) {
p = append_str( p, buf );
break;
default:
p = append_str(out, "Unknown disassembler mode");
p = append_str(
out, "Unknown disassembler mode" );
break;
}
break;
@ -752,19 +757,24 @@ char *disasm_8(word_20 *addr, char *out) {
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%cBIT=%d", (fn & 8) ? 'C' : 'A', (fn & 1) ? 1 : 0);
sprintf( buf, "%cBIT=%d",
( fn & 8 ) ? 'C' : 'A',
( fn & 1 ) ? 1 : 0 );
p = append_str( out, buf );
p = append_tab( out );
p = append_imm_nibble( p, addr, 1 );
break;
case CLASS_MNEMONICS:
p = append_str(out, (fn & 1) ? "bset" : "bclr");
p = append_str( out, ( fn & 1 ) ? "bset"
: "bclr" );
p = append_tab( out );
p = append_imm_nibble( p, addr, 1 );
p = append_str(p, (fn & 8) ? ", c" : ", a");
p = append_str( p, ( fn & 8 ) ? ", c"
: ", a" );
break;
default:
p = append_str(out, "Unknown disassembler mode");
p = append_str(
out, "Unknown disassembler mode" );
break;
}
break;
@ -781,7 +791,8 @@ char *disasm_8(word_20 *addr, char *out) {
switch ( disassembler_mode ) {
case HP_MNEMONICS:
c = ( char )( ( fn < 0xa ) ? 'A' : 'C' );
sprintf(buf, "?%cBIT=%d", c, (fn & 1) ? 1 : 0);
sprintf( buf, "?%cBIT=%d", c,
( fn & 1 ) ? 1 : 0 );
p = append_str( out, buf );
p = append_tab( out );
sprintf( buf, "%d", n );
@ -795,8 +806,10 @@ char *disasm_8(word_20 *addr, char *out) {
break;
case CLASS_MNEMONICS:
c = ( char )( ( fn < 0xa ) ? 'a' : 'c' );
p = append_str(out, (disp == 0) ? "rt" : "b");
p = append_str(p, (fn & 1) ? "bs" : "bc");
p = append_str( out, ( disp == 0 ) ? "rt"
: "b" );
p = append_str( p,
( fn & 1 ) ? "bs" : "bc" );
p = append_tab( out );
sprintf( buf, "#%d, %c", n, c );
p = append_str( p, buf );
@ -807,7 +820,8 @@ char *disasm_8(word_20 *addr, char *out) {
}
break;
default:
p = append_str(out, "Unknown disassembler mode");
p = append_str(
out, "Unknown disassembler mode" );
break;
}
break;
@ -823,7 +837,8 @@ char *disasm_8(word_20 *addr, char *out) {
fn = read_nibble( ( *addr )++ );
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, (n == 0xf) ? "%c%cEX" : "%c=%c", (n == 0xd) ? 'P' : 'C',
sprintf( buf, ( n == 0xf ) ? "%c%cEX" : "%c=%c",
( n == 0xd ) ? 'P' : 'C',
( n == 0xd ) ? 'C' : 'P' );
p = append_str( out, buf );
p = append_tab( out );
@ -831,9 +846,11 @@ char *disasm_8(word_20 *addr, char *out) {
p = append_str( p, buf );
break;
case CLASS_MNEMONICS:
p = append_str(out, (n == 0xf) ? "exg.1" : "move.1");
p = append_str( out,
( n == 0xf ) ? "exg.1" : "move.1" );
p = append_tab( out );
sprintf(buf, (n == 0xd) ? "p, c.%d" : "c.%d, p", fn);
sprintf( buf, ( n == 0xd ) ? "p, c.%d" : "c.%d, p",
fn );
p = append_str( p, buf );
break;
default:
@ -855,14 +872,18 @@ char *disasm_8(word_20 *addr, char *out) {
case 3:
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%sSLC", op_str_81[(n & 3) + 4 * disassembler_mode]);
sprintf( buf, "%sSLC",
op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
p = append_str( out, buf );
break;
case CLASS_MNEMONICS:
p = append_str( out, "rol.w" );
p = append_tab( out );
p = append_str( p, "#4, " );
p = append_str(p, op_str_81[(n & 3) + 4 * disassembler_mode]);
p = append_str(
p, op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -876,14 +897,18 @@ char *disasm_8(word_20 *addr, char *out) {
case 7:
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%sSRC", op_str_81[(n & 3) + 4 * disassembler_mode]);
sprintf( buf, "%sSRC",
op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
p = append_str( out, buf );
break;
case CLASS_MNEMONICS:
p = append_str( out, "ror.w" );
p = append_tab( out );
p = append_str( p, "#4, " );
p = append_str(p, op_str_81[(n & 3) + 4 * disassembler_mode]);
p = append_str(
p, op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -896,7 +921,9 @@ char *disasm_8(word_20 *addr, char *out) {
n = read_nibble( ( *addr )++ );
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%s=%s%cCON", op_str_81[(n & 3) + 4 * disassembler_mode],
sprintf(
buf, "%s=%s%cCON",
op_str_81[ ( n & 3 ) + 4 * disassembler_mode ],
op_str_81[ ( n & 3 ) + 4 * disassembler_mode ],
( n < 8 ) ? '+' : '-' );
p = append_str( out, buf );
@ -913,7 +940,9 @@ char *disasm_8(word_20 *addr, char *out) {
fn = read_nibble( ( *addr )++ );
sprintf( buf, "#%d, ", fn + 1 );
p = append_str( p, buf );
p = append_str(p, op_str_81[(n & 3) + 4 * disassembler_mode]);
p = append_str(
p, op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -924,7 +953,9 @@ char *disasm_8(word_20 *addr, char *out) {
case 9:
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%sSRB.F", op_str_81[(n & 3) + 4 * disassembler_mode]);
sprintf( buf, "%sSRB.F",
op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
p = append_str( out, buf );
p = append_tab( out );
p = append_field( p, read_nibble( ( *addr )++ ) );
@ -934,7 +965,9 @@ char *disasm_8(word_20 *addr, char *out) {
p = append_field( p, read_nibble( ( *addr )++ ) );
p = append_tab( out );
p = append_str( p, "#1, " );
p = append_str(p, op_str_81[(n & 3) + 4 * disassembler_mode]);
p = append_str(
p, op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -953,11 +986,16 @@ char *disasm_8(word_20 *addr, char *out) {
switch ( disassembler_mode ) {
case HP_MNEMONICS:
if ( n == 2 ) {
sprintf(buf, "%cR%dEX.F", ((int)c < 8) ? 'A' : 'C', (int)c & 7);
sprintf( buf, "%cR%dEX.F",
( ( int )c < 8 ) ? 'A' : 'C',
( int )c & 7 );
} else if ( n == 1 ) {
sprintf(buf, "%c=R%d.F", ((int)c < 8) ? 'A' : 'C', (int)c & 7);
sprintf( buf, "%c=R%d.F",
( ( int )c < 8 ) ? 'A' : 'C',
( int )c & 7 );
} else {
sprintf(buf, "R%d=%c.F", (int)c & 7, ((int)c < 8) ? 'A' : 'C');
sprintf( buf, "R%d=%c.F", ( int )c & 7,
( ( int )c < 8 ) ? 'A' : 'C' );
}
p = append_str( out, buf );
p = append_tab( out );
@ -971,10 +1009,12 @@ char *disasm_8(word_20 *addr, char *out) {
sprintf( buf, "r%d", ( int )c & 7 );
p = append_str( p, buf );
} else
p = append_str(p, ((int)c < 8) ? "a" : "c");
p = append_str( p,
( ( int )c < 8 ) ? "a" : "c" );
p = append_str( p, ", " );
if ( n == 1 )
p = append_str(p, ((int)c < 8) ? "a" : "c");
p = append_str( p,
( ( int )c < 8 ) ? "a" : "c" );
else {
sprintf( buf, "r%d", ( int )c & 7 );
p = append_str( p, buf );
@ -991,7 +1031,8 @@ char *disasm_8(word_20 *addr, char *out) {
if ( ( n < 2 ) || ( n > 7 ) )
break;
p = append_str(out, in_str_81b[n + 16 * disassembler_mode]);
p = append_str( out,
in_str_81b[ n + 16 * disassembler_mode ] );
break;
case 0xc:
@ -1000,14 +1041,18 @@ char *disasm_8(word_20 *addr, char *out) {
case 0xf:
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, "%sSRB", op_str_81[(n & 3) + 4 * disassembler_mode]);
sprintf( buf, "%sSRB",
op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
p = append_str( out, buf );
break;
case CLASS_MNEMONICS:
p = append_str( out, "lsr.w" );
p = append_tab( out );
p = append_str( p, "#1, " );
p = append_str(p, op_str_81[(n & 3) + 4 * disassembler_mode]);
p = append_str(
p, op_str_81[ ( n & 3 ) +
4 * disassembler_mode ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -1237,14 +1282,16 @@ word_20 disassemble(word_20 addr, char *out) {
switch ( n = read_nibble( addr++ ) ) {
case 0:
if ( ( n = read_nibble( addr++ ) ) != 0xe ) {
p = append_str(out, opcode_0_tbl[n + 16 * disassembler_mode]);
p = append_str( out,
opcode_0_tbl[ n + 16 * disassembler_mode ] );
break;
}
fn = read_nibble( addr++ );
n = read_nibble( addr++ );
switch ( disassembler_mode ) {
case HP_MNEMONICS:
sprintf(buf, op_str_0[(n & 7) + 8 * HP_MNEMONICS], (n < 8) ? '&' : '!');
sprintf( buf, op_str_0[ ( n & 7 ) + 8 * HP_MNEMONICS ],
( n < 8 ) ? '&' : '!' );
p = append_str( out, buf );
p = append_tab( out );
p = append_field( p, fn );
@ -1253,7 +1300,8 @@ word_20 disassemble(word_20 addr, char *out) {
p = append_str( out, ( n < 8 ) ? "and" : "or" );
p = append_field( p, fn );
p = append_tab( out );
p = append_str(p, op_str_0[(n & 7) + 8 * CLASS_MNEMONICS]);
p = append_str(
p, op_str_0[ ( n & 7 ) + 8 * CLASS_MNEMONICS ] );
break;
default:
p = append_str( out, "Unknown disassembler mode" );
@ -1319,7 +1367,8 @@ word_20 disassemble(word_20 addr, char *out) {
p = append_str( out, "NOP3" );
break;
}
sprintf(buf, (disp == 0) ? "RTN%sC" : "GO%sC", (n == 4) ? "" : "N");
sprintf( buf, ( disp == 0 ) ? "RTN%sC" : "GO%sC",
( n == 4 ) ? "" : "N" );
p = append_str( out, buf );
if ( disp != 0 ) {
p = append_tab( out );
@ -1437,11 +1486,14 @@ word_20 disassemble(word_20 addr, char *out) {
switch ( disassembler_mode ) {
case HP_MNEMONICS:
if ( ( c == 0 ) && ( n >= 8 ) )
sprintf(buf, op_str_9[(n & 3) + 8 * HP_MNEMONICS + 4],
in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]);
sprintf( buf,
op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS + 4 ],
in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c +
8 * HP_MNEMONICS ] );
else
sprintf( buf, op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS ],
in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]);
in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c +
8 * HP_MNEMONICS ] );
p = append_str( out, buf );
p = append_tab( out );
p = append_field( p, fn );
@ -1455,13 +1507,17 @@ word_20 disassemble(word_20 addr, char *out) {
case CLASS_MNEMONICS:
p = append_str( out, ( disp == 0 ) ? "rt" : "b" );
p = append_str(p, in_str_9[((n >> 2) & 3) + 4 * c + 8 * CLASS_MNEMONICS]);
p = append_str( p, in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c +
8 * CLASS_MNEMONICS ] );
p = append_field( p, fn );
p = append_tab( out );
if ( ( c == 0 ) && ( n >= 8 ) )
p = append_str(p, op_str_9[(n & 3) + 8 * CLASS_MNEMONICS + 4]);
p = append_str(
p,
op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS + 4 ] );
else
p = append_str(p, op_str_9[(n & 3) + 8 * CLASS_MNEMONICS]);
p = append_str(
p, op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS ] );
if ( disp != 0 ) {
p = append_str( p, ", " );
p = append_r_addr( p, &pc, disp, 2, 3 );
@ -1652,7 +1708,8 @@ word_20 disassemble(word_20 addr, char *out) {
sprintf( buf, "%c", ( n & 3 ) + 'a' );
p = append_str( p, buf );
} else {
p = append_str(p, op_str_af[n + 16 * CLASS_MNEMONICS]);
p = append_str( p,
op_str_af[ n + 16 * CLASS_MNEMONICS ] );
}
break;

View file

@ -68,7 +68,8 @@ int write_mem_file(char *name, unsigned char *mem, int size) {
return 0;
}
if (NULL == (tmp_mem = (unsigned char *)malloc((size_t)size / 2))) {
if ( NULL ==
( tmp_mem = ( unsigned char* )malloc( ( size_t )size / 2 ) ) ) {
for ( i = 0, j = 0; i < size / 2; i++ ) {
byte = ( mem[ j++ ] & 0x0f );
byte |= ( mem[ j++ ] << 4 ) & 0xf0;
@ -134,7 +135,8 @@ int main(int argc, char **argv) {
} else if ( ch >= 'A' && ch <= 'F' ) {
addr |= ch - 'A' + 10;
} else {
fprintf(stderr, "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch,
addr );
error = 1;
break;
}
@ -148,13 +150,14 @@ int main(int argc, char **argv) {
break;
}
if ( ch != ':' ) {
fprintf(stderr, "%s: Illegal char %c, expected \':\' at %lx\n", argv[0],
ch, addr);
fprintf( stderr, "%s: Illegal char %c, expected \':\' at %lx\n",
argv[ 0 ], ch, addr );
break;
}
for ( i = 0; i < 16; i++ ) {
if ( ( ch = fgetc( dump ) ) < 0 ) {
fprintf(stderr, "%s: Unexpected EOF at %lx\n", argv[0], addr);
fprintf( stderr, "%s: Unexpected EOF at %lx\n", argv[ 0 ],
addr );
error = 1;
break;
}
@ -163,7 +166,8 @@ int main(int argc, char **argv) {
} else if ( ch >= 'A' && ch <= 'F' ) {
core[ addr++ ] = ch - 'A' + 10;
} else {
fprintf(stderr, "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch,
addr );
error = 1;
break;
}
@ -173,8 +177,8 @@ int main(int argc, char **argv) {
if ( ( ch = fgetc( dump ) ) < 0 )
break;
if ( ch != '\n' ) {
fprintf(stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n", argv[0],
ch, addr);
fprintf( stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n",
argv[ 0 ], ch, addr );
break;
}
}
@ -187,7 +191,8 @@ int main(int argc, char **argv) {
else
size = 0x80000;
if ( !write_mem_file( DEFAULT_ROM_FILE, core, size ) ) {
fprintf(stderr, "%s: can\'t write to %s\n", argv[0], DEFAULT_ROM_FILE);
fprintf( stderr, "%s: can\'t write to %s\n", argv[ 0 ],
DEFAULT_ROM_FILE );
exit( 1 );
}

View file

@ -209,7 +209,8 @@ int decode_group_80(void) {
t = 0;
else
t = 1;
saturn.CARRY = (get_register_bit(REG, op5) == t) ? 1 : 0;
saturn.CARRY =
( get_register_bit( REG, op5 ) == t ) ? 1 : 0;
if ( saturn.CARRY ) {
saturn.PC += 5;
op6 = read_nibbles( saturn.PC, 2 );
@ -732,19 +733,23 @@ static inline int decode_8_thru_f(int op1) {
switch ( op5 & 3 ) {
case 0: /* A=A+CON */
saturn.PC += 6;
add_register_constant(saturn.A, op4, op6 + 1);
add_register_constant( saturn.A, op4,
op6 + 1 );
return 0;
case 1: /* B=B+CON */
saturn.PC += 6;
add_register_constant(saturn.B, op4, op6 + 1);
add_register_constant( saturn.B, op4,
op6 + 1 );
return 0;
case 2: /* C=C+CON */
saturn.PC += 6;
add_register_constant(saturn.C, op4, op6 + 1);
add_register_constant( saturn.C, op4,
op6 + 1 );
return 0;
case 3: /* D=D+CON */
saturn.PC += 6;
add_register_constant(saturn.D, op4, op6 + 1);
add_register_constant( saturn.D, op4,
op6 + 1 );
return 0;
default:
return 1;
@ -753,19 +758,23 @@ static inline int decode_8_thru_f(int op1) {
switch ( op5 & 3 ) {
case 0: /* A=A-CON */
saturn.PC += 6;
sub_register_constant(saturn.A, op4, op6 + 1);
sub_register_constant( saturn.A, op4,
op6 + 1 );
return 0;
case 1: /* B=B-CON */
saturn.PC += 6;
sub_register_constant(saturn.B, op4, op6 + 1);
sub_register_constant( saturn.B, op4,
op6 + 1 );
return 0;
case 2: /* C=C-CON */
saturn.PC += 6;
sub_register_constant(saturn.C, op4, op6 + 1);
sub_register_constant( saturn.C, op4,
op6 + 1 );
return 0;
case 3: /* D=D-CON */
saturn.PC += 6;
sub_register_constant(saturn.D, op4, op6 + 1);
sub_register_constant( saturn.D, op4,
op6 + 1 );
return 0;
default:
return 1;
@ -803,49 +812,59 @@ static inline int decode_8_thru_f(int op1) {
switch ( op6 ) {
case 0: /* saturn.R0=A */
saturn.PC += 6;
copy_register(saturn.R0, saturn.A, op4);
copy_register( saturn.R0, saturn.A,
op4 );
return 0;
case 1: /* saturn.R1=A */
case 5:
saturn.PC += 6;
copy_register(saturn.R1, saturn.A, op4);
copy_register( saturn.R1, saturn.A,
op4 );
return 0;
case 2: /* saturn.R2=A */
case 6:
saturn.PC += 6;
copy_register(saturn.R2, saturn.A, op4);
copy_register( saturn.R2, saturn.A,
op4 );
return 0;
case 3: /* saturn.R3=A */
case 7:
saturn.PC += 6;
copy_register(saturn.R3, saturn.A, op4);
copy_register( saturn.R3, saturn.A,
op4 );
return 0;
case 4: /* saturn.R4=A */
saturn.PC += 6;
copy_register(saturn.R4, saturn.A, op4);
copy_register( saturn.R4, saturn.A,
op4 );
return 0;
case 8: /* saturn.R0=C */
saturn.PC += 6;
copy_register(saturn.R0, saturn.C, op4);
copy_register( saturn.R0, saturn.C,
op4 );
return 0;
case 9: /* saturn.R1=C */
case 0xd:
saturn.PC += 6;
copy_register(saturn.R1, saturn.C, op4);
copy_register( saturn.R1, saturn.C,
op4 );
return 0;
case 0xa: /* saturn.R2=C */
case 0xe:
saturn.PC += 6;
copy_register(saturn.R2, saturn.C, op4);
copy_register( saturn.R2, saturn.C,
op4 );
return 0;
case 0xb: /* saturn.R3=C */
case 0xf:
saturn.PC += 6;
copy_register(saturn.R3, saturn.C, op4);
copy_register( saturn.R3, saturn.C,
op4 );
return 0;
case 0xc: /* saturn.R4=C */
saturn.PC += 6;
copy_register(saturn.R4, saturn.C, op4);
copy_register( saturn.R4, saturn.C,
op4 );
return 0;
default:
return 1;
@ -854,49 +873,59 @@ static inline int decode_8_thru_f(int op1) {
switch ( op6 ) {
case 0: /* A=R0 */
saturn.PC += 6;
copy_register(saturn.A, saturn.R0, op4);
copy_register( saturn.A, saturn.R0,
op4 );
return 0;
case 1: /* A=R1 */
case 5:
saturn.PC += 6;
copy_register(saturn.A, saturn.R1, op4);
copy_register( saturn.A, saturn.R1,
op4 );
return 0;
case 2: /* A=R2 */
case 6:
saturn.PC += 6;
copy_register(saturn.A, saturn.R2, op4);
copy_register( saturn.A, saturn.R2,
op4 );
return 0;
case 3: /* A=R3 */
case 7:
saturn.PC += 6;
copy_register(saturn.A, saturn.R3, op4);
copy_register( saturn.A, saturn.R3,
op4 );
return 0;
case 4: /* A=R4 */
saturn.PC += 6;
copy_register(saturn.A, saturn.R4, op4);
copy_register( saturn.A, saturn.R4,
op4 );
return 0;
case 8: /* C=R0 */
saturn.PC += 6;
copy_register(saturn.C, saturn.R0, op4);
copy_register( saturn.C, saturn.R0,
op4 );
return 0;
case 9: /* C=R1 */
case 0xd:
saturn.PC += 6;
copy_register(saturn.C, saturn.R1, op4);
copy_register( saturn.C, saturn.R1,
op4 );
return 0;
case 0xa: /* C=R2 */
case 0xe:
saturn.PC += 6;
copy_register(saturn.C, saturn.R2, op4);
copy_register( saturn.C, saturn.R2,
op4 );
return 0;
case 0xb: /* C=R3 */
case 0xf:
saturn.PC += 6;
copy_register(saturn.C, saturn.R3, op4);
copy_register( saturn.C, saturn.R3,
op4 );
return 0;
case 0xc: /* C=R4 */
saturn.PC += 6;
copy_register(saturn.C, saturn.R4, op4);
copy_register( saturn.C, saturn.R4,
op4 );
return 0;
default:
return 1;
@ -905,49 +934,59 @@ static inline int decode_8_thru_f(int op1) {
switch ( op6 ) {
case 0: /* AR0EX */
saturn.PC += 6;
exchange_register(saturn.A, saturn.R0, op4);
exchange_register( saturn.A,
saturn.R0, op4 );
return 0;
case 1: /* AR1EX */
case 5:
saturn.PC += 6;
exchange_register(saturn.A, saturn.R1, op4);
exchange_register( saturn.A,
saturn.R1, op4 );
return 0;
case 2: /* AR2EX */
case 6:
saturn.PC += 6;
exchange_register(saturn.A, saturn.R2, op4);
exchange_register( saturn.A,
saturn.R2, op4 );
return 0;
case 3: /* AR3EX */
case 7:
saturn.PC += 6;
exchange_register(saturn.A, saturn.R3, op4);
exchange_register( saturn.A,
saturn.R3, op4 );
return 0;
case 4: /* AR4EX */
saturn.PC += 6;
exchange_register(saturn.A, saturn.R4, op4);
exchange_register( saturn.A,
saturn.R4, op4 );
return 0;
case 8: /* CR0EX */
saturn.PC += 6;
exchange_register(saturn.C, saturn.R0, op4);
exchange_register( saturn.C,
saturn.R0, op4 );
return 0;
case 9: /* CR1EX */
case 0xd:
saturn.PC += 6;
exchange_register(saturn.C, saturn.R1, op4);
exchange_register( saturn.C,
saturn.R1, op4 );
return 0;
case 0xa: /* CR2EX */
case 0xe:
saturn.PC += 6;
exchange_register(saturn.C, saturn.R2, op4);
exchange_register( saturn.C,
saturn.R2, op4 );
return 0;
case 0xb: /* CR3EX */
case 0xf:
saturn.PC += 6;
exchange_register(saturn.C, saturn.R3, op4);
exchange_register( saturn.C,
saturn.R3, op4 );
return 0;
case 0xc: /* CR4EX */
saturn.PC += 6;
exchange_register(saturn.C, saturn.R4, op4);
exchange_register( saturn.C,
saturn.R4, op4 );
return 0;
default:
return 1;
@ -1090,52 +1129,68 @@ static inline int decode_8_thru_f(int op1) {
op3 = read_nibble( saturn.PC + 2 );
switch ( op3 ) {
case 0: /* ?A=B */
saturn.CARRY = is_equal_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY = is_equal_register(
saturn.A, saturn.B, A_FIELD );
break;
case 1: /* ?B=C */
saturn.CARRY = is_equal_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY = is_equal_register(
saturn.B, saturn.C, A_FIELD );
break;
case 2: /* ?A=C */
saturn.CARRY = is_equal_register(saturn.A, saturn.C, A_FIELD);
saturn.CARRY = is_equal_register(
saturn.A, saturn.C, A_FIELD );
break;
case 3: /* ?C=D */
saturn.CARRY = is_equal_register(saturn.C, saturn.D, A_FIELD);
saturn.CARRY = is_equal_register(
saturn.C, saturn.D, A_FIELD );
break;
case 4: /* ?A#B */
saturn.CARRY = is_not_equal_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY = is_not_equal_register(
saturn.A, saturn.B, A_FIELD );
break;
case 5: /* ?B#C */
saturn.CARRY = is_not_equal_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY = is_not_equal_register(
saturn.B, saturn.C, A_FIELD );
break;
case 6: /* ?A#C */
saturn.CARRY = is_not_equal_register(saturn.A, saturn.C, A_FIELD);
saturn.CARRY = is_not_equal_register(
saturn.A, saturn.C, A_FIELD );
break;
case 7: /* ?C#D */
saturn.CARRY = is_not_equal_register(saturn.C, saturn.D, A_FIELD);
saturn.CARRY = is_not_equal_register(
saturn.C, saturn.D, A_FIELD );
break;
case 8: /* ?A=0 */
saturn.CARRY = is_zero_register(saturn.A, A_FIELD);
saturn.CARRY =
is_zero_register( saturn.A, A_FIELD );
break;
case 9: /* ?B=0 */
saturn.CARRY = is_zero_register(saturn.B, A_FIELD);
saturn.CARRY =
is_zero_register( saturn.B, A_FIELD );
break;
case 0xa: /* ?C=0 */
saturn.CARRY = is_zero_register(saturn.C, A_FIELD);
saturn.CARRY =
is_zero_register( saturn.C, A_FIELD );
break;
case 0xb: /* ?D=0 */
saturn.CARRY = is_zero_register(saturn.D, A_FIELD);
saturn.CARRY =
is_zero_register( saturn.D, A_FIELD );
break;
case 0xc: /* ?A#0 */
saturn.CARRY = is_not_zero_register(saturn.A, A_FIELD);
saturn.CARRY =
is_not_zero_register( saturn.A, A_FIELD );
break;
case 0xd: /* ?B#0 */
saturn.CARRY = is_not_zero_register(saturn.B, A_FIELD);
saturn.CARRY =
is_not_zero_register( saturn.B, A_FIELD );
break;
case 0xe: /* ?C#0 */
saturn.CARRY = is_not_zero_register(saturn.C, A_FIELD);
saturn.CARRY =
is_not_zero_register( saturn.C, A_FIELD );
break;
case 0xf: /* ?D#0 */
saturn.CARRY = is_not_zero_register(saturn.D, A_FIELD);
saturn.CARRY =
is_not_zero_register( saturn.D, A_FIELD );
break;
default:
return 1;
@ -1159,56 +1214,68 @@ static inline int decode_8_thru_f(int op1) {
op3 = read_nibble( saturn.PC + 2 );
switch ( op3 ) {
case 0: /* ?A>B */
saturn.CARRY = is_greater_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY = is_greater_register(
saturn.A, saturn.B, A_FIELD );
break;
case 1: /* ?B>C */
saturn.CARRY = is_greater_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY = is_greater_register(
saturn.B, saturn.C, A_FIELD );
break;
case 2: /* ?C>A */
saturn.CARRY = is_greater_register(saturn.C, saturn.A, A_FIELD);
saturn.CARRY = is_greater_register(
saturn.C, saturn.A, A_FIELD );
break;
case 3: /* ?D>C */
saturn.CARRY = is_greater_register(saturn.D, saturn.C, A_FIELD);
saturn.CARRY = is_greater_register(
saturn.D, saturn.C, A_FIELD );
break;
case 4: /* ?A<B */
saturn.CARRY = is_less_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY =
is_less_register( saturn.A, saturn.B, A_FIELD );
break;
case 5: /* ?B<C */
saturn.CARRY = is_less_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY =
is_less_register( saturn.B, saturn.C, A_FIELD );
break;
case 6: /* ?C<A */
saturn.CARRY = is_less_register(saturn.C, saturn.A, A_FIELD);
saturn.CARRY =
is_less_register( saturn.C, saturn.A, A_FIELD );
break;
case 7: /* ?D<C */
saturn.CARRY = is_less_register(saturn.D, saturn.C, A_FIELD);
saturn.CARRY =
is_less_register( saturn.D, saturn.C, A_FIELD );
break;
case 8: /* ?A>=B */
saturn.CARRY =
is_greater_or_equal_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY = is_greater_or_equal_register(
saturn.A, saturn.B, A_FIELD );
break;
case 9: /* ?B>=C */
saturn.CARRY =
is_greater_or_equal_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY = is_greater_or_equal_register(
saturn.B, saturn.C, A_FIELD );
break;
case 0xa: /* ?C>=A */
saturn.CARRY =
is_greater_or_equal_register(saturn.C, saturn.A, A_FIELD);
saturn.CARRY = is_greater_or_equal_register(
saturn.C, saturn.A, A_FIELD );
break;
case 0xb: /* ?D>=C */
saturn.CARRY =
is_greater_or_equal_register(saturn.D, saturn.C, A_FIELD);
saturn.CARRY = is_greater_or_equal_register(
saturn.D, saturn.C, A_FIELD );
break;
case 0xc: /* ?A<=B */
saturn.CARRY = is_less_or_equal_register(saturn.A, saturn.B, A_FIELD);
saturn.CARRY = is_less_or_equal_register(
saturn.A, saturn.B, A_FIELD );
break;
case 0xd: /* ?B<=C */
saturn.CARRY = is_less_or_equal_register(saturn.B, saturn.C, A_FIELD);
saturn.CARRY = is_less_or_equal_register(
saturn.B, saturn.C, A_FIELD );
break;
case 0xe: /* ?C<=A */
saturn.CARRY = is_less_or_equal_register(saturn.C, saturn.A, A_FIELD);
saturn.CARRY = is_less_or_equal_register(
saturn.C, saturn.A, A_FIELD );
break;
case 0xf: /* ?D<=C */
saturn.CARRY = is_less_or_equal_register(saturn.D, saturn.C, A_FIELD);
saturn.CARRY = is_less_or_equal_register(
saturn.D, saturn.C, A_FIELD );
break;
default:
return 1;
@ -1262,28 +1329,36 @@ static inline int decode_8_thru_f(int op1) {
if ( op2 < 8 ) {
switch ( op3 ) {
case 0: /* ?A=B */
saturn.CARRY = is_equal_register(saturn.A, saturn.B, op2);
saturn.CARRY =
is_equal_register( saturn.A, saturn.B, op2 );
break;
case 1: /* ?B=C */
saturn.CARRY = is_equal_register(saturn.B, saturn.C, op2);
saturn.CARRY =
is_equal_register( saturn.B, saturn.C, op2 );
break;
case 2: /* ?A=C */
saturn.CARRY = is_equal_register(saturn.A, saturn.C, op2);
saturn.CARRY =
is_equal_register( saturn.A, saturn.C, op2 );
break;
case 3: /* ?C=D */
saturn.CARRY = is_equal_register(saturn.C, saturn.D, op2);
saturn.CARRY =
is_equal_register( saturn.C, saturn.D, op2 );
break;
case 4: /* ?A#B */
saturn.CARRY = is_not_equal_register(saturn.A, saturn.B, op2);
saturn.CARRY =
is_not_equal_register( saturn.A, saturn.B, op2 );
break;
case 5: /* ?B#C */
saturn.CARRY = is_not_equal_register(saturn.B, saturn.C, op2);
saturn.CARRY =
is_not_equal_register( saturn.B, saturn.C, op2 );
break;
case 6: /* ?A#C */
saturn.CARRY = is_not_equal_register(saturn.A, saturn.C, op2);
saturn.CARRY =
is_not_equal_register( saturn.A, saturn.C, op2 );
break;
case 7: /* ?C#D */
saturn.CARRY = is_not_equal_register(saturn.C, saturn.D, op2);
saturn.CARRY =
is_not_equal_register( saturn.C, saturn.D, op2 );
break;
case 8: /* ?A=0 */
saturn.CARRY = is_zero_register( saturn.A, op2 );
@ -1316,52 +1391,68 @@ static inline int decode_8_thru_f(int op1) {
op2 &= 7;
switch ( op3 ) {
case 0: /* ?A>B */
saturn.CARRY = is_greater_register(saturn.A, saturn.B, op2);
saturn.CARRY =
is_greater_register( saturn.A, saturn.B, op2 );
break;
case 1: /* ?B>C */
saturn.CARRY = is_greater_register(saturn.B, saturn.C, op2);
saturn.CARRY =
is_greater_register( saturn.B, saturn.C, op2 );
break;
case 2: /* ?C>A */
saturn.CARRY = is_greater_register(saturn.C, saturn.A, op2);
saturn.CARRY =
is_greater_register( saturn.C, saturn.A, op2 );
break;
case 3: /* ?D>C */
saturn.CARRY = is_greater_register(saturn.D, saturn.C, op2);
saturn.CARRY =
is_greater_register( saturn.D, saturn.C, op2 );
break;
case 4: /* ?A<B */
saturn.CARRY = is_less_register(saturn.A, saturn.B, op2);
saturn.CARRY =
is_less_register( saturn.A, saturn.B, op2 );
break;
case 5: /* ?B<C */
saturn.CARRY = is_less_register(saturn.B, saturn.C, op2);
saturn.CARRY =
is_less_register( saturn.B, saturn.C, op2 );
break;
case 6: /* ?C<A */
saturn.CARRY = is_less_register(saturn.C, saturn.A, op2);
saturn.CARRY =
is_less_register( saturn.C, saturn.A, op2 );
break;
case 7: /* ?D<C */
saturn.CARRY = is_less_register(saturn.D, saturn.C, op2);
saturn.CARRY =
is_less_register( saturn.D, saturn.C, op2 );
break;
case 8: /* ?A>=B */
saturn.CARRY = is_greater_or_equal_register(saturn.A, saturn.B, op2);
saturn.CARRY = is_greater_or_equal_register(
saturn.A, saturn.B, op2 );
break;
case 9: /* ?B>=C */
saturn.CARRY = is_greater_or_equal_register(saturn.B, saturn.C, op2);
saturn.CARRY = is_greater_or_equal_register(
saturn.B, saturn.C, op2 );
break;
case 0xa: /* ?C>=A */
saturn.CARRY = is_greater_or_equal_register(saturn.C, saturn.A, op2);
saturn.CARRY = is_greater_or_equal_register(
saturn.C, saturn.A, op2 );
break;
case 0xb: /* ?D>=C */
saturn.CARRY = is_greater_or_equal_register(saturn.D, saturn.C, op2);
saturn.CARRY = is_greater_or_equal_register(
saturn.D, saturn.C, op2 );
break;
case 0xc: /* ?A<=B */
saturn.CARRY = is_less_or_equal_register(saturn.A, saturn.B, op2);
saturn.CARRY = is_less_or_equal_register(
saturn.A, saturn.B, op2 );
break;
case 0xd: /* ?B<=C */
saturn.CARRY = is_less_or_equal_register(saturn.B, saturn.C, op2);
saturn.CARRY = is_less_or_equal_register(
saturn.B, saturn.C, op2 );
break;
case 0xe: /* ?C<=A */
saturn.CARRY = is_less_or_equal_register(saturn.C, saturn.A, op2);
saturn.CARRY = is_less_or_equal_register(
saturn.C, saturn.A, op2 );
break;
case 0xf: /* ?D<=C */
saturn.CARRY = is_less_or_equal_register(saturn.D, saturn.C, op2);
saturn.CARRY = is_less_or_equal_register(
saturn.D, saturn.C, op2 );
break;
default:
return 1;
@ -2338,12 +2429,12 @@ inline void schedule(void) {
delta_i = instructions - old_stat_instr;
old_stat_instr = instructions;
if ( delta_t_1 > 0 ) {
t1_i_per_tick =
((NR_SAMPLES - 1) * t1_i_per_tick + (delta_i / delta_t_16)) /
t1_i_per_tick = ( ( NR_SAMPLES - 1 ) * t1_i_per_tick +
( delta_i / delta_t_16 ) ) /
NR_SAMPLES;
t2_i_per_tick = t1_i_per_tick / 512;
saturn.i_per_s =
((NR_SAMPLES - 1) * saturn.i_per_s + (delta_i / delta_t_1)) /
saturn.i_per_s = ( ( NR_SAMPLES - 1 ) * saturn.i_per_s +
( delta_i / delta_t_1 ) ) /
NR_SAMPLES;
} else {
t1_i_per_tick = 8192;
@ -2359,7 +2450,8 @@ inline void schedule(void) {
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",
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
}
@ -2427,8 +2519,8 @@ int emulate(void) {
{
int i;
for (i = 0;
i < sizeof(saturn.keybuf.rows) / sizeof(saturn.keybuf.rows[0]);
for ( i = 0; i < sizeof( saturn.keybuf.rows ) /
sizeof( saturn.keybuf.rows[ 0 ] );
i++ ) {
if ( saturn.keybuf.rows[ i ] || throttle ) {
gettimeofday( &tv, &tz );

View file

@ -146,15 +146,15 @@ static unsigned char gx_silver_bits[] = {
#define gx_green_width 34
#define gx_green_height 22
static unsigned char gx_green_bits[] = {
0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff,
0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00,
0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03,
0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00,
0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03};
0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff,
0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03,
0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00,
0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03 };
#endif /* !_HP_H */

View file

@ -103,20 +103,25 @@ extern void set_register_nibble __ProtoType__((unsigned char *reg, int n,
extern unsigned char get_register_nibble __ProtoType__( ( unsigned char* reg,
int n ) );
extern void register_to_address __ProtoType__((unsigned char *reg, word_20 *dat,
int s));
extern void address_to_register __ProtoType__((word_20 dat, unsigned char *reg,
int s));
extern void register_to_address __ProtoType__( ( unsigned char* reg,
word_20* dat, int s ) );
extern void address_to_register __ProtoType__( ( word_20 dat,
unsigned char* reg, int s ) );
extern void add_address __ProtoType__( ( word_20 * dat, int add ) );
extern char* make_hexstr __ProtoType__( ( long addr, int n ) );
extern void load_constant __ProtoType__((unsigned char *reg, int n, long addr));
extern void load_address __ProtoType__((unsigned char *reg, long addr, int n));
extern void load_constant __ProtoType__( ( unsigned char* reg, int n,
long addr ) );
extern void load_address __ProtoType__( ( unsigned char* reg, long addr,
int n ) );
extern void store __ProtoType__((word_20 dat, unsigned char *reg, int code));
extern void store __ProtoType__( ( word_20 dat, unsigned char* reg,
int code ) );
extern void store_n __ProtoType__( ( word_20 dat, unsigned char* reg, int n ) );
extern void recall __ProtoType__((unsigned char *reg, word_20 dat, int code));
extern void recall_n __ProtoType__((unsigned char *reg, word_20 dat, int n));
extern void recall __ProtoType__( ( unsigned char* reg, word_20 dat,
int code ) );
extern void recall_n __ProtoType__( ( unsigned char* reg, word_20 dat,
int n ) );
extern long dat_to_addr __ProtoType__( ( unsigned char* dat ) );
extern void addr_to_dat __ProtoType__( ( long addr, unsigned char* dat ) );
@ -141,8 +146,10 @@ extern void add_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char* r2, int code ) );
extern void sub_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void complement_2_register __ProtoType__((unsigned char *r, int code));
extern void complement_1_register __ProtoType__((unsigned char *r, int code));
extern void complement_2_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void complement_1_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void inc_register __ProtoType__( ( unsigned char* r, int code ) );
extern void dec_register __ProtoType__( ( unsigned char* r, int code ) );
extern void zero_register __ProtoType__( ( unsigned char* r, int code ) );
@ -150,8 +157,8 @@ extern void or_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char* r2, int code ) );
extern void and_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void copy_register __ProtoType__((unsigned char *to, unsigned char *from,
int code));
extern void copy_register __ProtoType__( ( unsigned char* to,
unsigned char* from, int code ) );
extern void exchange_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
@ -161,7 +168,8 @@ extern void exchange_reg __ProtoType__((unsigned char *r, word_20 *d,
extern void shift_left_register __ProtoType__( ( unsigned char* r, int code ) );
extern void shift_left_circ_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_register __ProtoType__((unsigned char *r, int code));
extern void shift_right_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_circ_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_bit_register __ProtoType__( ( unsigned char* r,
@ -171,9 +179,10 @@ extern int is_not_zero_register __ProtoType__((unsigned char *r, int code));
extern int is_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern int is_not_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char *r2, int code));
extern int is_less_register __ProtoType__((unsigned char *r1, unsigned char *r2,
unsigned char* r2,
int code ) );
extern int is_less_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern int is_less_or_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2,
int code ) );

View file

@ -111,15 +111,15 @@ static unsigned char hp48_bottom_bits[] = {
#define hp48_logo_width 13
#define hp48_logo_height 4
static unsigned char hp48_logo_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f};
static unsigned char hp48_logo_bits[] = { 0x00, 0x00, 0x00, 0x00,
0xf8, 0x1f, 0xf8, 0x1f };
#define hp48_text_width 29
#define hp48_text_height 7
static unsigned char hp48_text_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0x00, 0xfe, 0x1f};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0x1f };
#define hp48_disp_width 29
#define hp48_disp_height 21
@ -160,11 +160,11 @@ static unsigned char hp48_keys_bits[] = {
#define hp48_orange_width 5
#define hp48_orange_height 53
static unsigned char hp48_orange_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x1c};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c };
#define hp48_blue_width 5
#define hp48_blue_height 57
@ -178,13 +178,13 @@ static unsigned char hp48_blue_bits[] = {
#define hp48_on_width 25
#define hp48_on_height 19
static unsigned char hp48_on_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x13, 0x01,
0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12, 0x01, 0x80, 0xc8, 0xe7, 0x00,
0x00, 0x05, 0x12, 0x01, 0x00, 0x02, 0x12, 0x01, 0x00, 0x05, 0x12, 0x01,
0x80, 0x08, 0xe2, 0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00,
0x00, 0x00, 0x13, 0x01, 0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12,
0x01, 0x80, 0xc8, 0xe7, 0x00, 0x00, 0x05, 0x12, 0x01, 0x00, 0x02,
0x12, 0x01, 0x00, 0x05, 0x12, 0x01, 0x80, 0x08, 0xe2, 0x00 };
#define hp48_top_gx_width 32
#define hp48_top_gx_height 30
@ -202,15 +202,15 @@ static unsigned char hp48_top_gx_bits[] = {
#define hp48_logo_gx_width 16
#define hp48_logo_gx_height 4
static unsigned char hp48_logo_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf8, 0xf7, 0xf8, 0xf7};
static unsigned char hp48_logo_gx_bits[] = { 0x00, 0x00, 0x00, 0x00,
0xf8, 0xf7, 0xf8, 0xf7 };
#define hp48_text_gx_width 29
#define hp48_text_gx_height 7
static unsigned char hp48_text_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f };
#define hp48_green_gx_width 29
#define hp48_green_gx_height 57

View file

@ -307,7 +307,8 @@ void copy_old_saturn(old_saturn_t *old, saturn_t *new) {
new->SR = old->SR;
new->MP = old->MP;
new->hexmode = old->hexmode;
memcpy(&(new->rstk[0]), &(old->rstk[0]), NR_RSTK * sizeof(word_20));
memcpy( &( new->rstk[ 0 ] ), &( old->rstk[ 0 ] ),
NR_RSTK * sizeof( word_20 ) );
new->rstkp = old->rstkp;
for ( i = 0; i < 9; i++ ) {
new->keybuf.rows[ i ] = old->keybuf.rows[ i ];
@ -438,7 +439,8 @@ void copy_0_3_0_saturn(saturn_0_3_0_t *old, saturn_t *new) {
new->SR = old->SR;
new->MP = old->MP;
new->hexmode = old->hexmode;
memcpy(&(new->rstk[0]), &(old->rstk[0]), NR_RSTK * sizeof(word_20));
memcpy( &( new->rstk[ 0 ] ), &( old->rstk[ 0 ] ),
NR_RSTK * sizeof( word_20 ) );
new->rstkp = old->rstkp;
for ( i = 0; i < 9; i++ ) {
new->keybuf.rows[ i ] = old->keybuf.rows[ i ];
@ -979,7 +981,8 @@ int read_mem_file(char *name, word_4 *mem, int size) {
if ( st.st_size != size / 2 ) {
if ( !quiet )
fprintf(stderr, "%s: strange size %s, expected %d, found %ld\n",
fprintf( stderr,
"%s: strange size %s, expected %d, found %ld\n",
progname, name, size / 2, st.st_size );
fclose( fp );
return 0;
@ -989,7 +992,8 @@ int read_mem_file(char *name, word_4 *mem, int size) {
for ( i = 0, j = 0; i < size / 2; i++ ) {
if ( 1 != fread( &byte, 1, 1, fp ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t read %s\n", progname, name);
fprintf( stderr, "%s: can\'t read %s\n", progname,
name );
fclose( fp );
return 0;
}
@ -1076,7 +1080,8 @@ void get_home_directory(char *path) {
} else {
if ( !quiet )
fprintf( stderr,
"%s: can\'t figure out your home directory, trying /tmp\n",
"%s: can\'t figure out your home directory, "
"trying /tmp\n",
progname );
strcpy( path, "/tmp" );
}
@ -1130,8 +1135,8 @@ int read_files(void) {
*/
copy_old_saturn( &old_saturn, &saturn );
if ( !quiet )
fprintf(stderr, "%s: %s seems to be an old version file\n", progname,
fnam);
fprintf( stderr, "%s: %s seems to be an old version file\n",
progname, fnam );
saturn.magic = X48_MAGIC;
saturn.t1_tick = 8192;
saturn.t2_tick = 16;
@ -1173,14 +1178,16 @@ int read_files(void) {
if ( ( v1 & 0xffffff00 ) < ( v2 & 0xffffff00 ) ) {
if ( !quiet )
fprintf(stderr, "%s: %s is a version %d.%d.%d file, converting\n",
progname, fnam, saturn.version[0], saturn.version[1],
saturn.version[2]);
fprintf( stderr,
"%s: %s is a version %d.%d.%d file, converting\n",
progname, fnam, saturn.version[ 0 ],
saturn.version[ 1 ], saturn.version[ 2 ] );
} else if ( ( v2 & 0xffffff00 ) < ( v1 & 0xffffff00 ) ) {
if ( !quiet )
fprintf(stderr, "%s: %s is a version %d.%d.%d file, trying ...\n",
progname, fnam, saturn.version[0], saturn.version[1],
saturn.version[2]);
fprintf( stderr,
"%s: %s is a version %d.%d.%d file, trying ...\n",
progname, fnam, saturn.version[ 0 ],
saturn.version[ 1 ], saturn.version[ 2 ] );
}
if ( v1 < 0x00040000 ) {
@ -1189,7 +1196,8 @@ int read_files(void) {
*/
if ( !read_version_0_3_0_file( fp ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t handle %s\n", progname, fnam);
fprintf( stderr, "%s: can\'t handle %s\n", progname,
fnam );
init_saturn();
} else {
copy_0_3_0_saturn( &saturn_0_3_0, &saturn );
@ -1202,7 +1210,8 @@ int read_files(void) {
*/
if ( !read_version_0_4_0_file( fp ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t handle %s\n", progname, fnam);
fprintf( stderr, "%s: can\'t handle %s\n", progname,
fnam );
init_saturn();
} else if ( verbose ) {
printf( "%s: read %s\n", progname, fnam );
@ -1213,7 +1222,8 @@ int read_files(void) {
*/
if ( !read_version_0_4_0_file( fp ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t handle %s\n", progname, fnam);
fprintf( stderr, "%s: can\'t handle %s\n", progname,
fnam );
init_saturn();
} else if ( verbose ) {
printf( "%s: read %s\n", progname, fnam );
@ -1235,7 +1245,8 @@ int read_files(void) {
saturn.ram = ( word_4* )NULL;
if ( NULL == ( saturn.ram = ( word_4* )malloc( ram_size ) ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t malloc RAM[%d]\n", progname, ram_size);
fprintf( stderr, "%s: can\'t malloc RAM[%d]\n", progname,
ram_size );
exit( 1 );
}
@ -1293,7 +1304,8 @@ int read_files(void) {
if ( stat( fnam, &st ) >= 0 ) {
port2_size = 2 * st.st_size;
if ( ( opt_gx && ( ( port2_size % 0x40000 ) == 0 ) ) ||
(!opt_gx && ((port2_size == 0x10000) || (port2_size == 0x40000)))) {
( !opt_gx &&
( ( port2_size == 0x10000 ) || ( port2_size == 0x40000 ) ) ) ) {
if ( NULL == ( saturn.port2 = ( word_4* )malloc( port2_size ) ) ) {
if ( !quiet )
fprintf( stderr, "%s: can\'t malloc PORT2[%ld]\n", progname,
@ -1450,14 +1462,15 @@ int write_files(void) {
make_dir = 1;
} else {
if ( !quiet )
fprintf(stderr, "%s: can\'t stat %s, saving to /tmp\n", progname, path);
fprintf( stderr, "%s: can\'t stat %s, saving to /tmp\n",
progname, path );
strcpy( path, "/tmp" );
}
} else {
if ( !S_ISDIR( st.st_mode ) ) {
if ( !quiet )
fprintf(stderr, "%s: %s is no directory, saving to /tmp\n", progname,
path);
fprintf( stderr, "%s: %s is no directory, saving to /tmp\n",
progname, path );
strcpy( path, "/tmp" );
}
}
@ -1465,8 +1478,8 @@ int write_files(void) {
if ( make_dir ) {
if ( mkdir( path, 0777 ) == -1 ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t mkdir %s, saving to /tmp\n", progname,
path);
fprintf( stderr, "%s: can\'t mkdir %s, saving to /tmp\n",
progname, path );
strcpy( path, "/tmp" );
}
}
@ -1477,7 +1490,8 @@ int write_files(void) {
strcat( fnam, "hp48" );
if ( ( fp = fopen( fnam, "w" ) ) == NULL ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t open %s, no saving done\n", progname, fnam);
fprintf( stderr, "%s: can\'t open %s, no saving done\n", progname,
fnam );
return 0;
}

View file

@ -171,9 +171,11 @@ void init_display(void) {
disp.lines = 110;
if ( display.offset > 3 )
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset + 2) & 0xfff;
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff;
else
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset) & 0xfff;
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff;
display.disp_end =
display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
@ -201,7 +203,8 @@ static inline void draw_nibble(int c, int r, int val) {
y = ( r * 2 ) + 20;
val &= 0x0f;
if ( val != lcd_buffer[ r ][ c ] ) {
XCopyPlane(dpy, nibble_maps[val], disp.win, disp.gc, 0, 0, 8, 2, x, y, 1);
XCopyPlane( dpy, nibble_maps[ val ], disp.win, disp.gc, 0, 0, 8, 2, x,
y, 1 );
lcd_buffer[ r ][ c ] = val;
}
}
@ -262,15 +265,19 @@ void update_display(void) {
} else {
#endif
if ( display.offset != old_offset ) {
memset(disp_buf, 0xf0,
memset(
disp_buf, 0xf0,
( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
memset(lcd_buffer, 0xf0,
memset(
lcd_buffer, 0xf0,
( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
old_offset = display.offset;
}
if ( display.lines != old_lines ) {
memset(&disp_buf[56][0], 0xf0, (size_t)(8 * NIBS_PER_BUFFER_ROW));
memset(&lcd_buffer[56][0], 0xf0, (size_t)(8 * NIBS_PER_BUFFER_ROW));
memset( &disp_buf[ 56 ][ 0 ], 0xf0,
( size_t )( 8 * NIBS_PER_BUFFER_ROW ) );
memset( &lcd_buffer[ 56 ][ 0 ], 0xf0,
( size_t )( 8 * NIBS_PER_BUFFER_ROW ) );
old_lines = display.lines;
}
for ( i = 0; i <= display.lines; i++ ) {
@ -286,12 +293,15 @@ void update_display(void) {
if ( shm_flag ) {
data_addr = 0;
data_addr_2 = disp.menu_image->bytes_per_line;
line_pad = 2 * disp.menu_image->bytes_per_line - NIBBLES_PER_ROW;
line_pad =
2 * disp.menu_image->bytes_per_line - NIBBLES_PER_ROW;
for ( ; i < DISP_ROWS; i++ ) {
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
val = read_nibble( addr++ );
disp.menu_image->data[data_addr++] = nibble_bits[val];
disp.menu_image->data[data_addr_2++] = nibble_bits[val];
disp.menu_image->data[ data_addr++ ] =
nibble_bits[ val ];
disp.menu_image->data[ data_addr_2++ ] =
nibble_bits[ val ];
}
data_addr += line_pad;
data_addr_2 += line_pad;
@ -310,12 +320,12 @@ void update_display(void) {
} else {
#ifdef HAVE_XSHM
if ( shm_flag ) {
memset(
disp.disp_image->data, 0,
(size_t)(disp.disp_image->bytes_per_line * disp.disp_image->height));
memset(
disp.menu_image->data, 0,
(size_t)(disp.menu_image->bytes_per_line * disp.menu_image->height));
memset( disp.disp_image->data, 0,
( size_t )( disp.disp_image->bytes_per_line *
disp.disp_image->height ) );
memset( disp.menu_image->data, 0,
( size_t )( disp.menu_image->bytes_per_line *
disp.menu_image->height ) );
disp.display_update = UPDATE_DISP | UPDATE_MENU;
} else {
#endif
@ -357,7 +367,8 @@ void disp_draw_nibble(word_20 addr, word_4 val) {
if ( shm_flag ) {
shm_addr = ( 2 * y * disp.disp_image->bytes_per_line ) + x;
disp.disp_image->data[ shm_addr ] = nibble_bits[ val ];
disp.disp_image->data[shm_addr + disp.disp_image->bytes_per_line] =
disp.disp_image
->data[ shm_addr + disp.disp_image->bytes_per_line ] =
nibble_bits[ val ];
disp.display_update |= UPDATE_DISP;
} else {
@ -457,8 +468,8 @@ void draw_annunc(void) {
ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x,
ann_tbl[ i ].y, 1 );
} else {
XClearArea(dpy, disp.win, ann_tbl[i].x, ann_tbl[i].y, ann_tbl[i].width,
ann_tbl[i].height, False);
XClearArea( dpy, disp.win, ann_tbl[ i ].x, ann_tbl[ i ].y,
ann_tbl[ i ].width, ann_tbl[ i ].height, False );
}
}
refresh_icon();

View file

@ -104,7 +104,8 @@ void save_options(int argc, char **argv) {
saved_argc = argc;
saved_argv = ( char** )malloc( ( argc + 2 ) * sizeof( char* ) );
if ( saved_argv == ( char** )0 ) {
fprintf(stderr, "%s: malloc failed in save_options(), exit\n", progname);
fprintf( stderr, "%s: malloc failed in save_options(), exit\n",
progname );
exit( 1 );
}
saved_argv[ argc ] = ( char* )0;
@ -112,7 +113,8 @@ void save_options(int argc, char **argv) {
l = strlen( argv[ argc ] ) + 1;
saved_argv[ argc ] = ( char* )malloc( l );
if ( saved_argv[ argc ] == ( char* )0 ) {
fprintf(stderr, "%s: malloc failed in save_options(), exit\n", progname);
fprintf( stderr, "%s: malloc failed in save_options(), exit\n",
progname );
exit( 1 );
}
memcpy( saved_argv[ argc ], argv[ argc ], l );

View file

@ -112,7 +112,8 @@ int(*read_nibble_crc) __ProtoType__((long addr));
static int line_counter = -1;
static inline int calc_crc( int nib ) {
saturn.crc = (saturn.crc >> 4) ^ (((saturn.crc ^ nib) & 0xf) * 0x1081);
saturn.crc =
( saturn.crc >> 4 ) ^ ( ( ( saturn.crc ^ nib ) & 0xf ) * 0x1081 );
return nib;
}
@ -132,9 +133,11 @@ void write_dev_mem(long addr, int val) {
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff;
else
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset) & 0xfff;
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff;
display.disp_end =
display.disp_start + (display.nibs_per_line * (display.lines + 1));
display.disp_start +
( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
#ifdef DEBUG_DISPLAY
@ -146,7 +149,8 @@ void write_dev_mem(long addr, int val) {
display.contrast &= ~0x0f;
display.contrast |= val;
#ifdef DEBUG_CONTRAST
fprintf(stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC, display.contrast);
fprintf( stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC,
display.contrast );
#endif
device.contrast_touched = 1;
return;
@ -154,7 +158,8 @@ void write_dev_mem(long addr, int val) {
display.contrast &= ~0xf0;
display.contrast |= ( ( val & 0x1 ) << 4 );
#ifdef DEBUG_CONTRAST
fprintf(stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC, display.contrast);
fprintf( stderr, "%.5lx: Contrast: 0x%x\n", saturn.PC,
display.contrast );
#endif
device.contrast_touched = 1;
/* Fall through */
@ -162,7 +167,8 @@ void write_dev_mem(long addr, int val) {
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);
fprintf( stderr, "%.5lx: DISP TEST: %x\n", saturn.PC,
saturn.disp_test );
#endif
device.disp_test_touched = 1;
return;
@ -196,7 +202,8 @@ void write_dev_mem(long addr, int val) {
saturn.baud = val;
device.baud_touched = 1;
#ifdef DEBUG_SERIALb
fprintf(stderr, "%.5lx: BAUD write: %x\n", saturn.PC, saturn.baud);
fprintf( stderr, "%.5lx: BAUD write: %x\n", saturn.PC,
saturn.baud );
#endif
return;
case 0x10e: /* CARD CONTROL */
@ -221,7 +228,8 @@ void write_dev_mem(long addr, int val) {
saturn.io_ctrl = val;
device.ioc_touched = 1;
#ifdef DEBUG_SERIAL
fprintf(stderr, "%.5lx: IOC write: %x\n", saturn.PC, saturn.io_ctrl);
fprintf( stderr, "%.5lx: IOC write: %x\n", saturn.PC,
saturn.io_ctrl );
#endif
return;
case 0x111: /* RCS */
@ -258,14 +266,16 @@ void write_dev_mem(long addr, int val) {
saturn.sreq |= val << ( ( addr - 0x118 ) * 4 );
device.sreq_touched = 1;
#ifdef DEBUG_SERIAL
fprintf(stderr, "%.5lx: SREQ? write: %x\n", saturn.PC, saturn.sreq);
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);
fprintf( stderr, "%.5lx: IRC write: %x\n", saturn.PC,
saturn.ir_ctrl );
#endif
return;
case 0x11b: /* BASE NIB OFFSET */
@ -295,7 +305,8 @@ void write_dev_mem(long addr, int val) {
device.base_nibble_touched = 1;
#ifdef DEBUG_BASE_NIBBLE
if ( opt_gx )
fprintf(stderr, "%.5lx: BASENIB: %x\n", saturn.PC, saturn.base_nibble);
fprintf( stderr, "%.5lx: BASENIB: %x\n", saturn.PC,
saturn.base_nibble );
#endif
return;
case 0x120:
@ -308,12 +319,15 @@ void write_dev_mem(long addr, int val) {
if ( display.disp_start != ( saturn.disp_addr & 0xffffe ) ) {
display.disp_start = saturn.disp_addr & 0xffffe;
display.disp_end =
display.disp_start + (display.nibs_per_line * (display.lines + 1));
display.disp_start +
( 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);
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:
@ -327,15 +341,18 @@ void write_dev_mem(long addr, int val) {
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff;
else
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset) & 0xfff;
display.nibs_per_line =
( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff;
display.disp_end =
display.disp_start + (display.nibs_per_line * (display.lines + 1));
display.disp_start +
( 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);
fprintf( stderr, "%.5lx: DISP END: %lx\n", saturn.PC,
display.disp_end );
#endif
return;
case 0x128:
@ -349,12 +366,15 @@ void write_dev_mem(long addr, int val) {
display.lines = 63;
disp.lines = 2 * display.lines;
display.disp_end =
display.disp_start + (display.nibs_per_line * (display.lines + 1));
display.disp_start +
( 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);
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:
@ -364,7 +384,8 @@ void write_dev_mem(long addr, int val) {
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);
fprintf( stderr, "Unknown device @0x%ld: %.4x\n", addr,
saturn.unknown );
#endif
device.unknown_touched = 1;
return;
@ -394,7 +415,8 @@ void write_dev_mem(long addr, int val) {
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);
fprintf( stderr, "Unknown device @0x%ld: %.2x\n", addr,
saturn.unknown2 );
#endif
device.unknown2_touched = 1;
return;
@ -416,8 +438,8 @@ void write_dev_mem(long addr, int val) {
return;
default:
if ( !quiet )
fprintf(stderr, "%.5lx: UNKNOWN DEVICE WRITE AT 0x%lx !!!\n", saturn.PC,
addr);
fprintf( stderr, "%.5lx: UNKNOWN DEVICE WRITE AT 0x%lx !!!\n",
saturn.PC, addr );
return;
}
}
@ -456,7 +478,8 @@ int read_dev_mem(long addr) {
return saturn.card_status & 0x0f;
case 0x110: /* IO CONTROL */
#ifdef DEBUG_SERIAL
fprintf(stderr, "%.5lx: IOC read: %x\n", saturn.PC, saturn.io_ctrl);
fprintf( stderr, "%.5lx: IOC read: %x\n", saturn.PC,
saturn.io_ctrl );
#endif
return saturn.io_ctrl & 0x0f;
case 0x111: /* RCS */
@ -484,12 +507,14 @@ int read_dev_mem(long addr) {
case 0x118:
case 0x119: /* SERVICE REQ */
#ifdef DEBUG_SERIAL
fprintf(stderr, "%.5lx: SREQ? read: %x\n", saturn.PC, saturn.sreq);
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);
fprintf( stderr, "%.5lx: IRC read: %x\n", saturn.PC,
saturn.ir_ctrl );
#endif
return saturn.ir_ctrl & 0x0f;
case 0x11b: /* BASE NIB OFFSET */
@ -527,7 +552,8 @@ int read_dev_mem(long addr) {
line_counter++;
if ( line_counter > 0x3f )
line_counter = -1;
return (((saturn.line_count & 0xc0) | (line_counter & 0x3f)) >>
return ( ( ( saturn.line_count & 0xc0 ) |
( line_counter & 0x3f ) ) >>
( ( addr - 0x128 ) * 4 ) ) &
0x0f;
case 0x12a:
@ -561,8 +587,8 @@ int read_dev_mem(long addr) {
return ( saturn.timer2 >> ( ( addr - 0x138 ) * 4 ) ) & 0xf;
default:
if ( !quiet )
fprintf(stderr, "%.5lx: UNKNOWN DEVICE READ AT 0x%lx !!!\n", saturn.PC,
addr);
fprintf( stderr, "%.5lx: UNKNOWN DEVICE READ AT 0x%lx !!!\n",
saturn.PC, addr );
return 0x00;
}
}
@ -578,7 +604,8 @@ void write_nibble_sx(long addr, int val) {
return;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 1:
@ -588,7 +615,8 @@ void write_nibble_sx(long addr, int val) {
case 5:
case 6:
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 7:
@ -603,13 +631,15 @@ void write_nibble_sx(long addr, int val) {
saturn.ram[ addr - 0x70000 ] = val;
break;
}
if (saturn.mem_cntl[MCTL_SysRAM_SX].config[1] == 0xf0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] ==
0xf0000 ) {
saturn.ram[ addr - 0x70000 ] = val;
break;
}
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 8:
@ -627,7 +657,8 @@ void write_nibble_sx(long addr, int val) {
return;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xc:
@ -644,7 +675,8 @@ void write_nibble_sx(long addr, int val) {
return;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xf:
@ -663,7 +695,8 @@ void write_nibble_sx(long addr, int val) {
return;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC, addr);
fprintf( stderr, "%.5lx: write to NULL at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
@ -690,7 +723,8 @@ 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);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 1:
@ -699,8 +733,8 @@ void write_nibble_gx(long addr, int val) {
case 5:
case 6:
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: BAD WRITE TO ROM AT ADDRESS %.5lx\n", saturn.PC,
addr);
fprintf( stderr, "%.5lx: BAD WRITE TO ROM AT ADDRESS %.5lx\n",
saturn.PC, addr );
#endif
return;
case 4:
@ -709,34 +743,38 @@ void write_nibble_gx(long addr, int val) {
break;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: BAD WRITE TO ROM AT ADDRESS %.5lx\n", saturn.PC,
addr);
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) {
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);
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);
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);
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);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 8:
@ -751,41 +789,47 @@ void write_nibble_gx(long addr, int val) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xf0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xf0000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xc0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xc0000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC, addr);
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);
fprintf( stderr, "%.5lx: write to bank switch at %.5lx\n",
saturn.PC, addr );
#endif
return;
}
}
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 )
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xc0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xc0000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
#ifdef DEBUG_BAD_MEM
fprintf(stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC, addr);
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 )
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xc0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xc0000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
@ -795,18 +839,21 @@ 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);
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 )
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xc0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xc0000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) {
if ( port2_is_ram )
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xb0000)) &
saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xb0000 ) ) &
port2_mask ] = val;
/*
if (port2_size > (saturn.bank_switch << 18))
@ -819,7 +866,8 @@ 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);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xc:
@ -844,7 +892,8 @@ void write_nibble_gx(long addr, int val) {
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) {
if ( port2_is_ram )
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) &
saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ] = val;
/*
if (port2_size > (saturn.bank_switch << 18))
@ -857,14 +906,16 @@ 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);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
case 0xd:
case 0xe:
case 0xf:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 )
if (saturn.mem_cntl[MCTL_SysRAM_GX].config[1] == 0xc0000) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] ==
0xc0000 ) {
saturn.ram[ addr - 0xc0000 ] = val;
break;
}
@ -877,7 +928,8 @@ void write_nibble_gx(long addr, int val) {
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 )
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) {
if ( port2_is_ram )
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) &
saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ] = val;
/*
if (port2_size > (saturn.bank_switch << 18))
@ -890,7 +942,8 @@ 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);
fprintf( stderr, "%.5lx: write to ROM at %.5lx\n", saturn.PC,
addr );
#endif
return;
}
@ -994,11 +1047,13 @@ int read_nibble_gx(long addr) {
return saturn.ram[ addr - 0x40000 ];
return saturn.rom[ addr ];
case 7:
if (addr >= 0x7f000 && saturn.mem_cntl[MCTL_BANK_GX].config[0] == 0x7f000) {
if ( addr >= 0x7f000 &&
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);
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x7f040 && addr < 0x7f080 ) {
@ -1013,14 +1068,16 @@ int read_nibble_gx(long addr) {
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);
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);
fprintf( stderr, "%.5lx: read from port 2 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
@ -1045,14 +1102,15 @@ int read_nibble_gx(long addr) {
if ( addr == 0x90000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf(stderr, "%.5lx: disable bank switch\n", saturn.PC);
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);
fprintf( stderr, "%.5lx: switch to bank %d\n",
saturn.PC, saturn.bank_switch );
#endif
}
return 0x7;
@ -1075,8 +1133,9 @@ int read_nibble_gx(long addr) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 )
return saturn.ram[ addr - 0x80000 ];
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) {
return saturn
.port2[((saturn.bank_switch << 18) + (addr - 0xb0000)) & port2_mask];
return saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xb0000 ) ) &
port2_mask ];
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -1101,8 +1160,9 @@ int read_nibble_gx(long addr) {
return saturn.port1[ ( addr - 0xc0000 ) & port1_mask ];
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) {
return saturn
.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) & port2_mask];
return saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ];
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -1125,12 +1185,14 @@ int read_nibble_gx(long addr) {
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 )
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) {
return saturn.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) &
return saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ];
/*
if (port2_size > (saturn.bank_switch << 18))
{
return saturn.port2[(saturn.bank_switch << 18)
return saturn.port2[(saturn.bank_switch <<
18)
+ (addr - 0xc0000)];
}
return 0x00;
@ -1176,30 +1238,36 @@ int read_nibble_crc_sx(long addr) {
case 0xa:
case 0xb:
if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0x80000 ) {
return calc_crc(saturn.port1[(addr - 0x80000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0x80000 ) & port1_mask ] );
}
if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0x80000 ) {
return calc_crc(saturn.port2[(addr - 0x80000) & port2_mask]);
return calc_crc(
saturn.port2[ ( addr - 0x80000 ) & port2_mask ] );
}
return 0x00;
case 0xc:
case 0xd:
case 0xe:
if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(saturn.port1[(addr - 0xc0000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] );
}
if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(saturn.port2[(addr - 0xc0000) & port2_mask]);
return calc_crc(
saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] );
}
return 0x00;
case 0xf:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0xf0000 )
return calc_crc( saturn.ram[ addr - 0xf0000 ] );
if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(saturn.port1[(addr - 0xc0000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] );
}
if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(saturn.port2[(addr - 0xc0000) & port2_mask]);
return calc_crc(
saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] );
}
return 0x00;
}
@ -1228,11 +1296,13 @@ int read_nibble_crc_gx(long addr) {
return calc_crc( saturn.ram[ addr - 0x40000 ] );
return calc_crc( saturn.rom[ addr ] );
case 7:
if (addr >= 0x7f000 && saturn.mem_cntl[MCTL_BANK_GX].config[0] == 0x7f000) {
if ( addr >= 0x7f000 &&
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);
fprintf( stderr, "%.5lx: disable bank switch\n",
saturn.PC );
#endif
}
if ( addr >= 0x7f040 && addr < 0x7f080 ) {
@ -1247,14 +1317,16 @@ int read_nibble_crc_gx(long addr) {
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);
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);
fprintf( stderr, "%.5lx: read from port 2 at %.5lx\n",
saturn.PC, addr );
#endif
return 0x7;
}
@ -1279,14 +1351,15 @@ int read_nibble_crc_gx(long addr) {
if ( addr == 0x90000 ) {
saturn.bank_switch = 0;
#ifdef DEBUG_BANK_SWITCH
fprintf(stderr, "%.5lx: disable bank switch\n", saturn.PC);
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);
fprintf( stderr, "%.5lx: switch to bank %d\n",
saturn.PC, saturn.bank_switch );
#endif
}
return 0x7;
@ -1301,7 +1374,8 @@ int read_nibble_crc_gx(long addr) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 )
return calc_crc( saturn.ram[ addr - 0x80000 ] );
if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xa0000 ) {
return calc_crc(saturn.port1[(addr - 0xa0000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0xa0000 ) & port1_mask ] );
}
return calc_crc( saturn.rom[ addr ] );
case 0xb:
@ -1309,14 +1383,16 @@ int read_nibble_crc_gx(long addr) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 )
return calc_crc( saturn.ram[ addr - 0x80000 ] );
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) {
return calc_crc(
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xb0000)) &
return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xb0000 ) ) &
port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
return calc_crc(saturn.port2[(saturn.bank_switch << 18)
+ (addr - 0xb0000)]);
return calc_crc(saturn.port2[(saturn.bank_switch
<< 18)
+ (addr -
0xb0000)]);
}
return 0x00;
*/
@ -1333,17 +1409,20 @@ int read_nibble_crc_gx(long addr) {
return calc_crc( saturn.ram[ addr - 0xc0000 ] );
}
if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(saturn.port1[(addr - 0xc0000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] );
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) {
return calc_crc(
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) &
return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
return calc_crc(saturn.port2[(saturn.bank_switch << 18)
+ (addr - 0xc0000)]);
return calc_crc(saturn.port2[(saturn.bank_switch
<< 18)
+ (addr -
0xc0000)]);
}
return 0x00;
*/
@ -1357,19 +1436,22 @@ int read_nibble_crc_gx(long addr) {
return calc_crc( saturn.ram[ addr - 0xc0000 ] );
if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xc0000 )
if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 1 ] == 0xc0000 ) {
return calc_crc(saturn.port1[(addr - 0xc0000) & port1_mask]);
return calc_crc(
saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] );
}
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 )
if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) {
return calc_crc(
saturn.port2[((saturn.bank_switch << 18) + (addr - 0xc0000)) &
saturn.port2[ ( ( saturn.bank_switch << 18 ) +
( addr - 0xc0000 ) ) &
port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
return calc_crc(saturn.port2[(saturn.bank_switch <<
18)
+ (addr - 0xc0000)]);
return
calc_crc(saturn.port2[(saturn.bank_switch << 18)
+ (addr -
0xc0000)]);
}
return 0x00;
*/

View file

@ -82,7 +82,8 @@ int main(int argc, char **argv) {
else if ( !strcmp( asize, "4M" ) )
size = 0x400000;
else {
fprintf(stderr,
fprintf(
stderr,
"%s: size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n",
argv[ 0 ] );
exit( 1 );

View file

@ -477,7 +477,8 @@ int is_less_register(unsigned char *r1, unsigned char *r2, int code) {
return z;
}
int is_less_or_equal_register(unsigned char *r1, unsigned char *r2, int code) {
int is_less_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ) {
int z, i, s, e;
s = get_start( code );

View file

@ -92,14 +92,15 @@ void get_resources(void) {
useSerial = get_boolean_resource( "useSerial", "UseSerial" );
serialLine = get_string_resource( "serialLine", "SerialLine" );
initialize = get_boolean_resource("completeInitialize", "CompleteInitialize");
initialize =
get_boolean_resource( "completeInitialize", "CompleteInitialize" );
resetOnStartup = get_boolean_resource( "resetOnStartup", "ResetOnStartup" );
romFileName = get_string_resource( "romFileName", "RomFileName" );
homeDirectory = get_string_resource( "homeDirectory", "HomeDirectory" );
useDebugger = get_boolean_resource( "useDebugger", "UseDebugger" );
disassembler_mode =
get_mnemonic_resource("disassemblerMnemonics", "DisassemblerMnemonics");
disassembler_mode = get_mnemonic_resource( "disassemblerMnemonics",
"DisassemblerMnemonics" );
netbook = get_boolean_resource( "netbook", "Netbook" );
@ -162,9 +163,11 @@ int get_boolean_resource(char *name, char *class) {
*tmp = 0;
free( os );
if (!strcmp(buf, "on") || !strcmp(buf, "true") || !strcmp(buf, "yes"))
if ( !strcmp( buf, "on" ) || !strcmp( buf, "true" ) ||
!strcmp( buf, "yes" ) )
return 1;
if (!strcmp(buf, "off") || !strcmp(buf, "false") || !strcmp(buf, "no"))
if ( !strcmp( buf, "off" ) || !strcmp( buf, "false" ) ||
!strcmp( buf, "no" ) )
return 0;
fprintf( stderr, "%s: %s must be boolean, not %s.\n", progname, name, buf );
return 0;
@ -179,7 +182,8 @@ int get_integer_resource(char *name, char *class) {
free( s );
return val;
}
fprintf(stderr, "%s: %s must be an integer, not %s.\n", progname, name, s);
fprintf( stderr, "%s: %s must be an integer, not %s.\n", progname, name,
s );
free( s );
return 0;
}
@ -204,7 +208,8 @@ unsigned int get_pixel_resource(char *name, char *class, Display *dpy,
DEFAULT:
if ( s )
free( s );
return (strcmp(class, "Background") ? WhitePixel(dpy, DefaultScreen(dpy))
return ( strcmp( class, "Background" )
? WhitePixel( dpy, DefaultScreen( dpy ) )
: BlackPixel( dpy, DefaultScreen( dpy ) ) );
}
@ -239,8 +244,8 @@ static Visual *id_to_visual(Display *dpy, int id, unsigned int *depth) {
vi_in.screen = DefaultScreen( dpy );
vi_in.visualid = id;
vi_out =
XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, &vi_in, &out_count);
vi_out = XGetVisualInfo( dpy, VisualScreenMask | VisualIDMask, &vi_in,
&out_count );
if ( vi_out ) {
Visual* v = vi_out[ 0 ].visual;
*depth = vi_out[ 0 ].depth;

View file

@ -118,7 +118,8 @@ int read_rom_file(char *name, unsigned char **mem, int *size) {
return 0;
}
if (NULL == (tmp_mem = (unsigned char *)malloc((size_t)st.st_size))) {
if ( NULL ==
( tmp_mem = ( unsigned char* )malloc( ( size_t )st.st_size ) ) ) {
for ( i = 0, j = 0; i < *size / 2; i++ ) {
if ( 1 != fread( &byte, 1, 1, fp ) ) {
fprintf( stderr, "can\'t read %s\n", name );
@ -157,16 +158,16 @@ int read_rom_file(char *name, unsigned char **mem, int *size) {
if ( *size == ROM_SIZE_GX ) {
opt_gx = 1;
} else if ( *size == 4 * ROM_SIZE_GX ) {
fprintf(stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", name,
*size);
fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n",
name, *size );
opt_gx = 2;
} else if ( *size == 8 * ROM_SIZE_GX ) {
fprintf(stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", name,
*size);
fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n",
name, *size );
opt_gx = 2;
} else {
fprintf(stderr, "%s seems to be G/GX ROM, but size is 0x%x\n", name,
*size);
fprintf( stderr, "%s seems to be G/GX ROM, but size is 0x%x\n",
name, *size );
free( *mem );
*mem = NULL;
*size = 0;
@ -176,8 +177,8 @@ int read_rom_file(char *name, unsigned char **mem, int *size) {
if ( *size == ROM_SIZE_SX ) {
opt_gx = 0;
} else {
fprintf(stderr, "%s seems to be S/SX ROM, but size is 0x%x\n", name,
*size);
fprintf( stderr, "%s seems to be S/SX ROM, but size is 0x%x\n",
name, *size );
free( *mem );
*mem = NULL;
*size = 0;

View file

@ -36,8 +36,7 @@
extern unsigned int opt_gx;
extern unsigned int rom_size;
extern int read_rom_file __ProtoType__((char *name,
unsigned char **mem,
extern int read_rom_file __ProtoType__( ( char* name, unsigned char** mem,
int* size ) );
#endif /* !_ROMIO_H */

View file

@ -116,7 +116,8 @@ int serial_init(void) {
ttyp = -1;
if ( useTerminal ) {
#if defined( IRIX )
if ((p = _getpty(&wire_fd, O_RDWR | O_EXCL | O_NDELAY, 0666, 0)) == NULL) {
if ( ( p = _getpty( &wire_fd, O_RDWR | O_EXCL | O_NDELAY, 0666, 0 ) ) ==
NULL ) {
wire_fd = -1;
ttyp = -1;
} else {
@ -131,31 +132,37 @@ int serial_init(void) {
}
}
#elif defined( SOLARIS )
if ((wire_fd = open("/dev/ptmx", O_RDWR | O_NONBLOCK, 0666)) >= 0) {
if ( ( wire_fd = open( "/dev/ptmx", O_RDWR | O_NONBLOCK, 0666 ) ) >=
0 ) {
grantpt( wire_fd );
unlockpt( wire_fd );
p = ptsname( wire_fd );
strcpy( tty_dev_name, p );
if ((ttyp = open(tty_dev_name, O_RDWR | O_NDELAY, 0666)) >= 0) {
if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY, 0666 ) ) >=
0 ) {
ioctl( ttyp, I_PUSH, "ptem" );
ioctl( ttyp, I_PUSH, "ldterm" );
if ( verbose )
printf("%s: wire connection on %s\n", progname, tty_dev_name);
printf( "%s: wire connection on %s\n", progname,
tty_dev_name );
wire_name = strdup( tty_dev_name );
}
}
#elif defined( LINUX )
/* Unix98 PTY (Preferred) */
if ((wire_fd = open("/dev/ptmx", O_RDWR | O_NONBLOCK, 0666)) >= 0) {
if ( ( wire_fd = open( "/dev/ptmx", O_RDWR | O_NONBLOCK, 0666 ) ) >=
0 ) {
grantpt( wire_fd );
unlockpt( wire_fd );
if ( ptsname_r( wire_fd, tty_dev_name, 128 ) ) {
perror( "Could not get the name of the wire device." );
exit( -1 );
}
if ((ttyp = open(tty_dev_name, O_RDWR | O_NDELAY, 0666)) >= 0) {
if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY, 0666 ) ) >=
0 ) {
if ( verbose )
printf("%s: wire connection on %s\n", progname, tty_dev_name);
printf( "%s: wire connection on %s\n", progname,
tty_dev_name );
wire_name = strdup( tty_dev_name );
}
}
@ -166,11 +173,13 @@ int serial_init(void) {
for ( n = 0; n < 16; n++ ) {
sprintf( tty_dev_name, "/dev/pty%c%x", c, n );
if ( ( wire_fd =
open(tty_dev_name, O_RDWR | O_EXCL | O_NDELAY, 0666)) >= 0) {
open( tty_dev_name, O_RDWR | O_EXCL | O_NDELAY,
0666 ) ) >= 0 ) {
ttyp = wire_fd;
sprintf( tty_dev_name, "/dev/tty%c%x", c, n );
if ( verbose )
printf("%s: wire connection on %s\n", progname, tty_dev_name);
printf( "%s: wire connection on %s\n", progname,
tty_dev_name );
wire_name = strdup( tty_dev_name );
break;
}
@ -186,15 +195,17 @@ int serial_init(void) {
do {
for ( n = 0; n < 16; n++ ) {
sprintf( tty_dev_name, "/dev/ptyp%x", n );
if ((wire_fd = open(tty_dev_name, O_RDWR | O_EXCL | O_NDELAY, 0666)) >=
0) {
if ( ( wire_fd = open( tty_dev_name, O_RDWR | O_EXCL | O_NDELAY,
0666 ) ) >= 0 ) {
sprintf( tty_dev_name, "/dev/tty%c%x", c, n );
if ((ttyp = open(tty_dev_name, O_RDWR | O_NDELAY, 0666)) < 0) {
if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY,
0666 ) ) < 0 ) {
wire_fd = -1;
ttyp = -1;
} else {
if ( verbose )
printf("%s: wire connection on %s\n", progname, tty_dev_name);
printf( "%s: wire connection on %s\n", progname,
tty_dev_name );
wire_name = strdup( tty_dev_name );
break;
}
@ -262,8 +273,8 @@ int serial_init(void) {
#endif
{
if ( !quiet )
fprintf(stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n", progname,
errno);
fprintf( stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n",
progname, errno );
ir_fd = -1;
}
}
@ -285,8 +296,8 @@ int serial_init(void) {
#endif
{
if ( !quiet )
fprintf(stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n", progname,
errno);
fprintf( stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n",
progname, errno );
ir_fd = -1;
}
}
@ -306,8 +317,8 @@ void serial_baud(int baud) {
#endif
{
if ( !quiet )
fprintf(stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n", progname,
errno);
fprintf( stderr, "%s: ioctl(IR, TCGETS) failed, errno = %d\n",
progname, errno );
ir_fd = -1;
error = 1;
}
@ -352,7 +363,8 @@ void serial_baud(int baud) {
if ( ( ir_fd >= 0 ) && ( ( ttybuf.c_ospeed ) == 0 ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
fprintf( stderr, "%s: can\'t set baud rate, using 9600\n",
progname );
ttybuf.c_cflag |= B9600;
}
#else
@ -396,7 +408,8 @@ void serial_baud(int baud) {
if ( ( ir_fd >= 0 ) && ( ( ttybuf.c_cflag & CBAUD ) == 0 ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
fprintf( stderr, "%s: can\'t set baud rate, using 9600\n",
progname );
ttybuf.c_cflag |= B9600;
}
#endif
@ -408,8 +421,8 @@ void serial_baud(int baud) {
#endif
{
if ( !quiet )
fprintf(stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n", progname,
errno);
fprintf( stderr, "%s: ioctl(IR, TCSETS) failed, errno = %d\n",
progname, errno );
ir_fd = -1;
error = 1;
}
@ -473,7 +486,8 @@ void serial_baud(int baud) {
if ( ( ttyp >= 0 ) && ( ( ttybuf.c_cflag & CBAUD ) == 0 ) ) {
if ( !quiet )
fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
fprintf( stderr, "%s: can\'t set baud rate, using 9600\n",
progname );
ttybuf.c_cflag |= B9600;
}
#endif
@ -534,7 +548,8 @@ void transmit_char(void) {
}
} else {
if ( errno != EAGAIN ) {
fprintf(stderr, "%s: serial write error: %d\n", progname, errno);
fprintf( stderr, "%s: serial write error: %d\n", progname,
errno );
}
saturn.tcs &= 0x0e;
if ( saturn.io_ctrl & 0x04 ) {
@ -550,7 +565,8 @@ void transmit_char(void) {
} else {
if ( errno != EAGAIN ) {
if ( !quiet )
fprintf(stderr, "%s: serial write error: %d\n", progname, errno);
fprintf( stderr, "%s: serial write error: %d\n", progname,
errno );
}
saturn.tcs &= 0x0e;
if ( saturn.io_ctrl & 0x04 ) {
@ -598,7 +614,8 @@ void receive_char() {
FD_SET( wire_fd, &rfds );
nfd = wire_fd + 1;
}
if ((nfd = select(nfd, &rfds, (fd_set *)0, (fd_set *)0, &tout)) > 0) {
if ( ( nfd = select( nfd, &rfds, ( fd_set* )0, ( fd_set* )0, &tout ) ) >
0 ) {
#ifdef DEBUG_SERIAL
fprintf( stderr, "select = %d\n", nfd );
#endif

View file

@ -48,288 +48,256 @@
#define blank_width 4
#define blank_height 7
static unsigned char blank_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char blank_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
#define hash_width 5
#define hash_height 7
static unsigned char hash_bits[] = {
0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a};
static unsigned char hash_bits[] = { 0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a };
#define lbrace_width 3
#define lbrace_height 7
static unsigned char lbrace_bits[] = {
0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04};
static unsigned char lbrace_bits[] = { 0x04, 0x02, 0x01, 0x01,
0x01, 0x02, 0x04 };
#define rbrace_width 3
#define rbrace_height 7
static unsigned char rbrace_bits[] = {
0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01};
static unsigned char rbrace_bits[] = { 0x01, 0x02, 0x04, 0x04,
0x04, 0x02, 0x01 };
#define comma_width 3
#define comma_height 7
static unsigned char comma_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x03};
static unsigned char comma_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x06, 0x06, 0x03 };
#define slash_width 3
#define slash_height 7
static unsigned char slash_bits[] = {
0x04, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01};
static unsigned char slash_bits[] = { 0x04, 0x04, 0x02, 0x02,
0x02, 0x01, 0x01 };
#define two_width 5
#define two_height 7
static unsigned char two_bits[] = {
0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f};
static unsigned char two_bits[] = { 0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f };
#define three_width 5
#define three_height 7
static unsigned char three_bits[] = {
0x0e, 0x11, 0x10, 0x0c, 0x10, 0x11, 0x0e};
static unsigned char three_bits[] = { 0x0e, 0x11, 0x10, 0x0c,
0x10, 0x11, 0x0e };
#define small_colon_width 2
#define small_colon_height 7
static unsigned char small_colon_bits[] = {
0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00};
static unsigned char small_colon_bits[] = { 0x00, 0x03, 0x03, 0x00,
0x03, 0x03, 0x00 };
#define A_width 5
#define A_height 7
static unsigned char A_bits[] = {
0x0e, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11};
static unsigned char A_bits[] = { 0x0e, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11 };
#define B_width 5
#define B_height 7
static unsigned char B_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x11, 0x11, 0x0f};
static unsigned char B_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x11, 0x11, 0x0f };
#define C_width 5
#define C_height 7
static unsigned char C_bits[] = {
0x0e, 0x11, 0x01, 0x01, 0x01, 0x11, 0x0e};
static unsigned char C_bits[] = { 0x0e, 0x11, 0x01, 0x01, 0x01, 0x11, 0x0e };
#define D_width 5
#define D_height 7
static unsigned char D_bits[] = {
0x0f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0f};
static unsigned char D_bits[] = { 0x0f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0f };
#define E_width 5
#define E_height 7
static unsigned char E_bits[] = {
0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x1f};
static unsigned char E_bits[] = { 0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x1f };
#define F_width 5
#define F_height 7
static unsigned char F_bits[] = {
0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x01};
static unsigned char F_bits[] = { 0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x01 };
#define G_width 5
#define G_height 7
static unsigned char G_bits[] = {
0x0e, 0x11, 0x01, 0x01, 0x19, 0x11, 0x0e};
static unsigned char G_bits[] = { 0x0e, 0x11, 0x01, 0x01, 0x19, 0x11, 0x0e };
#define H_width 5
#define H_height 7
static unsigned char H_bits[] = {
0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11};
static unsigned char H_bits[] = { 0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11 };
#define I_width 1
#define I_height 7
static unsigned char I_bits[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
static unsigned char I_bits[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
#define J_width 4
#define J_height 7
static unsigned char J_bits[] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x06};
static unsigned char J_bits[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x06 };
#define K_width 5
#define K_height 7
static unsigned char K_bits[] = {
0x11, 0x09, 0x05, 0x03, 0x05, 0x09, 0x11};
static unsigned char K_bits[] = { 0x11, 0x09, 0x05, 0x03, 0x05, 0x09, 0x11 };
#define L_width 4
#define L_height 7
static unsigned char L_bits[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0f};
static unsigned char L_bits[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0f };
#define M_width 5
#define M_height 7
static unsigned char M_bits[] = {
0x11, 0x1b, 0x15, 0x11, 0x11, 0x11, 0x11};
static unsigned char M_bits[] = { 0x11, 0x1b, 0x15, 0x11, 0x11, 0x11, 0x11 };
#define N_width 5
#define N_height 7
static unsigned char N_bits[] = {
0x11, 0x11, 0x13, 0x15, 0x19, 0x11, 0x11};
static unsigned char N_bits[] = { 0x11, 0x11, 0x13, 0x15, 0x19, 0x11, 0x11 };
#define O_width 5
#define O_height 7
static unsigned char O_bits[] = {
0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e};
static unsigned char O_bits[] = { 0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e };
#define P_width 5
#define P_height 7
static unsigned char P_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x01, 0x01, 0x01};
static unsigned char P_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x01, 0x01, 0x01 };
#define Q_width 5
#define Q_height 7
static unsigned char Q_bits[] = {
0x0e, 0x11, 0x11, 0x11, 0x15, 0x09, 0x16};
static unsigned char Q_bits[] = { 0x0e, 0x11, 0x11, 0x11, 0x15, 0x09, 0x16 };
#define R_width 5
#define R_height 7
static unsigned char R_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x05, 0x09, 0x11};
static unsigned char R_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x05, 0x09, 0x11 };
#define S_width 5
#define S_height 7
static unsigned char S_bits[] = {
0x0e, 0x11, 0x01, 0x0e, 0x10, 0x11, 0x0e};
static unsigned char S_bits[] = { 0x0e, 0x11, 0x01, 0x0e, 0x10, 0x11, 0x0e };
#define T_width 5
#define T_height 7
static unsigned char T_bits[] = {
0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04};
static unsigned char T_bits[] = { 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };
#define U_width 5
#define U_height 7
static unsigned char U_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e};
static unsigned char U_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e };
#define V_width 5
#define V_height 7
static unsigned char V_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x0a, 0x0a, 0x04};
static unsigned char V_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x0a, 0x0a, 0x04 };
#define W_width 5
#define W_height 7
static unsigned char W_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x15, 0x1b, 0x11};
static unsigned char W_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x15, 0x1b, 0x11 };
#define X_width 5
#define X_height 7
static unsigned char X_bits[] = {
0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11};
static unsigned char X_bits[] = { 0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11 };
#define Y_width 5
#define Y_height 7
static unsigned char Y_bits[] = {
0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x04};
static unsigned char Y_bits[] = { 0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x04 };
#define Z_width 5
#define Z_height 7
static unsigned char Z_bits[] = {
0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f};
static unsigned char Z_bits[] = { 0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f };
#define lbracket_width 3
#define lbracket_height 7
static unsigned char lbracket_bits[] = {
0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07};
static unsigned char lbracket_bits[] = { 0x07, 0x01, 0x01, 0x01,
0x01, 0x01, 0x07 };
#define rbracket_width 3
#define rbracket_height 7
static unsigned char rbracket_bits[] = {
0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07};
static unsigned char rbracket_bits[] = { 0x07, 0x04, 0x04, 0x04,
0x04, 0x04, 0x07 };
#define arrow_width 7
#define arrow_height 7
static unsigned char arrow_bits[] = {
0x00, 0x08, 0x18, 0x3f, 0x18, 0x08, 0x00};
static unsigned char arrow_bits[] = { 0x00, 0x08, 0x18, 0x3f,
0x18, 0x08, 0x00 };
#define diff_width 5
#define diff_height 7
static unsigned char diff_bits[] = {
0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e};
static unsigned char diff_bits[] = { 0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e };
#define integral_width 5
#define integral_height 8
static unsigned char integral_bits[] = {
0x0c, 0x12, 0x02, 0x04, 0x04, 0x08, 0x09, 0x06};
static unsigned char integral_bits[] = { 0x0c, 0x12, 0x02, 0x04,
0x04, 0x08, 0x09, 0x06 };
#define sigma_width 6
#define sigma_height 9
static unsigned char sigma_bits[] = {
0x3f, 0x21, 0x02, 0x04, 0x08, 0x04, 0x02, 0x21, 0x3f};
static unsigned char sigma_bits[] = { 0x3f, 0x21, 0x02, 0x04, 0x08,
0x04, 0x02, 0x21, 0x3f };
#define sqr_width 11
#define sqr_height 10
static unsigned char sqr_bits[] = {
0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x26, 0x01, 0x94, 0x07,
0x08, 0x00, 0x14, 0x00, 0x53, 0x00, 0x21, 0x00};
static unsigned char sqr_bits[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x26, 0x01, 0x94, 0x07, 0x08, 0x00,
0x14, 0x00, 0x53, 0x00, 0x21, 0x00 };
#define root_width 18
#define root_height 13
static unsigned char root_bits[] = {
0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14, 0x02, 0x02,
0x53, 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91, 0x00, 0x10, 0x91, 0x00,
0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00, 0x80, 0x20, 0x00, 0x00, 0x14, 0x00,
0x00, 0x0c, 0x00};
0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14,
0x02, 0x02, 0x53, 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91,
0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00,
0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 };
#define pow10_width 13
#define pow10_height 9
static unsigned char pow10_bits[] = {
0x00, 0x12, 0x00, 0x0c, 0x32, 0x04, 0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00,
static unsigned char pow10_bits[] = { 0x00, 0x12, 0x00, 0x0c, 0x32, 0x04,
0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00,
0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 };
#define exp_width 11
#define exp_height 9
static unsigned char exp_bits[] = {
0x80, 0x04, 0x00, 0x03, 0x00, 0x01, 0x8c, 0x02, 0x52, 0x02, 0x09, 0x00,
static unsigned char exp_bits[] = { 0x80, 0x04, 0x00, 0x03, 0x00, 0x01,
0x8c, 0x02, 0x52, 0x02, 0x09, 0x00,
0x07, 0x00, 0x21, 0x00, 0x1e, 0x00 };
#define under_width 6
#define under_height 7
static unsigned char under_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f};
static unsigned char under_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f };
#define prog_width 16
#define prog_height 7
static unsigned char prog_bits[] = {
0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09, 0x90, 0x12, 0x48, 0x24, 0x24,
0x48, 0x12};
static unsigned char prog_bits[] = { 0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09,
0x90, 0x12, 0x48, 0x24, 0x24, 0x48, 0x12 };
#define string_width 10
#define string_height 7
static unsigned char string_bits[] = {
0x85, 0x02, 0x85, 0x02, 0x85, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00};
static unsigned char string_bits[] = { 0x85, 0x02, 0x85, 0x02, 0x85,
0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
#define equal_width 5
#define equal_height 7
static unsigned char equal_bits[] = {
0x00, 0x1f, 0x00, 0x00, 0x1f, 0x00, 0x00};
static unsigned char equal_bits[] = { 0x00, 0x1f, 0x00, 0x00,
0x1f, 0x00, 0x00 };
#define nl_width 8
#define nl_height 7
static unsigned char nl_bits[] = {
0x00, 0x84, 0x86, 0xff, 0x06, 0x04, 0x00};
static unsigned char nl_bits[] = { 0x00, 0x84, 0x86, 0xff, 0x06, 0x04, 0x00 };
#define pi_width 6
#define pi_height 7
static unsigned char pi_bits[] = {
0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12};
static unsigned char pi_bits[] = { 0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12 };
#define angle_width 8
#define angle_height 7
static unsigned char angle_bits[] = {
0x40, 0x20, 0x10, 0x28, 0x44, 0x42, 0xff};
static unsigned char angle_bits[] = { 0x40, 0x20, 0x10, 0x28,
0x44, 0x42, 0xff };
#define lcurly_width 5
#define lcurly_height 7
static unsigned char lcurly_bits[] = {
0x18, 0x04, 0x04, 0x02, 0x04, 0x04, 0x18};
static unsigned char lcurly_bits[] = { 0x18, 0x04, 0x04, 0x02,
0x04, 0x04, 0x18 };
#define rcurly_width 5
#define rcurly_height 7
static unsigned char rcurly_bits[] = {
0x03, 0x04, 0x04, 0x08, 0x04, 0x04, 0x03};
static unsigned char rcurly_bits[] = { 0x03, 0x04, 0x04, 0x08,
0x04, 0x04, 0x03 };
#define sqr_gx_width 11
#define sqr_gx_height 13
static unsigned char sqr_gx_bits[] = {
0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x80, 0x07,
0x00, 0x00, 0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14, 0x00, 0x53, 0x00,
0x21, 0x00};
static unsigned char sqr_gx_bits[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x00, 0x01, 0x80, 0x07, 0x00, 0x00,
0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14,
0x00, 0x53, 0x00, 0x21, 0x00 };
#define root_gx_width 18
#define root_gx_height 15
@ -359,8 +327,8 @@ static unsigned char parens_gx_bits[] = {
#define hash_gx_width 8
#define hash_gx_height 12
static unsigned char hash_gx_bits[] = {
0x00, 0x00, 0x48, 0x48, 0xfe, 0x24, 0x24, 0x7f, 0x12, 0x12, 0x00, 0x00};
static unsigned char hash_gx_bits[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24,
0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 };
#define bracket_gx_width 12
#define bracket_gx_height 12
@ -395,8 +363,8 @@ static unsigned char curly_gx_bits[] = {
#define colon_gx_width 8
#define colon_gx_height 12
static unsigned char colon_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00};
static unsigned char colon_gx_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3,
0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 };
#define angle_gx_width 12
#define angle_gx_height 12
@ -419,8 +387,8 @@ static unsigned char nl_gx_bits[] = {
#define comma_gx_width 3
#define comma_gx_height 12
static unsigned char comma_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x04, 0x04, 0x02};
static unsigned char comma_gx_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x07, 0x07, 0x04, 0x04, 0x02 };
#define arrow_gx_width 18
#define arrow_gx_height 12
@ -431,8 +399,8 @@ static unsigned char arrow_gx_bits[] = {
#define equal_gx_width 8
#define equal_gx_height 12
static unsigned char equal_gx_bits[] = {
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00};
static unsigned char equal_gx_bits[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
0x00, 0xff, 0xff, 0x00, 0x00, 0x00 };
typedef struct letter_t {
unsigned int w, h;

View file

@ -93,7 +93,8 @@ word_64 time_offset = 0x0;
#define TIMEOUT_GX ( 0x80069 - RAM_BASE_GX )
#define TIMEOUTCLK_GX ( 0x80076 - RAM_BASE_GX )
#define calc_crc(nib) (crc = (crc >> 4) ^ (((crc ^ (nib)) & 0xf) * 0x1081))
#define calc_crc( nib ) \
( crc = ( crc >> 4 ) ^ ( ( ( crc ^ ( nib ) ) & 0xf ) * 0x1081 ) )
/*
* Set ACCESSTIME: (on startup)
@ -211,8 +212,8 @@ void start_timer(int timer) {
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);
fprintf( stderr, "Timer%c[%d] start at 0x%lx\n",
timer == T1_TIMER ? '*' : ' ', timer, timers[ timer ].start );
#endif
}
@ -240,7 +241,8 @@ void restart_timer(int timer) {
timers[ timer ].start += ( tv.tv_usec << 7 ) / 15625;
}
#ifdef DEBUG_TIMER
fprintf(stderr, "Timer[%d] restart at 0x%lx\n", timer, timers[timer].start);
fprintf( stderr, "Timer[%d] restart at 0x%lx\n", timer,
timers[ timer ].start );
#endif
}

File diff suppressed because it is too large Load diff