update .clang-format and format all the code

This commit is contained in:
Gwenhael Le Moine 2023-09-22 09:44:23 +02:00
parent 7979ebe5c4
commit 28d46cbfb3
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
22 changed files with 2956 additions and 5234 deletions

View file

@ -1,18 +1,59 @@
---
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'
Language: Cpp
ColumnLimit: 140
IndentWidth: 4
PPIndentWidth: 2
UseTab: Never
AlignArrayOfStructures: Left
IndentCaseBlocks: true
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: true
InsertBraces: false
InsertNewlineAtEOF: true
MaxEmptyLinesToKeep: 1
PointerAlignment: Left
ReferenceAlignment: Left
QualifierAlignment: Left
SortIncludes: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: true
SpacesInCStyleCastParentheses: true
SpacesInContainerLiterals: true
SpacesInParentheses: true
SpacesInSquareBrackets: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
...

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,8 @@ int conf_bank2 = 0x00000;
short conf_tab_sx[] = { 1, 2, 2, 2, 2, 0 };
short conf_tab_gx[] = { 1, 2, 2, 2, 2, 0 };
void do_in( void ) {
void do_in( void )
{
int i, in, out;
out = 0;
@ -65,7 +66,8 @@ void set_program_stat( int n ) { saturn.PSTAT[ n ] = 1; }
int get_program_stat( int n ) { return saturn.PSTAT[ n ]; }
void register_to_status( unsigned char* r ) {
void register_to_status( unsigned char* r )
{
int i;
for ( i = 0; i < 12; i++ ) {
@ -73,7 +75,8 @@ void register_to_status( unsigned char* r ) {
}
}
void status_to_register( unsigned char* r ) {
void status_to_register( unsigned char* r )
{
int i;
for ( i = 0; i < 12; i++ ) {
@ -85,7 +88,8 @@ void status_to_register( unsigned char* r ) {
}
}
void swap_register_status( unsigned char* r ) {
void swap_register_status( unsigned char* r )
{
int i, tmp;
for ( i = 0; i < 12; i++ ) {
@ -98,32 +102,24 @@ void swap_register_status( unsigned char* r ) {
}
}
void clear_status( void ) {
void clear_status( void )
{
for ( int i = 0; i < 12; i++ )
saturn.PSTAT[ i ] = 0;
}
void set_register_nibble( unsigned char* reg, int n, unsigned char val ) {
reg[ n ] = val;
}
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 ) );
}
void set_register_bit( unsigned char* reg, int n ) { reg[ n / 4 ] |= ( 1 << ( n % 4 ) ); }
void clear_register_bit( unsigned char* reg, int n ) {
reg[ n / 4 ] &= ~( 1 << ( n % 4 ) );
}
void clear_register_bit( unsigned char* reg, int n ) { reg[ n / 4 ] &= ~( 1 << ( n % 4 ) ); }
int get_register_bit( unsigned char* reg, int n ) {
return ( ( int )( reg[ n / 4 ] & ( 1 << ( n % 4 ) ) ) > 0 ) ? 1 : 0;
}
int get_register_bit( unsigned char* reg, int n ) { return ( ( int )( reg[ n / 4 ] & ( 1 << ( n % 4 ) ) ) > 0 ) ? 1 : 0; }
void do_reset( void ) {
void do_reset( void )
{
for ( int i = 0; i < 6; i++ ) {
if ( opt_gx )
saturn.mem_cntl[ i ].unconfigured = conf_tab_gx[ i ];
@ -139,7 +135,8 @@ void do_inton( void ) { saturn.kbd_ien = 1; }
void do_intoff( void ) { saturn.kbd_ien = 0; }
void do_return_interupt( void ) {
void do_return_interupt( void )
{
if ( saturn.int_pending ) {
saturn.int_pending = 0;
saturn.intenable = 0;
@ -155,7 +152,8 @@ void do_return_interupt( void ) {
}
}
void do_interupt( void ) {
void do_interupt( void )
{
interrupt_called = 1;
if ( saturn.intenable ) {
push_return_addr( saturn.PC );
@ -164,7 +162,8 @@ void do_interupt( void ) {
}
}
void do_kbd_int( void ) {
void do_kbd_int( void )
{
interrupt_called = 1;
if ( saturn.intenable ) {
push_return_addr( saturn.PC );
@ -174,7 +173,8 @@ void do_kbd_int( void ) {
saturn.int_pending = 1;
}
void do_reset_interrupt_system( void ) {
void do_reset_interrupt_system( void )
{
saturn.kbd_ien = 1;
int gen_intr = 0;
for ( int i = 0; i < 9; i++ ) {
@ -187,7 +187,8 @@ void do_reset_interrupt_system( void ) {
do_kbd_int();
}
void do_unconfigure( void ) {
void do_unconfigure( void )
{
int i;
unsigned int conf = 0;
@ -210,7 +211,8 @@ void do_unconfigure( void ) {
}
}
void do_configure( void ) {
void do_configure( void )
{
int i;
unsigned long conf = 0;
@ -222,25 +224,22 @@ 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;
}
}
}
int get_identification( void ) {
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 };
for ( i = 0; i < 6; i++ )
if ( saturn.mem_cntl[ i ].unconfigured )
break;
int id = ( i < 6 )
? chip_id[ 2 * i + ( 2 - saturn.mem_cntl[ i ].unconfigured ) ]
: 0;
int id = ( i < 6 ) ? chip_id[ 2 * i + ( 2 - saturn.mem_cntl[ i ].unconfigured ) ] : 0;
for ( i = 0; i < 3; i++ ) {
saturn.C[ i ] = id & 0x0f;
@ -250,7 +249,8 @@ int get_identification( void ) {
return 0;
}
void do_shutdown( void ) {
void do_shutdown( void )
{
if ( device.display_touched ) {
device.display_touched = 0;
ui_refresh_LCD();
@ -325,7 +325,8 @@ void do_shutdown( void ) {
start_timer( RUN_TIMER );
}
void clear_hardware_stat( int op ) {
void clear_hardware_stat( int op )
{
if ( op & 1 )
saturn.XM = 0;
if ( op & 2 )
@ -336,7 +337,8 @@ void clear_hardware_stat( int op ) {
saturn.MP = 0;
}
int is_zero_hardware_stat( int op ) {
int is_zero_hardware_stat( int op )
{
if ( op & 1 )
if ( saturn.XM != 0 )
return 0;
@ -353,7 +355,8 @@ int is_zero_hardware_stat( int op ) {
return 1;
}
void push_return_addr( long addr ) {
void push_return_addr( long addr )
{
int i;
if ( ++saturn.rstkp >= NR_RSTK ) {
@ -364,13 +367,15 @@ void push_return_addr( long addr ) {
saturn.rstk[ saturn.rstkp ] = addr;
}
long pop_return_addr( void ) {
long pop_return_addr( void )
{
if ( saturn.rstkp < 0 )
return 0;
return saturn.rstk[ saturn.rstkp-- ];
}
void load_constant( unsigned char* reg, int n, long addr ) {
void load_constant( unsigned char* reg, int n, long addr )
{
int p = saturn.P;
for ( int i = 0; i < n; i++ ) {
@ -379,14 +384,16 @@ void load_constant( unsigned char* reg, int n, long addr ) {
}
}
void load_addr( word_20* dat, long addr, int n ) {
void load_addr( word_20* dat, long addr, int n )
{
for ( int i = 0; i < n; i++ ) {
*dat &= ~nibble_masks[ i ];
*dat |= read_nibble( addr + i ) << ( i * 4 );
}
}
void register_to_address( unsigned char* reg, word_20* dat, int s ) {
void register_to_address( unsigned char* reg, word_20* dat, int s )
{
int n;
if ( s )
@ -399,7 +406,8 @@ void register_to_address( unsigned char* reg, word_20* dat, int s ) {
}
}
long dat_to_addr( unsigned char* dat ) {
long dat_to_addr( unsigned char* dat )
{
long addr = 0;
for ( int i = 4; i >= 0; i-- ) {
@ -409,14 +417,16 @@ long dat_to_addr( unsigned char* dat ) {
return addr;
}
void addr_to_dat( long addr, unsigned char* dat ) {
void addr_to_dat( long addr, unsigned char* dat )
{
for ( int i = 0; i < 5; i++ ) {
dat[ i ] = ( addr & 0xf );
addr >>= 4;
}
}
void add_address( word_20* dat, int add ) {
void add_address( word_20* dat, int add )
{
*dat += add;
if ( *dat & ( word_20 )0xfff00000 ) {
saturn.CARRY = 1;
@ -426,13 +436,12 @@ void add_address( word_20* dat, int add ) {
*dat &= 0xfffff;
}
static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0,
2, 0, 15, 3, 0, 0, 0, 0, 0 };
static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, 2, 0, 15, 3, 0, 0, 0, 0, 0 };
static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1,
2, 2, 15, 14, 1, 4, 3, 2, 0 };
static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, 2, 2, 15, 14, 1, 4, 3, 2, 0 };
static inline int get_start( int code ) {
static inline int get_start( int code )
{
int s;
if ( ( s = start_fields[ code ] ) == -1 )
@ -441,7 +450,8 @@ static inline int get_start( int code ) {
return s; /* FIXME: potentially return uninitialized s ? */
}
static inline int get_end( int code ) {
static inline int get_end( int code )
{
int e;
if ( ( e = end_fields[ code ] ) == -1 )
@ -450,7 +460,8 @@ static inline int get_end( int code ) {
return e; /* FIXME: potentially return uninitialized e ? */
}
void store( word_20 dat, unsigned char* reg, int code ) {
void store( word_20 dat, unsigned char* reg, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -458,12 +469,14 @@ void store( word_20 dat, unsigned char* reg, int code ) {
write_nibble( dat++, reg[ i ] );
}
void store_n( word_20 dat, unsigned char* reg, int n ) {
void store_n( word_20 dat, unsigned char* reg, int n )
{
for ( int i = 0; i < n; i++ )
write_nibble( dat++, reg[ i ] );
}
void recall( unsigned char* reg, word_20 dat, int code ) {
void recall( unsigned char* reg, word_20 dat, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -471,7 +484,8 @@ void recall( unsigned char* reg, word_20 dat, int code ) {
reg[ i ] = read_nibble_crc( dat++ );
}
void recall_n( unsigned char* reg, word_20 dat, int n ) {
void recall_n( unsigned char* reg, word_20 dat, int n )
{
for ( int i = 0; i < n; i++ )
reg[ i ] = read_nibble_crc( dat++ );
}

View file

@ -3,11 +3,11 @@
#include <sys/time.h>
#include "runtime_options.h" /* throttle */
#include "ui.h" /* ui_get_event(); ui_adjust_contrast(); ui_update_LCD(); ui_draw_annunc(); */
#include "debugger.h" /* enter_debugger, TRAP_INSTRUCTION, ILLEGAL_INSTRUCTION */
#include "emulator.h"
#include "emulator_inner.h"
#include "runtime_options.h" /* throttle */
#include "ui.h" /* ui_get_event(); ui_adjust_contrast(); ui_update_LCD(); ui_draw_annunc(); */
#define P_FIELD 0 /* unused? */
#define WP_FIELD 1 /* unused? */
@ -70,8 +70,7 @@ unsigned long delta_t_16;
unsigned long delta_i;
word_64 run;
static word_20 jumpmasks[] = { 0xffffffff, 0xfffffff0, 0xffffff00, 0xfffff000,
0xffff0000, 0xfff00000, 0xff000000, 0xf0000000 };
static word_20 jumpmasks[] = { 0xffffffff, 0xfffffff0, 0xffffff00, 0xfffff000, 0xffff0000, 0xfff00000, 0xff000000, 0xf0000000 };
saturn_t saturn;
@ -79,7 +78,8 @@ extern int device_check;
device_t device;
int decode_group_80( void ) {
int decode_group_80( void )
{
int t, op3, op4, op5, op6;
unsigned char* REG;
long addr;
@ -173,8 +173,7 @@ 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 );
@ -248,7 +247,8 @@ int decode_group_80( void ) {
}
}
int decode_group_1( void ) {
int decode_group_1( void )
{
int op, op2, op3, op4;
op2 = read_nibble( saturn.PC + 1 );
@ -645,7 +645,8 @@ int decode_group_1( void ) {
}
}
static inline int decode_8_thru_f( int op1 ) {
static inline int decode_8_thru_f( int op1 )
{
int op2, op3, op4, op5, op6;
op2 = read_nibble( saturn.PC + 1 );
@ -697,23 +698,19 @@ 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;
@ -722,23 +719,19 @@ 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;
@ -776,59 +769,49 @@ 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;
@ -837,59 +820,49 @@ 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;
@ -898,59 +871,49 @@ 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;
@ -1093,68 +1056,52 @@ 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;
@ -1178,68 +1125,52 @@ 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;
@ -1293,36 +1224,28 @@ 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 );
@ -1355,68 +1278,52 @@ 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;
@ -2002,7 +1909,8 @@ static inline int decode_8_thru_f( int op1 ) {
}
}
inline int step_instruction( void ) {
inline int step_instruction( void )
{
int op0, op1, op2, op3;
int stop = 0;
@ -2246,7 +2154,8 @@ inline int step_instruction( void ) {
return stop;
}
inline void schedule( void ) {
inline void schedule( void )
{
t1_t2_ticks ticks;
unsigned long steps;
static unsigned long old_stat_instr;
@ -2413,13 +2322,9 @@ 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 ) ) /
NR_SAMPLES;
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 ) ) /
NR_SAMPLES;
saturn.i_per_s = ( ( NR_SAMPLES - 1 ) * saturn.i_per_s + ( delta_i / delta_t_1 ) ) / NR_SAMPLES;
} else {
t1_i_per_tick = 8192;
t2_i_per_tick = 16;
@ -2452,7 +2357,8 @@ inline void schedule( void ) {
}
}
void emulate( void ) {
void emulate( void )
{
struct timeval tv;
struct timeval tv2;
struct timezone tz;
@ -2474,14 +2380,11 @@ void emulate( void ) {
do {
step_instruction();
for ( int i = 0; i < ( int )( sizeof( saturn.keybuf.rows ) /
sizeof( saturn.keybuf.rows[ 0 ] ) );
i++ ) {
for ( int i = 0; i < ( int )( sizeof( saturn.keybuf.rows ) / sizeof( saturn.keybuf.rows[ 0 ] ) ); i++ ) {
if ( saturn.keybuf.rows[ i ] || throttle ) {
/* Throttling speed if needed */
gettimeofday( &tv, &tz );
while ( ( tv.tv_sec == tv2.tv_sec ) &&
( ( tv.tv_usec - tv2.tv_usec ) < 2 ) )
while ( ( tv.tv_sec == tv2.tv_sec ) && ( ( tv.tv_usec - tv2.tv_usec ) < 2 ) )
gettimeofday( &tv, &tz );
tv2.tv_usec = tv.tv_usec;

View file

@ -1,15 +1,15 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "runtime_options.h"
#include "emulator.h"
#include "emulator_inner.h"
#include "romio.h"
#include "runtime_options.h"
#define X48_MAGIC 0x48503438
#define NR_CONFIG 8
@ -26,7 +26,8 @@ long port2_size;
long port2_mask;
short port2_is_ram;
int read_rom( const char* fname ) {
int read_rom( const char* fname )
{
int ram_size;
if ( !read_rom_file( fname, &saturn.rom, &rom_size ) )
@ -62,7 +63,8 @@ int read_rom( const char* fname ) {
return 1;
}
void saturn_config_init( void ) {
void saturn_config_init( void )
{
saturn.version[ 0 ] = VERSION_MAJOR;
saturn.version[ 1 ] = VERSION_MINOR;
saturn.version[ 2 ] = PATCHLEVEL;
@ -76,7 +78,8 @@ void saturn_config_init( void ) {
saturn.lbr = 0x0;
}
void init_saturn( void ) {
void init_saturn( void )
{
memset( &saturn, 0, sizeof( saturn ) - 4 * sizeof( unsigned char* ) );
saturn.PC = 0x00000;
saturn.magic = X48_MAGIC;
@ -107,7 +110,8 @@ void init_saturn( void ) {
dev_memory_init();
}
int init_emulator( void ) {
int init_emulator( void )
{
/* If not forced to initialize and files are readble => let's go */
if ( !initialize && read_files() ) {
if ( resetOnStartup )
@ -126,7 +130,8 @@ int init_emulator( void ) {
return 0;
}
int exit_emulator( void ) {
int exit_emulator( void )
{
write_files();
return 1;
@ -136,7 +141,8 @@ int exit_emulator( void ) {
/* READING ~/.x48ng/{rom,ram,hp48,port1,port2} */
/***********************************************/
int read_8( FILE* fp, word_8* var ) {
int read_8( FILE* fp, word_8* var )
{
unsigned char tmp;
if ( fread( &tmp, 1, 1, fp ) != 1 ) {
@ -148,7 +154,8 @@ int read_8( FILE* fp, word_8* var ) {
return 1;
}
int read_char( FILE* fp, char* var ) {
int read_char( FILE* fp, char* var )
{
char tmp;
if ( fread( &tmp, 1, 1, fp ) != 1 ) {
@ -160,7 +167,8 @@ int read_char( FILE* fp, char* var ) {
return 1;
}
int read_16( FILE* fp, word_16* var ) {
int read_16( FILE* fp, word_16* var )
{
unsigned char tmp[ 2 ];
if ( fread( &tmp[ 0 ], 1, 2, fp ) != 2 ) {
@ -173,7 +181,8 @@ int read_16( FILE* fp, word_16* var ) {
return 1;
}
int read_32( FILE* fp, word_32* var ) {
int read_32( FILE* fp, word_32* var )
{
unsigned char tmp[ 4 ];
if ( fread( &tmp[ 0 ], 1, 4, fp ) != 4 ) {
@ -188,7 +197,8 @@ int read_32( FILE* fp, word_32* var ) {
return 1;
}
int read_u_long( FILE* fp, unsigned long* var ) {
int read_u_long( FILE* fp, unsigned long* var )
{
unsigned char tmp[ 4 ];
if ( fread( &tmp[ 0 ], 1, 4, fp ) != 4 ) {
@ -203,7 +213,8 @@ int read_u_long( FILE* fp, unsigned long* var ) {
return 1;
}
int read_state_file( FILE* fp ) {
int read_state_file( FILE* fp )
{
int i;
/*
@ -368,7 +379,8 @@ int read_state_file( FILE* fp ) {
return 1;
}
int read_mem_file( char* name, word_4* mem, int size ) {
int read_mem_file( char* name, word_4* mem, int size )
{
struct stat st;
FILE* fp;
word_8* tmp_mem;
@ -404,8 +416,7 @@ int read_mem_file( char* name, word_4* mem, int size ) {
if ( st.st_size != size / 2 ) {
if ( verbose )
fprintf( stderr, "strange size %s, expected %d, found %ld\n",
name, size / 2, st.st_size );
fprintf( stderr, "strange size %s, expected %d, found %ld\n", name, size / 2, st.st_size );
fclose( fp );
return 0;
}
@ -422,8 +433,7 @@ int read_mem_file( char* name, word_4* mem, int size ) {
mem[ j++ ] = ( word_4 )( ( ( int )byte >> 4 ) & 0xf );
}
} else {
if ( fread( tmp_mem, 1, ( size_t )size / 2, fp ) !=
( unsigned long )( size / 2 ) ) {
if ( fread( tmp_mem, 1, ( size_t )size / 2, fp ) != ( unsigned long )( size / 2 ) ) {
if ( verbose )
fprintf( stderr, "can\'t read %s\n", name );
fclose( fp );
@ -448,7 +458,8 @@ int read_mem_file( char* name, word_4* mem, int size ) {
return 1;
}
int read_files( void ) {
int read_files( void )
{
unsigned long v1, v2;
int i, read_version;
int ram_size;
@ -515,8 +526,7 @@ int read_files( void ) {
*/
if ( !read_state_file( fp ) ) {
if ( verbose )
fprintf( stderr, "can\'t handle %s\n",
normalized_state_path );
fprintf( stderr, "can\'t handle %s\n", normalized_state_path );
init_saturn();
} else if ( verbose )
printf( "read %s\n", normalized_state_path );
@ -567,8 +577,7 @@ int read_files( void ) {
if ( NULL == ( saturn.port1 = ( word_4* )malloc( port1_size ) ) ) {
if ( verbose )
fprintf( stderr, "can\'t malloc PORT1[%ld]\n", port1_size );
} else if ( !read_mem_file( normalized_port1_path, saturn.port1,
port1_size ) ) {
} else if ( !read_mem_file( normalized_port1_path, saturn.port1, port1_size ) ) {
port1_size = 0;
port1_is_ram = 0;
} else {
@ -597,13 +606,11 @@ int read_files( void ) {
if ( stat( normalized_port2_path, &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 ( verbose )
fprintf( stderr, "can\'t malloc PORT2[%ld]\n", port2_size );
} else if ( !read_mem_file( normalized_port2_path, saturn.port2,
port2_size ) ) {
} else if ( !read_mem_file( normalized_port2_path, saturn.port2, port2_size ) ) {
port2_size = 0;
port2_is_ram = 0;
} else {
@ -631,7 +638,8 @@ int read_files( void ) {
/* WRITING ~/.x48ng/{rom,ram,hp48,port1,port2} */
/***********************************************/
int write_8( FILE* fp, word_8* var ) {
int write_8( FILE* fp, word_8* var )
{
unsigned char tmp;
tmp = *var;
@ -643,7 +651,8 @@ int write_8( FILE* fp, word_8* var ) {
return 1;
}
int write_char( FILE* fp, char* var ) {
int write_char( FILE* fp, char* var )
{
char tmp;
tmp = *var;
@ -655,7 +664,8 @@ int write_char( FILE* fp, char* var ) {
return 1;
}
int write_16( FILE* fp, word_16* var ) {
int write_16( FILE* fp, word_16* var )
{
unsigned char tmp[ 2 ];
tmp[ 0 ] = ( *var >> 8 ) & 0xff;
@ -668,7 +678,8 @@ int write_16( FILE* fp, word_16* var ) {
return 1;
}
int write_32( FILE* fp, word_32* var ) {
int write_32( FILE* fp, word_32* var )
{
unsigned char tmp[ 4 ];
tmp[ 0 ] = ( *var >> 24 ) & 0xff;
@ -683,7 +694,8 @@ int write_32( FILE* fp, word_32* var ) {
return 1;
}
int write_u_long( FILE* fp, unsigned long* var ) {
int write_u_long( FILE* fp, unsigned long* var )
{
unsigned char tmp[ 4 ];
tmp[ 0 ] = ( *var >> 24 ) & 0xff;
@ -698,7 +710,8 @@ int write_u_long( FILE* fp, unsigned long* var ) {
return 1;
}
int write_mem_file( char* name, word_4* mem, int size ) {
int write_mem_file( char* name, word_4* mem, int size )
{
FILE* fp;
word_8* tmp_mem;
word_8 byte;
@ -727,8 +740,7 @@ int write_mem_file( char* name, word_4* mem, int size ) {
tmp_mem[ i ] |= ( mem[ j++ ] << 4 ) & 0xf0;
}
if ( fwrite( tmp_mem, 1, ( size_t )size / 2, fp ) !=
( unsigned long )size / 2 ) {
if ( fwrite( tmp_mem, 1, ( size_t )size / 2, fp ) != ( unsigned long )size / 2 ) {
if ( verbose )
fprintf( stderr, "can\'t write %s\n", name );
fclose( fp );
@ -747,7 +759,8 @@ int write_mem_file( char* name, word_4* mem, int size ) {
return 1;
}
int write_state_file( char* filename ) {
int write_state_file( char* filename )
{
int i;
FILE* fp;
@ -856,7 +869,8 @@ int write_state_file( char* filename ) {
return 1;
}
int write_files( void ) {
int write_files( void )
{
struct stat st;
int make_dir = 0;
int ram_size = opt_gx ? RAM_SIZE_GX : RAM_SIZE_SX;
@ -866,15 +880,13 @@ int write_files( void ) {
make_dir = 1;
} else {
if ( verbose )
fprintf( stderr, "can\'t stat %s, saving to /tmp\n",
normalized_config_path );
fprintf( stderr, "can\'t stat %s, saving to /tmp\n", normalized_config_path );
strcpy( normalized_config_path, "/tmp" );
}
} else {
if ( !S_ISDIR( st.st_mode ) ) {
if ( verbose )
fprintf( stderr, "%s is no directory, saving to /tmp\n",
normalized_config_path );
fprintf( stderr, "%s is no directory, saving to /tmp\n", normalized_config_path );
strcpy( normalized_config_path, "/tmp" );
}
}
@ -882,8 +894,7 @@ int write_files( void ) {
if ( make_dir ) {
if ( mkdir( normalized_config_path, 0777 ) == -1 ) {
if ( verbose )
fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n",
normalized_config_path );
fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n", normalized_config_path );
strcpy( normalized_config_path, "/tmp" );
}
}
@ -909,14 +920,12 @@ int write_files( void ) {
return 0;
if ( ( port1_size > 0 ) && port1_is_ram ) {
if ( !write_mem_file( normalized_port1_path, saturn.port1,
port1_size ) )
if ( !write_mem_file( normalized_port1_path, saturn.port1, port1_size ) )
return 0;
}
if ( ( port2_size > 0 ) && port2_is_ram ) {
if ( !write_mem_file( normalized_port2_path, saturn.port2,
port2_size ) )
if ( !write_mem_file( normalized_port2_path, saturn.port2, port2_size ) )
return 0;
}

View file

@ -7,8 +7,8 @@
#include "emulator.h"
#include "emulator_inner.h"
#include "romio.h"
#include "ui.h" /* ui_disp_draw_nibble(); ui_menu_draw_nibble(); */
#include "runtime_options.h"
#include "ui.h" /* ui_disp_draw_nibble(); ui_menu_draw_nibble(); */
#define MCTL_MMIO_SX 0
#define MCTL_SysRAM_SX 1
@ -26,10 +26,8 @@
#define DISP_INSTR_OFF 0x10
long nibble_masks[ 16 ] = { 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000,
0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000,
0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000,
0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000 };
long nibble_masks[ 16 ] = { 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000,
0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000 };
display_t display;
@ -39,13 +37,14 @@ int ( *read_nibble_crc )( long addr );
static int line_counter = -1;
static inline int calc_crc( int nib ) {
saturn.crc =
( saturn.crc >> 4 ) ^ ( ( ( saturn.crc ^ nib ) & 0xf ) * 0x1081 );
static inline int calc_crc( int nib )
{
saturn.crc = ( saturn.crc >> 4 ) ^ ( ( ( saturn.crc ^ nib ) & 0xf ) * 0x1081 );
return nib;
}
void write_dev_mem( long addr, int val ) {
void write_dev_mem( long addr, int val )
{
static int old_line_offset = -1;
device_check = 1;
@ -57,14 +56,10 @@ void write_dev_mem( long addr, int val ) {
display.on = ( val & 0x8 ) >> 3;
display.offset = val & 0x7;
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.disp_end =
display.disp_start +
( display.nibs_per_line * ( display.lines + 1 ) );
display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff;
display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
return;
@ -186,9 +181,7 @@ void write_dev_mem( long addr, int val ) {
saturn.disp_addr |= val << ( ( addr - 0x120 ) * 4 );
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_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
return;
@ -200,14 +193,10 @@ void write_dev_mem( long addr, int val ) {
if ( saturn.line_offset != old_line_offset ) {
old_line_offset = saturn.line_offset;
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.disp_end =
display.disp_start +
( display.nibs_per_line * ( display.lines + 1 ) );
display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff;
display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
return;
@ -220,9 +209,7 @@ void write_dev_mem( long addr, int val ) {
display.lines = saturn.line_count & 0x3f;
if ( display.lines == 0 )
display.lines = 63;
display.disp_end =
display.disp_start +
( display.nibs_per_line * ( display.lines + 1 ) );
display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
device.display_touched = DISP_INSTR_OFF;
}
return;
@ -279,13 +266,13 @@ void write_dev_mem( long addr, int val ) {
return;
default:
if ( verbose )
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;
}
}
int read_dev_mem( long addr ) {
int read_dev_mem( long addr )
{
switch ( ( int )addr ) {
case 0x100: /* DISPLAY IO */
return saturn.disp_io & 0x0f;
@ -362,10 +349,7 @@ int read_dev_mem( long addr ) {
line_counter++;
if ( line_counter > 0x3f )
line_counter = -1;
return ( ( ( saturn.line_count & 0xc0 ) |
( line_counter & 0x3f ) ) >>
( ( addr - 0x128 ) * 4 ) ) &
0x0f;
return ( ( ( saturn.line_count & 0xc0 ) | ( line_counter & 0x3f ) ) >> ( ( addr - 0x128 ) * 4 ) ) & 0x0f;
case 0x12a:
case 0x12b:
case 0x12c:
@ -397,19 +381,18 @@ int read_dev_mem( long addr ) {
return ( saturn.timer2 >> ( ( addr - 0x138 ) * 4 ) ) & 0xf;
default:
if ( verbose )
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;
}
}
void write_nibble_sx( long addr, int val ) {
void write_nibble_sx( long addr, int val )
{
addr &= 0xfffff;
val &= 0x0f;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
if ( addr < 0x140 && addr >= 0x100 &&
saturn.mem_cntl[ MCTL_MMIO_SX ].config[ 0 ] == 0x100 ) {
if ( addr < 0x140 && addr >= 0x100 && saturn.mem_cntl[ MCTL_MMIO_SX ].config[ 0 ] == 0x100 ) {
write_dev_mem( addr, val );
return;
}
@ -423,18 +406,15 @@ void write_nibble_sx( long addr, int val ) {
return;
case 7:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 &&
addr < 0x74000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 ) {
saturn.ram[ addr - 0x70000 ] = val;
break;
}
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 &&
addr < 0x72000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 ) {
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;
}
@ -500,13 +480,13 @@ void write_nibble_sx( long addr, int val ) {
ui_menu_draw_nibble( addr, val );
}
void write_nibble_gx( long addr, int val ) {
void write_nibble_gx( long addr, int val )
{
addr &= 0xfffff;
val &= 0x0f;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
if ( addr < 0x140 && addr >= 0x100 &&
saturn.mem_cntl[ MCTL_MMIO_GX ].config[ 0 ] == 0x100 ) {
if ( addr < 0x140 && addr >= 0x100 && saturn.mem_cntl[ MCTL_MMIO_GX ].config[ 0 ] == 0x100 ) {
write_dev_mem( addr, val );
return;
}
@ -524,38 +504,31 @@ void write_nibble_gx( long addr, int val ) {
}
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 ) {
return;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
return;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
return;
}
return;
case 8:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0x84000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 ) {
saturn.ram[ addr - 0x80000 ] = val;
break;
}
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0x82000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 ) {
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;
}
@ -568,16 +541,14 @@ void write_nibble_gx( long addr, int val ) {
}
}
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;
}
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;
}
@ -589,28 +560,23 @@ void write_nibble_gx( long addr, int val ) {
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 ) ) &
port2_mask ] = val;
saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ] = val;
return;
}
return;
case 0xc:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0xc4000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 ) {
saturn.ram[ addr - 0xc0000 ] = val;
break;
}
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0xc2000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 ) {
saturn.ram[ addr - 0xc0000 ] = val;
break;
}
@ -624,9 +590,7 @@ 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 ) ) &
port2_mask ] = val;
saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val;
return;
}
return;
@ -634,8 +598,7 @@ void write_nibble_gx( long addr, int val ) {
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;
}
@ -648,9 +611,7 @@ 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 ) ) &
port2_mask ] = val;
saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val;
return;
}
return;
@ -669,7 +630,8 @@ void write_nibble_gx( long addr, int val ) {
ui_menu_draw_nibble( addr, val );
}
int read_nibble_sx( long addr ) {
int read_nibble_sx( long addr )
{
addr &= 0xfffff;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
@ -689,11 +651,9 @@ int read_nibble_sx( long addr ) {
return saturn.rom[ addr ];
case 7:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 &&
addr < 0x74000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 )
return saturn.ram[ addr - 0x70000 ];
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 &&
addr < 0x72000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 )
return saturn.ram[ addr - 0x70000 ];
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xf0000 )
return saturn.ram[ addr - 0x70000 ];
@ -734,7 +694,8 @@ int read_nibble_sx( long addr ) {
return 0x00;
}
int read_nibble_gx( long addr ) {
int read_nibble_gx( long addr )
{
addr &= 0xfffff;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
@ -756,8 +717,7 @@ 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;
}
@ -766,22 +726,18 @@ int read_nibble_gx( long addr ) {
}
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
return 0x7;
}
return saturn.rom[ addr ];
case 8:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0x84000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 )
return saturn.ram[ addr - 0x80000 ];
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0x82000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 )
return saturn.ram[ addr - 0x80000 ];
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xf0000 )
return saturn.ram[ addr - 0x80000 ];
@ -818,9 +774,7 @@ 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))
{
@ -833,11 +787,9 @@ int read_nibble_gx( long addr ) {
return saturn.rom[ addr ];
case 0xc:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0xc4000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 )
return saturn.ram[ addr - 0xc0000 ];
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0xc2000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 )
return saturn.ram[ addr - 0xc0000 ];
return saturn.ram[ addr - 0xc0000 ];
}
@ -845,9 +797,7 @@ 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))
{
@ -870,9 +820,7 @@ 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 ) ) &
port2_mask ];
return saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ];
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -888,7 +836,8 @@ int read_nibble_gx( long addr ) {
return 0x00;
}
int read_nibble_crc_sx( long addr ) {
int read_nibble_crc_sx( long addr )
{
addr &= 0xfffff;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
@ -908,11 +857,9 @@ int read_nibble_crc_sx( long addr ) {
return calc_crc( saturn.rom[ addr ] );
case 7:
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 &&
addr < 0x74000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 )
return calc_crc( saturn.ram[ addr - 0x70000 ] );
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 &&
addr < 0x72000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 )
return calc_crc( saturn.ram[ addr - 0x70000 ] );
if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xf0000 )
return calc_crc( saturn.ram[ addr - 0x70000 ] );
@ -923,43 +870,38 @@ 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;
}
return 0x00;
}
int read_nibble_crc_gx( long addr ) {
int read_nibble_crc_gx( long addr )
{
addr &= 0xfffff;
switch ( ( int )( addr >> 16 ) & 0x0f ) {
case 0:
@ -981,8 +923,7 @@ 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;
}
@ -991,22 +932,18 @@ int read_nibble_crc_gx( long addr ) {
}
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) {
return 0x7;
}
if ( addr >= 0x7e000 && addr < 0x7f000 &&
saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) {
return 0x7;
}
return calc_crc( saturn.rom[ addr ] );
case 8:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0x84000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 )
return calc_crc( saturn.ram[ addr - 0x80000 ] );
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0x82000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 )
return calc_crc( saturn.ram[ addr - 0x80000 ] );
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xf0000 )
return calc_crc( saturn.ram[ addr - 0x80000 ] );
@ -1035,8 +972,7 @@ 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:
@ -1044,9 +980,7 @@ 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 ) ) &
port2_mask ] );
return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -1061,22 +995,17 @@ int read_nibble_crc_gx( long addr ) {
return calc_crc( saturn.rom[ addr ] );
case 0xc:
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) {
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 &&
addr < 0xc4000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 )
return calc_crc( saturn.ram[ addr - 0xc0000 ] );
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 &&
addr < 0xc2000 )
if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 )
return calc_crc( saturn.ram[ addr - 0xc0000 ] );
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 ) ) &
port2_mask ] );
return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -1097,15 +1026,11 @@ 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 ) ) &
port2_mask ] );
return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] );
/*
if (port2_size > (saturn.bank_switch << 18))
{
@ -1122,7 +1047,8 @@ int read_nibble_crc_gx( long addr ) {
return 0x00;
}
long read_nibbles( long addr, int len ) {
long read_nibbles( long addr, int len )
{
long val = 0;
addr += len;
@ -1132,7 +1058,8 @@ long read_nibbles( long addr, int len ) {
return val;
}
void dev_memory_init( void ) {
void dev_memory_init( void )
{
if ( opt_gx ) {
read_nibble = read_nibble_gx;
read_nibble_crc = read_nibble_crc_gx;

View file

@ -6,14 +6,12 @@
extern long nibble_masks[ 16 ];
static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0,
2, 0, 15, 3, 0, 0, 0, 0, 0 };
static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, 2, 0, 15, 3, 0, 0, 0, 0, 0 };
static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1,
2, 2, 15, 14, 1, 4, 3, 2, 0 };
static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, 2, 2, 15, 14, 1, 4, 3, 2, 0 };
static inline int
get_start( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */
static inline int get_start( int code )
{ /* FIXME: Duplicate from hp48emu_actions.c */
int s;
if ( ( s = start_fields[ code ] ) == -1 )
@ -22,8 +20,8 @@ get_start( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */
return s; /* FIXME: potentially return uninitialized s ? */
}
static inline int
get_end( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */
static inline int get_end( int code )
{ /* FIXME: Duplicate from hp48emu_actions.c */
int e;
if ( ( e = end_fields[ code ] ) == -1 )
@ -32,8 +30,8 @@ get_end( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */
return e; /* FIXME: potentially return uninitialized e ? */
}
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -53,7 +51,8 @@ void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
saturn.CARRY = c ? 1 : 0;
}
void add_p_plus_one( unsigned char* r ) {
void add_p_plus_one( unsigned char* r )
{
int t;
int s = 0;
int e = 4;
@ -73,8 +72,8 @@ void add_p_plus_one( unsigned char* r ) {
saturn.CARRY = c ? 1 : 0;
}
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -93,7 +92,8 @@ void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
saturn.CARRY = c ? 1 : 0;
}
void complement_2_register( unsigned char* r, int code ) {
void complement_2_register( unsigned char* r, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -115,7 +115,8 @@ void complement_2_register( unsigned char* r, int code ) {
saturn.CARRY = carry ? 1 : 0;
}
void complement_1_register( unsigned char* r, int code ) {
void complement_1_register( unsigned char* r, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -127,7 +128,8 @@ void complement_1_register( unsigned char* r, int code ) {
saturn.CARRY = 0;
}
void inc_register( unsigned char* r, int code ) {
void inc_register( unsigned char* r, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -148,7 +150,8 @@ void inc_register( unsigned char* r, int code ) {
saturn.CARRY = c ? 1 : 0;
}
void add_register_constant( unsigned char* r, int code, int val ) {
void add_register_constant( unsigned char* r, int code, int val )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -169,7 +172,8 @@ void add_register_constant( unsigned char* r, int code, int val ) {
saturn.CARRY = c ? 1 : 0;
}
void dec_register( unsigned char* r, int code ) {
void dec_register( unsigned char* r, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -190,7 +194,8 @@ void dec_register( unsigned char* r, int code ) {
saturn.CARRY = c ? 1 : 0;
}
void sub_register_constant( unsigned char* r, int code, int val ) {
void sub_register_constant( unsigned char* r, int code, int val )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -211,7 +216,8 @@ void sub_register_constant( unsigned char* r, int code, int val ) {
saturn.CARRY = c ? 1 : 0;
}
void zero_register( unsigned char* r, int code ) {
void zero_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -219,8 +225,8 @@ void zero_register( unsigned char* r, int code ) {
r[ i ] = 0;
}
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -228,8 +234,8 @@ void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
res[ i ] = ( r1[ i ] | r2[ i ] ) & 0xf;
}
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -237,7 +243,8 @@ void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
res[ i ] = ( r1[ i ] & r2[ i ] ) & 0xf;
}
void copy_register( unsigned char* to, unsigned char* from, int code ) {
void copy_register( unsigned char* to, unsigned char* from, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -245,7 +252,8 @@ void copy_register( unsigned char* to, unsigned char* from, int code ) {
to[ i ] = from[ i ];
}
void exchange_register( unsigned char* r1, unsigned char* r2, int code ) {
void exchange_register( unsigned char* r1, unsigned char* r2, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -257,7 +265,8 @@ void exchange_register( unsigned char* r1, unsigned char* r2, int code ) {
}
}
void exchange_reg( unsigned char* r, word_20* d, int code ) {
void exchange_reg( unsigned char* r, word_20* d, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -270,7 +279,8 @@ void exchange_reg( unsigned char* r, word_20* d, int code ) {
}
}
void shift_left_register( unsigned char* r, int code ) {
void shift_left_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -280,7 +290,8 @@ void shift_left_register( unsigned char* r, int code ) {
r[ s ] = 0;
}
void shift_left_circ_register( unsigned char* r, int code ) {
void shift_left_circ_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
int t = r[ e ] & 0x0f;
@ -291,7 +302,8 @@ void shift_left_circ_register( unsigned char* r, int code ) {
r[ s ] = t;
}
void shift_right_register( unsigned char* r, int code ) {
void shift_right_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
@ -304,7 +316,8 @@ void shift_right_register( unsigned char* r, int code ) {
r[ e ] = 0;
}
void shift_right_circ_register( unsigned char* r, int code ) {
void shift_right_circ_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
int t = r[ s ] & 0x0f;
@ -317,7 +330,8 @@ void shift_right_circ_register( unsigned char* r, int code ) {
saturn.SB = 1;
}
void shift_right_bit_register( unsigned char* r, int code ) {
void shift_right_bit_register( unsigned char* r, int code )
{
int t;
int s = get_start( code );
int e = get_end( code );
@ -332,7 +346,8 @@ void shift_right_bit_register( unsigned char* r, int code ) {
saturn.SB = 1;
}
int is_zero_register( unsigned char* r, int code ) {
int is_zero_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 1;
@ -346,7 +361,8 @@ int is_zero_register( unsigned char* r, int code ) {
return z;
}
int is_not_zero_register( unsigned char* r, int code ) {
int is_not_zero_register( unsigned char* r, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 0;
@ -360,7 +376,8 @@ int is_not_zero_register( unsigned char* r, int code ) {
return z;
}
int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
int is_equal_register( unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 1;
@ -374,7 +391,8 @@ int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
return z;
}
int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 0;
@ -388,7 +406,8 @@ int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
return z;
}
int is_less_register( unsigned char* r1, unsigned char* r2, int code ) {
int is_less_register( unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 0;
@ -407,8 +426,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 s = get_start( code );
int e = get_end( code );
int z = 1;
@ -427,7 +446,8 @@ int is_less_or_equal_register( unsigned char* r1, unsigned char* r2,
return z;
}
int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) {
int is_greater_register( unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 0;
@ -446,8 +466,8 @@ int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) {
return z;
}
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ) {
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, int code )
{
int s = get_start( code );
int e = get_end( code );
int z = 1;

View file

@ -7,9 +7,9 @@
#include <termios.h>
#include <unistd.h>
#include "runtime_options.h"
#include "emulator.h"
#include "emulator_inner.h"
#include "runtime_options.h"
static int wire_fd;
static int ir_fd;
@ -20,7 +20,8 @@ extern int rece_instr;
char* wire_name = ( char* )0;
char* ir_name = ( char* )0;
void update_connection_display( void ) {
void update_connection_display( void )
{
if ( wire_fd == -1 ) {
if ( wire_name )
free( wire_name );
@ -33,7 +34,8 @@ void update_connection_display( void ) {
}
}
int init_serial( void ) {
int init_serial( void )
{
int c;
int n;
char tty_dev_name[ 128 ];
@ -43,16 +45,14 @@ int init_serial( void ) {
ttyp = -1;
if ( useTerminal ) {
/* 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( "wire connection on %s\n", tty_dev_name );
wire_name = strdup( tty_dev_name );
@ -64,9 +64,7 @@ int init_serial( void ) {
do {
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 ) {
if ( ( wire_fd = 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 )
@ -88,8 +86,7 @@ int init_serial( void ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", errno );
wire_fd = -1;
ttyp = -1;
}
@ -112,8 +109,7 @@ int init_serial( void ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", errno );
wire_fd = -1;
ttyp = -1;
}
@ -137,8 +133,7 @@ int init_serial( void ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", errno );
ir_fd = -1;
}
}
@ -160,8 +155,7 @@ int init_serial( void ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", errno );
ir_fd = -1;
}
}
@ -169,7 +163,8 @@ int init_serial( void ) {
return 1;
}
void serial_baud( int baud ) {
void serial_baud( int baud )
{
int error = 0;
struct termios ttybuf;
@ -181,8 +176,7 @@ void serial_baud( int baud ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", errno );
ir_fd = -1;
error = 1;
}
@ -195,33 +189,33 @@ void serial_baud( int baud ) {
ttybuf.c_cflag |= B1200;
break;
case 1: /* 1920 */
#ifdef B1920
# ifdef B1920
ttybuf.c_cflag |= B1920;
#endif
# endif
break;
case 2: /* 2400 */
ttybuf.c_cflag |= B2400;
break;
case 3: /* 3840 */
#ifdef B3840
# ifdef B3840
ttybuf.c_cflag |= B3840;
#endif
# endif
break;
case 4: /* 4800 */
ttybuf.c_cflag |= B4800;
break;
case 5: /* 7680 */
#ifdef B7680
# ifdef B7680
ttybuf.c_cflag |= B7680;
#endif
# endif
break;
case 6: /* 9600 */
ttybuf.c_cflag |= B9600;
break;
case 7: /* 15360 */
#ifdef B15360
# ifdef B15360
ttybuf.c_cflag |= B15360;
#endif
# endif
break;
}
@ -239,33 +233,33 @@ void serial_baud( int baud ) {
ttybuf.c_cflag |= B1200;
break;
case 1: /* 1920 */
#ifdef B1920
# ifdef B1920
ttybuf.c_cflag |= B1920;
#endif
# endif
break;
case 2: /* 2400 */
ttybuf.c_cflag |= B2400;
break;
case 3: /* 3840 */
#ifdef B3840
# ifdef B3840
ttybuf.c_cflag |= B3840;
#endif
# endif
break;
case 4: /* 4800 */
ttybuf.c_cflag |= B4800;
break;
case 5: /* 7680 */
#ifdef B7680
# ifdef B7680
ttybuf.c_cflag |= B7680;
#endif
# endif
break;
case 6: /* 9600 */
ttybuf.c_cflag |= B9600;
break;
case 7: /* 15360 */
#ifdef B15360
# ifdef B15360
ttybuf.c_cflag |= B15360;
#endif
# endif
break;
}
@ -283,8 +277,7 @@ void serial_baud( int baud ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", errno );
ir_fd = -1;
error = 1;
}
@ -298,8 +291,7 @@ void serial_baud( int baud ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", errno );
wire_fd = -1;
ttyp = -1;
error = 1;
@ -316,33 +308,33 @@ void serial_baud( int baud ) {
ttybuf.c_cflag |= B1200;
break;
case 1: /* 1920 */
#ifdef B1920
# ifdef B1920
ttybuf.c_cflag |= B1920;
#endif
# endif
break;
case 2: /* 2400 */
ttybuf.c_cflag |= B2400;
break;
case 3: /* 3840 */
#ifdef B3840
# ifdef B3840
ttybuf.c_cflag |= B3840;
#endif
# endif
break;
case 4: /* 4800 */
ttybuf.c_cflag |= B4800;
break;
case 5: /* 7680 */
#ifdef B7680
# ifdef B7680
ttybuf.c_cflag |= B7680;
#endif
# endif
break;
case 6: /* 9600 */
ttybuf.c_cflag |= B9600;
break;
case 7: /* 15360 */
#ifdef B15360
# ifdef B15360
ttybuf.c_cflag |= B15360;
#endif
# endif
break;
}
@ -360,8 +352,7 @@ void serial_baud( int baud ) {
#endif
{
if ( verbose )
fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n",
errno );
fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", errno );
wire_fd = -1;
ttyp = -1;
error = 1;
@ -371,7 +362,8 @@ void serial_baud( int baud ) {
update_connection_display();
}
void transmit_char( void ) {
void transmit_char( void )
{
if ( saturn.ir_ctrl & 0x04 ) {
if ( ir_fd == -1 ) {
saturn.tcs &= 0x0e;
@ -426,7 +418,8 @@ void transmit_char( void ) {
#define NR_BUFFER 256
void receive_char( void ) {
void receive_char( void )
{
struct timeval tout;
fd_set rfds;
int nfd;
@ -455,8 +448,7 @@ void receive_char( void ) {
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 ) {
if ( saturn.ir_ctrl & 0x04 ) {
if ( FD_ISSET( ir_fd, &rfds ) ) {
nrd = read( ir_fd, buf, NR_BUFFER );

View file

@ -1,15 +1,15 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <assert.h>
#include <sys/time.h>
#include "romio.h"
#include "debugger.h" /* used for in_debugger */
#include "emulator.h"
#include "emulator_inner.h"
#include "debugger.h" /* used for in_debugger */
#include "romio.h"
#define NR_TIMERS 4
@ -52,8 +52,7 @@ 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)
@ -68,7 +67,8 @@ word_64 time_offset = 0x0;
* 8. Prevent AutoOff by setting TIMEOUT
*
*/
void set_accesstime( void ) {
void set_accesstime( void )
{
struct timeval tv;
struct timezone tz;
@ -147,7 +147,8 @@ void set_accesstime( void ) {
saturn.ram[ timeoutclk_loc ] = 0xf;
}
void start_timer( int timer ) {
void start_timer( int timer )
{
struct timeval tv;
struct timezone tz;
@ -171,7 +172,8 @@ void start_timer( int timer ) {
}
}
void restart_timer( int timer ) {
void restart_timer( int timer )
{
struct timeval tv;
struct timezone tz;
@ -197,7 +199,8 @@ void restart_timer( int timer ) {
}
}
void stop_timer( int timer ) {
void stop_timer( int timer )
{
struct timeval tv;
struct timezone tz;
@ -226,7 +229,8 @@ void stop_timer( int timer ) {
// &timers[timer].value);
}
void reset_timer( int timer ) {
void reset_timer( int timer )
{
if ( timer > NR_TIMERS )
return;
timers[ timer ].run = 0;
@ -237,7 +241,8 @@ void reset_timer( int timer ) {
static word_64 zero = 0;
word_64 get_timer( int timer ) {
word_64 get_timer( int timer )
{
struct timeval tv;
struct timezone tz;
@ -277,7 +282,8 @@ word_64 get_timer( int timer ) {
*
*/
t1_t2_ticks get_t1_t2( void ) {
t1_t2_ticks get_t1_t2( void )
{
struct timeval tv;
struct timezone tz;
@ -329,8 +335,7 @@ t1_t2_ticks get_t1_t2( void ) {
* Don't adjust the time, can't come from user, anyhow.
*/
if ( ( saturn.timer2 >= 0 && access_time < 0 ) ||
( ( unsigned long )saturn.timer2 > access_time ) ) {
if ( ( saturn.timer2 >= 0 && access_time < 0 ) || ( ( unsigned long )saturn.timer2 > access_time ) ) {
/*
* check OK, return calculated time
*/
@ -359,8 +364,7 @@ t1_t2_ticks get_t1_t2( void ) {
access_time -= adj_time;
}
if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) ||
( ( unsigned long )saturn.timer2 > access_time ) ) {
if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) || ( ( unsigned long )saturn.timer2 > access_time ) ) {
/*
* check OK, return calculated time
*/

View file

@ -74,19 +74,15 @@ int get_identification( void );
void add_p_plus_one( unsigned char* r );
void add_register_constant( unsigned char* res, int code, int val );
void sub_register_constant( unsigned char* res, int code, int val );
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code );
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code );
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code );
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code );
void complement_2_register( unsigned char* r, int code );
void complement_1_register( unsigned char* r, int code );
void inc_register( unsigned char* r, int code );
void dec_register( unsigned char* r, int code );
void zero_register( unsigned char* r, int code );
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code );
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code );
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code );
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code );
void copy_register( unsigned char* to, unsigned char* from, int code );
void exchange_register( unsigned char* r1, unsigned char* r2, int code );
void exchange_reg( unsigned char* r, word_20* d, int code );
@ -102,8 +98,7 @@ int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code );
int is_less_register( unsigned char* r1, unsigned char* r2, int code );
int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, int code );
int is_greater_register( unsigned char* r1, unsigned char* r2, int code );
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
int code );
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, int code );
/****************/
/* emu_serial.c */

View file

@ -1,20 +1,21 @@
#include <errno.h>
#include <fcntl.h>
#include <langinfo.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <langinfo.h>
#include <locale.h>
#include "runtime_options.h"
#include "emulator.h"
#include "debugger.h"
#include "emulator.h"
#include "runtime_options.h"
#include "ui.h" /* init_ui(); */
void signal_handler( int sig ) {
void signal_handler( int sig )
{
switch ( sig ) {
case SIGINT: /* Ctrl-C */
enter_debugger |= USER_INTERRUPT;
@ -30,7 +31,8 @@ void signal_handler( int sig ) {
}
}
int main( int argc, char** argv ) {
int main( int argc, char** argv )
{
setlocale( LC_ALL, "C" );
/**********/

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <unistd.h>
#include "romio.h"
@ -11,7 +11,8 @@
unsigned int opt_gx = 0;
unsigned int rom_size = 0;
int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) {
int read_rom_file( const char* name, unsigned char** mem, unsigned int* size )
{
struct stat st;
FILE* fp;
unsigned char* tmp_mem;
@ -38,11 +39,9 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) {
return 0;
}
if ( four[ 0 ] == 0x02 && four[ 1 ] == 0x03 && four[ 2 ] == 0x06 &&
four[ 3 ] == 0x09 ) {
if ( four[ 0 ] == 0x02 && four[ 1 ] == 0x03 && four[ 2 ] == 0x06 && four[ 3 ] == 0x09 ) {
*size = st.st_size;
} else if ( four[ 0 ] == 0x32 && four[ 1 ] == 0x96 && four[ 2 ] == 0x1b &&
four[ 3 ] == 0x80 ) {
} else if ( four[ 0 ] == 0x32 && four[ 1 ] == 0x96 && four[ 2 ] == 0x1b && four[ 3 ] == 0x80 ) {
*size = 2 * st.st_size;
} else if ( four[ 1 ] == 0x49 ) {
fprintf( stderr, "%s is an HP49 ROM\n", name );
@ -83,8 +82,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) {
*/
if ( st.st_size != *size / 2 ) {
fprintf( stderr, "strange size %s, expected %d, found %ld\n", name,
*size / 2, st.st_size );
fprintf( stderr, "strange size %s, expected %d, found %ld\n", name, *size / 2, st.st_size );
free( *mem );
*mem = NULL;
*size = 0;
@ -92,8 +90,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned 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 );
@ -132,16 +129,13 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned 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;
@ -151,8 +145,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned 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

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

View file

@ -1,10 +1,10 @@
#include <errno.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <unistd.h>
#include <sys/stat.h>
#include <unistd.h>
#include <getopt.h>
@ -63,7 +63,8 @@ char normalized_state_path[ MAX_LENGTH_FILENAME ];
char normalized_port1_path[ MAX_LENGTH_FILENAME ];
char normalized_port2_path[ MAX_LENGTH_FILENAME ];
void get_absolute_config_dir( char* source, char* dest ) {
void get_absolute_config_dir( char* source, char* dest )
{
char* home;
struct passwd* pwd;
@ -90,14 +91,14 @@ void get_absolute_config_dir( char* source, char* dest ) {
strcat( dest, "/" );
}
static inline void normalize_filenames( void ) {
static inline void normalize_filenames( void )
{
struct stat st;
int normalized_config_path_exist = 1;
get_absolute_config_dir( configDir, normalized_config_path );
if ( verbose )
fprintf( stderr, "normalized_config_path: %s\n",
normalized_config_path );
fprintf( stderr, "normalized_config_path: %s\n", normalized_config_path );
if ( stat( normalized_config_path, &st ) == -1 )
if ( errno == ENOENT )
@ -141,122 +142,121 @@ static inline void normalize_filenames( void ) {
strcat( normalized_port2_path, port2FileName );
}
int parse_args( int argc, char* argv[] ) {
int parse_args( int argc, char* argv[] )
{
int option_index;
int c = '?';
char* optstring = "c:S:u:hvVtsirT";
static struct option long_options[] = {
{ "config-dir", required_argument, NULL, 1000 },
{ "rom", required_argument, NULL, 1010 },
{ "ram", required_argument, NULL, 1011 },
{ "state", required_argument, NULL, 1012 },
{ "port1", required_argument, NULL, 1013 },
{ "port2", required_argument, NULL, 1014 },
{"config-dir", required_argument, NULL, 1000 },
{ "rom", required_argument, NULL, 1010 },
{ "ram", required_argument, NULL, 1011 },
{ "state", required_argument, NULL, 1012 },
{ "port1", required_argument, NULL, 1013 },
{ "port2", required_argument, NULL, 1014 },
{ "serial-line", required_argument, NULL, 1015 },
{ "serial-line", required_argument, NULL, 1015 },
{ "front-end", required_argument, NULL, 'u' },
{ "front-end", required_argument, NULL, 'u' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ "verbose", no_argument, &verbose, 1 },
{ "use-terminal", no_argument, &useTerminal, 1 },
{ "use-serial", no_argument, &useSerial, 1 },
{ "verbose", no_argument, &verbose, 1 },
{ "use-terminal", no_argument, &useTerminal, 1 },
{ "use-serial", no_argument, &useSerial, 1 },
{ "initialize", no_argument, &initialize, 1 },
{ "reset", no_argument, &resetOnStartup, 1 },
{ "throttle", no_argument, &throttle, 1 },
{ "initialize", no_argument, &initialize, 1 },
{ "reset", no_argument, &resetOnStartup, 1 },
{ "throttle", no_argument, &throttle, 1 },
{ "no-debug", no_argument, &useDebugger, 0 },
{ "no-debug", no_argument, &useDebugger, 0 },
{ "sdl", no_argument, &frontend_type, FRONTEND_SDL },
{ "sdl-no-chrome", no_argument, &show_ui_chrome, 0 },
{ "sdl-fullscreen", no_argument, &show_ui_fullscreen, 1 },
{ "sdl", no_argument, &frontend_type, FRONTEND_SDL },
{ "sdl-no-chrome", no_argument, &show_ui_chrome, 0 },
{ "sdl-fullscreen", no_argument, &show_ui_fullscreen, 1 },
{ "x11", no_argument, &frontend_type, FRONTEND_X11 },
{ "x11-netbook", no_argument, &netbook, 1 },
{ "x11-mono", no_argument, &mono, 1 },
{ "x11-gray", no_argument, &gray, 1 },
{ "x11-visual", required_argument, NULL, 8110 },
{ "x11-small-font", required_argument, NULL, 8111 },
{ "x11-medium-font", required_argument, NULL, 8112 },
{ "x11-large-font", required_argument, NULL, 8113 },
{ "x11-connection-font", required_argument, NULL, 8114 },
{ "x11", no_argument, &frontend_type, FRONTEND_X11 },
{ "x11-netbook", no_argument, &netbook, 1 },
{ "x11-mono", no_argument, &mono, 1 },
{ "x11-gray", no_argument, &gray, 1 },
{ "x11-visual", required_argument, NULL, 8110 },
{ "x11-small-font", required_argument, NULL, 8111 },
{ "x11-medium-font", required_argument, NULL, 8112 },
{ "x11-large-font", required_argument, NULL, 8113 },
{ "x11-connection-font", required_argument, NULL, 8114 },
{ "tui", no_argument, &frontend_type, FRONTEND_TEXT },
{ "tui", no_argument, &frontend_type, FRONTEND_TEXT},
{ 0, 0, 0, 0 } };
{ 0, 0, 0, 0 }
};
char* help_text =
"usage: %s [options]\n"
"options:\n"
"\t-h --help\t\t\twhat you are reading\n"
"\t-v --version\t\t\tshow version\n"
"\t --config-dir=<path>\t\tuse <path> as x48ng's home (default: "
"~/.x48ng/)\n"
"\t --rom=<filename>\tuse <filename> (absolute or relative to "
"<config-dir>) as ROM (default: rom)\n"
"\t --ram=<filename>\tuse <filename> (absolute or relative to "
"<config-dir>) as RAM (default: ram)\n"
"\t --state=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as STATE (default: hp48)\n"
"\t --port1=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as PORT1 (default: port1)\n"
"\t --port2=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as PORT2 (default: port2)\n"
"\t --serial-line=<path>\t\tuse <path> as serial device default: "
"%s)\n"
"\t-V --verbose\t\t\tbe verbose (default: false)\n"
"\t-u --front-end\t\t\tspecify a front-end (available: x11, sdl, "
"text; "
"default: x11)\n"
"\t --x11\t\tuse X11 front-end (default: true)\n"
"\t --sdl\t\tuse SDL front-end (default: false)\n"
"\t --tui\t\tuse terminal front-end (default: false)\n"
"\t-t --use-terminal\t\tactivate pseudo terminal interface (default: "
"true)\n"
"\t-s --use-serial\t\t\tactivate serial interface (default: false)\n"
"\t --no-debug\t\t\tdisable the debugger\n"
"\t-i --initialize\t\t\tinitialize the content of <config-dir>\n"
"\t-r --reset\t\t\tperform a reset on startup\n"
"\t-T --throttle\t\t\ttry to emulate real speed (default: false)\n"
"\t --sdl-no-chrome\t\tonly display the LCD (default: "
"false)\n"
"\t --sdl-fullscreen\t\tmake the UI fullscreen "
"(default: "
"false)\n"
"\t --x11-netbook\t\tmake the UI horizontal (default: "
"false)\n"
"\t --x11-mono\t\t\tmake the UI monochrome (default: "
"false)\n"
"\t --x11-gray\t\t\tmake the UI grayscale (default: "
"false)\n"
"\t --x11-visual=<X visual>\tuse visual <X visual> (default: "
"default), possible values: "
"<default | staticgray | staticcolor | truecolor | grayscale | "
"pseudocolor | directcolor | 0xnn | nn>\n"
"\t --x11-small-font=<X font name>\tuse <X font name> as small "
"font (default: %s)\n"
"\t --x11-medium-font=<X font name>\tuse <X font name> as medium "
"font (default: %s)\n"
"\t --x11-large-font=<X font name>\tuse <X font name> as large "
"font (default: %s)\n"
"\t --x11-connection-font=<X font name>\tuse <X font name> as "
"connection font (default: %s)\n";
char* help_text = "usage: %s [options]\n"
"options:\n"
"\t-h --help\t\t\twhat you are reading\n"
"\t-v --version\t\t\tshow version\n"
"\t --config-dir=<path>\t\tuse <path> as x48ng's home (default: "
"~/.x48ng/)\n"
"\t --rom=<filename>\tuse <filename> (absolute or relative to "
"<config-dir>) as ROM (default: rom)\n"
"\t --ram=<filename>\tuse <filename> (absolute or relative to "
"<config-dir>) as RAM (default: ram)\n"
"\t --state=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as STATE (default: hp48)\n"
"\t --port1=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as PORT1 (default: port1)\n"
"\t --port2=<filename>\tuse <filename> (absolute or relative "
"to <config-dir>) as PORT2 (default: port2)\n"
"\t --serial-line=<path>\t\tuse <path> as serial device default: "
"%s)\n"
"\t-V --verbose\t\t\tbe verbose (default: false)\n"
"\t-u --front-end\t\t\tspecify a front-end (available: x11, sdl, "
"text; "
"default: x11)\n"
"\t --x11\t\tuse X11 front-end (default: true)\n"
"\t --sdl\t\tuse SDL front-end (default: false)\n"
"\t --tui\t\tuse terminal front-end (default: false)\n"
"\t-t --use-terminal\t\tactivate pseudo terminal interface (default: "
"true)\n"
"\t-s --use-serial\t\t\tactivate serial interface (default: false)\n"
"\t --no-debug\t\t\tdisable the debugger\n"
"\t-i --initialize\t\t\tinitialize the content of <config-dir>\n"
"\t-r --reset\t\t\tperform a reset on startup\n"
"\t-T --throttle\t\t\ttry to emulate real speed (default: false)\n"
"\t --sdl-no-chrome\t\tonly display the LCD (default: "
"false)\n"
"\t --sdl-fullscreen\t\tmake the UI fullscreen "
"(default: "
"false)\n"
"\t --x11-netbook\t\tmake the UI horizontal (default: "
"false)\n"
"\t --x11-mono\t\t\tmake the UI monochrome (default: "
"false)\n"
"\t --x11-gray\t\t\tmake the UI grayscale (default: "
"false)\n"
"\t --x11-visual=<X visual>\tuse visual <X visual> (default: "
"default), possible values: "
"<default | staticgray | staticcolor | truecolor | grayscale | "
"pseudocolor | directcolor | 0xnn | nn>\n"
"\t --x11-small-font=<X font name>\tuse <X font name> as small "
"font (default: %s)\n"
"\t --x11-medium-font=<X font name>\tuse <X font name> as medium "
"font (default: %s)\n"
"\t --x11-large-font=<X font name>\tuse <X font name> as large "
"font (default: %s)\n"
"\t --x11-connection-font=<X font name>\tuse <X font name> as "
"connection font (default: %s)\n";
while ( c != EOF ) {
c = getopt_long( argc, argv, optstring, long_options, &option_index );
switch ( c ) {
case 'h':
fprintf( stdout, help_text, progname, serialLine, smallFont,
mediumFont, largeFont, connFont );
fprintf( stdout, help_text, progname, serialLine, smallFont, mediumFont, largeFont, connFont );
exit( 0 );
break;
case 'v':
fprintf( stdout, "%s %d.%d.%d\n", progname, VERSION_MAJOR,
VERSION_MINOR, PATCHLEVEL );
fprintf( stdout, "%s %d.%d.%d\n", progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
exit( 0 );
break;
case 1000:
@ -390,16 +390,12 @@ int parse_args( int argc, char* argv[] ) {
fprintf( stderr, "largeFont = %s\n", largeFont );
fprintf( stderr, "connFont = %s\n", connFont );
fprintf( stderr, "normalized_config_path = %s\n",
normalized_config_path );
fprintf( stderr, "normalized_config_path = %s\n", normalized_config_path );
fprintf( stderr, "normalized_rom_path = %s\n", normalized_rom_path );
fprintf( stderr, "normalized_ram_path = %s\n", normalized_ram_path );
fprintf( stderr, "normalized_state_path = %s\n",
normalized_state_path );
fprintf( stderr, "normalized_port1_path = %s\n",
normalized_port1_path );
fprintf( stderr, "normalized_port2_path = %s\n",
normalized_port2_path );
fprintf( stderr, "normalized_state_path = %s\n", normalized_state_path );
fprintf( stderr, "normalized_port1_path = %s\n", normalized_port1_path );
fprintf( stderr, "normalized_port2_path = %s\n", normalized_port2_path );
}
return ( optind );

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <unistd.h>
#include "romio.h"
@ -10,10 +10,10 @@ unsigned short rom_crc, crc;
int verbose = 0;
#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 ) {
int main( int argc, char** argv )
{
unsigned char version[ 7 ];
long ver_addr;
int i, a, c, d, d0, d1, D0, D1;
@ -25,8 +25,7 @@ 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

@ -1,14 +1,15 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
unsigned char* core;
#define DEFAULT_ROM_FILE "rom.dump"
int write_mem_file( char* name, unsigned char* mem, size_t size ) {
int write_mem_file( char* name, unsigned char* mem, size_t size )
{
FILE* fp;
unsigned char* tmp_mem;
unsigned char byte;
@ -49,7 +50,8 @@ int write_mem_file( char* name, unsigned char* mem, size_t size ) {
return 1;
}
int main( int argc, char** argv ) {
int main( int argc, char** argv )
{
FILE* dump;
long addr;
size_t size;
@ -86,8 +88,7 @@ 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;
}
@ -101,14 +102,12 @@ 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;
}
@ -117,8 +116,7 @@ int main( int argc, char** argv ) {
} else if ( ch >= 'A' && ch <= 'F' ) {
core[ addr++ ] = ( unsigned char )( 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;
}
@ -128,8 +126,7 @@ 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;
}
}
@ -142,8 +139,7 @@ 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

@ -1,12 +1,13 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
unsigned char* mem;
int write_mem_file( char* name, unsigned char* mem, size_t size ) {
int write_mem_file( char* name, unsigned char* mem, size_t size )
{
FILE* fp;
if ( NULL == ( fp = fopen( name, "w" ) ) ) {
@ -24,15 +25,15 @@ int write_mem_file( char* name, unsigned char* mem, size_t size ) {
return 1;
}
int main( int argc, char** argv ) {
int main( int argc, char** argv )
{
size_t size;
char* name;
char* asize;
unsigned char* core;
if ( argc < 2 ) {
fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n",
argv[ 0 ] );
fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n", argv[ 0 ] );
exit( 1 );
}
@ -53,8 +54,7 @@ int main( int argc, char** argv ) {
else if ( !strcmp( asize, "4M" ) )
size = 0x400000;
else {
fprintf( stderr,
"size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n" );
fprintf( stderr, "size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n" );
exit( 1 );
}

268
src/ui.c
View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include "ui.h"
#include "runtime_options.h"
#include "ui.h"
#include "ui_inner.h"
int last_annunc_state = -1;
@ -10,134 +10,135 @@ unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
letter_t small_font[ 128 ] = {
{ 0, 0, 0 },
{ nl_gx_width, nl_gx_height, nl_gx_bitmap }, /* \001 == \n gx */
{ comma_gx_width, comma_gx_height, comma_gx_bitmap }, /* \002 == comma gx */
{ arrow_gx_width, arrow_gx_height, arrow_gx_bitmap }, /* \003 == \-> gx */
{ equal_gx_width, equal_gx_height, equal_gx_bitmap }, /* \004 == equal gx */
{ pi_gx_width, pi_gx_height, pi_gx_bitmap }, /* \005 == pi gx */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }, /* # 16 */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ blank_width, blank_height, blank_bitmap }, /* # 32 */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ hash_width, hash_height, hash_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ lbrace_width, lbrace_height, lbrace_bitmap },
{ rbrace_width, rbrace_height, rbrace_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ comma_width, comma_height, comma_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ slash_width, slash_height, slash_bitmap },
{ 0, 0, 0 }, /* # 48 */
{ 0, 0, 0 },
{ two_width, two_height, two_bitmap },
{ three_width, three_height, three_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ small_colon_width, small_colon_height, small_colon_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ equal_width, equal_height, equal_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }, /* # 64 */
{ A_width, A_height, A_bitmap },
{ B_width, B_height, B_bitmap },
{ C_width, C_height, C_bitmap },
{ D_width, D_height, D_bitmap },
{ E_width, E_height, E_bitmap },
{ F_width, F_height, F_bitmap },
{ G_width, G_height, G_bitmap },
{ H_width, H_height, H_bitmap },
{ I_width, I_height, I_bitmap },
{ J_width, J_height, J_bitmap },
{ K_width, K_height, K_bitmap },
{ L_width, L_height, L_bitmap },
{ M_width, M_height, M_bitmap },
{ N_width, N_height, N_bitmap },
{ O_width, O_height, O_bitmap },
{ P_width, P_height, P_bitmap }, /* # 80 */
{ Q_width, Q_height, Q_bitmap },
{ R_width, R_height, R_bitmap },
{ S_width, S_height, S_bitmap },
{ T_width, T_height, T_bitmap },
{ U_width, U_height, U_bitmap },
{ V_width, V_height, V_bitmap },
{ W_width, W_height, W_bitmap },
{ X_width, X_height, X_bitmap },
{ Y_width, Y_height, Y_bitmap },
{ Z_width, Z_height, Z_bitmap },
{ lbracket_width, lbracket_height, lbracket_bitmap },
{ 0, 0, 0 },
{ rbracket_width, rbracket_height, rbracket_bitmap },
{ 0, 0, 0 },
{ under_width, under_height, under_bitmap },
{ 0, 0, 0 }, /* # 96 */
{ arrow_width, arrow_height, arrow_bitmap }, /* a == left arrow */
{ diff_width, diff_height, diff_bitmap }, /* b == differential */
{ integral_width, integral_height, integral_bitmap }, /* c == integral */
{ sigma_width, sigma_height, sigma_bitmap }, /* d == sigma */
{ sqr_width, sqr_height, sqr_bitmap }, /* e == sqr */
{ root_width, root_height, root_bitmap }, /* f == root */
{ pow10_width, pow10_height, pow10_bitmap }, /* g == pow10 */
{ exp_width, exp_height, exp_bitmap }, /* h == exp */
{ prog_width, prog_height, prog_bitmap }, /* i == << >> */
{ string_width, string_height, string_bitmap }, /* j == " " */
{ nl_width, nl_height, nl_bitmap }, /* k == New Line */
{ pi_width, pi_height, pi_bitmap }, /* l == pi */
{ angle_width, angle_height, angle_bitmap }, /* m == angle */
{ sqr_gx_width, sqr_gx_height, sqr_gx_bitmap }, /* n == sqr gx */
{ root_gx_width, root_gx_height, root_gx_bitmap }, /* o == root gx */
{ pow10_gx_width, pow10_gx_height, pow10_gx_bitmap }, /* p == pow10 gx */
{ exp_gx_width, exp_gx_height, exp_gx_bitmap }, /* q == exp gx */
{ parens_gx_width, parens_gx_height, parens_gx_bitmap }, /* r == ( ) gx */
{ hash_gx_width, hash_gx_height, hash_gx_bitmap }, /* s == # gx */
{ bracket_gx_width, bracket_gx_height, bracket_gx_bitmap }, /* t == [] gx */
{ under_gx_width, under_gx_height, under_gx_bitmap }, /* u == _ gx */
{ prog_gx_width, prog_gx_height, prog_gx_bitmap }, /* v == << >> gx */
{ quote_gx_width, quote_gx_height, quote_gx_bitmap }, /* w == " " gx */
{ curly_gx_width, curly_gx_height, curly_gx_bitmap }, /* x == {} gx */
{ colon_gx_width, colon_gx_height, colon_gx_bitmap }, /* y == :: gx */
{ angle_gx_width, angle_gx_height, angle_gx_bitmap }, /* z == angle gx */
{ lcurly_width, lcurly_height, lcurly_bitmap },
{ 0, 0, 0 },
{ rcurly_width, rcurly_height, rcurly_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 } };
{0, 0, 0 },
{ nl_gx_width, nl_gx_height, nl_gx_bitmap }, /* \001 == \n gx */
{ comma_gx_width, comma_gx_height, comma_gx_bitmap }, /* \002 == comma gx */
{ arrow_gx_width, arrow_gx_height, arrow_gx_bitmap }, /* \003 == \-> gx */
{ equal_gx_width, equal_gx_height, equal_gx_bitmap }, /* \004 == equal gx */
{ pi_gx_width, pi_gx_height, pi_gx_bitmap }, /* \005 == pi gx */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }, /* # 16 */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ blank_width, blank_height, blank_bitmap }, /* # 32 */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ hash_width, hash_height, hash_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ lbrace_width, lbrace_height, lbrace_bitmap },
{ rbrace_width, rbrace_height, rbrace_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ comma_width, comma_height, comma_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ slash_width, slash_height, slash_bitmap },
{ 0, 0, 0 }, /* # 48 */
{ 0, 0, 0 },
{ two_width, two_height, two_bitmap },
{ three_width, three_height, three_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ small_colon_width, small_colon_height, small_colon_bitmap},
{ 0, 0, 0 },
{ 0, 0, 0 },
{ equal_width, equal_height, equal_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }, /* # 64 */
{ A_width, A_height, A_bitmap },
{ B_width, B_height, B_bitmap },
{ C_width, C_height, C_bitmap },
{ D_width, D_height, D_bitmap },
{ E_width, E_height, E_bitmap },
{ F_width, F_height, F_bitmap },
{ G_width, G_height, G_bitmap },
{ H_width, H_height, H_bitmap },
{ I_width, I_height, I_bitmap },
{ J_width, J_height, J_bitmap },
{ K_width, K_height, K_bitmap },
{ L_width, L_height, L_bitmap },
{ M_width, M_height, M_bitmap },
{ N_width, N_height, N_bitmap },
{ O_width, O_height, O_bitmap },
{ P_width, P_height, P_bitmap }, /* # 80 */
{ Q_width, Q_height, Q_bitmap },
{ R_width, R_height, R_bitmap },
{ S_width, S_height, S_bitmap },
{ T_width, T_height, T_bitmap },
{ U_width, U_height, U_bitmap },
{ V_width, V_height, V_bitmap },
{ W_width, W_height, W_bitmap },
{ X_width, X_height, X_bitmap },
{ Y_width, Y_height, Y_bitmap },
{ Z_width, Z_height, Z_bitmap },
{ lbracket_width, lbracket_height, lbracket_bitmap },
{ 0, 0, 0 },
{ rbracket_width, rbracket_height, rbracket_bitmap },
{ 0, 0, 0 },
{ under_width, under_height, under_bitmap },
{ 0, 0, 0 }, /* # 96 */
{ arrow_width, arrow_height, arrow_bitmap }, /* a == left arrow */
{ diff_width, diff_height, diff_bitmap }, /* b == differential */
{ integral_width, integral_height, integral_bitmap }, /* c == integral */
{ sigma_width, sigma_height, sigma_bitmap }, /* d == sigma */
{ sqr_width, sqr_height, sqr_bitmap }, /* e == sqr */
{ root_width, root_height, root_bitmap }, /* f == root */
{ pow10_width, pow10_height, pow10_bitmap }, /* g == pow10 */
{ exp_width, exp_height, exp_bitmap }, /* h == exp */
{ prog_width, prog_height, prog_bitmap }, /* i == << >> */
{ string_width, string_height, string_bitmap }, /* j == " " */
{ nl_width, nl_height, nl_bitmap }, /* k == New Line */
{ pi_width, pi_height, pi_bitmap }, /* l == pi */
{ angle_width, angle_height, angle_bitmap }, /* m == angle */
{ sqr_gx_width, sqr_gx_height, sqr_gx_bitmap }, /* n == sqr gx */
{ root_gx_width, root_gx_height, root_gx_bitmap }, /* o == root gx */
{ pow10_gx_width, pow10_gx_height, pow10_gx_bitmap }, /* p == pow10 gx */
{ exp_gx_width, exp_gx_height, exp_gx_bitmap }, /* q == exp gx */
{ parens_gx_width, parens_gx_height, parens_gx_bitmap }, /* r == ( ) gx */
{ hash_gx_width, hash_gx_height, hash_gx_bitmap }, /* s == # gx */
{ bracket_gx_width, bracket_gx_height, bracket_gx_bitmap }, /* t == [] gx */
{ under_gx_width, under_gx_height, under_gx_bitmap }, /* u == _ gx */
{ prog_gx_width, prog_gx_height, prog_gx_bitmap }, /* v == << >> gx */
{ quote_gx_width, quote_gx_height, quote_gx_bitmap }, /* w == " " gx */
{ curly_gx_width, curly_gx_height, curly_gx_bitmap }, /* x == {} gx */
{ colon_gx_width, colon_gx_height, colon_gx_bitmap }, /* y == :: gx */
{ angle_gx_width, angle_gx_height, angle_gx_bitmap }, /* z == angle gx */
{ lcurly_width, lcurly_height, lcurly_bitmap },
{ 0, 0, 0 },
{ rcurly_width, rcurly_height, rcurly_bitmap },
{ 0, 0, 0 },
{ 0, 0, 0 }
};
void ( *ui_disp_draw_nibble )( word_20 addr, word_4 val );
void ( *ui_menu_draw_nibble )( word_20 addr, word_4 val );
@ -149,7 +150,8 @@ void ( *ui_draw_annunc )( void );
void ( *ui_init_LCD )( void );
void ( *init_ui )( int argc, char** argv );
void setup_frontend( void ) {
void setup_frontend( void )
{
switch ( frontend_type ) {
case FRONTEND_X11:
default:
@ -190,7 +192,8 @@ void setup_frontend( void ) {
}
}
int SmallTextWidth( const char* string, unsigned int length ) {
int SmallTextWidth( const char* string, unsigned int length )
{
unsigned int i;
int w;
@ -200,8 +203,7 @@ int SmallTextWidth( const char* string, unsigned int length ) {
w += small_font[ ( int )string[ i ] ].w + 1;
} else {
if ( verbose )
fprintf( stderr, "Unknown small letter 0x00%x\n",
( int )string[ i ] );
fprintf( stderr, "Unknown small letter 0x00%x\n", ( int )string[ i ] );
w += 5;
}
}

View file

@ -103,119 +103,83 @@
#define hp_width 96
#define hp_height 24
static unsigned char hp_bitmap[] = {
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, 0x9f, 0xfd, 0x3f, 0x60, 0xcc, 0x6f, 0x66, 0x83, 0xdf, 0xff, 0x3f,
0xfc, 0x9f, 0xf1, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06,
0xfc, 0xc7, 0xc0, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06,
0xfc, 0xc3, 0x80, 0x7f, 0x60, 0xcc, 0x40, 0x26, 0x83, 0x01, 0x06, 0x06,
0xfc, 0x61, 0x00, 0x7f, 0xe0, 0xcf, 0xcf, 0x36, 0x83, 0x1f, 0x06, 0x06,
0xfc, 0x60, 0x00, 0x7e, 0x60, 0xcc, 0xc0, 0x36, 0x83, 0x01, 0x06, 0x06,
0xfc, 0x30, 0x00, 0x7e, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06,
0x7c, 0xb0, 0x68, 0x7c, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06,
0x7c, 0xf8, 0xf9, 0x7c, 0x60, 0xcc, 0x8f, 0x19, 0xbf, 0x1f, 0x06, 0x06,
0x7c, 0x98, 0xcd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0xcc, 0x66, 0x7c, 0xe0, 0x87, 0x81, 0x67, 0x0c, 0xc3, 0xcf, 0x0f,
0x7c, 0x66, 0x66, 0x7c, 0x60, 0xcc, 0xc3, 0x6c, 0x86, 0xc7, 0xd8, 0x18,
0x7c, 0x66, 0x3f, 0x7e, 0x60, 0x4c, 0x62, 0x60, 0x83, 0xc4, 0xd8, 0x30,
0xfc, 0x00, 0x03, 0x7e, 0x60, 0x6c, 0x66, 0xe0, 0xc1, 0xcc, 0xd8, 0x30,
0xfc, 0x80, 0x01, 0x7f, 0xe0, 0x67, 0x66, 0xe0, 0xc1, 0xcc, 0xcf, 0x30,
0xfc, 0x81, 0x81, 0x7f, 0x60, 0xe0, 0x67, 0x60, 0xc3, 0xcf, 0xcc, 0x30,
0xfc, 0xc3, 0xc0, 0x7f, 0x60, 0x30, 0x6c, 0x60, 0x66, 0xd8, 0xd8, 0x30,
0xfc, 0xcf, 0xf0, 0x7f, 0x60, 0x30, 0xcc, 0x6c, 0x6c, 0xd8, 0xd8, 0x18,
0xf8, 0x6f, 0xfe, 0x3f, 0x60, 0x30, 0x8c, 0x67, 0x78, 0xd8, 0xd8, 0x0f,
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, 0xf8, 0x9f, 0xfd, 0x3f, 0x60, 0xcc, 0x6f, 0x66, 0x83, 0xdf, 0xff, 0x3f, 0xfc, 0x9f, 0xf1, 0x7f, 0x60, 0xcc,
0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc7, 0xc0, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc3, 0x80,
0x7f, 0x60, 0xcc, 0x40, 0x26, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x61, 0x00, 0x7f, 0xe0, 0xcf, 0xcf, 0x36, 0x83, 0x1f, 0x06, 0x06,
0xfc, 0x60, 0x00, 0x7e, 0x60, 0xcc, 0xc0, 0x36, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x30, 0x00, 0x7e, 0x60, 0xcc, 0x80, 0x19, 0x83,
0x01, 0x06, 0x06, 0x7c, 0xb0, 0x68, 0x7c, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06, 0x7c, 0xf8, 0xf9, 0x7c, 0x60, 0xcc,
0x8f, 0x19, 0xbf, 0x1f, 0x06, 0x06, 0x7c, 0x98, 0xcd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0x66, 0x7c, 0xe0, 0x87, 0x81, 0x67, 0x0c, 0xc3, 0xcf, 0x0f,
0x7c, 0x66, 0x66, 0x7c, 0x60, 0xcc, 0xc3, 0x6c, 0x86, 0xc7, 0xd8, 0x18, 0x7c, 0x66, 0x3f, 0x7e, 0x60, 0x4c, 0x62, 0x60, 0x83,
0xc4, 0xd8, 0x30, 0xfc, 0x00, 0x03, 0x7e, 0x60, 0x6c, 0x66, 0xe0, 0xc1, 0xcc, 0xd8, 0x30, 0xfc, 0x80, 0x01, 0x7f, 0xe0, 0x67,
0x66, 0xe0, 0xc1, 0xcc, 0xcf, 0x30, 0xfc, 0x81, 0x81, 0x7f, 0x60, 0xe0, 0x67, 0x60, 0xc3, 0xcf, 0xcc, 0x30, 0xfc, 0xc3, 0xc0,
0x7f, 0x60, 0x30, 0x6c, 0x60, 0x66, 0xd8, 0xd8, 0x30, 0xfc, 0xcf, 0xf0, 0x7f, 0x60, 0x30, 0xcc, 0x6c, 0x6c, 0xd8, 0xd8, 0x18,
0xf8, 0x6f, 0xfe, 0x3f, 0x60, 0x30, 0x8c, 0x67, 0x78, 0xd8, 0xd8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define hp48sx_width 42
#define hp48sx_height 10
static unsigned char hp48sx_bitmap[] = {
0xe0, 0xf1, 0xc3, 0x3f, 0x87, 0x03, 0xf0, 0xf9, 0xe7, 0x7f, 0xc7, 0x01,
0xf8, 0x39, 0xe7, 0x70, 0xee, 0x00, 0xdc, 0x39, 0xe7, 0x00, 0x7e, 0x00,
0xee, 0xf0, 0xe3, 0x0f, 0x3c, 0x00, 0xe7, 0xf8, 0xc1, 0x1f, 0x1c, 0x00,
0xff, 0x9d, 0x03, 0x1c, 0x3e, 0x00, 0xff, 0x9d, 0x3b, 0x1c, 0x3f, 0x00,
0x70, 0xfc, 0xfb, 0x9f, 0x73, 0x00, 0x70, 0xf8, 0xf1, 0xcf, 0x71, 0x00 };
static unsigned char hp48sx_bitmap[] = { 0xe0, 0xf1, 0xc3, 0x3f, 0x87, 0x03, 0xf0, 0xf9, 0xe7, 0x7f, 0xc7, 0x01, 0xf8, 0x39, 0xe7,
0x70, 0xee, 0x00, 0xdc, 0x39, 0xe7, 0x00, 0x7e, 0x00, 0xee, 0xf0, 0xe3, 0x0f, 0x3c, 0x00,
0xe7, 0xf8, 0xc1, 0x1f, 0x1c, 0x00, 0xff, 0x9d, 0x03, 0x1c, 0x3e, 0x00, 0xff, 0x9d, 0x3b,
0x1c, 0x3f, 0x00, 0x70, 0xfc, 0xfb, 0x9f, 0x73, 0x00, 0x70, 0xf8, 0xf1, 0xcf, 0x71, 0x00 };
#define hp48gx_width 44
#define hp48gx_height 14
static unsigned char hp48gx_bitmap[] = {
0x00, 0xc3, 0x03, 0x7c, 0x0c, 0x0c, 0x80, 0xe3, 0x07, 0xff, 0x0c, 0x0e,
0xc0, 0x33, 0x86, 0xc3, 0x1c, 0x06, 0xe0, 0x31, 0xc6, 0xc0, 0x18, 0x03,
0xb0, 0x31, 0xe6, 0x00, 0xb0, 0x01, 0x98, 0x31, 0x63, 0x00, 0xf0, 0x01,
0x8c, 0xe1, 0x61, 0x00, 0xe0, 0x00, 0xc6, 0xb8, 0x31, 0xfc, 0x70, 0x00,
0xc7, 0x18, 0x33, 0xfc, 0xf8, 0x00, 0xff, 0x0d, 0x33, 0x60, 0xd8, 0x00,
0xff, 0x0d, 0x73, 0x60, 0x8c, 0x01, 0x60, 0x8c, 0x63, 0x30, 0x86, 0x03,
0x60, 0xfc, 0xe1, 0x3f, 0x07, 0x03, 0x60, 0xf8, 0x80, 0x37, 0x03, 0x03 };
0x00, 0xc3, 0x03, 0x7c, 0x0c, 0x0c, 0x80, 0xe3, 0x07, 0xff, 0x0c, 0x0e, 0xc0, 0x33, 0x86, 0xc3, 0x1c, 0x06, 0xe0, 0x31, 0xc6,
0xc0, 0x18, 0x03, 0xb0, 0x31, 0xe6, 0x00, 0xb0, 0x01, 0x98, 0x31, 0x63, 0x00, 0xf0, 0x01, 0x8c, 0xe1, 0x61, 0x00, 0xe0, 0x00,
0xc6, 0xb8, 0x31, 0xfc, 0x70, 0x00, 0xc7, 0x18, 0x33, 0xfc, 0xf8, 0x00, 0xff, 0x0d, 0x33, 0x60, 0xd8, 0x00, 0xff, 0x0d, 0x73,
0x60, 0x8c, 0x01, 0x60, 0x8c, 0x63, 0x30, 0x86, 0x03, 0x60, 0xfc, 0xe1, 0x3f, 0x07, 0x03, 0x60, 0xf8, 0x80, 0x37, 0x03, 0x03 };
#define science_width 131
#define science_height 8
static unsigned char science_bitmap[] = {
0x38, 0x1c, 0xf2, 0x09, 0x7d, 0x79, 0xe2, 0x80, 0x2f, 0xe4, 0x41, 0x08,
0x79, 0x20, 0x3c, 0xc2, 0x07, 0x44, 0x22, 0x12, 0x08, 0x11, 0x09, 0x12,
0x81, 0x20, 0x22, 0x62, 0x08, 0x89, 0x30, 0x44, 0x42, 0x00, 0x02, 0x01,
0x09, 0x94, 0x88, 0x04, 0x09, 0x40, 0x40, 0x11, 0x52, 0x94, 0x88, 0x28,
0x42, 0x21, 0x00, 0x1c, 0x01, 0xf9, 0x94, 0x88, 0x3c, 0x09, 0xc0, 0xc7,
0xf0, 0x51, 0x94, 0x84, 0x28, 0x3e, 0xe1, 0x03, 0xa0, 0x00, 0x09, 0x94,
0x88, 0x04, 0x05, 0x40, 0xc0, 0x10, 0x48, 0x94, 0x44, 0x24, 0x22, 0x21,
0x00, 0xa1, 0xa0, 0x04, 0xa2, 0x44, 0x82, 0x04, 0x21, 0xa0, 0x08, 0xfc,
0xa2, 0x42, 0x7e, 0xa1, 0x10, 0x00, 0x91, 0x90, 0x04, 0x42, 0x44, 0x82,
0x84, 0x20, 0x10, 0x09, 0x84, 0x42, 0x22, 0x42, 0xb1, 0x10, 0x00, 0x0e,
0x8f, 0x7c, 0x42, 0x44, 0x82, 0x78, 0xe0, 0x0b, 0x09, 0x82, 0x42, 0x1e,
0x41, 0x9f, 0xf7, 0x01 };
0x38, 0x1c, 0xf2, 0x09, 0x7d, 0x79, 0xe2, 0x80, 0x2f, 0xe4, 0x41, 0x08, 0x79, 0x20, 0x3c, 0xc2, 0x07, 0x44, 0x22, 0x12,
0x08, 0x11, 0x09, 0x12, 0x81, 0x20, 0x22, 0x62, 0x08, 0x89, 0x30, 0x44, 0x42, 0x00, 0x02, 0x01, 0x09, 0x94, 0x88, 0x04,
0x09, 0x40, 0x40, 0x11, 0x52, 0x94, 0x88, 0x28, 0x42, 0x21, 0x00, 0x1c, 0x01, 0xf9, 0x94, 0x88, 0x3c, 0x09, 0xc0, 0xc7,
0xf0, 0x51, 0x94, 0x84, 0x28, 0x3e, 0xe1, 0x03, 0xa0, 0x00, 0x09, 0x94, 0x88, 0x04, 0x05, 0x40, 0xc0, 0x10, 0x48, 0x94,
0x44, 0x24, 0x22, 0x21, 0x00, 0xa1, 0xa0, 0x04, 0xa2, 0x44, 0x82, 0x04, 0x21, 0xa0, 0x08, 0xfc, 0xa2, 0x42, 0x7e, 0xa1,
0x10, 0x00, 0x91, 0x90, 0x04, 0x42, 0x44, 0x82, 0x84, 0x20, 0x10, 0x09, 0x84, 0x42, 0x22, 0x42, 0xb1, 0x10, 0x00, 0x0e,
0x8f, 0x7c, 0x42, 0x44, 0x82, 0x78, 0xe0, 0x0b, 0x09, 0x82, 0x42, 0x1e, 0x41, 0x9f, 0xf7, 0x01 };
#define gx_128K_ram_x_hot 1
#define gx_128K_ram_y_hot 8
#define gx_128K_ram_width 43
#define gx_128K_ram_height 31
static unsigned char gx_128K_ram_bitmap[] = {
0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00,
0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xe2, 0xdf, 0xff, 0xff, 0x03, 0x00,
0x9c, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00,
0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00,
0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xdd, 0xff, 0x7f, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xdd, 0xff, 0xbf, 0x03, 0x00,
0xfe, 0xdb, 0xff, 0xdf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xef, 0x03, 0x00,
0xfe, 0xd7, 0xff, 0xf7, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfb, 0x03, 0x00,
0xfe, 0xcf, 0xff, 0xfc, 0x03, 0x00, 0xfe, 0x1f, 0x3f, 0xff, 0x03, 0x00,
0xfe, 0xdf, 0xc0, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00,
0xfe, 0xdf, 0xff, 0xff, 0x03, 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, 0xc4, 0x30, 0x12, 0x1c, 0x44, 0x04,
0x27, 0x49, 0x0a, 0x24, 0x46, 0x04, 0x84, 0x39, 0x06, 0x24, 0xc9, 0x06,
0x62, 0x24, 0x07, 0x9e, 0xaf, 0x06, 0x12, 0x24, 0x09, 0x92, 0xa8, 0x05,
0xf2, 0x18, 0x11, 0x52, 0x28, 0x05 };
0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xe2, 0xdf, 0xff,
0xff, 0x03, 0x00, 0x9c, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00,
0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xdd, 0xff, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xdd, 0xff, 0xbf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xdf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xef, 0x03, 0x00,
0xfe, 0xd7, 0xff, 0xf7, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfb, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfc, 0x03, 0x00, 0xfe, 0x1f, 0x3f,
0xff, 0x03, 0x00, 0xfe, 0xdf, 0xc0, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 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, 0xc4, 0x30, 0x12, 0x1c, 0x44, 0x04, 0x27, 0x49, 0x0a, 0x24, 0x46, 0x04, 0x84, 0x39, 0x06, 0x24, 0xc9, 0x06,
0x62, 0x24, 0x07, 0x9e, 0xaf, 0x06, 0x12, 0x24, 0x09, 0x92, 0xa8, 0x05, 0xf2, 0x18, 0x11, 0x52, 0x28, 0x05 };
#define gx_silver_x_hot 0
#define gx_silver_y_hot 8
#define gx_silver_width 35
#define gx_silver_height 21
static unsigned char gx_silver_bitmap[] = {
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0xc4, 0x40, 0x00, 0x00,
0x00, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02,
0x42, 0x00, 0x00, 0x02, 0x01, 0x42, 0x00, 0x00, 0x02, 0x01, 0x44, 0x00,
0x00, 0x01, 0xfd, 0xff, 0xff, 0xff, 0x07, 0x01, 0x44, 0x00, 0x80, 0x00,
0x01, 0x48, 0x00, 0x40, 0x00, 0x01, 0x48, 0x00, 0x20, 0x00, 0x00, 0x50,
0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x60, 0x00, 0x06,
0x00, 0x00, 0xc0, 0x81, 0x01, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 };
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0xc4,
0x40, 0x00, 0x00, 0x00, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x42, 0x00, 0x00, 0x02, 0x01, 0x42,
0x00, 0x00, 0x02, 0x01, 0x44, 0x00, 0x00, 0x01, 0xfd, 0xff, 0xff, 0xff, 0x07, 0x01, 0x44, 0x00, 0x80, 0x00, 0x01, 0x48, 0x00,
0x40, 0x00, 0x01, 0x48, 0x00, 0x20, 0x00, 0x00, 0x50, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x60, 0x00, 0x06,
0x00, 0x00, 0xc0, 0x81, 0x01, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 };
#define gx_green_x_hot 11
#define gx_green_y_hot 0
#define gx_green_width 34
#define gx_green_height 22
static unsigned char gx_green_bitmap[] = {
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 *\/ */
@ -224,39 +188,33 @@ static unsigned char gx_green_bitmap[] = {
#define ann_alpha_width 15
#define ann_alpha_height 12
static unsigned char ann_alpha_bitmap[] = {
0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 };
static unsigned char ann_alpha_bitmap[] = { 0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 };
#define ann_battery_width 15
#define ann_battery_height 12
static unsigned char ann_battery_bitmap[] = {
0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 };
static unsigned char ann_battery_bitmap[] = { 0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 };
#define ann_busy_width 15
#define ann_busy_height 12
static unsigned char ann_busy_bitmap[] = {
0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f };
static unsigned char ann_busy_bitmap[] = { 0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f };
#define ann_io_width 15
#define ann_io_height 12
static unsigned char ann_io_bitmap[] = {
0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 };
static unsigned char ann_io_bitmap[] = { 0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 };
#define ann_left_width 15
#define ann_left_height 12
static unsigned char ann_left_bitmap[] = {
0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 };
static unsigned char ann_left_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 };
#define ann_right_width 15
#define ann_right_height 12
static unsigned char ann_right_bitmap[] = {
0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f };
static unsigned char ann_right_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f };
/* #endif /\* !_ANNUNC_H *\/ */
@ -265,134 +223,107 @@ static unsigned char ann_right_bitmap[] = {
#define menu_label_width 24
#define menu_label_height 11
static unsigned char menu_label_bitmap[] = {
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 };
static unsigned char menu_label_bitmap[] = { 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_bitmap[] = {
0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8,
0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07 };
static unsigned char up_bitmap[] = { 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_bitmap[] = {
0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8,
0x00, 0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00 };
static unsigned char down_bitmap[] = { 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_bitmap[] = {
0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff,
0x07, 0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04 };
static unsigned char left_bitmap[] = { 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_bitmap[] = {
0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff,
0x07, 0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00 };
static unsigned char right_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char sqrt_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char power_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char inv_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char neg_bitmap[] = { 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_bitmap[] = {
0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff,
0x07, 0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00 };
static unsigned char bs_bitmap[] = { 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_bitmap[] = {
0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83, 0x05, 0x83, 0x05,
0x83, 0x03, 0x83, 0x01, 0x83, 0x01, 0x46, 0x09, 0x3c, 0x06 };
static unsigned char alpha_bitmap[] = { 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_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0x03, 0xff, 0x03, 0x00, 0x00,
0x00, 0x00, 0x30, 0x00, 0x30, 0x00 };
static unsigned char div_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char shl_bitmap[] = { 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_bitmap[] = { 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc,
0x00, 0x78, 0x00, 0x78, 0x00, 0xfc, 0x00,
0xce, 0x01, 0x87, 0x03, 0x03, 0x03 };
static unsigned char mul_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char shr_bitmap[] = { 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_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char minus_bitmap[] = { 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_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30,
0x00, 0xff, 0x03, 0xff, 0x03, 0x30, 0x00,
0x30, 0x00, 0x30, 0x00, 0x30, 0x00 };
static unsigned char plus_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xff, 0x03,
0xff, 0x03, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00 };
#define colon_width 2
#define colon_height 10
static unsigned char colon_bitmap[] = { 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char colon_bitmap[] = { 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/* Below used only for X11 */
#define last_width 120
#define last_height 6
static unsigned char last_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc6, 0x1c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x11, 0x49, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10, 0x8f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc9, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80 };
static unsigned char last_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc6, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, 0x49, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x8f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc9, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 };
/* #endif /\* !_BUTTONS_H *\/ */
@ -404,48 +335,39 @@ static unsigned char last_bitmap[] = {
#define blank_width 4
#define blank_height 7
static unsigned char blank_bitmap[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
static unsigned char blank_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define hash_width 5
#define hash_height 7
static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a,
0x0a, 0x1f, 0x0a };
static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a };
#define lbrace_width 3
#define lbrace_height 7
static unsigned char lbrace_bitmap[] = { 0x04, 0x02, 0x01, 0x01,
0x01, 0x02, 0x04 };
static unsigned char lbrace_bitmap[] = { 0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04 };
#define rbrace_width 3
#define rbrace_height 7
static unsigned char rbrace_bitmap[] = { 0x01, 0x02, 0x04, 0x04,
0x04, 0x02, 0x01 };
static unsigned char rbrace_bitmap[] = { 0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01 };
#define comma_width 3
#define comma_height 7
static unsigned char comma_bitmap[] = { 0x00, 0x00, 0x00, 0x00,
0x06, 0x06, 0x03 };
static unsigned char comma_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x03 };
#define slash_width 3
#define slash_height 7
static unsigned char slash_bitmap[] = { 0x04, 0x04, 0x02, 0x02,
0x02, 0x01, 0x01 };
static unsigned char slash_bitmap[] = { 0x04, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01 };
#define two_width 5
#define two_height 7
static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08,
0x04, 0x02, 0x1f };
static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f };
#define three_width 5
#define three_height 7
static unsigned char three_bitmap[] = { 0x0e, 0x11, 0x10, 0x0c,
0x10, 0x11, 0x0e };
static unsigned char three_bitmap[] = { 0x0e, 0x11, 0x10, 0x0c, 0x10, 0x11, 0x0e };
#define small_colon_width 2
#define small_colon_height 7
static unsigned char small_colon_bitmap[] = { 0x00, 0x03, 0x03, 0x00,
0x03, 0x03, 0x00 };
static unsigned char small_colon_bitmap[] = { 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00 };
#define A_width 5
#define A_height 7
@ -553,81 +475,64 @@ static unsigned char Z_bitmap[] = { 0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f };
#define lbracket_width 3
#define lbracket_height 7
static unsigned char lbracket_bitmap[] = { 0x07, 0x01, 0x01, 0x01,
0x01, 0x01, 0x07 };
static unsigned char lbracket_bitmap[] = { 0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07 };
#define rbracket_width 3
#define rbracket_height 7
static unsigned char rbracket_bitmap[] = { 0x07, 0x04, 0x04, 0x04,
0x04, 0x04, 0x07 };
static unsigned char rbracket_bitmap[] = { 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07 };
#define arrow_width 7
#define arrow_height 7
static unsigned char arrow_bitmap[] = { 0x00, 0x08, 0x18, 0x3f,
0x18, 0x08, 0x00 };
static unsigned char arrow_bitmap[] = { 0x00, 0x08, 0x18, 0x3f, 0x18, 0x08, 0x00 };
#define diff_width 5
#define diff_height 7
static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e,
0x11, 0x11, 0x0e };
static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e };
#define integral_width 5
#define integral_height 8
static unsigned char integral_bitmap[] = { 0x0c, 0x12, 0x02, 0x04,
0x04, 0x08, 0x09, 0x06 };
static unsigned char integral_bitmap[] = { 0x0c, 0x12, 0x02, 0x04, 0x04, 0x08, 0x09, 0x06 };
#define sigma_width 6
#define sigma_height 9
static unsigned char sigma_bitmap[] = { 0x3f, 0x21, 0x02, 0x04, 0x08,
0x04, 0x02, 0x21, 0x3f };
static unsigned char sigma_bitmap[] = { 0x3f, 0x21, 0x02, 0x04, 0x08, 0x04, 0x02, 0x21, 0x3f };
#define sqr_width 11
#define sqr_height 10
static unsigned char sqr_bitmap[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x26, 0x01, 0x94, 0x07, 0x08, 0x00,
0x14, 0x00, 0x53, 0x00, 0x21, 0x00 };
static unsigned char sqr_bitmap[] = { 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_bitmap[] = {
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 };
static unsigned char root_bitmap[] = { 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_bitmap[] = { 0x00, 0x12, 0x00, 0x0c, 0x32, 0x04,
0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00,
0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 };
static unsigned char pow10_bitmap[] = { 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_bitmap[] = { 0x80, 0x04, 0x00, 0x03, 0x00, 0x01,
0x8c, 0x02, 0x52, 0x02, 0x09, 0x00,
0x07, 0x00, 0x21, 0x00, 0x1e, 0x00 };
static unsigned char exp_bitmap[] = { 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_bitmap[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f };
static unsigned char under_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f };
#define prog_width 16
#define prog_height 7
static unsigned char prog_bitmap[] = { 0x48, 0x12, 0x24, 0x24, 0x12,
0x48, 0x09, 0x90, 0x12, 0x48,
0x24, 0x24, 0x48, 0x12 };
static unsigned char prog_bitmap[] = { 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_bitmap[] = { 0x85, 0x02, 0x85, 0x02, 0x85,
0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
static unsigned char string_bitmap[] = { 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_bitmap[] = { 0x00, 0x1f, 0x00, 0x00,
0x1f, 0x00, 0x00 };
static unsigned char equal_bitmap[] = { 0x00, 0x1f, 0x00, 0x00, 0x1f, 0x00, 0x00 };
#define nl_width 8
#define nl_height 7
@ -639,128 +544,105 @@ static unsigned char pi_bitmap[] = { 0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12 };
#define angle_width 8
#define angle_height 7
static unsigned char angle_bitmap[] = { 0x40, 0x20, 0x10, 0x28,
0x44, 0x42, 0xff };
static unsigned char angle_bitmap[] = { 0x40, 0x20, 0x10, 0x28, 0x44, 0x42, 0xff };
#define lcurly_width 5
#define lcurly_height 7
static unsigned char lcurly_bitmap[] = { 0x18, 0x04, 0x04, 0x02,
0x04, 0x04, 0x18 };
static unsigned char lcurly_bitmap[] = { 0x18, 0x04, 0x04, 0x02, 0x04, 0x04, 0x18 };
#define rcurly_width 5
#define rcurly_height 7
static unsigned char rcurly_bitmap[] = { 0x03, 0x04, 0x04, 0x08,
0x04, 0x04, 0x03 };
static unsigned char rcurly_bitmap[] = { 0x03, 0x04, 0x04, 0x08, 0x04, 0x04, 0x03 };
#define sqr_gx_width 11
#define sqr_gx_height 13
static unsigned char sqr_gx_bitmap[] = {
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_bitmap[] = { 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
static unsigned char root_gx_bitmap[] = {
0x66, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00,
0x53, 0xfe, 0x03, 0x21, 0x02, 0x02, 0x00, 0x02, 0x00, 0x00, 0x99, 0x00,
0x00, 0x91, 0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00,
0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 };
static unsigned char root_gx_bitmap[] = { 0x66, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00, 0x53, 0xfe, 0x03,
0x21, 0x02, 0x02, 0x00, 0x02, 0x00, 0x00, 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_gx_width 13
#define pow10_gx_height 12
static unsigned char pow10_gx_bitmap[] = {
0x00, 0x12, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x09, 0x32, 0x00,
0x4b, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 };
static unsigned char pow10_gx_bitmap[] = { 0x00, 0x12, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x09, 0x32, 0x00,
0x4b, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 };
#define exp_gx_width 13
#define exp_gx_height 12
static unsigned char exp_gx_bitmap[] = {
0x00, 0xfb, 0x00, 0xf6, 0x00, 0xe6, 0x00, 0xf6, 0x80, 0xed, 0x18, 0xe0,
0x36, 0xe0, 0x36, 0xe0, 0x1f, 0xe0, 0x03, 0xe0, 0x13, 0xe0, 0x0e, 0xe0 };
static unsigned char exp_gx_bitmap[] = { 0x00, 0xfb, 0x00, 0xf6, 0x00, 0xe6, 0x00, 0xf6, 0x80, 0xed, 0x18, 0xe0,
0x36, 0xe0, 0x36, 0xe0, 0x1f, 0xe0, 0x03, 0xe0, 0x13, 0xe0, 0x0e, 0xe0 };
#define parens_gx_width 20
#define parens_gx_height 12
static unsigned char parens_gx_bitmap[] = {
0x0c, 0x00, 0x03, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x03, 0x00, 0x0c,
0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c,
0x03, 0x00, 0x0c, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x0c, 0x00, 0x03 };
static unsigned char parens_gx_bitmap[] = { 0x0c, 0x00, 0x03, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x03, 0x00, 0x0c,
0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c,
0x03, 0x00, 0x0c, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x0c, 0x00, 0x03 };
#define hash_gx_width 8
#define hash_gx_height 12
static unsigned char hash_gx_bitmap[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24,
0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 };
static unsigned char hash_gx_bitmap[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24, 0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 };
#define bracket_gx_width 12
#define bracket_gx_height 12
static unsigned char bracket_gx_bitmap[] = {
0x0f, 0x0f, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c,
0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x0f, 0x0f };
static unsigned char bracket_gx_bitmap[] = { 0x0f, 0x0f, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c,
0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x0f, 0x0f };
#define under_gx_width 10
#define under_gx_height 12
static unsigned char under_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03 };
static unsigned char under_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03 };
#define prog_gx_width 24
#define prog_gx_height 12
static unsigned char prog_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x18,
0x8c, 0x81, 0x31, 0xc6, 0x00, 0x63, 0x63, 0x00, 0xc6, 0xc6, 0x00, 0x63,
0x8c, 0x81, 0x31, 0x18, 0xc3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char prog_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x18,
0x8c, 0x81, 0x31, 0xc6, 0x00, 0x63, 0x63, 0x00, 0xc6, 0xc6, 0x00, 0x63,
0x8c, 0x81, 0x31, 0x18, 0xc3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define quote_gx_width 12
#define quote_gx_height 12
static unsigned char quote_gx_bitmap[] = {
0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char quote_gx_bitmap[] = { 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define curly_gx_width 14
#define curly_gx_height 12
static unsigned char curly_gx_bitmap[] = {
0x0c, 0x0c, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x03, 0x30,
0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x0c, 0x0c };
static unsigned char curly_gx_bitmap[] = { 0x0c, 0x0c, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x03, 0x30,
0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x0c, 0x0c };
#define colon_gx_width 8
#define colon_gx_height 12
static unsigned char colon_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3,
0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 };
static unsigned char colon_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 };
#define angle_gx_width 12
#define angle_gx_height 12
static unsigned char angle_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x01,
0xb0, 0x03, 0x18, 0x03, 0x0c, 0x03, 0x06, 0x03, 0xff, 0x0f, 0xff, 0x0f };
static unsigned char angle_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x01,
0xb0, 0x03, 0x18, 0x03, 0x0c, 0x03, 0x06, 0x03, 0xff, 0x0f, 0xff, 0x0f };
#define pi_gx_width 10
#define pi_gx_height 12
static unsigned char pi_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x03, 0xff, 0x01,
0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00 };
static unsigned char pi_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x03, 0xff, 0x01,
0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00 };
#define nl_gx_width 18
#define nl_gx_height 12
static unsigned char nl_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x03, 0xf0, 0x00, 0x03,
0xfc, 0x00, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0xfc, 0x00, 0x00,
0xf0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char nl_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x03, 0xf0, 0x00, 0x03,
0xfc, 0x00, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0xfc, 0x00, 0x00,
0xf0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define comma_gx_width 3
#define comma_gx_height 12
static unsigned char comma_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x07, 0x07, 0x04, 0x04, 0x02 };
static unsigned char comma_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x04, 0x04, 0x02 };
#define arrow_gx_width 18
#define arrow_gx_height 12
static unsigned char arrow_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x3c, 0x00,
0x00, 0xfc, 0x00, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x00,
0x00, 0x3c, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char arrow_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x3c, 0x00,
0x00, 0xfc, 0x00, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x00,
0x00, 0x3c, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define equal_gx_width 8
#define equal_gx_height 12
static unsigned char equal_gx_bitmap[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
0x00, 0xff, 0xff, 0x00, 0x00, 0x00 };
static unsigned char equal_gx_bitmap[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00 };
/*************/
/* functions */

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,19 @@
#include <ctype.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <ncurses.h>
#include "runtime_options.h"
#include "emulator.h"
#include "romio.h"
#include "runtime_options.h"
#include "ui.h"
#include "ui_inner.h"
@ -32,263 +32,176 @@ typedef struct tui_button_t {
short pressed;
int code;
int x;
int y;
unsigned int w;
unsigned int h;
/* int x; */
/* int y; */
/* unsigned int w; */
/* unsigned int h; */
int lc;
const char* label;
short font_size;
unsigned int lw;
unsigned int lh;
unsigned char* lb;
/* int lc; */
/* const char* label; */
/* short font_size; */
/* unsigned int lw; */
/* unsigned int lh; */
/* unsigned char* lb; */
const char* letter;
/* const char* letter; */
const char* left;
short is_menu;
const char* right;
const char* sub;
/* const char* left; */
/* short is_menu; */
/* const char* right; */
/* const char* sub; */
} tui_button_t;
/*************/
/* variables */
/*************/
static tui_ann_struct_t ann_tbl[] = {
{ ANN_LEFT, 16, 4, '<' }, /* '↰' */
{ ANN_RIGHT, 61, 4, '>' }, /* '↱ */
{ ANN_ALPHA, 106, 4, 'a' }, /* 'α' */
{ ANN_BATTERY, 151, 4, 'B' }, /* '🪫' */
{ ANN_BUSY, 196, 4, '*' }, /* '⌛' */
{ ANN_IO, 241, 4, '^' }, /* '☃' */
{ 0 } };
{ANN_LEFT, 16, 4, '<'}, /* '↰' */
{ ANN_RIGHT, 61, 4, '>'}, /* '↱ */
{ ANN_ALPHA, 106, 4, 'a'}, /* 'α' */
{ ANN_BATTERY, 151, 4, 'B'}, /* '🪫' */
{ ANN_BUSY, 196, 4, '*'}, /* '⌛' */
{ ANN_IO, 241, 4, '^'}, /* '☃' */
/* { 0 } */
};
static tui_button_t* buttons = 0;
static tui_button_t buttons_sx[] = {
{ "A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0 },
{ "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0 },
{ "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0 },
{ "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0 },
{ "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0 },
{ "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0 },
{"A", 0, 0x14 },
{ "B", 0, 0x84 },
{ "C", 0, 0x83 },
{ "D", 0, 0x82 },
{ "E", 0, 0x81 },
{ "F", 0, 0x80 },
{ "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "PRINT",
1, 0, 0 },
{ "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", "I/O",
1, 0, 0 },
{ "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I",
"MODES", 1, 0, 0 },
{ "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J",
"MEMORY", 1, 0, 0 },
{ "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height,
up_bitmap, "K", "LIBRARY", 1, 0, 0 },
{ "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV",
0, 0, 0 },
{ "MTH", 0, 0x24 },
{ "PRG", 0, 0x74 },
{ "CST", 0, 0x73 },
{ "VAR", 0, 0x72 },
{ "UP", 0, 0x71 },
{ "NXT", 0, 0x70 },
{ "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width,
colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0 },
{ "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF",
0, "RCL", 0 },
{ "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O",
"aQ", 0, "aNUM", 0 },
{ "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width,
left_height, left_bitmap, "P", "GRAPH", 0, 0, 0 },
{ "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width,
down_height, down_bitmap, "Q", "REVIEW", 0, 0, 0 },
{ "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width,
right_height, right_bitmap, "R", "SWAP", 0, 0, 0 },
{ "COLON", 0, 0x04 },
{ "STO", 0, 0x64 },
{ "EVAL", 0, 0x63 },
{ "LEFT", 0, 0x62 },
{ "DOWN", 0, 0x61 },
{ "RIGHT", 0, 0x60 },
{ "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN",
0, "b", 0 },
{ "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS",
0, "c", 0 },
{ "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U",
"ATAN", 0, "d", 0 },
{ "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width,
sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0 },
{ "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width,
power_height, power_bitmap, "W", "g", 0, "LOG", 0 },
{ "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height,
inv_bitmap, "X", "h", 0, "LN", 0 },
{ "SIN", 0, 0x34 },
{ "COS", 0, 0x54 },
{ "TAN", 0, 0x53 },
{ "SQRT", 0, 0x52 },
{ "POWER", 0, 0x51 },
{ "INV", 0, 0x50 },
{ "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0,
"EQUATION", 0, "MATRIX", 0 },
{ "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height,
neg_bitmap, "Y", "EDIT", 0, "VISIT", 0 },
{ "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "2D",
0, "3D", 0 },
{ "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "PURGE",
0, 0, 0 },
{ "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height,
bs_bitmap, 0, "DROP", 0, "CLR", 0 },
{ "ENTER", 0, 0x44 },
{ "NEG", 0, 0x43 },
{ "EEX", 0, 0x42 },
{ "DEL", 0, 0x41 },
{ "BS", 0, 0x40 },
{ "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width,
alpha_height, alpha_bitmap, 0, "USR", 0, "ENTRY", 0 },
{ "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, "SOLVE", 1,
0, 0 },
{ "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, "PLOT", 1,
0, 0 },
{ "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, "ALGEBRA",
1, 0, 0 },
{ "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height,
div_bitmap, 0, "( )", 0, "#", 0 },
{ "ALPHA", 0, 0x35 },
{ "7", 0, 0x33 },
{ "8", 0, 0x32 },
{ "9", 0, 0x31 },
{ "DIV", 0, 0x30 },
{ "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height,
shl_bitmap, 0, 0, 0, 0, 0 },
{ "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, "TIME", 1, 0,
0 },
{ "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, "STAT", 1,
0, 0 },
{ "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, "UNITS", 1,
0, 0 },
{ "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height,
mul_bitmap, 0, "[ ]", 0, "_", 0 },
{ "SHL", 0, 0x25 },
{ "4", 0, 0x23 },
{ "5", 0, 0x22 },
{ "6", 0, 0x21 },
{ "MUL", 0, 0x20 },
{ "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height,
shr_bitmap, 0, 0, 0, 0, 0 },
{ "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, "RAD", 0,
"POLAR", 0 },
{ "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, "STACK", 0,
"ARG", 0 },
{ "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, "CMD", 0,
"MENU", 0 },
{ "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width,
minus_height, minus_bitmap, 0, "i", 0, "j", 0 },
{ "SHR", 0, 0x15 },
{ "1", 0, 0x13 },
{ "2", 0, 0x12 },
{ "3", 0, 0x11 },
{ "MINUS", 0, 0x10 },
{ "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0,
"OFF", "ATTN" },
{ "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "= ", 0,
" a", 0 },
{ "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, ", ",
0, " k", 0 },
{ "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "l ", 0,
" m", 0 },
{ "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width,
plus_height, plus_bitmap, 0, "{ }", 0, ": :", 0 } };
{ "ON", 0, 0x8000},
{ "0", 0, 0x03 },
{ "PERIOD", 0, 0x02 },
{ "SPC", 0, 0x01 },
{ "PLUS", 0, 0x00 },
/* { 0 } */
};
static tui_button_t buttons_gx[] = {
{ "A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0 },
{ "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0 },
{ "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0 },
{ "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0 },
{ "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0 },
{ "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width,
menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0 },
{"A", 0, 0x14 },
{ "B", 0, 0x84 },
{ "C", 0, 0x83 },
{ "D", 0, 0x82 },
{ "E", 0, 0x81 },
{ "F", 0, 0x80 },
{ "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "RAD", 0,
"POLAR", 0 },
{ "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", 0, 0,
"CHARS", 0 },
{ "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", 0, 0,
"MODES", 0 },
{ "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", 0, 0,
"MEMORY", 0 },
{ "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height,
up_bitmap, "K", 0, 0, "STACK", 0 },
{ "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV",
0, "MENU", 0 },
{ "MTH", 0, 0x24 },
{ "PRG", 0, 0x74 },
{ "CST", 0, 0x73 },
{ "VAR", 0, 0x72 },
{ "UP", 0, 0x71 },
{ "NXT", 0, 0x70 },
{ "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width,
colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0 },
{ "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF",
0, "RCL", 0 },
{ "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O",
"aNUM", 0, "UNDO", 0 },
{ "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width,
left_height, left_bitmap, "P", "PICTURE", 0, 0, 0 },
{ "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width,
down_height, down_bitmap, "Q", "VIEW", 0, 0, 0 },
{ "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width,
right_height, right_bitmap, "R", "SWAP", 0, 0, 0 },
{ "COLON", 0, 0x04 },
{ "STO", 0, 0x64 },
{ "EVAL", 0, 0x63 },
{ "LEFT", 0, 0x62 },
{ "DOWN", 0, 0x61 },
{ "RIGHT", 0, 0x60 },
{ "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN",
0, "b", 0 },
{ "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS",
0, "c", 0 },
{ "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U",
"ATAN", 0, "d", 0 },
{ "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width,
sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0 },
{ "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width,
power_height, power_bitmap, "W", "p", 0, "LOG", 0 },
{ "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height,
inv_bitmap, "X", "q", 0, "LN", 0 },
{ "SIN", 0, 0x34 },
{ "COS", 0, 0x54 },
{ "TAN", 0, 0x53 },
{ "SQRT", 0, 0x52 },
{ "POWER", 0, 0x51 },
{ "INV", 0, 0x50 },
{ "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0,
"EQUATION", 0, "MATRIX", 0 },
{ "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height,
neg_bitmap, "Y", "EDIT", 0, "CMD", 0 },
{ "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z",
"PURG", 0, "ARG", 0 },
{ "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "CLEAR",
0, 0, 0 },
{ "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height,
bs_bitmap, 0, "DROP", 0, 0, 0 },
{ "ENTER", 0, 0x44 },
{ "NEG", 0, 0x43 },
{ "EEX", 0, 0x42 },
{ "DEL", 0, 0x41 },
{ "BS", 0, 0x40 },
{ "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width,
alpha_height, alpha_bitmap, 0, "USER", 0, "ENTRY", 0 },
{ "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, 0, 1,
"SOLVE", 0 },
{ "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, 0, 1,
"PLOT", 0 },
{ "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, 0, 1,
"SYMBOLIC", 0 },
{ "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height,
div_bitmap, 0, "r ", 0, "s", 0 },
{ "ALPHA", 0, 0x35 },
{ "7", 0, 0x33 },
{ "8", 0, 0x32 },
{ "9", 0, 0x31 },
{ "DIV", 0, 0x30 },
{ "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height,
shl_bitmap, 0, 0, 0, 0, 0 },
{ "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, 0, 1, "TIME",
0 },
{ "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, 0, 1,
"STAT", 0 },
{ "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, 0, 1,
"UNITS", 0 },
{ "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height,
mul_bitmap, 0, "t ", 0, "u", 0 },
{ "SHL", 0, 0x25 },
{ "4", 0, 0x23 },
{ "5", 0, 0x22 },
{ "6", 0, 0x21 },
{ "MUL", 0, 0x20 },
{ "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height,
shr_bitmap, 0, 0, 1, " ", 0 },
{ "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, 0, 1, "I/O",
0 },
{ "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, 0, 1,
"LIBRARY", 0 },
{ "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, 0, 1,
"EQ LIB", 0 },
{ "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width,
minus_height, minus_bitmap, 0, "v ", 0, "w", 0 },
{ "SHR", 0, 0x15 },
{ "1", 0, 0x13 },
{ "2", 0, 0x12 },
{ "3", 0, 0x11 },
{ "MINUS", 0, 0x10 },
{ "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0,
"OFF", "CANCEL" },
{ "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "\004 ", 0,
"\003", 0 },
{ "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0,
"\002 ", 0, "\001", 0 },
{ "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "\005 ",
0, "z", 0 },
{ "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width,
plus_height, plus_bitmap, 0, "x ", 0, "y", 0 },
{ 0 } };
{ "ON", 0, 0x8000},
{ "0", 0, 0x03 },
{ "PERIOD", 0, 0x02 },
{ "SPC", 0, 0x01 },
{ "PLUS", 0, 0x00 },
/* { 0 } */
};
/****************************/
/* functions implementation */
/****************************/
static inline void draw_nibble( int c, int r, int val ) {
static int tui_draw_nibble( int x, int y, int val )
{
/* TODO */
return 0;
}
static inline void draw_nibble( int c, int r, int val )
{
int x, y;
x = ( c * 4 ); // x: start in pixels
@ -301,11 +214,12 @@ static inline void draw_nibble( int c, int r, int val ) {
if ( val != lcd_buffer[ r ][ c ] ) {
lcd_buffer[ r ][ c ] = val;
/* TEXTDrawNibble( x, y, val ); */
tui_draw_nibble( x, y, val );
}
}
static inline void draw_row( long addr, int row ) {
static inline void draw_row( long addr, int row )
{
int i, v;
int line_length;
@ -321,7 +235,8 @@ static inline void draw_row( long addr, int row ) {
}
}
static void tui_button_pressed( int b ) {
static void tui_button_pressed( int b )
{
// Check not already pressed (may be important: avoids a useless do_kbd_int)
if ( buttons[ b ].pressed == 1 )
return;
@ -347,7 +262,8 @@ static void tui_button_pressed( int b ) {
}
}
static void tui_button_released( int b ) {
static void tui_button_released( int b )
{
// Check not already released (not critical)
if ( buttons[ b ].pressed == 0 )
return;
@ -365,7 +281,8 @@ static void tui_button_released( int b ) {
}
}
static void tui_button_release_all( void ) {
static void tui_button_release_all( void )
{
for ( int b = FIRST_BUTTON; b <= LAST_BUTTON; b++ )
if ( buttons[ b ].pressed )
tui_button_released( b );
@ -374,7 +291,8 @@ static void tui_button_release_all( void ) {
/**********/
/* public */
/**********/
int text_get_event( void ) {
int text_get_event( void )
{
int hpkey = -1;
/* check for input */
@ -581,7 +499,8 @@ int text_get_event( void ) {
void text_adjust_contrast() {}
void text_init_LCD( void ) {
void text_init_LCD( void )
{
display.on = ( int )( saturn.disp_io & 0x8 ) >> 3;
display.disp_start = ( saturn.disp_addr & 0xffffe );
@ -592,14 +511,11 @@ void text_init_LCD( void ) {
display.lines = 63;
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 ) );
display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) );
display.menu_start = saturn.menu_addr;
display.menu_end = saturn.menu_addr + 0x110;
@ -613,7 +529,8 @@ void text_init_LCD( void ) {
memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) );
}
void text_update_LCD( void ) {
void text_update_LCD( void )
{
int i, j;
long addr;
static int old_offset = -1;
@ -622,17 +539,13 @@ void text_update_LCD( void ) {
if ( display.on ) {
addr = display.disp_start;
if ( display.offset != old_offset ) {
memset( disp_buf, 0xf0,
( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
memset( lcd_buffer, 0xf0,
( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
memset( disp_buf, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
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++ ) {
@ -658,7 +571,8 @@ void text_update_LCD( void ) {
void text_refresh_LCD( void ) {}
void text_disp_draw_nibble( word_20 addr, word_4 val ) {
void text_disp_draw_nibble( word_20 addr, word_4 val )
{
long offset;
int x, y;
@ -684,7 +598,8 @@ void text_disp_draw_nibble( word_20 addr, word_4 val ) {
}
}
void text_menu_draw_nibble( word_20 addr, word_4 val ) {
void text_menu_draw_nibble( word_20 addr, word_4 val )
{
long offset;
int x, y;
@ -697,7 +612,8 @@ void text_menu_draw_nibble( word_20 addr, word_4 val ) {
}
}
void text_draw_annunc( void ) {
void text_draw_annunc( void )
{
int val;
val = display.annunc;
@ -709,13 +625,13 @@ void text_draw_annunc( void ) {
char annuncstate[ 6 ];
for ( int i = 0; ann_tbl[ i ].bit; i++ )
annuncstate[ i ] =
( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0;
annuncstate[ i ] = ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0;
/* TEXTDrawAnnunc( annuncstate ); */
}
void init_text_ui( int argc, char** argv ) {
void init_text_ui( int argc, char** argv )
{
buttons = ( tui_button_t* )malloc( sizeof( buttons_gx ) );
if ( opt_gx )

File diff suppressed because it is too large Load diff