add and use .clang-format

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

18
.clang-format Normal file
View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -43,37 +43,37 @@
#define ann_alpha_width 15
#define ann_alpha_height 12
static unsigned char ann_alpha_bits[] = {
0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00};
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_bits[] = {
0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00};
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_bits[] = {
0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f};
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_bits[] = {
0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00};
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_bits[] = {
0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33};
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_bits[] = {
0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f};
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 */

View file

@ -38,8 +38,8 @@
#include "global.h"
extern char *append_str __ProtoType__((char *buf, char *string));
extern char *append_tab __ProtoType__((char *buf));
extern char *append_tab_16 __ProtoType__((char *buf));
extern char* append_str __ProtoType__( ( char* buf, char* string ) );
extern char* append_tab __ProtoType__( ( char* buf ) );
extern char* append_tab_16 __ProtoType__( ( char* buf ) );
#endif /* !_APPEND_H */

View file

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

View file

@ -45,89 +45,91 @@
#include "global.h"
#include "romio.h"
unsigned char *rom;
unsigned char* rom;
unsigned short rom_crc, crc;
int verbose = 0;
char *progname;
char* progname;
#define calc_crc(n) (crc = ((crc >> 4) ^ (((crc ^ n) & 0xf) * 0x1081)))
#define calc_crc( n ) \
( crc = ( ( crc >> 4 ) ^ ( ( ( crc ^ n ) & 0xf ) * 0x1081 ) ) )
int main(int argc, char **argv) {
unsigned char version[7];
long ver_addr;
int i, a, c, d, d0, d1, D0, D1;
int fail;
int main( int argc, char** argv ) {
unsigned char version[ 7 ];
long ver_addr;
int i, a, c, d, d0, d1, D0, D1;
int fail;
if (argc < 2) {
fprintf(stderr, "usage: %s rom-file\n", argv[0]);
exit(1);
}
if (!read_rom_file(argv[1], &rom, &rom_size)) {
fprintf(stderr, "%s: can\'t read ROM from %s\n", argv[0], argv[1]);
exit(1);
}
if (opt_gx != 0)
ver_addr = 0x7ffbf;
else
ver_addr = 0x7fff0;
for (i = 0; i < 6; i++) {
version[i] = rom[ver_addr + 2 * i + 1] << 4;
version[i] |= rom[ver_addr + 2 * i];
}
version[6] = '\0';
printf("ROM Version is %s\n", version);
for (i = 0x100; i < 0x140; i++) {
rom[i] = 0x0;
}
fail = a = 0;
D0 = 0x00000;
D1 = 0x40000;
for (d = 1; d <= rom_size / 0x80000; d++) {
crc = 0x0000;
rom_crc = 0;
for (i = 0; i < 4; i++) {
rom_crc <<= 4;
rom_crc |= (rom[0x80000 * d - i - 1] & 0x0f);
if ( argc < 2 ) {
fprintf( stderr, "usage: %s rom-file\n", argv[ 0 ] );
exit( 1 );
}
if (opt_gx)
printf("ROM CRC %d reads 0x%.4x\n", d, rom_crc);
if ( !read_rom_file( argv[ 1 ], &rom, &rom_size ) ) {
fprintf( stderr, "%s: can\'t read ROM from %s\n", argv[ 0 ],
argv[ 1 ] );
exit( 1 );
}
if ( opt_gx != 0 )
ver_addr = 0x7ffbf;
else
printf("ROM CRC reads 0x%.4x\n", rom_crc);
ver_addr = 0x7fff0;
d0 = D0;
d1 = D1;
for (c = 0x3fff; c >= 0x0000; c--) {
for (i = 0; i < 16; i++) {
calc_crc(rom[d0 + i]);
}
d0 += 16;
for (i = 0; i < 16; i++) {
calc_crc(rom[d1 + i]);
}
d1 += 16;
for ( i = 0; i < 6; i++ ) {
version[ i ] = rom[ ver_addr + 2 * i + 1 ] << 4;
version[ i ] |= rom[ ver_addr + 2 * i ];
}
D0 += 0x80000;
D1 += 0x80000;
a = crc;
a = ((a | 0xf0000) + 1) & 0xfffff;
version[ 6 ] = '\0';
printf( "ROM Version is %s\n", version );
if (a != 0x00000) {
fail++;
for ( i = 0x100; i < 0x140; i++ ) {
rom[ i ] = 0x0;
}
}
if (fail != 0)
printf("IROM %.4x: ROM CRC test FAILED !!!\n", a & 0xffff);
else
printf("IROM OK: ROM CRC test passed.\n");
fail = a = 0;
D0 = 0x00000;
D1 = 0x40000;
for ( d = 1; d <= rom_size / 0x80000; d++ ) {
return 0;
crc = 0x0000;
rom_crc = 0;
for ( i = 0; i < 4; i++ ) {
rom_crc <<= 4;
rom_crc |= ( rom[ 0x80000 * d - i - 1 ] & 0x0f );
}
if ( opt_gx )
printf( "ROM CRC %d reads 0x%.4x\n", d, rom_crc );
else
printf( "ROM CRC reads 0x%.4x\n", rom_crc );
d0 = D0;
d1 = D1;
for ( c = 0x3fff; c >= 0x0000; c-- ) {
for ( i = 0; i < 16; i++ ) {
calc_crc( rom[ d0 + i ] );
}
d0 += 16;
for ( i = 0; i < 16; i++ ) {
calc_crc( rom[ d1 + i ] );
}
d1 += 16;
}
D0 += 0x80000;
D1 += 0x80000;
a = crc;
a = ( ( a | 0xf0000 ) + 1 ) & 0xfffff;
if ( a != 0x00000 ) {
fail++;
}
}
if ( fail != 0 )
printf( "IROM %.4x: ROM CRC test FAILED !!!\n", a & 0xffff );
else
printf( "IROM OK: ROM CRC test passed.\n" );
return 0;
}

View file

@ -140,10 +140,10 @@
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for `select'. */
#define SELECT_TYPE_ARG234 (fd_set *)
#define SELECT_TYPE_ARG234 ( fd_set* )
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
#define SELECT_TYPE_ARG5 ( struct timeval* )
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for

File diff suppressed because it is too large Load diff

View file

@ -57,10 +57,10 @@ extern int enter_debugger;
extern int in_debugger;
extern int exec_flags;
extern void init_debugger __ProtoType__((void));
extern int debug __ProtoType__((void));
extern int emulate_debug __ProtoType__((void));
extern void init_debugger __ProtoType__( ( void ));
extern int debug __ProtoType__( ( void ));
extern int emulate_debug __ProtoType__( ( void ));
extern char *str_nibbles __ProtoType__((word_20 addr, int n));
extern char* str_nibbles __ProtoType__( ( word_20 addr, int n ) );
#endif /* !_DEBUGGER_H */

View file

@ -63,52 +63,52 @@ extern int device_check;
device_t device;
void check_devices(void) {
if (device.display_touched > 0 && device.display_touched-- == 1) {
device.display_touched = 0;
update_display();
}
if (device.display_touched > 0) {
device_check = 1;
}
if (device.contrast_touched) {
device.contrast_touched = 0;
adjust_contrast(display.contrast);
}
if (device.ann_touched) {
device.ann_touched = 0;
draw_annunc();
}
if (device.baud_touched) {
device.baud_touched = 0;
serial_baud(saturn.baud);
}
if (device.ioc_touched) {
device.ioc_touched = 0;
if ((saturn.io_ctrl & 0x02) && (saturn.rcs & 0x01)) {
do_interupt();
void check_devices( void ) {
if ( device.display_touched > 0 && device.display_touched-- == 1 ) {
device.display_touched = 0;
update_display();
}
if ( device.display_touched > 0 ) {
device_check = 1;
}
if ( device.contrast_touched ) {
device.contrast_touched = 0;
adjust_contrast( display.contrast );
}
if ( device.ann_touched ) {
device.ann_touched = 0;
draw_annunc();
}
if ( device.baud_touched ) {
device.baud_touched = 0;
serial_baud( saturn.baud );
}
if ( device.ioc_touched ) {
device.ioc_touched = 0;
if ( ( saturn.io_ctrl & 0x02 ) && ( saturn.rcs & 0x01 ) ) {
do_interupt();
}
}
if ( device.rbr_touched ) {
device.rbr_touched = 0;
receive_char();
}
if ( device.tbr_touched ) {
device.tbr_touched = 0;
transmit_char();
}
if ( device.t1_touched ) {
saturn.t1_instr = 0;
sched_timer1 = saturn.t1_tick;
restart_timer( T1_TIMER );
set_t1 = saturn.timer1;
device.t1_touched = 0;
}
if ( device.t2_touched ) {
saturn.t2_instr = 0;
sched_timer2 = saturn.t2_tick;
device.t2_touched = 0;
}
}
if (device.rbr_touched) {
device.rbr_touched = 0;
receive_char();
}
if (device.tbr_touched) {
device.tbr_touched = 0;
transmit_char();
}
if (device.t1_touched) {
saturn.t1_instr = 0;
sched_timer1 = saturn.t1_tick;
restart_timer(T1_TIMER);
set_t1 = saturn.timer1;
device.t1_touched = 0;
}
if (device.t2_touched) {
saturn.t2_instr = 0;
sched_timer2 = saturn.t2_tick;
device.t2_touched = 0;
}
#if 0
if (device.disp_test_touched) {
device.disp_test_touched = 0;

View file

@ -64,69 +64,69 @@
typedef struct device_t {
int display_touched;
int display_touched;
char contrast_touched;
char contrast_touched;
char disp_test_touched;
char disp_test_touched;
char crc_touched;
char crc_touched;
char power_status_touched;
char power_ctrl_touched;
char power_status_touched;
char power_ctrl_touched;
char mode_touched;
char mode_touched;
char ann_touched;
char ann_touched;
char baud_touched;
char baud_touched;
char card_ctrl_touched;
char card_status_touched;
char card_ctrl_touched;
char card_status_touched;
char ioc_touched;
char ioc_touched;
char tcs_touched;
char rcs_touched;
char tcs_touched;
char rcs_touched;
char rbr_touched;
char tbr_touched;
char rbr_touched;
char tbr_touched;
char sreq_touched;
char sreq_touched;
char ir_ctrl_touched;
char ir_ctrl_touched;
char base_off_touched;
char base_off_touched;
char lcr_touched;
char lbr_touched;
char lcr_touched;
char lbr_touched;
char scratch_touched;
char base_nibble_touched;
char scratch_touched;
char base_nibble_touched;
char unknown_touched;
char unknown_touched;
char t1_ctrl_touched;
char t2_ctrl_touched;
char t1_ctrl_touched;
char t2_ctrl_touched;
char unknown2_touched;
char unknown2_touched;
char t1_touched;
char t2_touched;
char t1_touched;
char t2_touched;
} device_t;
extern device_t device;
extern void check_devices __ProtoType__((void));
extern void check_devices __ProtoType__( ( void ));
#if 0
extern void check_out_register __ProtoType__((void));
#endif
extern void update_display __ProtoType__((void));
extern void redraw_display __ProtoType__((void));
extern void disp_draw_nibble __ProtoType__((word_20 addr, word_4 val));
extern void menu_draw_nibble __ProtoType__((word_20 addr, word_4 val));
extern void draw_annunc __ProtoType__((void));
extern void redraw_annunc __ProtoType__((void));
extern void update_display __ProtoType__( ( void ));
extern void redraw_display __ProtoType__( ( void ));
extern void disp_draw_nibble __ProtoType__( ( word_20 addr, word_4 val ) );
extern void menu_draw_nibble __ProtoType__( ( word_20 addr, word_4 val ) );
extern void draw_annunc __ProtoType__( ( void ));
extern void redraw_annunc __ProtoType__( ( void ));
#endif /* !_DEVICE_H */

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,12 @@
#include "global.h"
#include "hp48.h"
#define HP_MNEMONICS 0
#define CLASS_MNEMONICS 1
#define HP_MNEMONICS 0
#define CLASS_MNEMONICS 1
extern int disassembler_mode;
extern char *mode_name[];
extern char* mode_name[];
extern word_20 disassemble __ProtoType__((word_20 addr, char *out));
extern word_20 disassemble __ProtoType__( ( word_20 addr, char* out ) );
#endif /* !_DISASM_H */

View file

@ -53,143 +53,148 @@
#include <unistd.h>
#include <fcntl.h>
unsigned char *core;
unsigned char* core;
#define DEFAULT_ROM_FILE "rom.dump"
int write_mem_file(char *name, unsigned char *mem, int size) {
FILE *fp;
unsigned char *tmp_mem;
unsigned char byte;
int i, j;
int write_mem_file( char* name, unsigned char* mem, int size ) {
FILE* fp;
unsigned char* tmp_mem;
unsigned char byte;
int i, j;
if (NULL == (fp = fopen(name, "w"))) {
fprintf(stderr, "can\'t open %s\n", name);
return 0;
}
if (NULL == (tmp_mem = (unsigned char *)malloc((size_t)size / 2))) {
for (i = 0, j = 0; i < size / 2; i++) {
byte = (mem[j++] & 0x0f);
byte |= (mem[j++] << 4) & 0xf0;
if (1 != fwrite(&byte, 1, 1, fp)) {
fprintf(stderr, "can\'t write %s\n", name);
fclose(fp);
if ( NULL == ( fp = fopen( name, "w" ) ) ) {
fprintf( stderr, "can\'t open %s\n", name );
return 0;
}
}
} else {
for (i = 0, j = 0; i < size / 2; i++) {
tmp_mem[i] = (mem[j++] & 0x0f);
tmp_mem[i] |= (mem[j++] << 4) & 0xf0;
}
if (fwrite(tmp_mem, 1, (size_t)size / 2, fp) != size / 2) {
fprintf(stderr, "can\'t write %s\n", name);
fclose(fp);
free(tmp_mem);
return 0;
if ( NULL ==
( tmp_mem = ( unsigned char* )malloc( ( size_t )size / 2 ) ) ) {
for ( i = 0, j = 0; i < size / 2; i++ ) {
byte = ( mem[ j++ ] & 0x0f );
byte |= ( mem[ j++ ] << 4 ) & 0xf0;
if ( 1 != fwrite( &byte, 1, 1, fp ) ) {
fprintf( stderr, "can\'t write %s\n", name );
fclose( fp );
return 0;
}
}
} else {
for ( i = 0, j = 0; i < size / 2; i++ ) {
tmp_mem[ i ] = ( mem[ j++ ] & 0x0f );
tmp_mem[ i ] |= ( mem[ j++ ] << 4 ) & 0xf0;
}
if ( fwrite( tmp_mem, 1, ( size_t )size / 2, fp ) != size / 2 ) {
fprintf( stderr, "can\'t write %s\n", name );
fclose( fp );
free( tmp_mem );
return 0;
}
free( tmp_mem );
}
free(tmp_mem);
}
fclose(fp);
return 1;
fclose( fp );
return 1;
}
int main(int argc, char **argv) {
FILE *dump;
long addr, size;
int ch, i, gx, error;
int main( int argc, char** argv ) {
FILE* dump;
long addr, size;
int ch, i, gx, error;
if (argc < 2) {
fprintf(stderr, "usage: %s hp48-dump-file\n", argv[0]);
exit(1);
}
if ((dump = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "%s: can\'t open %s\n", argv[0], argv[1]);
exit(1);
}
if ((core = (unsigned char *)malloc(0x100000)) == NULL) {
fprintf(stderr, "%s: can\'t malloc %d bytes\n", argv[0], 0x100000);
exit(1);
}
memset(core, 0, 0x100000);
gx = 0;
error = 0;
while (1) {
addr = 0;
for (i = 0; i < 5; i++) {
addr <<= 4;
if ((ch = fgetc(dump)) < 0) {
error = 1;
break;
}
if (ch >= '0' && ch <= '9') {
addr |= ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
addr |= ch - 'A' + 10;
} else {
fprintf(stderr, "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
error = 1;
break;
}
if ( argc < 2 ) {
fprintf( stderr, "usage: %s hp48-dump-file\n", argv[ 0 ] );
exit( 1 );
}
if (error)
break;
if (addr >= 0x80000)
gx = 1;
if ((ch = fgetc(dump)) < 0) {
fprintf(stderr, "%s: Unexpected EOF at %lx\n", argv[0], addr);
break;
}
if (ch != ':') {
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);
error = 1;
break;
}
if (ch >= '0' && ch <= '9') {
core[addr++] = ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
core[addr++] = ch - 'A' + 10;
} else {
fprintf(stderr, "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
error = 1;
break;
}
}
if (error)
break;
if ((ch = fgetc(dump)) < 0)
break;
if (ch != '\n') {
fprintf(stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n", argv[0],
ch, addr);
break;
}
}
if (!gx)
if (core[0x29] == 0x0)
gx = 1;
if (gx)
size = 0x100000;
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);
exit(1);
}
if ( ( dump = fopen( argv[ 1 ], "r" ) ) == NULL ) {
fprintf( stderr, "%s: can\'t open %s\n", argv[ 0 ], argv[ 1 ] );
exit( 1 );
}
exit(0);
if ( ( core = ( unsigned char* )malloc( 0x100000 ) ) == NULL ) {
fprintf( stderr, "%s: can\'t malloc %d bytes\n", argv[ 0 ], 0x100000 );
exit( 1 );
}
memset( core, 0, 0x100000 );
gx = 0;
error = 0;
while ( 1 ) {
addr = 0;
for ( i = 0; i < 5; i++ ) {
addr <<= 4;
if ( ( ch = fgetc( dump ) ) < 0 ) {
error = 1;
break;
}
if ( ch >= '0' && ch <= '9' ) {
addr |= ch - '0';
} else if ( ch >= 'A' && ch <= 'F' ) {
addr |= ch - 'A' + 10;
} else {
fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch,
addr );
error = 1;
break;
}
}
if ( error )
break;
if ( addr >= 0x80000 )
gx = 1;
if ( ( ch = fgetc( dump ) ) < 0 ) {
fprintf( stderr, "%s: Unexpected EOF at %lx\n", argv[ 0 ], addr );
break;
}
if ( ch != ':' ) {
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 );
error = 1;
break;
}
if ( ch >= '0' && ch <= '9' ) {
core[ addr++ ] = ch - '0';
} else if ( ch >= 'A' && ch <= 'F' ) {
core[ addr++ ] = ch - 'A' + 10;
} else {
fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch,
addr );
error = 1;
break;
}
}
if ( error )
break;
if ( ( ch = fgetc( dump ) ) < 0 )
break;
if ( ch != '\n' ) {
fprintf( stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n",
argv[ 0 ], ch, addr );
break;
}
}
if ( !gx )
if ( core[ 0x29 ] == 0x0 )
gx = 1;
if ( gx )
size = 0x100000;
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 );
exit( 1 );
}
exit( 0 );
}

File diff suppressed because it is too large Load diff

View file

@ -31,26 +31,26 @@
#include "global.h"
#include "resources.h"
char errbuf[1024] = {
char errbuf[ 1024 ] = {
0,
};
char fixbuf[1024] = {
char fixbuf[ 1024 ] = {
0,
};
void fatal_exit(void) {
if (quiet)
exit(1);
void fatal_exit( void ) {
if ( quiet )
exit( 1 );
if (errbuf[0] == '\0') {
fprintf(stderr, "%s: FATAL ERROR, exit.\n", progname);
exit(1);
}
if ( errbuf[ 0 ] == '\0' ) {
fprintf( stderr, "%s: FATAL ERROR, exit.\n", progname );
exit( 1 );
}
fprintf(stderr, "%s: FATAL ERROR, exit.\n - %s\n", progname, errbuf);
fprintf( stderr, "%s: FATAL ERROR, exit.\n - %s\n", progname, errbuf );
if (fixbuf[0] != '\0')
fprintf(stderr, " - %s\n", fixbuf);
if ( fixbuf[ 0 ] != '\0' )
fprintf( stderr, " - %s\n", fixbuf );
exit(1);
exit( 1 );
}

View file

@ -29,9 +29,9 @@
#include "global.h"
extern char errbuf[1024];
extern char fixbuf[1024];
extern char errbuf[ 1024 ];
extern char fixbuf[ 1024 ];
extern void fatal_exit __ProtoType__((void));
extern void fatal_exit __ProtoType__( ( void ));
#endif /* !_ERRORS_H */

View file

@ -45,11 +45,11 @@
#include "config.h"
#define __ProtoType__(x) x
#define __ProtoType__( x ) x
#if !defined(__GNUC__) || defined(__STRICT_ANSI__)
#if !defined( __GNUC__ ) || defined( __STRICT_ANSI__ )
#define inline
#if !defined(__STDC__)
#if !defined( __STDC__ )
#define const
#endif
#endif
@ -57,7 +57,7 @@
/*
* If we are running Linux, `linux' will be defined by gcc.
*/
#if defined(linux)
#if defined( linux )
#ifndef LINUX
#define LINUX 1
@ -67,9 +67,9 @@
#else /* Not Linux */
#if defined(sun) && defined(unix)
#if defined( sun ) && defined( unix )
#if defined(__svr4__) || defined(SVR4) || defined(SYSV)
#if defined( __svr4__ ) || defined( SVR4 ) || defined( SYSV )
#ifndef SOLARIS
#define SOLARIS 1
@ -79,7 +79,7 @@
#else /* Not Solaris */
#if defined(hpux)
#if defined( hpux )
#ifndef HPUX
#define HPUX 1
@ -108,28 +108,28 @@
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
extern int printf __ProtoType__((char *, ...));
extern int fprintf __ProtoType__((FILE *, char *, ...));
extern int sscanf __ProtoType__((char *, char *, ...));
extern void fflush __ProtoType__((FILE *));
extern int fseek __ProtoType__((FILE *, long, int));
extern int fread __ProtoType__((void *, int, int, FILE *));
extern int fwrite __ProtoType__((void *, int, int, FILE *));
extern void fclose __ProtoType__((FILE *));
extern int fgetc __ProtoType__((FILE *));
extern void bzero __ProtoType__((void *, int));
extern time_t time __ProtoType__((time_t *));
extern int select __ProtoType__((int, fd_set *, fd_set *, fd_set *,
struct timeval *));
extern int setitimer __ProtoType__((int, struct itimerval *,
struct itimerval *));
extern int gethostname __ProtoType__((char *, int));
extern int printf __ProtoType__( ( char*, ... ) );
extern int fprintf __ProtoType__( ( FILE*, char*, ... ) );
extern int sscanf __ProtoType__( ( char*, char*, ... ) );
extern void fflush __ProtoType__( ( FILE* ));
extern int fseek __ProtoType__( ( FILE*, long, int ));
extern int fread __ProtoType__( ( void*, int, int, FILE* ));
extern int fwrite __ProtoType__( ( void*, int, int, FILE* ));
extern void fclose __ProtoType__( ( FILE* ));
extern int fgetc __ProtoType__( ( FILE* ));
extern void bzero __ProtoType__( ( void*, int ));
extern time_t time __ProtoType__( ( time_t* ));
extern int select __ProtoType__( ( int, fd_set*, fd_set*, fd_set*,
struct timeval* ));
extern int setitimer __ProtoType__( ( int, struct itimerval*,
struct itimerval* ));
extern int gethostname __ProtoType__( ( char*, int ));
#ifdef HAVE_XSHM
#include <sys/ipc.h>
#include <sys/shm.h>
extern int shmget __ProtoType__((key_t, int, int));
extern int shmat __ProtoType__((int, void *, int));
extern int shmctl __ProtoType__((int, int, struct shmid_ds *));
extern int shmget __ProtoType__( ( key_t, int, int ));
extern int shmat __ProtoType__( ( int, void*, int ));
extern int shmctl __ProtoType__( ( int, int, struct shmid_ds* ));
#endif
#endif

166
src/hp.h
View file

@ -43,118 +43,118 @@
#define hp_width 96
#define hp_height 24
static unsigned char hp_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 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_bits[] = {
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};
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_bits[] = {
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_bits[] = {
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_bits[] = {
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_bits[] = {
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_bits[] = {
0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff,
0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00,
0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03,
0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00,
0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03};
0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff,
0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03,
0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00,
0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03 };
#endif /* !_HP_H */

View file

@ -107,143 +107,143 @@ typedef long word_32;
typedef int64_t word_64;
#else
typedef struct word_64 {
unsigned long hi, lo;
unsigned long hi, lo;
} word_64;
#endif
typedef struct keystate_t {
short rows[9];
short rows[ 9 ];
} keystate_t;
typedef struct display_t {
int on;
int on;
long disp_start;
long disp_end;
long disp_start;
long disp_end;
int offset;
int lines;
int nibs_per_line;
int offset;
int lines;
int nibs_per_line;
int contrast;
int contrast;
long menu_start;
long menu_end;
long menu_start;
long menu_end;
int annunc;
int annunc;
} display_t;
typedef struct mem_cntl_t {
unsigned short unconfigured;
word_20 config[2];
unsigned short unconfigured;
word_20 config[ 2 ];
} mem_cntl_t;
typedef struct saturn_t {
unsigned long magic;
char version[4];
unsigned long magic;
char version[ 4 ];
unsigned char A[16], B[16], C[16], D[16];
unsigned char A[ 16 ], B[ 16 ], C[ 16 ], D[ 16 ];
word_20 d[2];
word_20 d[ 2 ];
#define D0 d[0]
#define D1 d[1]
#define D0 d[ 0 ]
#define D1 d[ 1 ]
word_4 P;
word_20 PC;
word_4 P;
word_20 PC;
unsigned char R0[16], R1[16], R2[16], R3[16], R4[16];
unsigned char IN[4];
unsigned char OUT[3];
unsigned char R0[ 16 ], R1[ 16 ], R2[ 16 ], R3[ 16 ], R4[ 16 ];
unsigned char IN[ 4 ];
unsigned char OUT[ 3 ];
word_1 CARRY;
word_1 CARRY;
unsigned char PSTAT[NR_PSTAT];
unsigned char XM, SB, SR, MP;
unsigned char PSTAT[ NR_PSTAT ];
unsigned char XM, SB, SR, MP;
word_4 hexmode;
word_4 hexmode;
word_20 rstk[NR_RSTK];
short rstkp;
word_20 rstk[ NR_RSTK ];
short rstkp;
keystate_t keybuf;
keystate_t keybuf;
unsigned char intenable;
unsigned char int_pending;
unsigned char kbd_ien;
unsigned char intenable;
unsigned char int_pending;
unsigned char kbd_ien;
word_4 disp_io;
word_4 disp_io;
word_4 contrast_ctrl;
word_8 disp_test;
word_4 contrast_ctrl;
word_8 disp_test;
word_16 crc;
word_16 crc;
word_4 power_status;
word_4 power_ctrl;
word_4 power_status;
word_4 power_ctrl;
word_4 mode;
word_4 mode;
word_8 annunc;
word_8 annunc;
word_4 baud;
word_4 baud;
word_4 card_ctrl;
word_4 card_status;
word_4 card_ctrl;
word_4 card_status;
word_4 io_ctrl;
word_4 rcs;
word_4 tcs;
word_4 io_ctrl;
word_4 rcs;
word_4 tcs;
word_8 rbr;
word_8 tbr;
word_8 rbr;
word_8 tbr;
word_8 sreq;
word_8 sreq;
word_4 ir_ctrl;
word_4 ir_ctrl;
word_4 base_off;
word_4 base_off;
word_4 lcr;
word_4 lbr;
word_4 lcr;
word_4 lbr;
word_4 scratch;
word_4 scratch;
word_4 base_nibble;
word_4 base_nibble;
word_20 disp_addr;
word_12 line_offset;
word_8 line_count;
word_20 disp_addr;
word_12 line_offset;
word_8 line_count;
word_16 unknown;
word_16 unknown;
word_4 t1_ctrl;
word_4 t2_ctrl;
word_4 t1_ctrl;
word_4 t2_ctrl;
word_20 menu_addr;
word_20 menu_addr;
word_8 unknown2;
word_8 unknown2;
char timer1; /* may NOT be unsigned !!! */
word_32 timer2;
char timer1; /* may NOT be unsigned !!! */
word_32 timer2;
long t1_instr;
long t2_instr;
long t1_instr;
long t2_instr;
short t1_tick;
short t2_tick;
long i_per_s;
short t1_tick;
short t2_tick;
long i_per_s;
short bank_switch;
mem_cntl_t mem_cntl[NR_MCTL];
short bank_switch;
mem_cntl_t mem_cntl[ NR_MCTL ];
unsigned char *rom;
unsigned char *ram;
unsigned char *port1;
unsigned char *port2;
unsigned char* rom;
unsigned char* ram;
unsigned char* port1;
unsigned char* port2;
} saturn_t;
@ -260,33 +260,33 @@ extern long sched_adjtime;
extern long schedule_event;
extern display_t display;
extern void init_display __ProtoType__((void));
extern void init_display __ProtoType__( ( void ));
extern saturn_t saturn;
extern int exit_emulator __ProtoType__((void));
extern int init_emulator __ProtoType__((void));
extern void init_active_stuff __ProtoType__((void));
extern int exit_emulator __ProtoType__( ( void ));
extern int init_emulator __ProtoType__( ( void ));
extern void init_active_stuff __ProtoType__( ( void ));
extern int serial_init __ProtoType__((void));
extern void serial_baud __ProtoType__((int baud));
extern void transmit_char __ProtoType__((void));
extern void receive_char __ProtoType__((void));
extern int serial_init __ProtoType__( ( void ));
extern void serial_baud __ProtoType__( ( int baud ) );
extern void transmit_char __ProtoType__( ( void ));
extern void receive_char __ProtoType__( ( void ));
extern void do_kbd_int __ProtoType__((void));
extern void do_interupt __ProtoType__((void));
extern void do_kbd_int __ProtoType__( ( void ));
extern void do_interupt __ProtoType__( ( void ));
extern void(*write_nibble) __ProtoType__((long addr, int val));
extern int(*read_nibble) __ProtoType__((long addr));
extern int(*read_nibble_crc) __ProtoType__((long addr));
extern void( *write_nibble ) __ProtoType__( ( long addr, int val ) );
extern int( *read_nibble ) __ProtoType__( ( long addr ) );
extern int( *read_nibble_crc ) __ProtoType__( ( long addr ) );
extern int emulate __ProtoType__((void));
extern int step_instruction __ProtoType__((void));
extern void schedule __ProtoType__((void));
extern int emulate __ProtoType__( ( void ));
extern int step_instruction __ProtoType__( ( void ));
extern void schedule __ProtoType__( ( void ));
extern int read_rom __ProtoType__((const char *fname));
extern int read_files __ProtoType__((void));
extern int write_files __ProtoType__((void));
extern int read_rom __ProtoType__( ( const char* fname ) );
extern int read_files __ProtoType__( ( void ));
extern int write_files __ProtoType__( ( void ));
extern void load_addr __ProtoType__((word_20 * dat, long addr, int n));
extern void load_addr __ProtoType__( ( word_20 * dat, long addr, int n ) );
#endif /* !_HP48_H */

View file

@ -64,123 +64,132 @@
#include <X11/Xlib.h>
#include "hp48.h"
extern Display *dpy;
extern Display* dpy;
extern Window dispW;
extern GC gc;
extern void push_return_addr __ProtoType__((long addr));
extern long pop_return_addr __ProtoType__((void));
extern void push_return_addr __ProtoType__( ( long addr ) );
extern long pop_return_addr __ProtoType__( ( void ));
extern void init_annunc __ProtoType__((void));
extern void init_annunc __ProtoType__( ( void ));
extern void init_saturn __ProtoType__((void));
extern void init_saturn __ProtoType__( ( void ));
extern void check_timer __ProtoType__((void));
extern void check_timer __ProtoType__( ( void ));
extern void register_to_status __ProtoType__((unsigned char *r));
extern void status_to_register __ProtoType__((unsigned char *r));
extern void swap_register_status __ProtoType__((unsigned char *r));
extern void clear_status __ProtoType__((void));
extern void register_to_status __ProtoType__( ( unsigned char* r ) );
extern void status_to_register __ProtoType__( ( unsigned char* r ) );
extern void swap_register_status __ProtoType__( ( unsigned char* r ) );
extern void clear_status __ProtoType__( ( void ));
extern long read_nibbles __ProtoType__((long addr, int len));
extern void write_nibbles __ProtoType__((long addr, long val, int len));
extern void dev_memory_init __ProtoType__((void));
extern long read_nibbles __ProtoType__( ( long addr, int len ) );
extern void write_nibbles __ProtoType__( ( long addr, long val, int len ) );
extern void dev_memory_init __ProtoType__( ( void ));
extern void set_program_stat __ProtoType__((int n));
extern void clear_program_stat __ProtoType__((int n));
extern int get_program_stat __ProtoType__((int n));
extern void set_program_stat __ProtoType__( ( int n ) );
extern void clear_program_stat __ProtoType__( ( int n ) );
extern int get_program_stat __ProtoType__( ( int n ) );
extern void set_hardware_stat __ProtoType__((int op));
extern void clear_hardware_stat __ProtoType__((int op));
extern int is_zero_hardware_stat __ProtoType__((int op));
extern void set_hardware_stat __ProtoType__( ( int op ) );
extern void clear_hardware_stat __ProtoType__( ( int op ) );
extern int is_zero_hardware_stat __ProtoType__( ( int op ) );
extern void set_register_bit __ProtoType__((unsigned char *reg, int n));
extern void clear_register_bit __ProtoType__((unsigned char *reg, int n));
extern int get_register_bit __ProtoType__((unsigned char *reg, int n));
extern void set_register_bit __ProtoType__( ( unsigned char* reg, int n ) );
extern void clear_register_bit __ProtoType__( ( unsigned char* reg, int n ) );
extern int get_register_bit __ProtoType__( ( unsigned char* reg, int n ) );
extern void set_register_nibble __ProtoType__((unsigned char *reg, int n,
unsigned char val));
extern unsigned char get_register_nibble __ProtoType__((unsigned char *reg,
int n));
extern void set_register_nibble __ProtoType__( ( unsigned char* reg, int n,
unsigned char val ) );
extern unsigned char get_register_nibble __ProtoType__( ( unsigned char* reg,
int n ) );
extern void register_to_address __ProtoType__((unsigned char *reg, word_20 *dat,
int s));
extern void address_to_register __ProtoType__((word_20 dat, unsigned char *reg,
int s));
extern void add_address __ProtoType__((word_20 * dat, int add));
extern void register_to_address __ProtoType__( ( unsigned char* reg,
word_20* dat, int s ) );
extern void address_to_register __ProtoType__( ( word_20 dat,
unsigned char* reg, int s ) );
extern void add_address __ProtoType__( ( word_20 * dat, int add ) );
extern char *make_hexstr __ProtoType__((long addr, int n));
extern void load_constant __ProtoType__((unsigned char *reg, int n, long addr));
extern void load_address __ProtoType__((unsigned char *reg, long addr, int n));
extern char* make_hexstr __ProtoType__( ( long addr, int n ) );
extern void load_constant __ProtoType__( ( unsigned char* reg, int n,
long addr ) );
extern void load_address __ProtoType__( ( unsigned char* reg, long addr,
int n ) );
extern void store __ProtoType__((word_20 dat, unsigned char *reg, int code));
extern void store_n __ProtoType__((word_20 dat, unsigned char *reg, int n));
extern void recall __ProtoType__((unsigned char *reg, word_20 dat, int code));
extern void recall_n __ProtoType__((unsigned char *reg, word_20 dat, int n));
extern void store __ProtoType__( ( word_20 dat, unsigned char* reg,
int code ) );
extern void store_n __ProtoType__( ( word_20 dat, unsigned char* reg, int n ) );
extern void recall __ProtoType__( ( unsigned char* reg, word_20 dat,
int code ) );
extern void recall_n __ProtoType__( ( unsigned char* reg, word_20 dat,
int n ) );
extern long dat_to_addr __ProtoType__((unsigned char *dat));
extern void addr_to_dat __ProtoType__((long addr, unsigned char *dat));
extern long dat_to_addr __ProtoType__( ( unsigned char* dat ) );
extern void addr_to_dat __ProtoType__( ( long addr, unsigned char* dat ) );
extern void do_in __ProtoType__((void));
extern void do_reset __ProtoType__((void));
extern void do_configure __ProtoType__((void));
extern void do_unconfigure __ProtoType__((void));
extern void do_inton __ProtoType__((void));
extern void do_intoff __ProtoType__((void));
extern void do_return_interupt __ProtoType__((void));
extern void do_reset_interrupt_system __ProtoType__((void));
extern void do_shutdown __ProtoType__((void));
extern int get_identification __ProtoType__((void));
extern void do_in __ProtoType__( ( void ));
extern void do_reset __ProtoType__( ( void ));
extern void do_configure __ProtoType__( ( void ));
extern void do_unconfigure __ProtoType__( ( void ));
extern void do_inton __ProtoType__( ( void ));
extern void do_intoff __ProtoType__( ( void ));
extern void do_return_interupt __ProtoType__( ( void ));
extern void do_reset_interrupt_system __ProtoType__( ( void ));
extern void do_shutdown __ProtoType__( ( void ));
extern int get_identification __ProtoType__( ( void ));
extern void add_p_plus_one __ProtoType__((unsigned char *r));
extern void add_register_constant __ProtoType__((unsigned char *res, int code,
int val));
extern void sub_register_constant __ProtoType__((unsigned char *res, int code,
int val));
extern void add_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char *r2, int code));
extern void sub_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char *r2, int code));
extern void complement_2_register __ProtoType__((unsigned char *r, int code));
extern void complement_1_register __ProtoType__((unsigned char *r, int code));
extern void inc_register __ProtoType__((unsigned char *r, int code));
extern void dec_register __ProtoType__((unsigned char *r, int code));
extern void zero_register __ProtoType__((unsigned char *r, int code));
extern void or_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char *r2, int code));
extern void and_register __ProtoType__((unsigned char *res, unsigned char *r1,
unsigned char *r2, int code));
extern void copy_register __ProtoType__((unsigned char *to, unsigned char *from,
int code));
extern void exchange_register __ProtoType__((unsigned char *r1,
unsigned char *r2, int code));
extern void add_p_plus_one __ProtoType__( ( unsigned char* r ) );
extern void add_register_constant __ProtoType__( ( unsigned char* res, int code,
int val ) );
extern void sub_register_constant __ProtoType__( ( unsigned char* res, int code,
int val ) );
extern void add_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void sub_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void complement_2_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void complement_1_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void inc_register __ProtoType__( ( unsigned char* r, int code ) );
extern void dec_register __ProtoType__( ( unsigned char* r, int code ) );
extern void zero_register __ProtoType__( ( unsigned char* r, int code ) );
extern void or_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void and_register __ProtoType__( ( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ) );
extern void copy_register __ProtoType__( ( unsigned char* to,
unsigned char* from, int code ) );
extern void exchange_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern void exchange_reg __ProtoType__((unsigned char *r, word_20 *d,
int code));
extern void exchange_reg __ProtoType__( ( unsigned char* r, word_20* d,
int code ) );
extern void shift_left_register __ProtoType__((unsigned char *r, int code));
extern void shift_left_circ_register __ProtoType__((unsigned char *r,
int code));
extern void shift_right_register __ProtoType__((unsigned char *r, int code));
extern void shift_right_circ_register __ProtoType__((unsigned char *r,
int code));
extern void shift_right_bit_register __ProtoType__((unsigned char *r,
int code));
extern int is_zero_register __ProtoType__((unsigned char *r, int code));
extern int is_not_zero_register __ProtoType__((unsigned char *r, int code));
extern int is_equal_register __ProtoType__((unsigned char *r1,
unsigned char *r2, int code));
extern int is_not_equal_register __ProtoType__((unsigned char *r1,
unsigned char *r2, int code));
extern int is_less_register __ProtoType__((unsigned char *r1, unsigned char *r2,
int code));
extern int is_less_or_equal_register __ProtoType__((unsigned char *r1,
unsigned char *r2,
int code));
extern int is_greater_register __ProtoType__((unsigned char *r1,
unsigned char *r2, int code));
extern int is_greater_or_equal_register __ProtoType__((unsigned char *r1,
unsigned char *r2,
int code));
extern void shift_left_register __ProtoType__( ( unsigned char* r, int code ) );
extern void shift_left_circ_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_circ_register __ProtoType__( ( unsigned char* r,
int code ) );
extern void shift_right_bit_register __ProtoType__( ( unsigned char* r,
int code ) );
extern int is_zero_register __ProtoType__( ( unsigned char* r, int code ) );
extern int is_not_zero_register __ProtoType__( ( unsigned char* r, int code ) );
extern int is_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern int is_not_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2,
int code ) );
extern int is_less_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern int is_less_or_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2,
int code ) );
extern int is_greater_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2, int code ) );
extern int is_greater_or_equal_register __ProtoType__( ( unsigned char* r1,
unsigned char* r2,
int code ) );
#endif /* !_HP48_EMU_H */

View file

@ -37,78 +37,78 @@
#define _HP48CHAR_H 1
typedef struct trans_tbl_t {
unsigned char hp48_char;
char *trans;
unsigned char hp48_char;
char* trans;
} trans_tbl_t;
#ifndef DEFINE_TRANS_TABLE
extern trans_tbl_t hp48_trans_tbl[256];
extern trans_tbl_t hp48_trans_tbl[ 256 ];
#else
trans_tbl_t hp48_trans_tbl[256] = {
{0, "\\0"}, {1, "\\001"}, {2, "\\002"}, {3, "\\003"},
{4, "\\004"}, {5, "\\005"}, {6, "\\006"}, {7, "\\007"},
{8, "\\b"}, {9, "\\t"}, {10, "\\n"}, {11, "\\011"},
{12, "\\f"}, {13, "\\r"}, {14, "\\014"}, {15, "\\015"},
{16, "\\016"}, {17, "\\017"}, {18, "\\018"}, {19, "\\019"},
{20, "\\020"}, {21, "\\021"}, {22, "\\022"}, {23, "\\023"},
{24, "\\024"}, {25, "\\025"}, {26, "\\026"}, {27, "\\027"},
{28, "\\028"}, {29, "\\029"}, {30, "\\030"}, {31, "\\031"},
{' ', 0}, {'!', 0}, {'"', 0}, {'#', 0},
{'$', 0}, {'%', 0}, {'&', 0}, {'\'', 0},
{'(', 0}, {')', 0}, {'*', 0}, {'+', 0},
{',', 0}, {'-', 0}, {'.', 0}, {'/', 0},
{'0', 0}, {'1', 0}, {'2', 0}, {'3', 0},
{'4', 0}, {'5', 0}, {'6', 0}, {'7', 0},
{'8', 0}, {'9', 0}, {':', 0}, {';', 0},
{'<', 0}, {'=', 0}, {'>', 0}, {'?', 0},
{'@', 0}, {'A', 0}, {'B', 0}, {'C', 0},
{'D', 0}, {'E', 0}, {'F', 0}, {'G', 0},
{'H', 0}, {'I', 0}, {'J', 0}, {'K', 0},
{'L', 0}, {'M', 0}, {'N', 0}, {'O', 0},
{'P', 0}, {'Q', 0}, {'R', 0}, {'S', 0},
{'T', 0}, {'U', 0}, {'V', 0}, {'W', 0},
{'X', 0}, {'Y', 0}, {'Z', 0}, {'[', 0},
{'\\', 0}, {']', 0}, {'^', 0}, {'_', 0},
{'`', 0}, {'a', 0}, {'b', 0}, {'c', 0},
{'d', 0}, {'e', 0}, {'f', 0}, {'g', 0},
{'h', 0}, {'i', 0}, {'j', 0}, {'k', 0},
{'l', 0}, {'m', 0}, {'n', 0}, {'o', 0},
{'p', 0}, {'q', 0}, {'r', 0}, {'s', 0},
{'t', 0}, {'u', 0}, {'v', 0}, {'w', 0},
{'x', 0}, {'y', 0}, {'z', 0}, {'{', 0},
{'|', 0}, {'}', 0}, {'~', 0}, {127, "\\127"},
{128, "\\<)"}, {129, "\\x-"}, {130, "\\.V"}, {131, "\\v/"},
{132, "\\.S"}, {133, "\\GS"}, {134, "\\|>"}, {135, "\\pi"},
{136, "\\.d"}, {137, "\\<="}, {138, "\\>="}, {139, "\\=/"},
{140, "\\Ga"}, {141, "\\->"}, {142, "\\<-"}, {143, "\\|v"},
{144, "\\|^"}, {145, "\\Gg"}, {146, "\\Gd"}, {147, "\\Ge"},
{148, "\\Gn"}, {149, "\\Gh"}, {150, "\\Gl"}, {151, "\\Gr"},
{152, "\\Gs"}, {153, "\\Gt"}, {154, "\\Gw"}, {155, "\\GD"},
{156, "\\PI"}, {157, "\\GW"}, {158, "\\[]"}, {159, "\\oo"},
{160, "\\160"}, {161, "\\161"}, {162, "\\162"}, {163, "\\163"},
{164, "\\164"}, {165, "\\165"}, {166, "\\166"}, {167, "\\167"},
{168, "\\168"}, {169, "\\169"}, {170, "\\170"}, {171, "\\<<"},
{172, "\\172"}, {173, "\\173"}, {174, "\\174"}, {175, "\\175"},
{176, "\\^o"}, {177, "\\177"}, {178, "\\178"}, {179, "\\179"},
{180, "\\180"}, {181, "\\Gm"}, {182, "\\182"}, {183, "\\183"},
{184, "\\184"}, {185, "\\185"}, {186, "\\186"}, {187, "\\>>"},
{188, "\\188"}, {189, "\\189"}, {190, "\\190"}, {191, "\\191"},
{192, "\\192"}, {193, "\\193"}, {194, "\\194"}, {195, "\\195"},
{196, "\\196"}, {197, "\\197"}, {198, "\\198"}, {199, "\\199"},
{200, "\\200"}, {201, "\\201"}, {202, "\\202"}, {203, "\\203"},
{204, "\\204"}, {205, "\\205"}, {206, "\\206"}, {207, "\\207"},
{208, "\\208"}, {209, "\\209"}, {210, "\\210"}, {211, "\\211"},
{212, "\\212"}, {213, "\\213"}, {214, "\\214"}, {215, "\\.x"},
{216, "\\O/"}, {217, "\\217"}, {218, "\\218"}, {219, "\\219"},
{220, "\\220"}, {221, "\\221"}, {222, "\\222"}, {223, "\\223"},
{224, "\\224"}, {225, "\\225"}, {226, "\\226"}, {227, "\\227"},
{228, "\\228"}, {229, "\\229"}, {230, "\\230"}, {231, "\\231"},
{232, "\\232"}, {233, "\\233"}, {234, "\\234"}, {235, "\\235"},
{236, "\\236"}, {237, "\\237"}, {238, "\\238"}, {239, "\\239"},
{240, "\\240"}, {241, "\\241"}, {242, "\\242"}, {243, "\\243"},
{244, "\\244"}, {245, "\\245"}, {246, "\\246"}, {247, "\\:-"},
{248, "\\248"}, {249, "\\249"}, {250, "\\250"}, {251, "\\251"},
{252, "\\252"}, {253, "\\253"}, {254, "\\254"}, {255, "\\255"}};
trans_tbl_t hp48_trans_tbl[ 256 ] = {
{ 0, "\\0" }, { 1, "\\001" }, { 2, "\\002" }, { 3, "\\003" },
{ 4, "\\004" }, { 5, "\\005" }, { 6, "\\006" }, { 7, "\\007" },
{ 8, "\\b" }, { 9, "\\t" }, { 10, "\\n" }, { 11, "\\011" },
{ 12, "\\f" }, { 13, "\\r" }, { 14, "\\014" }, { 15, "\\015" },
{ 16, "\\016" }, { 17, "\\017" }, { 18, "\\018" }, { 19, "\\019" },
{ 20, "\\020" }, { 21, "\\021" }, { 22, "\\022" }, { 23, "\\023" },
{ 24, "\\024" }, { 25, "\\025" }, { 26, "\\026" }, { 27, "\\027" },
{ 28, "\\028" }, { 29, "\\029" }, { 30, "\\030" }, { 31, "\\031" },
{ ' ', 0 }, { '!', 0 }, { '"', 0 }, { '#', 0 },
{ '$', 0 }, { '%', 0 }, { '&', 0 }, { '\'', 0 },
{ '(', 0 }, { ')', 0 }, { '*', 0 }, { '+', 0 },
{ ',', 0 }, { '-', 0 }, { '.', 0 }, { '/', 0 },
{ '0', 0 }, { '1', 0 }, { '2', 0 }, { '3', 0 },
{ '4', 0 }, { '5', 0 }, { '6', 0 }, { '7', 0 },
{ '8', 0 }, { '9', 0 }, { ':', 0 }, { ';', 0 },
{ '<', 0 }, { '=', 0 }, { '>', 0 }, { '?', 0 },
{ '@', 0 }, { 'A', 0 }, { 'B', 0 }, { 'C', 0 },
{ 'D', 0 }, { 'E', 0 }, { 'F', 0 }, { 'G', 0 },
{ 'H', 0 }, { 'I', 0 }, { 'J', 0 }, { 'K', 0 },
{ 'L', 0 }, { 'M', 0 }, { 'N', 0 }, { 'O', 0 },
{ 'P', 0 }, { 'Q', 0 }, { 'R', 0 }, { 'S', 0 },
{ 'T', 0 }, { 'U', 0 }, { 'V', 0 }, { 'W', 0 },
{ 'X', 0 }, { 'Y', 0 }, { 'Z', 0 }, { '[', 0 },
{ '\\', 0 }, { ']', 0 }, { '^', 0 }, { '_', 0 },
{ '`', 0 }, { 'a', 0 }, { 'b', 0 }, { 'c', 0 },
{ 'd', 0 }, { 'e', 0 }, { 'f', 0 }, { 'g', 0 },
{ 'h', 0 }, { 'i', 0 }, { 'j', 0 }, { 'k', 0 },
{ 'l', 0 }, { 'm', 0 }, { 'n', 0 }, { 'o', 0 },
{ 'p', 0 }, { 'q', 0 }, { 'r', 0 }, { 's', 0 },
{ 't', 0 }, { 'u', 0 }, { 'v', 0 }, { 'w', 0 },
{ 'x', 0 }, { 'y', 0 }, { 'z', 0 }, { '{', 0 },
{ '|', 0 }, { '}', 0 }, { '~', 0 }, { 127, "\\127" },
{ 128, "\\<)" }, { 129, "\\x-" }, { 130, "\\.V" }, { 131, "\\v/" },
{ 132, "\\.S" }, { 133, "\\GS" }, { 134, "\\|>" }, { 135, "\\pi" },
{ 136, "\\.d" }, { 137, "\\<=" }, { 138, "\\>=" }, { 139, "\\=/" },
{ 140, "\\Ga" }, { 141, "\\->" }, { 142, "\\<-" }, { 143, "\\|v" },
{ 144, "\\|^" }, { 145, "\\Gg" }, { 146, "\\Gd" }, { 147, "\\Ge" },
{ 148, "\\Gn" }, { 149, "\\Gh" }, { 150, "\\Gl" }, { 151, "\\Gr" },
{ 152, "\\Gs" }, { 153, "\\Gt" }, { 154, "\\Gw" }, { 155, "\\GD" },
{ 156, "\\PI" }, { 157, "\\GW" }, { 158, "\\[]" }, { 159, "\\oo" },
{ 160, "\\160" }, { 161, "\\161" }, { 162, "\\162" }, { 163, "\\163" },
{ 164, "\\164" }, { 165, "\\165" }, { 166, "\\166" }, { 167, "\\167" },
{ 168, "\\168" }, { 169, "\\169" }, { 170, "\\170" }, { 171, "\\<<" },
{ 172, "\\172" }, { 173, "\\173" }, { 174, "\\174" }, { 175, "\\175" },
{ 176, "\\^o" }, { 177, "\\177" }, { 178, "\\178" }, { 179, "\\179" },
{ 180, "\\180" }, { 181, "\\Gm" }, { 182, "\\182" }, { 183, "\\183" },
{ 184, "\\184" }, { 185, "\\185" }, { 186, "\\186" }, { 187, "\\>>" },
{ 188, "\\188" }, { 189, "\\189" }, { 190, "\\190" }, { 191, "\\191" },
{ 192, "\\192" }, { 193, "\\193" }, { 194, "\\194" }, { 195, "\\195" },
{ 196, "\\196" }, { 197, "\\197" }, { 198, "\\198" }, { 199, "\\199" },
{ 200, "\\200" }, { 201, "\\201" }, { 202, "\\202" }, { 203, "\\203" },
{ 204, "\\204" }, { 205, "\\205" }, { 206, "\\206" }, { 207, "\\207" },
{ 208, "\\208" }, { 209, "\\209" }, { 210, "\\210" }, { 211, "\\211" },
{ 212, "\\212" }, { 213, "\\213" }, { 214, "\\214" }, { 215, "\\.x" },
{ 216, "\\O/" }, { 217, "\\217" }, { 218, "\\218" }, { 219, "\\219" },
{ 220, "\\220" }, { 221, "\\221" }, { 222, "\\222" }, { 223, "\\223" },
{ 224, "\\224" }, { 225, "\\225" }, { 226, "\\226" }, { 227, "\\227" },
{ 228, "\\228" }, { 229, "\\229" }, { 230, "\\230" }, { 231, "\\231" },
{ 232, "\\232" }, { 233, "\\233" }, { 234, "\\234" }, { 235, "\\235" },
{ 236, "\\236" }, { 237, "\\237" }, { 238, "\\238" }, { 239, "\\239" },
{ 240, "\\240" }, { 241, "\\241" }, { 242, "\\242" }, { 243, "\\243" },
{ 244, "\\244" }, { 245, "\\245" }, { 246, "\\246" }, { 247, "\\:-" },
{ 248, "\\248" }, { 249, "\\249" }, { 250, "\\250" }, { 251, "\\251" },
{ 252, "\\252" }, { 253, "\\253" }, { 254, "\\254" }, { 255, "\\255" } };
#endif /* DEFINE_TRANS_TABLE */
#endif /* !_HP48CHAR_H */

View file

@ -46,193 +46,193 @@
#define hp48_icon_width 32
#define hp48_icon_height 64
static unsigned char hp48_icon_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff,
0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6,
0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff};
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff,
0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6,
0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff };
#define hp48_top_width 32
#define hp48_top_height 30
static unsigned char hp48_top_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff,
0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff};
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff,
0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff };
#define hp48_bottom_width 32
#define hp48_bottom_height 64
static unsigned char hp48_bottom_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6,
0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6,
0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3,
0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff };
#define hp48_logo_width 13
#define hp48_logo_height 4
static unsigned char hp48_logo_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f};
static unsigned char hp48_logo_bits[] = { 0x00, 0x00, 0x00, 0x00,
0xf8, 0x1f, 0xf8, 0x1f };
#define hp48_text_width 29
#define hp48_text_height 7
static unsigned char hp48_text_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0x00, 0xfe, 0x1f};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0x1f };
#define hp48_disp_width 29
#define hp48_disp_height 21
static unsigned char hp48_disp_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f };
#define hp48_keys_width 30
#define hp48_keys_height 61
static unsigned char hp48_keys_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39,
0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x73, 0xce, 0x39, 0xfc, 0x73, 0xce, 0x39,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c,
0x1c, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c,
0x1c, 0xcf, 0xf3, 0x3c};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39,
0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x73, 0xce, 0x39, 0xfc, 0x73, 0xce, 0x39,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c,
0x1c, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c,
0x1c, 0xcf, 0xf3, 0x3c };
#define hp48_orange_width 5
#define hp48_orange_height 53
static unsigned char hp48_orange_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x1c};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c };
#define hp48_blue_width 5
#define hp48_blue_height 57
static unsigned char hp48_blue_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c };
#define hp48_on_width 25
#define hp48_on_height 19
static unsigned char hp48_on_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x13, 0x01,
0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12, 0x01, 0x80, 0xc8, 0xe7, 0x00,
0x00, 0x05, 0x12, 0x01, 0x00, 0x02, 0x12, 0x01, 0x00, 0x05, 0x12, 0x01,
0x80, 0x08, 0xe2, 0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00,
0x00, 0x00, 0x13, 0x01, 0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12,
0x01, 0x80, 0xc8, 0xe7, 0x00, 0x00, 0x05, 0x12, 0x01, 0x00, 0x02,
0x12, 0x01, 0x00, 0x05, 0x12, 0x01, 0x80, 0x08, 0xe2, 0x00 };
#define hp48_top_gx_width 32
#define hp48_top_gx_height 30
static unsigned char hp48_top_gx_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x08, 0xff, 0xe1,
0x07, 0x08, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff};
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x08, 0xff, 0xe1,
0x07, 0x08, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff };
#define hp48_logo_gx_width 16
#define hp48_logo_gx_height 4
static unsigned char hp48_logo_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xf8, 0xf7, 0xf8, 0xf7};
static unsigned char hp48_logo_gx_bits[] = { 0x00, 0x00, 0x00, 0x00,
0xf8, 0xf7, 0xf8, 0xf7 };
#define hp48_text_gx_width 29
#define hp48_text_gx_height 7
static unsigned char hp48_text_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f };
#define hp48_green_gx_width 29
#define hp48_green_gx_height 57
static unsigned char hp48_green_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 };
#endif /* !_ICON_H */

3018
src/init.c

File diff suppressed because it is too large Load diff

701
src/lcd.c
View file

@ -80,401 +80,412 @@ display_t display;
#define DISP_ROWS 64
#define NIBS_PER_BUFFER_ROW (NIBBLES_PER_ROW + 2)
#define NIBS_PER_BUFFER_ROW ( NIBBLES_PER_ROW + 2 )
unsigned char disp_buf[DISP_ROWS][NIBS_PER_BUFFER_ROW];
unsigned char lcd_buffer[DISP_ROWS][NIBS_PER_BUFFER_ROW];
unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
Pixmap nibble_maps[16];
Pixmap nibble_maps[ 16 ];
unsigned char nibbles[16][2] = {
{0x00, 0x00}, /* ---- */
{0x03, 0x03}, /* *--- */
{0x0c, 0x0c}, /* -*-- */
{0x0f, 0x0f}, /* **-- */
{0x30, 0x30}, /* --*- */
{0x33, 0x33}, /* *-*- */
{0x3c, 0x3c}, /* -**- */
{0x3f, 0x3f}, /* ***- */
{0xc0, 0xc0}, /* ---* */
{0xc3, 0xc3}, /* *--* */
{0xcc, 0xcc}, /* -*-* */
{0xcf, 0xcf}, /* **-* */
{0xf0, 0xf0}, /* --** */
{0xf3, 0xf3}, /* *-** */
{0xfc, 0xfc}, /* -*** */
{0xff, 0xff} /* **** */
unsigned char nibbles[ 16 ][ 2 ] = {
{ 0x00, 0x00 }, /* ---- */
{ 0x03, 0x03 }, /* *--- */
{ 0x0c, 0x0c }, /* -*-- */
{ 0x0f, 0x0f }, /* **-- */
{ 0x30, 0x30 }, /* --*- */
{ 0x33, 0x33 }, /* *-*- */
{ 0x3c, 0x3c }, /* -**- */
{ 0x3f, 0x3f }, /* ***- */
{ 0xc0, 0xc0 }, /* ---* */
{ 0xc3, 0xc3 }, /* *--* */
{ 0xcc, 0xcc }, /* -*-* */
{ 0xcf, 0xcf }, /* **-* */
{ 0xf0, 0xf0 }, /* --** */
{ 0xf3, 0xf3 }, /* *-** */
{ 0xfc, 0xfc }, /* -*** */
{ 0xff, 0xff } /* **** */
};
static unsigned char nibble_bits[16];
static unsigned char nibble_bits[ 16 ];
void init_nibble_maps(void) {
int i;
void init_nibble_maps( void ) {
int i;
for (i = 0; i < 16; i++) {
nibble_maps[i] =
XCreateBitmapFromData(dpy, disp.win, (char *)nibbles[i], 8, 2);
}
#ifdef HAVE_XSHM
if (shm_flag) {
if (disp.disp_image->bitmap_bit_order == MSBFirst) {
nibble_bits[0x0] = 0x00; /* ---- */
nibble_bits[0x1] = 0xc0; /* *--- */
nibble_bits[0x2] = 0x30; /* -*-- */
nibble_bits[0x3] = 0xf0; /* **-- */
nibble_bits[0x4] = 0x0c; /* --*- */
nibble_bits[0x5] = 0xcc; /* *-*- */
nibble_bits[0x6] = 0x3c; /* -**- */
nibble_bits[0x7] = 0xfc; /* ***- */
nibble_bits[0x8] = 0x03; /* ---* */
nibble_bits[0x9] = 0xc3; /* *--* */
nibble_bits[0xa] = 0x33; /* -*-* */
nibble_bits[0xb] = 0xf3; /* **-* */
nibble_bits[0xc] = 0x0f; /* --** */
nibble_bits[0xd] = 0xcf; /* *-** */
nibble_bits[0xe] = 0x3f; /* -*** */
nibble_bits[0xf] = 0xff; /* **** */
} else {
nibble_bits[0x0] = 0x00; /* ---- */
nibble_bits[0x1] = 0x03; /* *--- */
nibble_bits[0x2] = 0x0c; /* -*-- */
nibble_bits[0x3] = 0x0f; /* **-- */
nibble_bits[0x4] = 0x30; /* --*- */
nibble_bits[0x5] = 0x33; /* *-*- */
nibble_bits[0x6] = 0x3c; /* -**- */
nibble_bits[0x7] = 0x3f; /* ***- */
nibble_bits[0x8] = 0xc0; /* ---* */
nibble_bits[0x9] = 0xc3; /* *--* */
nibble_bits[0xa] = 0xcc; /* -*-* */
nibble_bits[0xb] = 0xcf; /* **-* */
nibble_bits[0xc] = 0xf0; /* --** */
nibble_bits[0xd] = 0xf3; /* *-** */
nibble_bits[0xe] = 0xfc; /* -*** */
nibble_bits[0xf] = 0xff; /* **** */
for ( i = 0; i < 16; i++ ) {
nibble_maps[ i ] =
XCreateBitmapFromData( dpy, disp.win, ( char* )nibbles[ i ], 8, 2 );
}
#ifdef HAVE_XSHM
if ( shm_flag ) {
if ( disp.disp_image->bitmap_bit_order == MSBFirst ) {
nibble_bits[ 0x0 ] = 0x00; /* ---- */
nibble_bits[ 0x1 ] = 0xc0; /* *--- */
nibble_bits[ 0x2 ] = 0x30; /* -*-- */
nibble_bits[ 0x3 ] = 0xf0; /* **-- */
nibble_bits[ 0x4 ] = 0x0c; /* --*- */
nibble_bits[ 0x5 ] = 0xcc; /* *-*- */
nibble_bits[ 0x6 ] = 0x3c; /* -**- */
nibble_bits[ 0x7 ] = 0xfc; /* ***- */
nibble_bits[ 0x8 ] = 0x03; /* ---* */
nibble_bits[ 0x9 ] = 0xc3; /* *--* */
nibble_bits[ 0xa ] = 0x33; /* -*-* */
nibble_bits[ 0xb ] = 0xf3; /* **-* */
nibble_bits[ 0xc ] = 0x0f; /* --** */
nibble_bits[ 0xd ] = 0xcf; /* *-** */
nibble_bits[ 0xe ] = 0x3f; /* -*** */
nibble_bits[ 0xf ] = 0xff; /* **** */
} else {
nibble_bits[ 0x0 ] = 0x00; /* ---- */
nibble_bits[ 0x1 ] = 0x03; /* *--- */
nibble_bits[ 0x2 ] = 0x0c; /* -*-- */
nibble_bits[ 0x3 ] = 0x0f; /* **-- */
nibble_bits[ 0x4 ] = 0x30; /* --*- */
nibble_bits[ 0x5 ] = 0x33; /* *-*- */
nibble_bits[ 0x6 ] = 0x3c; /* -**- */
nibble_bits[ 0x7 ] = 0x3f; /* ***- */
nibble_bits[ 0x8 ] = 0xc0; /* ---* */
nibble_bits[ 0x9 ] = 0xc3; /* *--* */
nibble_bits[ 0xa ] = 0xcc; /* -*-* */
nibble_bits[ 0xb ] = 0xcf; /* **-* */
nibble_bits[ 0xc ] = 0xf0; /* --** */
nibble_bits[ 0xd ] = 0xf3; /* *-** */
nibble_bits[ 0xe ] = 0xfc; /* -*** */
nibble_bits[ 0xf ] = 0xff; /* **** */
}
}
}
#endif
}
void init_display(void) {
display.on = (int)(saturn.disp_io & 0x8) >> 3;
void init_display( void ) {
display.on = ( int )( saturn.disp_io & 0x8 ) >> 3;
display.disp_start = (saturn.disp_addr & 0xffffe);
display.offset = (saturn.disp_io & 0x7);
disp.offset = 2 * display.offset;
display.disp_start = ( saturn.disp_addr & 0xffffe );
display.offset = ( saturn.disp_io & 0x7 );
disp.offset = 2 * display.offset;
display.lines = (saturn.line_count & 0x3f);
if (display.lines == 0)
display.lines = 63;
disp.lines = 2 * display.lines;
if (disp.lines < 110)
disp.lines = 110;
display.lines = ( saturn.line_count & 0x3f );
if ( display.lines == 0 )
display.lines = 63;
disp.lines = 2 * display.lines;
if ( disp.lines < 110 )
disp.lines = 110;
if (display.offset > 3)
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset + 2) & 0xfff;
else
display.nibs_per_line = (NIBBLES_PER_ROW + saturn.line_offset) & 0xfff;
if ( display.offset > 3 )
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.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;
display.menu_start = saturn.menu_addr;
display.menu_end = saturn.menu_addr + 0x110;
display.contrast = saturn.contrast_ctrl;
display.contrast |= ((saturn.disp_test & 0x1) << 4);
display.contrast = saturn.contrast_ctrl;
display.contrast |= ( ( saturn.disp_test & 0x1 ) << 4 );
display.annunc = saturn.annunc;
display.annunc = saturn.annunc;
memset(disp_buf, 0xf0, sizeof(disp_buf));
memset(lcd_buffer, 0xf0, sizeof(lcd_buffer));
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) );
init_nibble_maps();
init_nibble_maps();
}
static inline void draw_nibble(int c, int r, int val) {
int x, y;
static inline void draw_nibble( int c, int r, int val ) {
int x, y;
x = (c * 8) + 5;
if (r <= display.lines)
x -= disp.offset;
y = (r * 2) + 20;
val &= 0x0f;
if (val != lcd_buffer[r][c]) {
XCopyPlane(dpy, nibble_maps[val], disp.win, disp.gc, 0, 0, 8, 2, x, y, 1);
lcd_buffer[r][c] = val;
}
}
static inline void draw_row(long addr, int row) {
int i, v;
int line_length;
line_length = NIBBLES_PER_ROW;
if ((display.offset > 3) && (row <= display.lines))
line_length += 2;
for (i = 0; i < line_length; i++) {
v = read_nibble(addr + i);
if (v != disp_buf[row][i]) {
disp_buf[row][i] = v;
draw_nibble(i, row, v);
x = ( c * 8 ) + 5;
if ( r <= display.lines )
x -= disp.offset;
y = ( r * 2 ) + 20;
val &= 0x0f;
if ( val != lcd_buffer[ r ][ c ] ) {
XCopyPlane( dpy, nibble_maps[ val ], disp.win, disp.gc, 0, 0, 8, 2, x,
y, 1 );
lcd_buffer[ r ][ c ] = val;
}
}
}
void update_display(void) {
int i, j;
long addr;
static int old_offset = -1;
static int old_lines = -1;
#ifdef HAVE_XSHM
int addr_pad;
int val, line_pad, line_length;
word_20 data_addr, data_addr_2;
#endif
static inline void draw_row( long addr, int row ) {
int i, v;
int line_length;
if (!disp.mapped) {
refresh_icon();
return;
}
if (display.on) {
addr = display.disp_start;
#ifdef HAVE_XSHM
if (shm_flag) {
data_addr = 0;
data_addr_2 = disp.disp_image->bytes_per_line;
line_length = NIBBLES_PER_ROW;
if (display.offset > 3)
line_length = NIBBLES_PER_ROW;
if ( ( display.offset > 3 ) && ( row <= display.lines ) )
line_length += 2;
line_pad = 2 * disp.disp_image->bytes_per_line - line_length;
addr_pad = display.nibs_per_line - line_length;
for (i = 0; i <= display.lines; i++) {
for (j = 0; j < line_length; j++) {
val = read_nibble(addr++);
disp.disp_image->data[data_addr++] = nibble_bits[val];
disp.disp_image->data[data_addr_2++] = nibble_bits[val];
for ( i = 0; i < line_length; i++ ) {
v = read_nibble( addr + i );
if ( v != disp_buf[ row ][ i ] ) {
disp_buf[ row ][ i ] = v;
draw_nibble( i, row, v );
}
addr += addr_pad;
data_addr += line_pad;
data_addr_2 += line_pad;
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
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));
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));
old_lines = display.lines;
}
for (i = 0; i <= display.lines; i++) {
draw_row(addr, i);
addr += display.nibs_per_line;
}
#ifdef HAVE_XSHM
}
#endif
if (i < DISP_ROWS) {
addr = display.menu_start;
}
void update_display( void ) {
int i, j;
long addr;
static int old_offset = -1;
static int old_lines = -1;
#ifdef HAVE_XSHM
int addr_pad;
int val, line_pad, line_length;
word_20 data_addr, data_addr_2;
#endif
if ( !disp.mapped ) {
refresh_icon();
return;
}
if ( display.on ) {
addr = display.disp_start;
#ifdef HAVE_XSHM
if ( shm_flag ) {
data_addr = 0;
data_addr_2 = disp.disp_image->bytes_per_line;
line_length = NIBBLES_PER_ROW;
if ( display.offset > 3 )
line_length += 2;
line_pad = 2 * disp.disp_image->bytes_per_line - line_length;
addr_pad = display.nibs_per_line - line_length;
for ( i = 0; i <= display.lines; i++ ) {
for ( j = 0; j < line_length; j++ ) {
val = read_nibble( addr++ );
disp.disp_image->data[ data_addr++ ] = nibble_bits[ val ];
disp.disp_image->data[ data_addr_2++ ] = nibble_bits[ val ];
}
addr += addr_pad;
data_addr += line_pad;
data_addr_2 += line_pad;
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
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 ) );
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 ) );
old_lines = display.lines;
}
for ( i = 0; i <= display.lines; i++ ) {
draw_row( addr, i );
addr += display.nibs_per_line;
}
#ifdef HAVE_XSHM
if (shm_flag) {
data_addr = 0;
data_addr_2 = disp.menu_image->bytes_per_line;
line_pad = 2 * disp.menu_image->bytes_per_line - NIBBLES_PER_ROW;
for (; i < DISP_ROWS; i++) {
for (j = 0; j < NIBBLES_PER_ROW; j++) {
val = read_nibble(addr++);
disp.menu_image->data[data_addr++] = nibble_bits[val];
disp.menu_image->data[data_addr_2++] = nibble_bits[val];
}
data_addr += line_pad;
data_addr_2 += line_pad;
}
#endif
if ( i < DISP_ROWS ) {
addr = display.menu_start;
#ifdef HAVE_XSHM
if ( shm_flag ) {
data_addr = 0;
data_addr_2 = disp.menu_image->bytes_per_line;
line_pad =
2 * disp.menu_image->bytes_per_line - NIBBLES_PER_ROW;
for ( ; i < DISP_ROWS; i++ ) {
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
val = read_nibble( addr++ );
disp.menu_image->data[ data_addr++ ] =
nibble_bits[ val ];
disp.menu_image->data[ data_addr_2++ ] =
nibble_bits[ val ];
}
data_addr += line_pad;
data_addr_2 += line_pad;
}
disp.display_update |= UPDATE_MENU;
} else {
#endif
for ( ; i < DISP_ROWS; i++ ) {
draw_row( addr, i );
addr += NIBBLES_PER_ROW;
}
#ifdef HAVE_XSHM
}
#endif
}
} else {
#ifdef HAVE_XSHM
if ( shm_flag ) {
memset( disp.disp_image->data, 0,
( size_t )( disp.disp_image->bytes_per_line *
disp.disp_image->height ) );
memset( disp.menu_image->data, 0,
( size_t )( disp.menu_image->bytes_per_line *
disp.menu_image->height ) );
disp.display_update = UPDATE_DISP | UPDATE_MENU;
} else {
#endif
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
for ( i = 0; i < 64; i++ ) {
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
draw_nibble( j, i, 0x00 );
}
}
#ifdef HAVE_XSHM
}
#endif
}
}
void redraw_display( void ) {
XClearWindow( dpy, disp.win );
memset( disp_buf, 0, sizeof( disp_buf ) );
memset( lcd_buffer, 0, sizeof( lcd_buffer ) );
update_display();
}
void disp_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#ifdef HAVE_XSHM
int shm_addr;
#endif
int x, y;
offset = ( addr - display.disp_start );
x = offset % display.nibs_per_line;
if ( x < 0 || x > 35 )
return;
if ( display.nibs_per_line != 0 ) {
y = offset / display.nibs_per_line;
if ( y < 0 || y > 63 )
return;
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr = ( 2 * y * disp.disp_image->bytes_per_line ) + x;
disp.disp_image->data[ shm_addr ] = nibble_bits[ val ];
disp.disp_image
->data[ shm_addr + disp.disp_image->bytes_per_line ] =
nibble_bits[ val ];
disp.display_update |= UPDATE_DISP;
} else {
#endif
if ( val != disp_buf[ y ][ x ] ) {
disp_buf[ y ][ x ] = val;
draw_nibble( x, y, val );
}
#ifdef HAVE_XSHM
}
#endif
} else {
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr = x;
for ( y = 0; y < display.lines; y++ ) {
disp.disp_image->data[ shm_addr ] = nibble_bits[ val ];
shm_addr += disp.disp_image->bytes_per_line;
disp.disp_image->data[ shm_addr ] = nibble_bits[ val ];
shm_addr += disp.disp_image->bytes_per_line;
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
for ( y = 0; y < display.lines; y++ ) {
if ( val != disp_buf[ y ][ x ] ) {
disp_buf[ y ][ x ] = val;
draw_nibble( x, y, val );
}
}
#ifdef HAVE_XSHM
}
#endif
}
}
void menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#ifdef HAVE_XSHM
int shm_addr;
#endif
int x, y;
offset = ( addr - display.menu_start );
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr =
2 * ( offset / NIBBLES_PER_ROW ) * disp.menu_image->bytes_per_line +
( offset % NIBBLES_PER_ROW );
disp.menu_image->data[ shm_addr ] = nibble_bits[ val ];
disp.menu_image->data[ shm_addr + disp.menu_image->bytes_per_line ] =
nibble_bits[ val ];
disp.display_update |= UPDATE_MENU;
} else {
#endif
for (; i < DISP_ROWS; i++) {
draw_row(addr, i);
addr += NIBBLES_PER_ROW;
}
#ifdef HAVE_XSHM
}
#endif
}
} else {
#ifdef HAVE_XSHM
if (shm_flag) {
memset(
disp.disp_image->data, 0,
(size_t)(disp.disp_image->bytes_per_line * disp.disp_image->height));
memset(
disp.menu_image->data, 0,
(size_t)(disp.menu_image->bytes_per_line * disp.menu_image->height));
disp.display_update = UPDATE_DISP | UPDATE_MENU;
} else {
#endif
memset(disp_buf, 0xf0, sizeof(disp_buf));
for (i = 0; i < 64; i++) {
for (j = 0; j < NIBBLES_PER_ROW; j++) {
draw_nibble(j, i, 0x00);
x = offset % NIBBLES_PER_ROW;
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
if ( val != disp_buf[ y ][ x ] ) {
disp_buf[ y ][ x ] = val;
draw_nibble( x, y, val );
}
}
#ifdef HAVE_XSHM
}
#endif
}
}
void redraw_display(void) {
XClearWindow(dpy, disp.win);
memset(disp_buf, 0, sizeof(disp_buf));
memset(lcd_buffer, 0, sizeof(lcd_buffer));
update_display();
}
void disp_draw_nibble(word_20 addr, word_4 val) {
long offset;
#ifdef HAVE_XSHM
int shm_addr;
#endif
int x, y;
offset = (addr - display.disp_start);
x = offset % display.nibs_per_line;
if (x < 0 || x > 35)
return;
if (display.nibs_per_line != 0) {
y = offset / display.nibs_per_line;
if (y < 0 || y > 63)
return;
#ifdef HAVE_XSHM
if (shm_flag) {
shm_addr = (2 * y * disp.disp_image->bytes_per_line) + x;
disp.disp_image->data[shm_addr] = nibble_bits[val];
disp.disp_image->data[shm_addr + disp.disp_image->bytes_per_line] =
nibble_bits[val];
disp.display_update |= UPDATE_DISP;
} else {
#endif
if (val != disp_buf[y][x]) {
disp_buf[y][x] = val;
draw_nibble(x, y, val);
}
#ifdef HAVE_XSHM
}
#endif
} else {
#ifdef HAVE_XSHM
if (shm_flag) {
shm_addr = x;
for (y = 0; y < display.lines; y++) {
disp.disp_image->data[shm_addr] = nibble_bits[val];
shm_addr += disp.disp_image->bytes_per_line;
disp.disp_image->data[shm_addr] = nibble_bits[val];
shm_addr += disp.disp_image->bytes_per_line;
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
for (y = 0; y < display.lines; y++) {
if (val != disp_buf[y][x]) {
disp_buf[y][x] = val;
draw_nibble(x, y, val);
}
}
#ifdef HAVE_XSHM
}
#endif
}
}
void menu_draw_nibble(word_20 addr, word_4 val) {
long offset;
#ifdef HAVE_XSHM
int shm_addr;
#endif
int x, y;
offset = (addr - display.menu_start);
#ifdef HAVE_XSHM
if (shm_flag) {
shm_addr =
2 * (offset / NIBBLES_PER_ROW) * disp.menu_image->bytes_per_line +
(offset % NIBBLES_PER_ROW);
disp.menu_image->data[shm_addr] = nibble_bits[val];
disp.menu_image->data[shm_addr + disp.menu_image->bytes_per_line] =
nibble_bits[val];
disp.display_update |= UPDATE_MENU;
} else {
#endif
x = offset % NIBBLES_PER_ROW;
y = display.lines + (offset / NIBBLES_PER_ROW) + 1;
if (val != disp_buf[y][x]) {
disp_buf[y][x] = val;
draw_nibble(x, y, val);
}
#ifdef HAVE_XSHM
}
#endif
}
struct ann_struct {
int bit;
int x;
int y;
unsigned int width;
unsigned int height;
unsigned char *bits;
Pixmap pixmap;
int bit;
int x;
int y;
unsigned int width;
unsigned int height;
unsigned char* bits;
Pixmap pixmap;
} ann_tbl[] = {
{ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bits},
{ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bits},
{ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bits},
{ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height,
ann_battery_bits},
{ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bits},
{ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bits},
{0}};
{ ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bits },
{ ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bits },
{ ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bits },
{ ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height,
ann_battery_bits },
{ ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bits },
{ ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bits },
{ 0 } };
void draw_annunc(void) {
int val;
int i;
void draw_annunc( void ) {
int val;
int i;
val = display.annunc;
val = display.annunc;
if (val == last_annunc_state)
return;
last_annunc_state = val;
for (i = 0; ann_tbl[i].bit; i++) {
if ((ann_tbl[i].bit & val) == ann_tbl[i].bit) {
XCopyPlane(dpy, ann_tbl[i].pixmap, disp.win, disp.gc, 0, 0,
ann_tbl[i].width, ann_tbl[i].height, ann_tbl[i].x,
ann_tbl[i].y, 1);
} else {
XClearArea(dpy, disp.win, ann_tbl[i].x, ann_tbl[i].y, ann_tbl[i].width,
ann_tbl[i].height, False);
if ( val == last_annunc_state )
return;
last_annunc_state = val;
for ( i = 0; ann_tbl[ i ].bit; i++ ) {
if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) {
XCopyPlane( dpy, ann_tbl[ i ].pixmap, disp.win, disp.gc, 0, 0,
ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x,
ann_tbl[ i ].y, 1 );
} else {
XClearArea( dpy, disp.win, ann_tbl[ i ].x, ann_tbl[ i ].y,
ann_tbl[ i ].width, ann_tbl[ i ].height, False );
}
}
}
refresh_icon();
refresh_icon();
}
void redraw_annunc(void) {
last_annunc_state = -1;
draw_annunc();
void redraw_annunc( void ) {
last_annunc_state = -1;
draw_annunc();
}
void init_annunc(void) {
int i;
void init_annunc( void ) {
int i;
for (i = 0; ann_tbl[i].bit; i++) {
ann_tbl[i].pixmap =
XCreateBitmapFromData(dpy, disp.win, (char *)ann_tbl[i].bits,
ann_tbl[i].width, ann_tbl[i].height);
}
for ( i = 0; ann_tbl[ i ].bit; i++ ) {
ann_tbl[ i ].pixmap =
XCreateBitmapFromData( dpy, disp.win, ( char* )ann_tbl[ i ].bits,
ann_tbl[ i ].width, ann_tbl[ i ].height );
}
}

View file

@ -73,164 +73,166 @@
#include <langinfo.h>
#include <locale.h>
char *progname;
char *res_name;
char *res_class;
char* progname;
char* res_name;
char* res_class;
int saved_argc;
char **saved_argv;
char** saved_argv;
saturn_t saturn;
void signal_handler(int sig) {
switch (sig) {
case SIGINT:
enter_debugger |= USER_INTERRUPT;
break;
case SIGALRM:
got_alarm = 1;
break;
case SIGPIPE:
exit_x48(0);
exit(0);
default:
break;
}
}
void save_options(int argc, char **argv) {
int l;
saved_argc = argc;
saved_argv = (char **)malloc((argc + 2) * sizeof(char *));
if (saved_argv == (char **)0) {
fprintf(stderr, "%s: malloc failed in save_options(), exit\n", progname);
exit(1);
}
saved_argv[argc] = (char *)0;
while (argc--) {
l = strlen(argv[argc]) + 1;
saved_argv[argc] = (char *)malloc(l);
if (saved_argv[argc] == (char *)0) {
fprintf(stderr, "%s: malloc failed in save_options(), exit\n", progname);
exit(1);
void signal_handler( int sig ) {
switch ( sig ) {
case SIGINT:
enter_debugger |= USER_INTERRUPT;
break;
case SIGALRM:
got_alarm = 1;
break;
case SIGPIPE:
exit_x48( 0 );
exit( 0 );
default:
break;
}
memcpy(saved_argv[argc], argv[argc], l);
}
}
int main(int argc, char **argv) {
char *name;
sigset_t set;
struct sigaction sa;
long flags;
struct itimerval it;
void save_options( int argc, char** argv ) {
int l;
setlocale(LC_ALL, "C");
saved_argc = argc;
saved_argv = ( char** )malloc( ( argc + 2 ) * sizeof( char* ) );
if ( saved_argv == ( char** )0 ) {
fprintf( stderr, "%s: malloc failed in save_options(), exit\n",
progname );
exit( 1 );
}
saved_argv[ argc ] = ( char* )0;
while ( argc-- ) {
l = strlen( argv[ argc ] ) + 1;
saved_argv[ argc ] = ( char* )malloc( l );
if ( saved_argv[ argc ] == ( char* )0 ) {
fprintf( stderr, "%s: malloc failed in save_options(), exit\n",
progname );
exit( 1 );
}
memcpy( saved_argv[ argc ], argv[ argc ], l );
}
}
name = (char *)0;
/*
* Get the name we are called.
*/
progname = strrchr(argv[0], '/');
if (progname == NULL)
progname = argv[0];
else
progname++;
int main( int argc, char** argv ) {
char* name;
sigset_t set;
struct sigaction sa;
long flags;
struct itimerval it;
/*
* save command line options
*/
save_options(argc, argv);
setlocale( LC_ALL, "C" );
/*
* Open up the display
*/
if (InitDisplay(argc, argv) < 0) {
exit(1);
}
/*
* initialize emulator stuff
*/
init_emulator();
/*
* Create the HP-48 window
*/
if (CreateWindows(saved_argc, saved_argv) < 0) {
fprintf(stderr, "%s: can\'t create window\n", progname);
exit(1);
}
/*
* can't be done before windows exist
*/
init_active_stuff();
/*
* install a handler for SIGALRM
*/
sigemptyset(&set);
sigaddset(&set, SIGALRM);
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction(SIGALRM, &sa, (struct sigaction *)0);
/*
* install a handler for SIGINT
*/
sigemptyset(&set);
sigaddset(&set, SIGINT);
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction(SIGINT, &sa, (struct sigaction *)0);
/*
* install a handler for SIGPIPE
*/
sigemptyset(&set);
sigaddset(&set, SIGPIPE);
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction(SIGPIPE, &sa, (struct sigaction *)0);
/*
* set the real time interval timer
*/
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 20000;
it.it_value.tv_sec = 0;
it.it_value.tv_usec = 20000;
setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
/*
* Set stdin flags to not include O_NDELAY and O_NONBLOCK
*/
flags = fcntl(STDIN_FILENO, F_GETFL, 0);
flags &= ~O_NDELAY;
flags &= ~O_NONBLOCK;
fcntl(STDIN_FILENO, F_SETFL, flags);
do {
if (!exec_flags)
emulate();
name = ( char* )0;
/*
* Get the name we are called.
*/
progname = strrchr( argv[ 0 ], '/' );
if ( progname == NULL )
progname = argv[ 0 ];
else
emulate_debug();
progname++;
debug();
/*
* save command line options
*/
save_options( argc, argv );
} while (1);
/*
* Open up the display
*/
if ( InitDisplay( argc, argv ) < 0 ) {
exit( 1 );
}
return 0;
/*
* initialize emulator stuff
*/
init_emulator();
/*
* Create the HP-48 window
*/
if ( CreateWindows( saved_argc, saved_argv ) < 0 ) {
fprintf( stderr, "%s: can\'t create window\n", progname );
exit( 1 );
}
/*
* can't be done before windows exist
*/
init_active_stuff();
/*
* install a handler for SIGALRM
*/
sigemptyset( &set );
sigaddset( &set, SIGALRM );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGALRM, &sa, ( struct sigaction* )0 );
/*
* install a handler for SIGINT
*/
sigemptyset( &set );
sigaddset( &set, SIGINT );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGINT, &sa, ( struct sigaction* )0 );
/*
* install a handler for SIGPIPE
*/
sigemptyset( &set );
sigaddset( &set, SIGPIPE );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGPIPE, &sa, ( struct sigaction* )0 );
/*
* set the real time interval timer
*/
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 20000;
it.it_value.tv_sec = 0;
it.it_value.tv_usec = 20000;
setitimer( ITIMER_REAL, &it, ( struct itimerval* )0 );
/*
* Set stdin flags to not include O_NDELAY and O_NONBLOCK
*/
flags = fcntl( STDIN_FILENO, F_GETFL, 0 );
flags &= ~O_NDELAY;
flags &= ~O_NONBLOCK;
fcntl( STDIN_FILENO, F_SETFL, flags );
do {
if ( !exec_flags )
emulate();
else
emulate_debug();
debug();
} while ( 1 );
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -33,71 +33,72 @@
#include <unistd.h>
#include <fcntl.h>
unsigned char *mem;
unsigned char* mem;
int write_mem_file(char *name, unsigned char *mem, int size) {
FILE *fp;
int write_mem_file( char* name, unsigned char* mem, int size ) {
FILE* fp;
if (NULL == (fp = fopen(name, "w"))) {
fprintf(stderr, "can\'t open %s\n", name);
return 0;
}
if ( NULL == ( fp = fopen( name, "w" ) ) ) {
fprintf( stderr, "can\'t open %s\n", name );
return 0;
}
if (fwrite(mem, 1, (size_t)size, fp) != size) {
fprintf(stderr, "can\'t write %s\n", name);
fclose(fp);
return 0;
}
if ( fwrite( mem, 1, ( size_t )size, fp ) != size ) {
fprintf( stderr, "can\'t write %s\n", name );
fclose( fp );
return 0;
}
fclose(fp);
return 1;
fclose( fp );
return 1;
}
int main(int argc, char **argv) {
long size;
char *name;
char *asize;
unsigned char *core;
int main( int argc, char** argv ) {
long 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]);
exit(1);
}
if ( argc < 2 ) {
fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n",
argv[ 0 ] );
exit( 1 );
}
name = argv[2];
asize = argv[1];
if (!strcmp(asize, "32K"))
size = 0x8000;
else if (!strcmp(asize, "128K"))
size = 0x20000;
else if (!strcmp(asize, "256K"))
size = 0x40000;
else if (!strcmp(asize, "512K"))
size = 0x80000;
else if (!strcmp(asize, "1M"))
size = 0x100000;
else if (!strcmp(asize, "2M"))
size = 0x200000;
else if (!strcmp(asize, "4M"))
size = 0x400000;
else {
fprintf(stderr,
name = argv[ 2 ];
asize = argv[ 1 ];
if ( !strcmp( asize, "32K" ) )
size = 0x8000;
else if ( !strcmp( asize, "128K" ) )
size = 0x20000;
else if ( !strcmp( asize, "256K" ) )
size = 0x40000;
else if ( !strcmp( asize, "512K" ) )
size = 0x80000;
else if ( !strcmp( asize, "1M" ) )
size = 0x100000;
else if ( !strcmp( asize, "2M" ) )
size = 0x200000;
else if ( !strcmp( asize, "4M" ) )
size = 0x400000;
else {
fprintf(
stderr,
"%s: size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n",
argv[0]);
exit(1);
}
argv[ 0 ] );
exit( 1 );
}
if ((core = (unsigned char *)malloc(size)) == NULL) {
fprintf(stderr, "%s: can\'t malloc %ld bytes\n", argv[0], size);
exit(1);
}
memset(core, 0, size);
if ( ( core = ( unsigned char* )malloc( size ) ) == NULL ) {
fprintf( stderr, "%s: can\'t malloc %ld bytes\n", argv[ 0 ], size );
exit( 1 );
}
memset( core, 0, size );
if (!write_mem_file(name, core, size)) {
fprintf(stderr, "%s: can\'t write to %s\n", argv[0], name);
exit(1);
}
if ( !write_mem_file( name, core, size ) ) {
fprintf( stderr, "%s: can\'t write to %s\n", argv[ 0 ], name );
exit( 1 );
}
exit(0);
exit( 0 );
}

View file

@ -50,8 +50,8 @@
#include "constants.h"
#include "resources.h"
void usage(void) {
fprintf(stdout, "\n\
void usage( void ) {
fprintf( stdout, "\n\
x48 Version %d.%d.%d, Copyright (c) 1994-2005 by Eddie C. Dost <ecd@dressler.de>.\n\
\n\
usage:\n\t%s [-options ...]\n\
@ -91,22 +91,22 @@ where options include:\n\
-/+throttle turn off/on speed emulation\n\
-/+netbook turn off/on netbook layout\n\
\n",
VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname);
VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname );
fflush(stdout);
exit(1);
fflush( stdout );
exit( 1 );
}
void show_version(void) {
fprintf(stdout, "\n\
void show_version( void ) {
fprintf( stdout, "\n\
%s Version %d.%d.%d, x48 is Copyright (c) 1994-2005 by Eddie C. Dost <ecd@dressler.de>.\n\
Compiled on %s #%d\n\n",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, COMPILE_TIME,
COMPILE_VERSION);
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, COMPILE_TIME,
COMPILE_VERSION );
}
void show_copyright(void) {
fprintf(stdout, "\n\
void show_copyright( void ) {
fprintf( stdout, "\n\
COPYRIGHT\n\
\n\
X48 is an Emulator/Debugger for the HP-48 Handheld Calculator.\n\
@ -124,11 +124,11 @@ GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n" );
}
void show_warranty(void) {
fprintf(stdout, "\n\
void show_warranty( void ) {
fprintf( stdout, "\n\
NO WARRANTY\n\
\n\
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n\
@ -149,5 +149,5 @@ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n\
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n\
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n\
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n\
POSSIBILITY OF SUCH DAMAGES.\n\n");
POSSIBILITY OF SUCH DAMAGES.\n\n" );
}

View file

@ -49,72 +49,72 @@
#include <X11/Xresource.h>
static XrmOptionDescRec options[] = {
{"-display", ".display", XrmoptionSepArg, (void *)0},
{"-geometry", "*geometry", XrmoptionSepArg, (void *)0},
{"-iconGeom", "*iconGeom", XrmoptionSepArg, (void *)0},
{"-iconName", "*iconName", XrmoptionSepArg, (void *)0},
{"-iconic", "*iconic", XrmoptionNoArg, (void *)"True"},
{"-name", (char *)0, XrmoptionSepArg, (void *)0},
{"-title", "*title", XrmoptionSepArg, (void *)0},
{ "-display", ".display", XrmoptionSepArg, ( void* )0 },
{ "-geometry", "*geometry", XrmoptionSepArg, ( void* )0 },
{ "-iconGeom", "*iconGeom", XrmoptionSepArg, ( void* )0 },
{ "-iconName", "*iconName", XrmoptionSepArg, ( void* )0 },
{ "-iconic", "*iconic", XrmoptionNoArg, ( void* )"True" },
{ "-name", ( char* )0, XrmoptionSepArg, ( void* )0 },
{ "-title", "*title", XrmoptionSepArg, ( void* )0 },
{"-xshm", "*useXShm", XrmoptionNoArg, (void *)"True"},
{"+xshm", "*useXShm", XrmoptionNoArg, (void *)"False"},
{ "-xshm", "*useXShm", XrmoptionNoArg, ( void* )"True" },
{ "+xshm", "*useXShm", XrmoptionNoArg, ( void* )"False" },
{"-visual", "*visual", XrmoptionSepArg, (void *)0},
{"-mono", "*mono", XrmoptionNoArg, (void *)"True"},
{"-gray", "*gray", XrmoptionNoArg, (void *)"True"},
{"-monoIcon", "*monoIcon", XrmoptionNoArg, (void *)"True"},
{ "-visual", "*visual", XrmoptionSepArg, ( void* )0 },
{ "-mono", "*mono", XrmoptionNoArg, ( void* )"True" },
{ "-gray", "*gray", XrmoptionNoArg, ( void* )"True" },
{ "-monoIcon", "*monoIcon", XrmoptionNoArg, ( void* )"True" },
{"-version", "*printVersion", XrmoptionNoArg, (void *)"True"},
{"-copyright", "*printCopyright", XrmoptionNoArg, (void *)"True"},
{"-warranty", "*printWarranty", XrmoptionNoArg, (void *)"True"},
{ "-version", "*printVersion", XrmoptionNoArg, ( void* )"True" },
{ "-copyright", "*printCopyright", XrmoptionNoArg, ( void* )"True" },
{ "-warranty", "*printWarranty", XrmoptionNoArg, ( void* )"True" },
{"-smallFont", "*smallLabelFont", XrmoptionSepArg, (void *)0},
{"-mediumFont", "*mediumLabelFont", XrmoptionSepArg, (void *)0},
{"-largeFont", "*largeLabelFont", XrmoptionSepArg, (void *)0},
{"-connFont", "*connectionFont", XrmoptionSepArg, (void *)0},
{ "-smallFont", "*smallLabelFont", XrmoptionSepArg, ( void* )0 },
{ "-mediumFont", "*mediumLabelFont", XrmoptionSepArg, ( void* )0 },
{ "-largeFont", "*largeLabelFont", XrmoptionSepArg, ( void* )0 },
{ "-connFont", "*connectionFont", XrmoptionSepArg, ( void* )0 },
{"-verbose", "*verbose", XrmoptionNoArg, (void *)"True"},
{"-quiet", "*quiet", XrmoptionNoArg, (void *)"True"},
{ "-verbose", "*verbose", XrmoptionNoArg, ( void* )"True" },
{ "-quiet", "*quiet", XrmoptionNoArg, ( void* )"True" },
{"-terminal", "*useTerminal", XrmoptionNoArg, (void *)"True"},
{"+terminal", "*useTerminal", XrmoptionNoArg, (void *)"False"},
{"-serial", "*useSerial", XrmoptionNoArg, (void *)"True"},
{"+serial", "*useSerial", XrmoptionNoArg, (void *)"False"},
{"-line", "*serialLine", XrmoptionSepArg, (void *)0},
{ "-terminal", "*useTerminal", XrmoptionNoArg, ( void* )"True" },
{ "+terminal", "*useTerminal", XrmoptionNoArg, ( void* )"False" },
{ "-serial", "*useSerial", XrmoptionNoArg, ( void* )"True" },
{ "+serial", "*useSerial", XrmoptionNoArg, ( void* )"False" },
{ "-line", "*serialLine", XrmoptionSepArg, ( void* )0 },
{"-initialize", "*completeInitialize", XrmoptionNoArg, (void *)"True"},
{"-reset", "*resetOnStartup", XrmoptionNoArg, (void *)"True"},
{"-rom", "*romFileName", XrmoptionSepArg, (void *)0},
{"-home", "*homeDirectory", XrmoptionSepArg, (void *)0},
{ "-initialize", "*completeInitialize", XrmoptionNoArg, ( void* )"True" },
{ "-reset", "*resetOnStartup", XrmoptionNoArg, ( void* )"True" },
{ "-rom", "*romFileName", XrmoptionSepArg, ( void* )0 },
{ "-home", "*homeDirectory", XrmoptionSepArg, ( void* )0 },
{"-debug", "*useDebugger", XrmoptionNoArg, (void *)"False"},
{"+debug", "*useDebugger", XrmoptionNoArg, (void *)"True"},
{"-disasm", "*disassemblerMnemonics", XrmoptionSepArg, (void *)0},
{ "-debug", "*useDebugger", XrmoptionNoArg, ( void* )"False" },
{ "+debug", "*useDebugger", XrmoptionNoArg, ( void* )"True" },
{ "-disasm", "*disassemblerMnemonics", XrmoptionSepArg, ( void* )0 },
{"-xrm", (char *)0, XrmoptionResArg, (void *)0},
{"-netbook", "*netbook", XrmoptionNoArg, (void *)"False"},
{"+netbook", "*netbook", XrmoptionNoArg, (void *)"True"},
{ "-xrm", ( char* )0, XrmoptionResArg, ( void* )0 },
{ "-netbook", "*netbook", XrmoptionNoArg, ( void* )"False" },
{ "+netbook", "*netbook", XrmoptionNoArg, ( void* )"True" },
{"-throttle", "*throttle", XrmoptionNoArg, (void *)"False"},
{"+throttle", "*throttle", XrmoptionNoArg, (void *)"True"},
{ "-throttle", "*throttle", XrmoptionNoArg, ( void* )"False" },
{ "+throttle", "*throttle", XrmoptionNoArg, ( void* )"True" },
/*
* these are parsed for compatibility, but not used yet.
*/
{"-bg", "*background", XrmoptionSepArg, (void *)0},
{"-background", "*background", XrmoptionSepArg, (void *)0},
{"-bd", "*borderColor", XrmoptionSepArg, (void *)0},
{"-bordercolor", "*borderColor", XrmoptionSepArg, (void *)0},
{"-bw", "*borderWidth", XrmoptionSepArg, (void *)0},
{"-borderwidth", "*borderWidth", XrmoptionSepArg, (void *)0},
{"-fg", "*foreground", XrmoptionSepArg, (void *)0},
{"-foreground", "*foreground", XrmoptionSepArg, (void *)0},
{"-fn", "*fontName", XrmoptionSepArg, (void *)0},
{"-font", "*fontName", XrmoptionSepArg, (void *)0},
{"-rv", "*reverseVideo", XrmoptionNoArg, (void *)"True"},
{"+rv", "*reverseVideo", XrmoptionNoArg, (void *)"False"},
{"-reverse", "*reverseVideo", XrmoptionNoArg, (void *)"True"},
{ "-bg", "*background", XrmoptionSepArg, ( void* )0 },
{ "-background", "*background", XrmoptionSepArg, ( void* )0 },
{ "-bd", "*borderColor", XrmoptionSepArg, ( void* )0 },
{ "-bordercolor", "*borderColor", XrmoptionSepArg, ( void* )0 },
{ "-bw", "*borderWidth", XrmoptionSepArg, ( void* )0 },
{ "-borderwidth", "*borderWidth", XrmoptionSepArg, ( void* )0 },
{ "-fg", "*foreground", XrmoptionSepArg, ( void* )0 },
{ "-foreground", "*foreground", XrmoptionSepArg, ( void* )0 },
{ "-fn", "*fontName", XrmoptionSepArg, ( void* )0 },
{ "-font", "*fontName", XrmoptionSepArg, ( void* )0 },
{ "-rv", "*reverseVideo", XrmoptionNoArg, ( void* )"True" },
{ "+rv", "*reverseVideo", XrmoptionNoArg, ( void* )"False" },
{ "-reverse", "*reverseVideo", XrmoptionNoArg, ( void* )"True" },
};

View file

@ -50,487 +50,488 @@
#include "hp48.h"
#include "hp48_emu.h"
extern long nibble_masks[16];
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) {
int s;
static inline int get_start( int code ) {
int s;
if ((s = start_fields[code]) == -1) {
s = saturn.P;
}
return s;
}
static inline int get_end(int code) {
int e;
if ((e = end_fields[code]) == -1) {
e = saturn.P;
}
return e;
}
void add_register(unsigned char *res, unsigned char *r1, unsigned char *r2,
int code) {
int t, c, i, s, e;
s = get_start(code);
e = get_end(code);
c = 0;
for (i = s; i <= e; i++) {
t = r1[i] + r2[i] + c;
if (t < (int)saturn.hexmode) {
res[i] = t & 0xf;
c = 0;
} else {
res[i] = (t - saturn.hexmode) & 0xf;
c = 1;
if ( ( s = start_fields[ code ] ) == -1 ) {
s = saturn.P;
}
return s;
}
static inline int get_end( int code ) {
int e;
if ( ( e = end_fields[ code ] ) == -1 ) {
e = saturn.P;
}
return e;
}
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
int t, c, i, s, e;
s = get_start( code );
e = get_end( code );
c = 0;
for ( i = s; i <= e; i++ ) {
t = r1[ i ] + r2[ i ] + c;
if ( t < ( int )saturn.hexmode ) {
res[ i ] = t & 0xf;
c = 0;
} else {
res[ i ] = ( t - saturn.hexmode ) & 0xf;
c = 1;
}
}
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void add_p_plus_one( unsigned char* r ) {
int t, c, i, s, e;
s = 0;
e = 4;
c = saturn.P + 1;
for ( i = s; i <= e; i++ ) {
t = r[ i ] + c;
if ( t < 16 ) {
r[ i ] = t & 0xf;
c = 0;
} else {
r[ i ] = ( t - 16 ) & 0xf;
c = 1;
}
}
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
int t, c, i, s, e;
s = get_start( code );
e = get_end( code );
c = 0;
for ( i = s; i <= e; i++ ) {
t = r1[ i ] - r2[ i ] - c;
if ( t >= 0 ) {
res[ i ] = t & 0xf;
c = 0;
} else {
res[ i ] = ( t + saturn.hexmode ) & 0xf;
c = 1;
}
}
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void complement_2_register( unsigned char* r, int code ) {
int t, c, carry, i, s, e;
s = get_start( code );
e = get_end( code );
c = 1;
carry = 0;
for ( i = s; i <= e; i++ ) {
t = ( saturn.hexmode - 1 ) - r[ i ] + c;
if ( t < ( int )saturn.hexmode ) {
r[ i ] = t & 0xf;
c = 0;
} else {
r[ i ] = ( t - saturn.hexmode ) & 0xf;
c = 1;
}
carry += r[ i ];
}
if ( carry )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void complement_1_register( unsigned char* r, int code ) {
int t, i, s, e;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ ) {
t = ( saturn.hexmode - 1 ) - r[ i ];
r[ i ] = t & 0xf;
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void add_p_plus_one(unsigned char *r) {
int t, c, i, s, e;
void inc_register( unsigned char* r, int code ) {
int t, c, i, s, e;
s = 0;
e = 4;
c = saturn.P + 1;
for (i = s; i <= e; i++) {
t = r[i] + c;
if (t < 16) {
r[i] = t & 0xf;
c = 0;
} else {
r[i] = (t - 16) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
c = 1;
for ( i = s; i <= e; i++ ) {
t = r[ i ] + c;
if ( t < ( int )saturn.hexmode ) {
r[ i ] = t & 0xf;
c = 0;
break;
} else {
r[ i ] = ( t - saturn.hexmode ) & 0xf;
c = 1;
}
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void sub_register(unsigned char *res, unsigned char *r1, unsigned char *r2,
int code) {
int t, c, i, s, e;
void add_register_constant( unsigned char* r, int code, int val ) {
int t, c, i, s, e;
s = get_start(code);
e = get_end(code);
c = 0;
for (i = s; i <= e; i++) {
t = r1[i] - r2[i] - c;
if (t >= 0) {
res[i] = t & 0xf;
c = 0;
} else {
res[i] = (t + saturn.hexmode) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
c = val;
for ( i = s; i <= e; i++ ) {
t = r[ i ] + c;
if ( t < 16 ) {
r[ i ] = t & 0xf;
c = 0;
break;
} else {
r[ i ] = ( t - 16 ) & 0xf;
c = 1;
}
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void complement_2_register(unsigned char *r, int code) {
int t, c, carry, i, s, e;
void dec_register( unsigned char* r, int code ) {
int t, c, i, s, e;
s = get_start(code);
e = get_end(code);
c = 1;
carry = 0;
for (i = s; i <= e; i++) {
t = (saturn.hexmode - 1) - r[i] + c;
if (t < (int)saturn.hexmode) {
r[i] = t & 0xf;
c = 0;
} else {
r[i] = (t - saturn.hexmode) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
c = 1;
for ( i = s; i <= e; i++ ) {
t = r[ i ] - c;
if ( t >= 0 ) {
r[ i ] = t & 0xf;
c = 0;
break;
} else {
r[ i ] = ( t + saturn.hexmode ) & 0xf;
c = 1;
}
}
carry += r[i];
}
if (carry)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void complement_1_register(unsigned char *r, int code) {
int t, i, s, e;
void sub_register_constant( unsigned char* r, int code, int val ) {
int t, c, i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++) {
t = (saturn.hexmode - 1) - r[i];
r[i] = t & 0xf;
}
saturn.CARRY = 0;
}
void inc_register(unsigned char *r, int code) {
int t, c, i, s, e;
s = get_start(code);
e = get_end(code);
c = 1;
for (i = s; i <= e; i++) {
t = r[i] + c;
if (t < (int)saturn.hexmode) {
r[i] = t & 0xf;
c = 0;
break;
} else {
r[i] = (t - saturn.hexmode) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
c = val;
for ( i = s; i <= e; i++ ) {
t = r[ i ] - c;
if ( t >= 0 ) {
r[ i ] = t & 0xf;
c = 0;
break;
} else {
r[ i ] = ( t + 16 ) & 0xf;
c = 1;
}
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
if ( c )
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void add_register_constant(unsigned char *r, int code, int val) {
int t, c, i, s, e;
void zero_register( unsigned char* r, int code ) {
int i, s, e;
s = get_start(code);
e = get_end(code);
c = val;
for (i = s; i <= e; i++) {
t = r[i] + c;
if (t < 16) {
r[i] = t & 0xf;
c = 0;
break;
} else {
r[i] = (t - 16) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ )
r[ i ] = 0;
}
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
int i, s, e;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ ) {
res[ i ] = ( r1[ i ] | r2[ i ] ) & 0xf;
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void dec_register(unsigned char *r, int code) {
int t, c, i, s, e;
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
int code ) {
int i, s, e;
s = get_start(code);
e = get_end(code);
c = 1;
for (i = s; i <= e; i++) {
t = r[i] - c;
if (t >= 0) {
r[i] = t & 0xf;
c = 0;
break;
} else {
r[i] = (t + saturn.hexmode) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ ) {
res[ i ] = ( r1[ i ] & r2[ i ] ) & 0xf;
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void sub_register_constant(unsigned char *r, int code, int val) {
int t, c, i, s, e;
void copy_register( unsigned char* to, unsigned char* from, int code ) {
int i, s, e;
s = get_start(code);
e = get_end(code);
c = val;
for (i = s; i <= e; i++) {
t = r[i] - c;
if (t >= 0) {
r[i] = t & 0xf;
c = 0;
break;
} else {
r[i] = (t + 16) & 0xf;
c = 1;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ )
to[ i ] = from[ i ];
}
void exchange_register( unsigned char* r1, unsigned char* r2, int code ) {
int t, i, s, e;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ ) {
t = r1[ i ];
r1[ i ] = r2[ i ];
r2[ i ] = t;
}
}
if (c)
saturn.CARRY = 1;
else
saturn.CARRY = 0;
}
void zero_register(unsigned char *r, int code) {
int i, s, e;
void exchange_reg( unsigned char* r, word_20* d, int code ) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++)
r[i] = 0;
}
void or_register(unsigned char *res, unsigned char *r1, unsigned char *r2,
int code) {
int i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++) {
res[i] = (r1[i] | r2[i]) & 0xf;
}
}
void and_register(unsigned char *res, unsigned char *r1, unsigned char *r2,
int code) {
int i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++) {
res[i] = (r1[i] & r2[i]) & 0xf;
}
}
void copy_register(unsigned char *to, unsigned char *from, int code) {
int i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++)
to[i] = from[i];
}
void exchange_register(unsigned char *r1, unsigned char *r2, int code) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++) {
t = r1[i];
r1[i] = r2[i];
r2[i] = t;
}
}
void exchange_reg(unsigned char *r, word_20 *d, int code) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
for (i = s; i <= e; i++) {
t = r[i];
r[i] = (*d >> (i * 4)) & 0x0f;
*d &= ~nibble_masks[i];
*d |= t << (i * 4);
}
}
void shift_left_register(unsigned char *r, int code) {
int i, s, e;
s = get_start(code);
e = get_end(code);
for (i = e; i > s; i--) {
r[i] = r[i - 1] & 0x0f;
}
r[s] = 0;
}
void shift_left_circ_register(unsigned char *r, int code) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
t = r[e] & 0x0f;
for (i = e; i > s; i--) {
r[i] = r[i - 1] & 0x0f;
}
r[s] = t;
}
void shift_right_register(unsigned char *r, int code) {
int i, s, e;
s = get_start(code);
e = get_end(code);
if (r[s] & 0x0f)
saturn.SB = 1;
for (i = s; i < e; i++) {
r[i] = r[i + 1] & 0x0f;
}
r[e] = 0;
}
void shift_right_circ_register(unsigned char *r, int code) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
t = r[s] & 0x0f;
for (i = s; i < e; i++) {
r[i] = r[i + 1] & 0x0f;
}
r[e] = t;
if (t)
saturn.SB = 1;
}
void shift_right_bit_register(unsigned char *r, int code) {
int t, i, s, e, sb;
s = get_start(code);
e = get_end(code);
sb = 0;
for (i = e; i >= s; i--) {
t = (((r[i] >> 1) & 7) | (sb << 3)) & 0x0f;
sb = r[i] & 1;
r[i] = t;
}
if (sb)
saturn.SB = 1;
}
int is_zero_register(unsigned char *r, int code) {
int z, i, s, e;
s = get_start(code);
e = get_end(code);
z = 1;
for (i = s; i <= e; i++)
if ((r[i] & 0xf) != 0) {
z = 0;
break;
s = get_start( code );
e = get_end( code );
for ( i = s; i <= e; i++ ) {
t = r[ i ];
r[ i ] = ( *d >> ( i * 4 ) ) & 0x0f;
*d &= ~nibble_masks[ i ];
*d |= t << ( i * 4 );
}
return z;
}
int is_not_zero_register(unsigned char *r, int code) {
int z, i, s, e;
void shift_left_register( unsigned char* r, int code ) {
int i, s, e;
s = get_start(code);
e = get_end(code);
z = 0;
for (i = s; i <= e; i++)
if ((r[i] & 0xf) != 0) {
z = 1;
break;
s = get_start( code );
e = get_end( code );
for ( i = e; i > s; i-- ) {
r[ i ] = r[ i - 1 ] & 0x0f;
}
return z;
r[ s ] = 0;
}
int is_equal_register(unsigned char *r1, unsigned char *r2, int code) {
int z, i, s, e;
void shift_left_circ_register( unsigned char* r, int code ) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
z = 1;
for (i = s; i <= e; i++)
if ((r1[i] & 0xf) != (r2[i] & 0xf)) {
z = 0;
break;
s = get_start( code );
e = get_end( code );
t = r[ e ] & 0x0f;
for ( i = e; i > s; i-- ) {
r[ i ] = r[ i - 1 ] & 0x0f;
}
return z;
r[ s ] = t;
}
int is_not_equal_register(unsigned char *r1, unsigned char *r2, int code) {
int z, i, s, e;
void shift_right_register( unsigned char* r, int code ) {
int i, s, e;
s = get_start(code);
e = get_end(code);
z = 0;
for (i = s; i <= e; i++)
if ((r1[i] & 0xf) != (r2[i] & 0xf)) {
z = 1;
break;
s = get_start( code );
e = get_end( code );
if ( r[ s ] & 0x0f )
saturn.SB = 1;
for ( i = s; i < e; i++ ) {
r[ i ] = r[ i + 1 ] & 0x0f;
}
return z;
r[ e ] = 0;
}
int is_less_register(unsigned char *r1, unsigned char *r2, int code) {
int z, i, s, e;
void shift_right_circ_register( unsigned char* r, int code ) {
int t, i, s, e;
s = get_start(code);
e = get_end(code);
z = 0;
for (i = e; i >= s; i--) {
if ((int)(r1[i] & 0xf) < (int)(r2[i] & 0xf)) {
z = 1;
break;
s = get_start( code );
e = get_end( code );
t = r[ s ] & 0x0f;
for ( i = s; i < e; i++ ) {
r[ i ] = r[ i + 1 ] & 0x0f;
}
if ((int)(r1[i] & 0xf) > (int)(r2[i] & 0xf)) {
z = 0;
break;
}
}
return z;
r[ e ] = t;
if ( t )
saturn.SB = 1;
}
int is_less_or_equal_register(unsigned char *r1, unsigned char *r2, int code) {
int z, i, s, e;
void shift_right_bit_register( unsigned char* r, int code ) {
int t, i, s, e, sb;
s = get_start(code);
e = get_end(code);
z = 1;
for (i = e; i >= s; i--) {
if ((int)(r1[i] & 0xf) < (int)(r2[i] & 0xf)) {
z = 1;
break;
s = get_start( code );
e = get_end( code );
sb = 0;
for ( i = e; i >= s; i-- ) {
t = ( ( ( r[ i ] >> 1 ) & 7 ) | ( sb << 3 ) ) & 0x0f;
sb = r[ i ] & 1;
r[ i ] = t;
}
if ((int)(r1[i] & 0xf) > (int)(r2[i] & 0xf)) {
z = 0;
break;
}
}
return z;
if ( sb )
saturn.SB = 1;
}
int is_greater_register(unsigned char *r1, unsigned char *r2, int code) {
int z, i, s, e;
int is_zero_register( unsigned char* r, int code ) {
int z, i, s, e;
s = get_start(code);
e = get_end(code);
z = 0;
for (i = e; i >= s; i--) {
if ((int)(r1[i] & 0xf) > (int)(r2[i] & 0xf)) {
z = 1;
break;
}
if ((int)(r1[i] & 0xf) < (int)(r2[i] & 0xf)) {
z = 0;
break;
}
}
return z;
s = get_start( code );
e = get_end( code );
z = 1;
for ( i = s; i <= e; i++ )
if ( ( r[ i ] & 0xf ) != 0 ) {
z = 0;
break;
}
return z;
}
int is_greater_or_equal_register(unsigned char *r1, unsigned char *r2,
int code) {
int z, i, s, e;
int is_not_zero_register( unsigned char* r, int code ) {
int z, i, s, e;
s = get_start(code);
e = get_end(code);
z = 1;
for (i = e; i >= s; i--) {
if ((int)(r1[i] & 0xf) < (int)(r2[i] & 0xf)) {
z = 0;
break;
}
if ((int)(r1[i] & 0xf) > (int)(r2[i] & 0xf)) {
z = 1;
break;
}
}
return z;
s = get_start( code );
e = get_end( code );
z = 0;
for ( i = s; i <= e; i++ )
if ( ( r[ i ] & 0xf ) != 0 ) {
z = 1;
break;
}
return z;
}
int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 1;
for ( i = s; i <= e; i++ )
if ( ( r1[ i ] & 0xf ) != ( r2[ i ] & 0xf ) ) {
z = 0;
break;
}
return z;
}
int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 0;
for ( i = s; i <= e; i++ )
if ( ( r1[ i ] & 0xf ) != ( r2[ i ] & 0xf ) ) {
z = 1;
break;
}
return z;
}
int is_less_register( unsigned char* r1, unsigned char* r2, int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 0;
for ( i = e; i >= s; i-- ) {
if ( ( int )( r1[ i ] & 0xf ) < ( int )( r2[ i ] & 0xf ) ) {
z = 1;
break;
}
if ( ( int )( r1[ i ] & 0xf ) > ( int )( r2[ i ] & 0xf ) ) {
z = 0;
break;
}
}
return z;
}
int is_less_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 1;
for ( i = e; i >= s; i-- ) {
if ( ( int )( r1[ i ] & 0xf ) < ( int )( r2[ i ] & 0xf ) ) {
z = 1;
break;
}
if ( ( int )( r1[ i ] & 0xf ) > ( int )( r2[ i ] & 0xf ) ) {
z = 0;
break;
}
}
return z;
}
int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 0;
for ( i = e; i >= s; i-- ) {
if ( ( int )( r1[ i ] & 0xf ) > ( int )( r2[ i ] & 0xf ) ) {
z = 1;
break;
}
if ( ( int )( r1[ i ] & 0xf ) < ( int )( r2[ i ] & 0xf ) ) {
z = 0;
break;
}
}
return z;
}
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ) {
int z, i, s, e;
s = get_start( code );
e = get_end( code );
z = 1;
for ( i = e; i >= s; i-- ) {
if ( ( int )( r1[ i ] & 0xf ) < ( int )( r2[ i ] & 0xf ) ) {
z = 0;
break;
}
if ( ( int )( r1[ i ] & 0xf ) > ( int )( r2[ i ] & 0xf ) ) {
z = 1;
break;
}
}
return z;
}

View file

@ -59,265 +59,270 @@
#include "errors.h"
#include "resources.h"
XrmDatabase rdb = (XrmDatabase)0;
XrmDatabase rdb = ( XrmDatabase )0;
int verbose;
int quiet;
int useTerminal;
int useSerial;
char *serialLine;
char* serialLine;
int useXShm;
int useDebugger;
int netbook;
int throttle;
int initialize;
int resetOnStartup;
char *romFileName;
char *homeDirectory;
char* romFileName;
char* homeDirectory;
void get_resources(void) {
if (get_boolean_resource("printVersion", "PrintVersion"))
show_version();
if (get_boolean_resource("printCopyright", "PrintCopyright"))
show_copyright();
if (get_boolean_resource("printWarranty", "PrintWarranty"))
show_warranty();
void get_resources( void ) {
if ( get_boolean_resource( "printVersion", "PrintVersion" ) )
show_version();
if ( get_boolean_resource( "printCopyright", "PrintCopyright" ) )
show_copyright();
if ( get_boolean_resource( "printWarranty", "PrintWarranty" ) )
show_warranty();
verbose = get_boolean_resource("verbose", "Verbose");
quiet = get_boolean_resource("quiet", "Quiet");
verbose = get_boolean_resource( "verbose", "Verbose" );
quiet = get_boolean_resource( "quiet", "Quiet" );
useXShm = get_boolean_resource("useXShm", "UseXShm");
useXShm = get_boolean_resource( "useXShm", "UseXShm" );
useTerminal = get_boolean_resource("useTerminal", "UseTerminal");
useSerial = get_boolean_resource("useSerial", "UseSerial");
serialLine = get_string_resource("serialLine", "SerialLine");
useTerminal = get_boolean_resource( "useTerminal", "UseTerminal" );
useSerial = get_boolean_resource( "useSerial", "UseSerial" );
serialLine = get_string_resource( "serialLine", "SerialLine" );
initialize = get_boolean_resource("completeInitialize", "CompleteInitialize");
resetOnStartup = get_boolean_resource("resetOnStartup", "ResetOnStartup");
romFileName = get_string_resource("romFileName", "RomFileName");
homeDirectory = get_string_resource("homeDirectory", "HomeDirectory");
initialize =
get_boolean_resource( "completeInitialize", "CompleteInitialize" );
resetOnStartup = get_boolean_resource( "resetOnStartup", "ResetOnStartup" );
romFileName = get_string_resource( "romFileName", "RomFileName" );
homeDirectory = get_string_resource( "homeDirectory", "HomeDirectory" );
useDebugger = get_boolean_resource("useDebugger", "UseDebugger");
disassembler_mode =
get_mnemonic_resource("disassemblerMnemonics", "DisassemblerMnemonics");
useDebugger = get_boolean_resource( "useDebugger", "UseDebugger" );
disassembler_mode = get_mnemonic_resource( "disassemblerMnemonics",
"DisassemblerMnemonics" );
netbook = get_boolean_resource("netbook", "Netbook");
netbook = get_boolean_resource( "netbook", "Netbook" );
throttle = get_boolean_resource("throttle", "Throttle");
throttle = get_boolean_resource( "throttle", "Throttle" );
}
char *get_string_resource_from_db(XrmDatabase db, char *name, char *class) {
XrmValue value;
char *type;
char full_name[1024], full_class[1024];
char* get_string_resource_from_db( XrmDatabase db, char* name, char* class ) {
XrmValue value;
char* type;
char full_name[ 1024 ], full_class[ 1024 ];
strcpy(full_name, res_name);
strcat(full_name, ".");
strcat(full_name, name);
strcpy(full_class, res_class);
strcat(full_class, ".");
strcat(full_class, class);
if (XrmGetResource(db, full_name, full_class, &type, &value)) {
char *str = (char *)malloc(value.size + 1);
strncpy(str, (char *)value.addr, value.size);
str[value.size] = 0;
return str;
}
return (char *)0;
strcpy( full_name, res_name );
strcat( full_name, "." );
strcat( full_name, name );
strcpy( full_class, res_class );
strcat( full_class, "." );
strcat( full_class, class );
if ( XrmGetResource( db, full_name, full_class, &type, &value ) ) {
char* str = ( char* )malloc( value.size + 1 );
strncpy( str, ( char* )value.addr, value.size );
str[ value.size ] = 0;
return str;
}
return ( char* )0;
}
char *get_string_resource(char *name, char *class) {
return get_string_resource_from_db(rdb, name, class);
char* get_string_resource( char* name, char* class ) {
return get_string_resource_from_db( rdb, name, class );
}
int get_mnemonic_resource(char *name, char *class) {
char *tmp, buf[100];
char *s = get_string_resource(name, class);
char *os = s;
int get_mnemonic_resource( char* name, char* class ) {
char *tmp, buf[ 100 ];
char* s = get_string_resource( name, class );
char* os = s;
if (!s)
if ( !s )
return CLASS_MNEMONICS;
for ( tmp = buf; *s; s++ )
*tmp++ = isupper( *s ) ? _tolower( *s ) : *s;
*tmp = 0;
free( os );
if ( !strcmp( buf, "hp" ) )
return HP_MNEMONICS;
if ( !strcmp( buf, "class" ) )
return CLASS_MNEMONICS;
fprintf( stderr, "%s: %s must be one of \'HP\' or \'class\', not %s.\n",
progname, name, buf );
return CLASS_MNEMONICS;
for (tmp = buf; *s; s++)
*tmp++ = isupper(*s) ? _tolower(*s) : *s;
*tmp = 0;
free(os);
if (!strcmp(buf, "hp"))
return HP_MNEMONICS;
if (!strcmp(buf, "class"))
return CLASS_MNEMONICS;
fprintf(stderr, "%s: %s must be one of \'HP\' or \'class\', not %s.\n",
progname, name, buf);
return CLASS_MNEMONICS;
}
int get_boolean_resource(char *name, char *class) {
char *tmp, buf[100];
char *s = get_string_resource(name, class);
char *os = s;
if (!s)
return 0;
for (tmp = buf; *s; s++)
*tmp++ = isupper(*s) ? _tolower(*s) : *s;
*tmp = 0;
free(os);
int get_boolean_resource( char* name, char* class ) {
char *tmp, buf[ 100 ];
char* s = get_string_resource( name, class );
char* os = s;
if ( !s )
return 0;
for ( tmp = buf; *s; s++ )
*tmp++ = isupper( *s ) ? _tolower( *s ) : *s;
*tmp = 0;
free( os );
if (!strcmp(buf, "on") || !strcmp(buf, "true") || !strcmp(buf, "yes"))
return 1;
if (!strcmp(buf, "off") || !strcmp(buf, "false") || !strcmp(buf, "no"))
if ( !strcmp( buf, "on" ) || !strcmp( buf, "true" ) ||
!strcmp( buf, "yes" ) )
return 1;
if ( !strcmp( buf, "off" ) || !strcmp( buf, "false" ) ||
!strcmp( buf, "no" ) )
return 0;
fprintf( stderr, "%s: %s must be boolean, not %s.\n", progname, name, buf );
return 0;
fprintf(stderr, "%s: %s must be boolean, not %s.\n", progname, name, buf);
return 0;
}
int get_integer_resource(char *name, char *class) {
int val;
char c, *s = get_string_resource(name, class);
if (!s)
int get_integer_resource( char* name, char* class ) {
int val;
char c, *s = get_string_resource( name, class );
if ( !s )
return 0;
if ( 1 == sscanf( s, " %d %c", &val, &c ) ) {
free( s );
return val;
}
fprintf( stderr, "%s: %s must be an integer, not %s.\n", progname, name,
s );
free( s );
return 0;
if (1 == sscanf(s, " %d %c", &val, &c)) {
free(s);
return val;
}
fprintf(stderr, "%s: %s must be an integer, not %s.\n", progname, name, s);
free(s);
return 0;
}
unsigned int get_pixel_resource(char *name, char *class, Display *dpy,
Colormap cmap) {
XColor color;
char *s = get_string_resource(name, class);
if (!s)
goto DEFAULT;
unsigned int get_pixel_resource( char* name, char* class, Display* dpy,
Colormap cmap ) {
XColor color;
char* s = get_string_resource( name, class );
if ( !s )
goto DEFAULT;
if (!XParseColor(dpy, cmap, s, &color)) {
fprintf(stderr, "%s: can't parse color %s\n", progname, s);
goto DEFAULT;
}
if (!XAllocColor(dpy, cmap, &color)) {
fprintf(stderr, "%s: couldn't allocate color %s\n", progname, s);
goto DEFAULT;
}
free(s);
return color.pixel;
if ( !XParseColor( dpy, cmap, s, &color ) ) {
fprintf( stderr, "%s: can't parse color %s\n", progname, s );
goto DEFAULT;
}
if ( !XAllocColor( dpy, cmap, &color ) ) {
fprintf( stderr, "%s: couldn't allocate color %s\n", progname, s );
goto DEFAULT;
}
free( s );
return color.pixel;
DEFAULT:
if (s)
free(s);
return (strcmp(class, "Background") ? WhitePixel(dpy, DefaultScreen(dpy))
: BlackPixel(dpy, DefaultScreen(dpy)));
if ( s )
free( s );
return ( strcmp( class, "Background" )
? WhitePixel( dpy, DefaultScreen( dpy ) )
: BlackPixel( dpy, DefaultScreen( dpy ) ) );
}
static Visual *pick_visual_of_class(Display *dpy, int visual_class,
unsigned int *depth) {
XVisualInfo vi_in, *vi_out;
int out_count;
static Visual* pick_visual_of_class( Display* dpy, int visual_class,
unsigned int* depth ) {
XVisualInfo vi_in, *vi_out;
int out_count;
vi_in.class = visual_class;
vi_in.screen = DefaultScreen(dpy);
vi_out = XGetVisualInfo(dpy, VisualClassMask | VisualScreenMask, &vi_in,
&out_count);
if (vi_out) { /* choose the 'best' one, if multiple */
int i, best;
Visual *visual;
for (i = 0, best = 0; i < out_count; i++)
if (vi_out[i].depth > vi_out[best].depth)
best = i;
visual = vi_out[best].visual;
*depth = vi_out[best].depth;
XFree((char *)vi_out);
return visual;
} else {
*depth = DefaultDepth(dpy, DefaultScreen(dpy));
return DefaultVisual(dpy, DefaultScreen(dpy));
}
vi_in.class = visual_class;
vi_in.screen = DefaultScreen( dpy );
vi_out = XGetVisualInfo( dpy, VisualClassMask | VisualScreenMask, &vi_in,
&out_count );
if ( vi_out ) { /* choose the 'best' one, if multiple */
int i, best;
Visual* visual;
for ( i = 0, best = 0; i < out_count; i++ )
if ( vi_out[ i ].depth > vi_out[ best ].depth )
best = i;
visual = vi_out[ best ].visual;
*depth = vi_out[ best ].depth;
XFree( ( char* )vi_out );
return visual;
} else {
*depth = DefaultDepth( dpy, DefaultScreen( dpy ) );
return DefaultVisual( dpy, DefaultScreen( dpy ) );
}
}
static Visual *id_to_visual(Display *dpy, int id, unsigned int *depth) {
XVisualInfo vi_in, *vi_out;
int out_count;
static Visual* id_to_visual( Display* dpy, int id, unsigned int* depth ) {
XVisualInfo vi_in, *vi_out;
int out_count;
vi_in.screen = DefaultScreen(dpy);
vi_in.visualid = id;
vi_out =
XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, &vi_in, &out_count);
if (vi_out) {
Visual *v = vi_out[0].visual;
*depth = vi_out[0].depth;
XFree((char *)vi_out);
return v;
}
return 0;
vi_in.screen = DefaultScreen( dpy );
vi_in.visualid = id;
vi_out = XGetVisualInfo( dpy, VisualScreenMask | VisualIDMask, &vi_in,
&out_count );
if ( vi_out ) {
Visual* v = vi_out[ 0 ].visual;
*depth = vi_out[ 0 ].depth;
XFree( ( char* )vi_out );
return v;
}
return 0;
}
Visual *get_visual_resource(Display *dpy, char *name, char *class,
unsigned int *depth) {
char c;
char *tmp, *s;
int vclass;
int id;
Visual* get_visual_resource( Display* dpy, char* name, char* class,
unsigned int* depth ) {
char c;
char *tmp, *s;
int vclass;
int id;
s = get_string_resource(name, class);
if (s)
for (tmp = s; *tmp; tmp++)
if (isupper(*tmp))
*tmp = _tolower(*tmp);
s = get_string_resource( name, class );
if ( s )
for ( tmp = s; *tmp; tmp++ )
if ( isupper( *tmp ) )
*tmp = _tolower( *tmp );
if (!s || !strcmp(s, "default"))
vclass = -1;
else if (!strcmp(s, "staticgray"))
vclass = StaticGray;
else if (!strcmp(s, "staticcolor"))
vclass = StaticColor;
else if (!strcmp(s, "truecolor"))
vclass = TrueColor;
else if (!strcmp(s, "grayscale"))
vclass = GrayScale;
else if (!strcmp(s, "pseudocolor"))
vclass = PseudoColor;
else if (!strcmp(s, "directcolor"))
vclass = DirectColor;
else if (1 == sscanf(s, " %d %c", &id, &c))
vclass = -2;
else if (1 == sscanf(s, " 0x%x %c", &id, &c))
vclass = -2;
else {
fprintf(stderr, "%s: unrecognized visual \"%s\".\n", progname, s);
vclass = -1;
}
if (s)
free(s);
if ( !s || !strcmp( s, "default" ) )
vclass = -1;
else if ( !strcmp( s, "staticgray" ) )
vclass = StaticGray;
else if ( !strcmp( s, "staticcolor" ) )
vclass = StaticColor;
else if ( !strcmp( s, "truecolor" ) )
vclass = TrueColor;
else if ( !strcmp( s, "grayscale" ) )
vclass = GrayScale;
else if ( !strcmp( s, "pseudocolor" ) )
vclass = PseudoColor;
else if ( !strcmp( s, "directcolor" ) )
vclass = DirectColor;
else if ( 1 == sscanf( s, " %d %c", &id, &c ) )
vclass = -2;
else if ( 1 == sscanf( s, " 0x%x %c", &id, &c ) )
vclass = -2;
else {
fprintf( stderr, "%s: unrecognized visual \"%s\".\n", progname, s );
vclass = -1;
}
if ( s )
free( s );
if (vclass == -1) {
*depth = DefaultDepth(dpy, DefaultScreen(dpy));
return DefaultVisual(dpy, DefaultScreen(dpy));
} else if (vclass == -2) {
Visual *v = id_to_visual(dpy, id, depth);
if (v)
return v;
fprintf(stderr, "%s: no visual with id 0x%x.\n", progname, id);
*depth = DefaultDepth(dpy, DefaultScreen(dpy));
return DefaultVisual(dpy, DefaultScreen(dpy));
} else
return pick_visual_of_class(dpy, vclass, depth);
if ( vclass == -1 ) {
*depth = DefaultDepth( dpy, DefaultScreen( dpy ) );
return DefaultVisual( dpy, DefaultScreen( dpy ) );
} else if ( vclass == -2 ) {
Visual* v = id_to_visual( dpy, id, depth );
if ( v )
return v;
fprintf( stderr, "%s: no visual with id 0x%x.\n", progname, id );
*depth = DefaultDepth( dpy, DefaultScreen( dpy ) );
return DefaultVisual( dpy, DefaultScreen( dpy ) );
} else
return pick_visual_of_class( dpy, vclass, depth );
}
XFontStruct *get_font_resource(Display *dpy, char *name, char *class) {
char *s;
XFontStruct *f = (XFontStruct *)0;
XFontStruct* get_font_resource( Display* dpy, char* name, char* class ) {
char* s;
XFontStruct* f = ( XFontStruct* )0;
s = get_string_resource(name, class);
s = get_string_resource( name, class );
if (s)
f = XLoadQueryFont(dpy, s);
else {
sprintf(errbuf, "can\'t get resource \'%s\'", name);
fatal_exit();
}
if (f == (XFontStruct *)0) {
sprintf(errbuf, "can\'t load font \'%s\'", s);
sprintf(fixbuf, "Please change resource \'%s\'", name);
fatal_exit();
}
return f;
if ( s )
f = XLoadQueryFont( dpy, s );
else {
sprintf( errbuf, "can\'t get resource \'%s\'", name );
fatal_exit();
}
if ( f == ( XFontStruct* )0 ) {
sprintf( errbuf, "can\'t load font \'%s\'", s );
sprintf( fixbuf, "Please change resource \'%s\'", name );
fatal_exit();
}
return f;
}

View file

@ -49,47 +49,47 @@ extern int useXShm;
extern int useDebugger;
extern int netbook;
extern int throttle;
extern char *serialLine;
extern char* serialLine;
extern int initialize;
extern int resetOnStartup;
extern char *romFileName;
extern char *homeDirectory;
extern char* romFileName;
extern char* homeDirectory;
extern char *progname;
extern char *res_name;
extern char *res_class;
extern char* progname;
extern char* res_name;
extern char* res_class;
extern XrmDatabase rdb;
extern void usage __ProtoType__((void));
extern void show_version __ProtoType__((void));
extern void show_copyright __ProtoType__((void));
extern void show_warranty __ProtoType__((void));
extern void get_resources __ProtoType__((void));
extern char *get_string_resource_from_db __ProtoType__((XrmDatabase db,
char *name,
char *class));
extern char *get_string_resource __ProtoType__((char *name, char *class));
extern int get_boolean_resource __ProtoType__((char *name, char *class));
extern int get_mnemonic_resource __ProtoType__((char *name, char *class));
extern Visual *get_visual_resource __ProtoType__((Display * dpy, char *name,
char *class,
unsigned int *depth));
extern XFontStruct *get_font_resource __ProtoType__((Display * dpy,
char *res_name,
char *res_class));
extern void usage __ProtoType__( ( void ));
extern void show_version __ProtoType__( ( void ));
extern void show_copyright __ProtoType__( ( void ));
extern void show_warranty __ProtoType__( ( void ));
extern void get_resources __ProtoType__( ( void ));
extern char* get_string_resource_from_db __ProtoType__( ( XrmDatabase db,
char* name,
char* class ) );
extern char* get_string_resource __ProtoType__( ( char* name, char* class ) );
extern int get_boolean_resource __ProtoType__( ( char* name, char* class ) );
extern int get_mnemonic_resource __ProtoType__( ( char* name, char* class ) );
extern Visual* get_visual_resource __ProtoType__( ( Display * dpy, char* name,
char* class,
unsigned int* depth ) );
extern XFontStruct* get_font_resource __ProtoType__( ( Display * dpy,
char* res_name,
char* res_class ) );
#ifndef isupper
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define isupper( c ) ( ( c ) >= 'A' && ( c ) <= 'Z' )
#endif
#ifndef islower
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#define islower( c ) ( ( c ) >= 'a' && ( c ) <= 'z' )
#endif
#ifndef _tolower
#define _tolower(c) ((c) - 'A' + 'a')
#define _tolower( c ) ( ( c ) - 'A' + 'a' )
#endif
#ifndef _toupper
#define _toupper(c) ((c) - 'a' + 'A')
#define _toupper( c ) ( ( c ) - 'a' + 'A' )
#endif
#endif /* !_RESOURCES_H */

View file

@ -37,156 +37,157 @@
unsigned int opt_gx = 0;
unsigned int rom_size = 0;
int read_rom_file(char *name, unsigned char **mem, int *size) {
struct stat st;
FILE *fp;
unsigned char *tmp_mem;
unsigned char byte;
unsigned char four[4];
int i, j;
int read_rom_file( char* name, unsigned char** mem, int* size ) {
struct stat st;
FILE* fp;
unsigned char* tmp_mem;
unsigned char byte;
unsigned char four[ 4 ];
int i, j;
*mem = NULL;
*size = 0;
if (NULL == (fp = fopen(name, "r"))) {
fprintf(stderr, "can\'t open %s\n", name);
return 0;
}
if (stat(name, &st) < 0) {
fprintf(stderr, "can\'t stat %s\n", name);
fclose(fp);
return 0;
}
if (fread(four, 1, 4, fp) != 4) {
fprintf(stderr, "can\'t read first 4 bytes of %s\n", name);
fclose(fp);
return 0;
}
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) {
*size = 2 * st.st_size;
} else if (four[1] = 0x49) {
fprintf(stderr, "%s is an HP49 ROM\n", name);
*size = 2 * st.st_size;
} else if (four[0]) {
printf("%d\n", st.st_size);
*size = st.st_size;
} else {
fprintf(stderr, "%s is not a HP48 ROM\n", name);
fclose(fp);
return 0;
}
if (fseek(fp, 0, 0) < 0) {
fprintf(stderr, "can\'t fseek to position 0 in %s\n", name);
*mem = NULL;
*size = 0;
fclose(fp);
return 0;
}
*mem = (unsigned char *)malloc(*size);
if (st.st_size == *size) {
/*
* size is same as memory size, old version file
*/
if (fread(*mem, 1, (size_t)*size, fp) != *size) {
fprintf(stderr, "can\'t read %s\n", name);
free(*mem);
*mem = NULL;
*size = 0;
fclose(fp);
return 0;
}
} else {
/*
* size is different, check size and decompress memory
*/
if (st.st_size != *size / 2) {
fprintf(stderr, "strange size %s, expected %d, found %ld\n", name,
*size / 2, st.st_size);
free(*mem);
*mem = NULL;
*size = 0;
fclose(fp);
return 0;
}
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);
free(*mem);
*mem = NULL;
*size = 0;
fclose(fp);
return 0;
}
(*mem)[j++] = byte & 0xf;
(*mem)[j++] = (byte >> 4) & 0xf;
}
} else {
if (fread(tmp_mem, 1, (size_t)*size / 2, fp) != *size / 2) {
fprintf(stderr, "can\'t read %s\n", name);
free(*mem);
*mem = NULL;
*size = 0;
fclose(fp);
free(tmp_mem);
if ( NULL == ( fp = fopen( name, "r" ) ) ) {
fprintf( stderr, "can\'t open %s\n", name );
return 0;
}
for (i = 0, j = 0; i < *size / 2; i++) {
(*mem)[j++] = tmp_mem[i] & 0xf;
(*mem)[j++] = (tmp_mem[i] >> 4) & 0xf;
}
free(tmp_mem);
}
}
fclose(fp);
if ( stat( name, &st ) < 0 ) {
fprintf( stderr, "can\'t stat %s\n", name );
fclose( fp );
return 0;
}
if ((*mem)[0x29] == 0x00) {
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);
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);
opt_gx = 2;
if ( fread( four, 1, 4, fp ) != 4 ) {
fprintf( stderr, "can\'t read first 4 bytes of %s\n", name );
fclose( fp );
return 0;
}
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 ) {
*size = 2 * st.st_size;
} else if ( four[ 1 ] = 0x49 ) {
fprintf( stderr, "%s is an HP49 ROM\n", name );
*size = 2 * st.st_size;
} else if ( four[ 0 ] ) {
printf( "%d\n", st.st_size );
*size = st.st_size;
} else {
fprintf(stderr, "%s seems to be G/GX ROM, but size is 0x%x\n", name,
*size);
free(*mem);
*mem = NULL;
*size = 0;
return 0;
fprintf( stderr, "%s is not a HP48 ROM\n", name );
fclose( fp );
return 0;
}
} else {
if (*size == ROM_SIZE_SX) {
opt_gx = 0;
if ( fseek( fp, 0, 0 ) < 0 ) {
fprintf( stderr, "can\'t fseek to position 0 in %s\n", name );
*size = 0;
fclose( fp );
return 0;
}
*mem = ( unsigned char* )malloc( *size );
if ( st.st_size == *size ) {
/*
* size is same as memory size, old version file
*/
if ( fread( *mem, 1, ( size_t )*size, fp ) != *size ) {
fprintf( stderr, "can\'t read %s\n", name );
free( *mem );
*mem = NULL;
*size = 0;
fclose( fp );
return 0;
}
} else {
fprintf(stderr, "%s seems to be S/SX ROM, but size is 0x%x\n", name,
*size);
free(*mem);
*mem = NULL;
*size = 0;
return 0;
/*
* size is different, check size and decompress memory
*/
if ( st.st_size != *size / 2 ) {
fprintf( stderr, "strange size %s, expected %d, found %ld\n", name,
*size / 2, st.st_size );
free( *mem );
*mem = NULL;
*size = 0;
fclose( fp );
return 0;
}
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 );
free( *mem );
*mem = NULL;
*size = 0;
fclose( fp );
return 0;
}
( *mem )[ j++ ] = byte & 0xf;
( *mem )[ j++ ] = ( byte >> 4 ) & 0xf;
}
} else {
if ( fread( tmp_mem, 1, ( size_t )*size / 2, fp ) != *size / 2 ) {
fprintf( stderr, "can\'t read %s\n", name );
free( *mem );
*mem = NULL;
*size = 0;
fclose( fp );
free( tmp_mem );
return 0;
}
for ( i = 0, j = 0; i < *size / 2; i++ ) {
( *mem )[ j++ ] = tmp_mem[ i ] & 0xf;
( *mem )[ j++ ] = ( tmp_mem[ i ] >> 4 ) & 0xf;
}
free( tmp_mem );
}
}
}
if (verbose)
printf("%s: read %s\n", progname, name);
fclose( fp );
return 1;
if ( ( *mem )[ 0x29 ] == 0x00 ) {
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 );
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 );
opt_gx = 2;
} else {
fprintf( stderr, "%s seems to be G/GX ROM, but size is 0x%x\n",
name, *size );
free( *mem );
*mem = NULL;
*size = 0;
return 0;
}
} else {
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 );
free( *mem );
*mem = NULL;
*size = 0;
return 0;
}
}
if ( verbose )
printf( "%s: read %s\n", progname, name );
return 1;
}

View file

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

2094
src/rpl.c

File diff suppressed because it is too large Load diff

View file

@ -93,40 +93,40 @@
#define UM_END 0x10b86 /* Unit Operator _ */
typedef struct hp_real {
word_20 x;
word_32 ml;
word_32 mh;
word_4 m;
word_1 s;
word_20 x;
word_32 ml;
word_32 mh;
word_4 m;
word_1 s;
} hp_real;
extern char *decode_rpl_obj __ProtoType__((word_20 addr, char *buf));
extern void decode_rpl_obj_2 __ProtoType__((word_20 addr, char *typ,
char *dat));
extern char* decode_rpl_obj __ProtoType__( ( word_20 addr, char* buf ) );
extern void decode_rpl_obj_2 __ProtoType__( ( word_20 addr, char* typ,
char* dat ) );
extern char *skip_ob __ProtoType__((word_20 * addr, char *string));
extern char *dec_rpl_obj __ProtoType__((word_20 * addr, char *string));
extern char *dec_bin_int __ProtoType__((word_20 * addr, char *string));
extern char *dec_real __ProtoType__((word_20 * addr, char *string));
extern char *dec_long_real __ProtoType__((word_20 * addr, char *string));
extern char *dec_complex __ProtoType__((word_20 * addr, char *string));
extern char *dec_long_complex __ProtoType__((word_20 * addr, char *string));
extern char *dec_char __ProtoType__((word_20 * addr, char *string));
extern char *dec_array __ProtoType__((word_20 * addr, char *string));
extern char *dec_lnk_array __ProtoType__((word_20 * addr, char *string));
extern char *dec_string __ProtoType__((word_20 * addr, char *string));
extern char *dec_hex_string __ProtoType__((word_20 * addr, char *string));
extern char *dec_list __ProtoType__((word_20 * addr, char *string));
extern char *dec_symb __ProtoType__((word_20 * addr, char *string));
extern char *dec_unit __ProtoType__((word_20 * addr, char *string));
extern char *dec_library __ProtoType__((word_20 * addr, char *string));
extern char *dec_library_data __ProtoType__((word_20 * addr, char *string));
extern char *dec_acptr __ProtoType__((word_20 * addr, char *string));
extern char *dec_prog __ProtoType__((word_20 * addr, char *string));
extern char *dec_code __ProtoType__((word_20 * addr, char *string));
extern char *dec_global_ident __ProtoType__((word_20 * addr, char *string));
extern char *dec_local_ident __ProtoType__((word_20 * addr, char *string));
extern char *dec_xlib_name __ProtoType__((word_20 * addr, char *string));
extern char *dec_unit_op __ProtoType__((word_20 * addr, char *string));
extern char* skip_ob __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_rpl_obj __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_bin_int __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_real __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_long_real __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_complex __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_long_complex __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_char __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_array __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_lnk_array __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_string __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_hex_string __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_list __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_symb __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_unit __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_library __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_library_data __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_acptr __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_prog __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_code __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_global_ident __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_local_ident __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_xlib_name __ProtoType__( ( word_20 * addr, char* string ) );
extern char* dec_unit_op __ProtoType__( ( word_20 * addr, char* string ) );
#endif /* !_RPL_H */

File diff suppressed because it is too large Load diff

View file

@ -48,525 +48,493 @@
#define blank_width 4
#define blank_height 7
static unsigned char blank_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char blank_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
#define hash_width 5
#define hash_height 7
static unsigned char hash_bits[] = {
0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a};
static unsigned char hash_bits[] = { 0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a };
#define lbrace_width 3
#define lbrace_height 7
static unsigned char lbrace_bits[] = {
0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04};
static unsigned char lbrace_bits[] = { 0x04, 0x02, 0x01, 0x01,
0x01, 0x02, 0x04 };
#define rbrace_width 3
#define rbrace_height 7
static unsigned char rbrace_bits[] = {
0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01};
static unsigned char rbrace_bits[] = { 0x01, 0x02, 0x04, 0x04,
0x04, 0x02, 0x01 };
#define comma_width 3
#define comma_height 7
static unsigned char comma_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x03};
static unsigned char comma_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x06, 0x06, 0x03 };
#define slash_width 3
#define slash_height 7
static unsigned char slash_bits[] = {
0x04, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01};
static unsigned char slash_bits[] = { 0x04, 0x04, 0x02, 0x02,
0x02, 0x01, 0x01 };
#define two_width 5
#define two_height 7
static unsigned char two_bits[] = {
0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f};
static unsigned char two_bits[] = { 0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f };
#define three_width 5
#define three_height 7
static unsigned char three_bits[] = {
0x0e, 0x11, 0x10, 0x0c, 0x10, 0x11, 0x0e};
static unsigned char three_bits[] = { 0x0e, 0x11, 0x10, 0x0c,
0x10, 0x11, 0x0e };
#define small_colon_width 2
#define small_colon_height 7
static unsigned char small_colon_bits[] = {
0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00};
static unsigned char small_colon_bits[] = { 0x00, 0x03, 0x03, 0x00,
0x03, 0x03, 0x00 };
#define A_width 5
#define A_height 7
static unsigned char A_bits[] = {
0x0e, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11};
static unsigned char A_bits[] = { 0x0e, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11 };
#define B_width 5
#define B_height 7
static unsigned char B_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x11, 0x11, 0x0f};
static unsigned char B_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x11, 0x11, 0x0f };
#define C_width 5
#define C_height 7
static unsigned char C_bits[] = {
0x0e, 0x11, 0x01, 0x01, 0x01, 0x11, 0x0e};
static unsigned char C_bits[] = { 0x0e, 0x11, 0x01, 0x01, 0x01, 0x11, 0x0e };
#define D_width 5
#define D_height 7
static unsigned char D_bits[] = {
0x0f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0f};
static unsigned char D_bits[] = { 0x0f, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0f };
#define E_width 5
#define E_height 7
static unsigned char E_bits[] = {
0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x1f};
static unsigned char E_bits[] = { 0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x1f };
#define F_width 5
#define F_height 7
static unsigned char F_bits[] = {
0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x01};
static unsigned char F_bits[] = { 0x1f, 0x01, 0x01, 0x0f, 0x01, 0x01, 0x01 };
#define G_width 5
#define G_height 7
static unsigned char G_bits[] = {
0x0e, 0x11, 0x01, 0x01, 0x19, 0x11, 0x0e};
static unsigned char G_bits[] = { 0x0e, 0x11, 0x01, 0x01, 0x19, 0x11, 0x0e };
#define H_width 5
#define H_height 7
static unsigned char H_bits[] = {
0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11};
static unsigned char H_bits[] = { 0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11 };
#define I_width 1
#define I_height 7
static unsigned char I_bits[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
static unsigned char I_bits[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
#define J_width 4
#define J_height 7
static unsigned char J_bits[] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x06};
static unsigned char J_bits[] = { 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x06 };
#define K_width 5
#define K_height 7
static unsigned char K_bits[] = {
0x11, 0x09, 0x05, 0x03, 0x05, 0x09, 0x11};
static unsigned char K_bits[] = { 0x11, 0x09, 0x05, 0x03, 0x05, 0x09, 0x11 };
#define L_width 4
#define L_height 7
static unsigned char L_bits[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0f};
static unsigned char L_bits[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0f };
#define M_width 5
#define M_height 7
static unsigned char M_bits[] = {
0x11, 0x1b, 0x15, 0x11, 0x11, 0x11, 0x11};
static unsigned char M_bits[] = { 0x11, 0x1b, 0x15, 0x11, 0x11, 0x11, 0x11 };
#define N_width 5
#define N_height 7
static unsigned char N_bits[] = {
0x11, 0x11, 0x13, 0x15, 0x19, 0x11, 0x11};
static unsigned char N_bits[] = { 0x11, 0x11, 0x13, 0x15, 0x19, 0x11, 0x11 };
#define O_width 5
#define O_height 7
static unsigned char O_bits[] = {
0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e};
static unsigned char O_bits[] = { 0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e };
#define P_width 5
#define P_height 7
static unsigned char P_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x01, 0x01, 0x01};
static unsigned char P_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x01, 0x01, 0x01 };
#define Q_width 5
#define Q_height 7
static unsigned char Q_bits[] = {
0x0e, 0x11, 0x11, 0x11, 0x15, 0x09, 0x16};
static unsigned char Q_bits[] = { 0x0e, 0x11, 0x11, 0x11, 0x15, 0x09, 0x16 };
#define R_width 5
#define R_height 7
static unsigned char R_bits[] = {
0x0f, 0x11, 0x11, 0x0f, 0x05, 0x09, 0x11};
static unsigned char R_bits[] = { 0x0f, 0x11, 0x11, 0x0f, 0x05, 0x09, 0x11 };
#define S_width 5
#define S_height 7
static unsigned char S_bits[] = {
0x0e, 0x11, 0x01, 0x0e, 0x10, 0x11, 0x0e};
static unsigned char S_bits[] = { 0x0e, 0x11, 0x01, 0x0e, 0x10, 0x11, 0x0e };
#define T_width 5
#define T_height 7
static unsigned char T_bits[] = {
0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04};
static unsigned char T_bits[] = { 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };
#define U_width 5
#define U_height 7
static unsigned char U_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e};
static unsigned char U_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e };
#define V_width 5
#define V_height 7
static unsigned char V_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x0a, 0x0a, 0x04};
static unsigned char V_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x0a, 0x0a, 0x04 };
#define W_width 5
#define W_height 7
static unsigned char W_bits[] = {
0x11, 0x11, 0x11, 0x11, 0x15, 0x1b, 0x11};
static unsigned char W_bits[] = { 0x11, 0x11, 0x11, 0x11, 0x15, 0x1b, 0x11 };
#define X_width 5
#define X_height 7
static unsigned char X_bits[] = {
0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11};
static unsigned char X_bits[] = { 0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11 };
#define Y_width 5
#define Y_height 7
static unsigned char Y_bits[] = {
0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x04};
static unsigned char Y_bits[] = { 0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x04 };
#define Z_width 5
#define Z_height 7
static unsigned char Z_bits[] = {
0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f};
static unsigned char Z_bits[] = { 0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f };
#define lbracket_width 3
#define lbracket_height 7
static unsigned char lbracket_bits[] = {
0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07};
static unsigned char lbracket_bits[] = { 0x07, 0x01, 0x01, 0x01,
0x01, 0x01, 0x07 };
#define rbracket_width 3
#define rbracket_height 7
static unsigned char rbracket_bits[] = {
0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07};
static unsigned char rbracket_bits[] = { 0x07, 0x04, 0x04, 0x04,
0x04, 0x04, 0x07 };
#define arrow_width 7
#define arrow_height 7
static unsigned char arrow_bits[] = {
0x00, 0x08, 0x18, 0x3f, 0x18, 0x08, 0x00};
static unsigned char arrow_bits[] = { 0x00, 0x08, 0x18, 0x3f,
0x18, 0x08, 0x00 };
#define diff_width 5
#define diff_height 7
static unsigned char diff_bits[] = {
0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e};
static unsigned char diff_bits[] = { 0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e };
#define integral_width 5
#define integral_height 8
static unsigned char integral_bits[] = {
0x0c, 0x12, 0x02, 0x04, 0x04, 0x08, 0x09, 0x06};
static unsigned char integral_bits[] = { 0x0c, 0x12, 0x02, 0x04,
0x04, 0x08, 0x09, 0x06 };
#define sigma_width 6
#define sigma_height 9
static unsigned char sigma_bits[] = {
0x3f, 0x21, 0x02, 0x04, 0x08, 0x04, 0x02, 0x21, 0x3f};
static unsigned char sigma_bits[] = { 0x3f, 0x21, 0x02, 0x04, 0x08,
0x04, 0x02, 0x21, 0x3f };
#define sqr_width 11
#define sqr_height 10
static unsigned char sqr_bits[] = {
0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x26, 0x01, 0x94, 0x07,
0x08, 0x00, 0x14, 0x00, 0x53, 0x00, 0x21, 0x00};
static unsigned char sqr_bits[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x26, 0x01, 0x94, 0x07, 0x08, 0x00,
0x14, 0x00, 0x53, 0x00, 0x21, 0x00 };
#define root_width 18
#define root_height 13
static unsigned char root_bits[] = {
0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14, 0x02, 0x02,
0x53, 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91, 0x00, 0x10, 0x91, 0x00,
0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00, 0x80, 0x20, 0x00, 0x00, 0x14, 0x00,
0x00, 0x0c, 0x00};
0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14,
0x02, 0x02, 0x53, 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91,
0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00,
0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 };
#define pow10_width 13
#define pow10_height 9
static unsigned char pow10_bits[] = {
0x00, 0x12, 0x00, 0x0c, 0x32, 0x04, 0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00,
0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00};
static unsigned char pow10_bits[] = { 0x00, 0x12, 0x00, 0x0c, 0x32, 0x04,
0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00,
0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 };
#define exp_width 11
#define exp_height 9
static unsigned char exp_bits[] = {
0x80, 0x04, 0x00, 0x03, 0x00, 0x01, 0x8c, 0x02, 0x52, 0x02, 0x09, 0x00,
0x07, 0x00, 0x21, 0x00, 0x1e, 0x00};
static unsigned char exp_bits[] = { 0x80, 0x04, 0x00, 0x03, 0x00, 0x01,
0x8c, 0x02, 0x52, 0x02, 0x09, 0x00,
0x07, 0x00, 0x21, 0x00, 0x1e, 0x00 };
#define under_width 6
#define under_height 7
static unsigned char under_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f};
static unsigned char under_bits[] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f };
#define prog_width 16
#define prog_height 7
static unsigned char prog_bits[] = {
0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09, 0x90, 0x12, 0x48, 0x24, 0x24,
0x48, 0x12};
static unsigned char prog_bits[] = { 0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09,
0x90, 0x12, 0x48, 0x24, 0x24, 0x48, 0x12 };
#define string_width 10
#define string_height 7
static unsigned char string_bits[] = {
0x85, 0x02, 0x85, 0x02, 0x85, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00};
static unsigned char string_bits[] = { 0x85, 0x02, 0x85, 0x02, 0x85,
0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
#define equal_width 5
#define equal_height 7
static unsigned char equal_bits[] = {
0x00, 0x1f, 0x00, 0x00, 0x1f, 0x00, 0x00};
static unsigned char equal_bits[] = { 0x00, 0x1f, 0x00, 0x00,
0x1f, 0x00, 0x00 };
#define nl_width 8
#define nl_height 7
static unsigned char nl_bits[] = {
0x00, 0x84, 0x86, 0xff, 0x06, 0x04, 0x00};
static unsigned char nl_bits[] = { 0x00, 0x84, 0x86, 0xff, 0x06, 0x04, 0x00 };
#define pi_width 6
#define pi_height 7
static unsigned char pi_bits[] = {
0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12};
static unsigned char pi_bits[] = { 0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12 };
#define angle_width 8
#define angle_height 7
static unsigned char angle_bits[] = {
0x40, 0x20, 0x10, 0x28, 0x44, 0x42, 0xff};
static unsigned char angle_bits[] = { 0x40, 0x20, 0x10, 0x28,
0x44, 0x42, 0xff };
#define lcurly_width 5
#define lcurly_height 7
static unsigned char lcurly_bits[] = {
0x18, 0x04, 0x04, 0x02, 0x04, 0x04, 0x18};
static unsigned char lcurly_bits[] = { 0x18, 0x04, 0x04, 0x02,
0x04, 0x04, 0x18 };
#define rcurly_width 5
#define rcurly_height 7
static unsigned char rcurly_bits[] = {
0x03, 0x04, 0x04, 0x08, 0x04, 0x04, 0x03};
static unsigned char rcurly_bits[] = { 0x03, 0x04, 0x04, 0x08,
0x04, 0x04, 0x03 };
#define sqr_gx_width 11
#define sqr_gx_height 13
static unsigned char sqr_gx_bits[] = {
0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x80, 0x07,
0x00, 0x00, 0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14, 0x00, 0x53, 0x00,
0x21, 0x00};
static unsigned char sqr_gx_bits[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x00, 0x01, 0x80, 0x07, 0x00, 0x00,
0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14,
0x00, 0x53, 0x00, 0x21, 0x00 };
#define root_gx_width 18
#define root_gx_height 15
static unsigned char root_gx_bits[] = {
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};
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_bits[] = {
0x00, 0x12, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x09, 0x32, 0x00,
0x4b, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00};
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_bits[] = {
0x00, 0xfb, 0x00, 0xf6, 0x00, 0xe6, 0x00, 0xf6, 0x80, 0xed, 0x18, 0xe0,
0x36, 0xe0, 0x36, 0xe0, 0x1f, 0xe0, 0x03, 0xe0, 0x13, 0xe0, 0x0e, 0xe0};
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_bits[] = {
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};
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_bits[] = {
0x00, 0x00, 0x48, 0x48, 0xfe, 0x24, 0x24, 0x7f, 0x12, 0x12, 0x00, 0x00};
static unsigned char hash_gx_bits[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24,
0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 };
#define bracket_gx_width 12
#define bracket_gx_height 12
static unsigned char bracket_gx_bits[] = {
0x0f, 0x0f, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c,
0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x0f, 0x0f};
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_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03};
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_bits[] = {
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};
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_bits[] = {
0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
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_bits[] = {
0x0c, 0x0c, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x03, 0x30,
0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x0c, 0x0c};
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_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00};
static unsigned char colon_gx_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3,
0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 };
#define angle_gx_width 12
#define angle_gx_height 12
static unsigned char angle_gx_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x01,
0xb0, 0x03, 0x18, 0x03, 0x0c, 0x03, 0x06, 0x03, 0xff, 0x0f, 0xff, 0x0f};
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_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x03, 0xff, 0x01,
0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00};
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_bits[] = {
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};
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_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x04, 0x04, 0x02};
static unsigned char comma_gx_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x07, 0x07, 0x04, 0x04, 0x02 };
#define arrow_gx_width 18
#define arrow_gx_height 12
static unsigned char arrow_gx_bits[] = {
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};
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_bits[] = {
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00};
static unsigned char equal_gx_bits[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
0x00, 0xff, 0xff, 0x00, 0x00, 0x00 };
typedef struct letter_t {
unsigned int w, h;
unsigned char *bits;
unsigned int w, h;
unsigned char* bits;
} letter_t;
letter_t small_font[] = {
{0, 0, 0},
{nl_gx_width, nl_gx_height, nl_gx_bits}, /* \001 == \n gx */
{comma_gx_width, comma_gx_height, comma_gx_bits}, /* \002 == comma gx */
{arrow_gx_width, arrow_gx_height, arrow_gx_bits}, /* \003 == \-> gx */
{equal_gx_width, equal_gx_height, equal_gx_bits}, /* \004 == equal gx */
{pi_gx_width, pi_gx_height, pi_gx_bits}, /* \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_bits}, /* # 32 */
{0, 0, 0},
{0, 0, 0},
{hash_width, hash_height, hash_bits},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{lbrace_width, lbrace_height, lbrace_bits},
{rbrace_width, rbrace_height, rbrace_bits},
{0, 0, 0},
{0, 0, 0},
{comma_width, comma_height, comma_bits},
{0, 0, 0},
{0, 0, 0},
{slash_width, slash_height, slash_bits},
{0, 0, 0}, /* # 48 */
{0, 0, 0},
{two_width, two_height, two_bits},
{three_width, three_height, three_bits},
{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_bits},
{0, 0, 0},
{0, 0, 0},
{equal_width, equal_height, equal_bits},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}, /* # 64 */
{A_width, A_height, A_bits},
{B_width, B_height, B_bits},
{C_width, C_height, C_bits},
{D_width, D_height, D_bits},
{E_width, E_height, E_bits},
{F_width, F_height, F_bits},
{G_width, G_height, G_bits},
{H_width, H_height, H_bits},
{I_width, I_height, I_bits},
{J_width, J_height, J_bits},
{K_width, K_height, K_bits},
{L_width, L_height, L_bits},
{M_width, M_height, M_bits},
{N_width, N_height, N_bits},
{O_width, O_height, O_bits},
{P_width, P_height, P_bits}, /* # 80 */
{Q_width, Q_height, Q_bits},
{R_width, R_height, R_bits},
{S_width, S_height, S_bits},
{T_width, T_height, T_bits},
{U_width, U_height, U_bits},
{V_width, V_height, V_bits},
{W_width, W_height, W_bits},
{X_width, X_height, X_bits},
{Y_width, Y_height, Y_bits},
{Z_width, Z_height, Z_bits},
{lbracket_width, lbracket_height, lbracket_bits},
{0, 0, 0},
{rbracket_width, rbracket_height, rbracket_bits},
{0, 0, 0},
{under_width, under_height, under_bits},
{0, 0, 0}, /* # 96 */
{arrow_width, arrow_height, arrow_bits}, /* a == left arrow */
{diff_width, diff_height, diff_bits}, /* b == differential */
{integral_width, integral_height, integral_bits}, /* c == integral */
{sigma_width, sigma_height, sigma_bits}, /* d == sigma */
{sqr_width, sqr_height, sqr_bits}, /* e == sqr */
{root_width, root_height, root_bits}, /* f == root */
{pow10_width, pow10_height, pow10_bits}, /* g == pow10 */
{exp_width, exp_height, exp_bits}, /* h == exp */
{prog_width, prog_height, prog_bits}, /* i == << >> */
{string_width, string_height, string_bits}, /* j == " " */
{nl_width, nl_height, nl_bits}, /* k == New Line */
{pi_width, pi_height, pi_bits}, /* l == pi */
{angle_width, angle_height, angle_bits}, /* m == angle */
{sqr_gx_width, sqr_gx_height, sqr_gx_bits}, /* n == sqr gx */
{root_gx_width, root_gx_height, root_gx_bits}, /* o == root gx */
{pow10_gx_width, pow10_gx_height, pow10_gx_bits}, /* p == pow10 gx */
{exp_gx_width, exp_gx_height, exp_gx_bits}, /* q == exp gx */
{parens_gx_width, parens_gx_height, parens_gx_bits}, /* r == ( ) gx */
{hash_gx_width, hash_gx_height, hash_gx_bits}, /* s == # gx */
{bracket_gx_width, bracket_gx_height, bracket_gx_bits}, /* t == [] gx */
{under_gx_width, under_gx_height, under_gx_bits}, /* u == _ gx */
{prog_gx_width, prog_gx_height, prog_gx_bits}, /* v == << >> gx */
{quote_gx_width, quote_gx_height, quote_gx_bits}, /* w == " " gx */
{curly_gx_width, curly_gx_height, curly_gx_bits}, /* x == {} gx */
{colon_gx_width, colon_gx_height, colon_gx_bits}, /* y == :: gx */
{angle_gx_width, angle_gx_height, angle_gx_bits}, /* z == angle gx */
{lcurly_width, lcurly_height, lcurly_bits},
{0, 0, 0},
{rcurly_width, rcurly_height, rcurly_bits},
{0, 0, 0},
{0, 0, 0}};
{ 0, 0, 0 },
{ nl_gx_width, nl_gx_height, nl_gx_bits }, /* \001 == \n gx */
{ comma_gx_width, comma_gx_height, comma_gx_bits }, /* \002 == comma gx */
{ arrow_gx_width, arrow_gx_height, arrow_gx_bits }, /* \003 == \-> gx */
{ equal_gx_width, equal_gx_height, equal_gx_bits }, /* \004 == equal gx */
{ pi_gx_width, pi_gx_height, pi_gx_bits }, /* \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_bits }, /* # 32 */
{ 0, 0, 0 },
{ 0, 0, 0 },
{ hash_width, hash_height, hash_bits },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ lbrace_width, lbrace_height, lbrace_bits },
{ rbrace_width, rbrace_height, rbrace_bits },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ comma_width, comma_height, comma_bits },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ slash_width, slash_height, slash_bits },
{ 0, 0, 0 }, /* # 48 */
{ 0, 0, 0 },
{ two_width, two_height, two_bits },
{ three_width, three_height, three_bits },
{ 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_bits },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ equal_width, equal_height, equal_bits },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }, /* # 64 */
{ A_width, A_height, A_bits },
{ B_width, B_height, B_bits },
{ C_width, C_height, C_bits },
{ D_width, D_height, D_bits },
{ E_width, E_height, E_bits },
{ F_width, F_height, F_bits },
{ G_width, G_height, G_bits },
{ H_width, H_height, H_bits },
{ I_width, I_height, I_bits },
{ J_width, J_height, J_bits },
{ K_width, K_height, K_bits },
{ L_width, L_height, L_bits },
{ M_width, M_height, M_bits },
{ N_width, N_height, N_bits },
{ O_width, O_height, O_bits },
{ P_width, P_height, P_bits }, /* # 80 */
{ Q_width, Q_height, Q_bits },
{ R_width, R_height, R_bits },
{ S_width, S_height, S_bits },
{ T_width, T_height, T_bits },
{ U_width, U_height, U_bits },
{ V_width, V_height, V_bits },
{ W_width, W_height, W_bits },
{ X_width, X_height, X_bits },
{ Y_width, Y_height, Y_bits },
{ Z_width, Z_height, Z_bits },
{ lbracket_width, lbracket_height, lbracket_bits },
{ 0, 0, 0 },
{ rbracket_width, rbracket_height, rbracket_bits },
{ 0, 0, 0 },
{ under_width, under_height, under_bits },
{ 0, 0, 0 }, /* # 96 */
{ arrow_width, arrow_height, arrow_bits }, /* a == left arrow */
{ diff_width, diff_height, diff_bits }, /* b == differential */
{ integral_width, integral_height, integral_bits }, /* c == integral */
{ sigma_width, sigma_height, sigma_bits }, /* d == sigma */
{ sqr_width, sqr_height, sqr_bits }, /* e == sqr */
{ root_width, root_height, root_bits }, /* f == root */
{ pow10_width, pow10_height, pow10_bits }, /* g == pow10 */
{ exp_width, exp_height, exp_bits }, /* h == exp */
{ prog_width, prog_height, prog_bits }, /* i == << >> */
{ string_width, string_height, string_bits }, /* j == " " */
{ nl_width, nl_height, nl_bits }, /* k == New Line */
{ pi_width, pi_height, pi_bits }, /* l == pi */
{ angle_width, angle_height, angle_bits }, /* m == angle */
{ sqr_gx_width, sqr_gx_height, sqr_gx_bits }, /* n == sqr gx */
{ root_gx_width, root_gx_height, root_gx_bits }, /* o == root gx */
{ pow10_gx_width, pow10_gx_height, pow10_gx_bits }, /* p == pow10 gx */
{ exp_gx_width, exp_gx_height, exp_gx_bits }, /* q == exp gx */
{ parens_gx_width, parens_gx_height, parens_gx_bits }, /* r == ( ) gx */
{ hash_gx_width, hash_gx_height, hash_gx_bits }, /* s == # gx */
{ bracket_gx_width, bracket_gx_height, bracket_gx_bits }, /* t == [] gx */
{ under_gx_width, under_gx_height, under_gx_bits }, /* u == _ gx */
{ prog_gx_width, prog_gx_height, prog_gx_bits }, /* v == << >> gx */
{ quote_gx_width, quote_gx_height, quote_gx_bits }, /* w == " " gx */
{ curly_gx_width, curly_gx_height, curly_gx_bits }, /* x == {} gx */
{ colon_gx_width, colon_gx_height, colon_gx_bits }, /* y == :: gx */
{ angle_gx_width, angle_gx_height, angle_gx_bits }, /* z == angle gx */
{ lcurly_width, lcurly_height, lcurly_bits },
{ 0, 0, 0 },
{ rcurly_width, rcurly_height, rcurly_bits },
{ 0, 0, 0 },
{ 0, 0, 0 } };
#endif /* !_SMALL_H */

View file

@ -55,13 +55,13 @@
/* #define DEBUG_TIMER_ADJUST 1 */
typedef struct x48_timer_t {
word_1 run;
word_64 start;
word_64 stop;
word_64 value;
word_1 run;
word_64 start;
word_64 stop;
word_64 value;
} x48_timer_t;
static x48_timer_t timers[NR_TIMERS];
static x48_timer_t timers[ NR_TIMERS ];
static long systime_offset = 0;
@ -82,18 +82,19 @@ word_64 set_0_time = 0x0;
word_64 time_offset = 0x0;
#define RAM_BASE_SX 0x70000
#define ACCESSTIME_SX (0x70052 - RAM_BASE_SX)
#define ACCESSCRC_SX (0x7005F - RAM_BASE_SX)
#define TIMEOUT_SX (0x70063 - RAM_BASE_SX)
#define TIMEOUTCLK_SX (0x70070 - RAM_BASE_SX)
#define ACCESSTIME_SX ( 0x70052 - RAM_BASE_SX )
#define ACCESSCRC_SX ( 0x7005F - RAM_BASE_SX )
#define TIMEOUT_SX ( 0x70063 - RAM_BASE_SX )
#define TIMEOUTCLK_SX ( 0x70070 - RAM_BASE_SX )
#define RAM_BASE_GX 0x80000
#define ACCESSTIME_GX (0x80058 - RAM_BASE_GX)
#define ACCESSCRC_GX (0x80065 - RAM_BASE_GX)
#define TIMEOUT_GX (0x80069 - RAM_BASE_GX)
#define TIMEOUTCLK_GX (0x80076 - RAM_BASE_GX)
#define ACCESSTIME_GX ( 0x80058 - RAM_BASE_GX )
#define ACCESSCRC_GX ( 0x80065 - RAM_BASE_GX )
#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)
@ -108,214 +109,215 @@ word_64 time_offset = 0x0;
* 8. Prevent AutoOff by setting TIMEOUT
*
*/
void set_accesstime(void) {
struct timeval tv;
struct timezone tz;
word_64 ticks, timeout, timer2;
word_20 accesstime_loc, timeout_loc;
word_20 accesscrc_loc, timeoutclk_loc;
word_16 crc;
word_4 val;
int i;
time_t gmt;
struct tm *ltm;
void set_accesstime( void ) {
struct timeval tv;
struct timezone tz;
word_64 ticks, timeout, timer2;
word_20 accesstime_loc, timeout_loc;
word_20 accesscrc_loc, timeoutclk_loc;
word_16 crc;
word_4 val;
int i;
time_t gmt;
struct tm* ltm;
/*
* This is done to set the variable 'timezone' on SYSV systems
*/
(void)time(&gmt);
ltm = localtime(&gmt);
#if defined(SYSV_TIME) || defined(__sgi)
systime_offset = timezone;
if (ltm->tm_isdst)
systime_offset -= 3600;
/*
* This is done to set the variable 'timezone' on SYSV systems
*/
( void )time( &gmt );
ltm = localtime( &gmt );
#if defined( SYSV_TIME ) || defined( __sgi )
systime_offset = timezone;
if ( ltm->tm_isdst )
systime_offset -= 3600;
#else
systime_offset = -ltm->tm_gmtoff;
systime_offset = -ltm->tm_gmtoff;
#endif
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
ticks = tv.tv_sec;
ticks <<= 13;
ticks += (tv.tv_usec << 7) / 15625;
ticks = tv.tv_sec;
ticks <<= 13;
ticks += ( tv.tv_usec << 7 ) / 15625;
time_offset = unix_0_time + set_0_time;
ticks += time_offset;
time_offset = unix_0_time + set_0_time;
ticks += time_offset;
timer2 = saturn.timer2;
if (saturn.timer2 & 0x80000000) {
assert(timer2 < 0);
}
timer2 = saturn.timer2;
if ( saturn.timer2 & 0x80000000 ) {
assert( timer2 < 0 );
}
ticks += timer2;
ticks += timer2;
timeout = ticks;
timeout = ticks;
crc = 0x0;
crc = 0x0;
if (opt_gx) {
accesstime_loc = ACCESSTIME_GX;
accesscrc_loc = ACCESSCRC_GX;
timeout_loc = TIMEOUT_GX;
timeoutclk_loc = TIMEOUTCLK_GX;
} else {
accesstime_loc = ACCESSTIME_SX;
accesscrc_loc = ACCESSCRC_SX;
timeout_loc = TIMEOUT_SX;
timeoutclk_loc = TIMEOUTCLK_SX;
}
if ( opt_gx ) {
accesstime_loc = ACCESSTIME_GX;
accesscrc_loc = ACCESSCRC_GX;
timeout_loc = TIMEOUT_GX;
timeoutclk_loc = TIMEOUTCLK_GX;
} else {
accesstime_loc = ACCESSTIME_SX;
accesscrc_loc = ACCESSCRC_SX;
timeout_loc = TIMEOUT_SX;
timeoutclk_loc = TIMEOUTCLK_SX;
}
for (i = 0; i < 13; i++) {
val = ticks & 0xf;
calc_crc(val);
saturn.ram[accesstime_loc + i] = val;
ticks >>= 4;
}
for ( i = 0; i < 13; i++ ) {
val = ticks & 0xf;
calc_crc( val );
saturn.ram[ accesstime_loc + i ] = val;
ticks >>= 4;
}
for (i = 0; i < 4; i++) {
saturn.ram[accesscrc_loc + i] = crc & 0xf;
crc >>= 4;
}
for ( i = 0; i < 4; i++ ) {
saturn.ram[ accesscrc_loc + i ] = crc & 0xf;
crc >>= 4;
}
timeout += ticks_10_min;
timeout += ticks_10_min;
for (i = 0; i < 13; i++) {
val = timeout & 0xf;
calc_crc(val);
saturn.ram[timeout_loc + i] = val;
timeout >>= 4;
}
for ( i = 0; i < 13; i++ ) {
val = timeout & 0xf;
calc_crc( val );
saturn.ram[ timeout_loc + i ] = val;
timeout >>= 4;
}
saturn.ram[timeoutclk_loc] = 0xf;
saturn.ram[ timeoutclk_loc ] = 0xf;
}
void start_timer(int timer) {
struct timeval tv;
struct timezone tz;
assert(timer <= NR_TIMERS);
void start_timer( int timer ) {
struct timeval tv;
struct timezone tz;
assert( timer <= NR_TIMERS );
if (timers[timer].run == 1)
return;
if ( timers[ timer ].run == 1 )
return;
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
timers[timer].run = 1;
if (timer == T1_TIMER) {
timers[timer].start = (tv.tv_sec << 9);
timers[timer].start += (tv.tv_usec / 15625) >> 3;
} else {
timers[timer].start = tv.tv_sec;
timers[timer].start <<= 13;
timers[timer].start += (tv.tv_usec << 7) / 15625;
}
timers[ timer ].run = 1;
if ( timer == T1_TIMER ) {
timers[ timer ].start = ( tv.tv_sec << 9 );
timers[ timer ].start += ( tv.tv_usec / 15625 ) >> 3;
} else {
timers[ timer ].start = tv.tv_sec;
timers[ timer ].start <<= 13;
timers[ timer ].start += ( tv.tv_usec << 7 ) / 15625;
}
#ifdef DEBUG_TIMER
fprintf(stderr, "Timer%c[%d] start at 0x%lx\n", timer == T1_TIMER ? '*' : ' ',
timer, timers[timer].start);
fprintf( stderr, "Timer%c[%d] start at 0x%lx\n",
timer == T1_TIMER ? '*' : ' ', timer, timers[ timer ].start );
#endif
}
void restart_timer(int timer) {
struct timeval tv;
struct timezone tz;
void restart_timer( int timer ) {
struct timeval tv;
struct timezone tz;
if (timer > NR_TIMERS)
return;
if ( timer > NR_TIMERS )
return;
timers[timer].start = 0;
timers[timer].stop = 0;
timers[timer].value = 0;
timers[ timer ].start = 0;
timers[ timer ].stop = 0;
timers[ timer ].value = 0;
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
timers[timer].run = 1;
if (timer == T1_TIMER) {
timers[timer].start = (tv.tv_sec << 9);
timers[timer].start += (tv.tv_usec / 15625) >> 3;
} else {
timers[timer].start = tv.tv_sec;
timers[timer].start <<= 13;
timers[timer].start += (tv.tv_usec << 7) / 15625;
}
timers[ timer ].run = 1;
if ( timer == T1_TIMER ) {
timers[ timer ].start = ( tv.tv_sec << 9 );
timers[ timer ].start += ( tv.tv_usec / 15625 ) >> 3;
} else {
timers[ timer ].start = tv.tv_sec;
timers[ timer ].start <<= 13;
timers[ timer ].start += ( tv.tv_usec << 7 ) / 15625;
}
#ifdef DEBUG_TIMER
fprintf(stderr, "Timer[%d] restart at 0x%lx\n", timer, timers[timer].start);
fprintf( stderr, "Timer[%d] restart at 0x%lx\n", timer,
timers[ timer ].start );
#endif
}
void stop_timer(int timer) {
struct timeval tv;
struct timezone tz;
void stop_timer( int timer ) {
struct timeval tv;
struct timezone tz;
if (timer > NR_TIMERS)
return;
if ( timer > NR_TIMERS )
return;
if (timers[timer].run == 0)
return;
if ( timers[ timer ].run == 0 )
return;
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
timers[timer].run = 0;
if (timer == T1_TIMER) {
timers[timer].stop = (tv.tv_sec << 9);
timers[timer].stop += (tv.tv_usec / 15625) >> 3;
} else {
timers[timer].stop = tv.tv_sec;
timers[timer].stop <<= 13;
timers[timer].stop += (tv.tv_usec << 7) / 15625;
}
timers[ timer ].run = 0;
if ( timer == T1_TIMER ) {
timers[ timer ].stop = ( tv.tv_sec << 9 );
timers[ timer ].stop += ( tv.tv_usec / 15625 ) >> 3;
} else {
timers[ timer ].stop = tv.tv_sec;
timers[ timer ].stop <<= 13;
timers[ timer ].stop += ( tv.tv_usec << 7 ) / 15625;
}
timers[timer].value += timers[timer].stop - timers[timer].start;
// add_sub_64(&timers[timer].stop, &timers[timer].start,
// &timers[timer].value);
timers[ timer ].value += timers[ timer ].stop - timers[ timer ].start;
// add_sub_64(&timers[timer].stop, &timers[timer].start,
// &timers[timer].value);
#ifdef DEBUG_TIMER
fprintf(stderr, "Timer[%d] stop at 0x%llx, value 0x%llx\n", timer,
timers[timer].stop, timers[timer].value);
fprintf( stderr, "Timer[%d] stop at 0x%llx, value 0x%llx\n", timer,
timers[ timer ].stop, timers[ timer ].value );
#endif
}
void reset_timer(int timer) {
if (timer > NR_TIMERS)
return;
timers[timer].run = 0;
timers[timer].start = 0;
timers[timer].stop = 0;
timers[timer].value = 0;
void reset_timer( int timer ) {
if ( timer > NR_TIMERS )
return;
timers[ timer ].run = 0;
timers[ timer ].start = 0;
timers[ timer ].stop = 0;
timers[ timer ].value = 0;
#ifdef DEBUG_TIMER
fprintf(stderr, "Timer[%d] reset\n", timer);
fprintf( stderr, "Timer[%d] reset\n", timer );
#endif
}
static word_64 zero = 0;
word_64 get_timer(int timer) {
struct timeval tv;
struct timezone tz;
word_64 stop;
word_64 get_timer( int timer ) {
struct timeval tv;
struct timezone tz;
word_64 stop;
if (timer > NR_TIMERS)
return zero;
if ( timer > NR_TIMERS )
return zero;
if (timers[timer].run) {
if ( timers[ timer ].run ) {
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
if (timer == T1_TIMER) {
stop = (tv.tv_sec << 9);
stop += (tv.tv_usec / 15625) >> 3;
} else {
stop = tv.tv_sec;
stop <<= 13;
stop += (tv.tv_usec << 7) / 15625;
if ( timer == T1_TIMER ) {
stop = ( tv.tv_sec << 9 );
stop += ( tv.tv_usec / 15625 ) >> 3;
} else {
stop = tv.tv_sec;
stop <<= 13;
stop += ( tv.tv_usec << 7 ) / 15625;
}
timers[ timer ].value += stop - timers[ timer ].start;
}
timers[timer].value += stop - timers[timer].start;
}
return timers[timer].value;
return timers[ timer ].value;
}
/*
@ -329,108 +331,108 @@ word_64 get_timer(int timer) {
*
*/
t1_t2_ticks get_t1_t2(void) {
struct timeval tv;
struct timezone tz;
word_64 stop;
t1_t2_ticks ticks;
word_64 access_time;
word_64 adj_time;
word_64 diff_time;
word_64 delta;
word_20 accesstime_loc;
int i;
t1_t2_ticks get_t1_t2( void ) {
struct timeval tv;
struct timezone tz;
word_64 stop;
t1_t2_ticks ticks;
word_64 access_time;
word_64 adj_time;
word_64 diff_time;
word_64 delta;
word_20 accesstime_loc;
int i;
gettimeofday(&tv, &tz);
tv.tv_sec -= systime_offset;
gettimeofday( &tv, &tz );
tv.tv_sec -= systime_offset;
if (timers[T1_TIMER].run) {
stop = (tv.tv_sec << 9);
stop += (tv.tv_usec / 15625) >> 3;
if (timers[T1_TIMER].start <= stop) {
timers[T1_TIMER].value += stop - timers[T1_TIMER].start;
} else {
fprintf(stderr, "clock running backwards\n");
if ( timers[ T1_TIMER ].run ) {
stop = ( tv.tv_sec << 9 );
stop += ( tv.tv_usec / 15625 ) >> 3;
if ( timers[ T1_TIMER ].start <= stop ) {
timers[ T1_TIMER ].value += stop - timers[ T1_TIMER ].start;
} else {
fprintf( stderr, "clock running backwards\n" );
}
}
}
ticks.t1_ticks = timers[T1_TIMER].value;
ticks.t1_ticks = timers[ T1_TIMER ].value;
stop = tv.tv_sec;
stop <<= 13;
stop += (tv.tv_usec << 7) / 15625;
stop = tv.tv_sec;
stop <<= 13;
stop += ( tv.tv_usec << 7 ) / 15625;
stop += time_offset;
stop += time_offset;
accesstime_loc = opt_gx ? ACCESSTIME_GX : ACCESSTIME_SX;
accesstime_loc = opt_gx ? ACCESSTIME_GX : ACCESSTIME_SX;
access_time = 0x0;
access_time = 0x0;
for (i = 13 - 1; i >= 0; i--) {
access_time <<= 4;
access_time |= ((int)saturn.ram[accesstime_loc + i] & 0xf);
}
for ( i = 13 - 1; i >= 0; i-- ) {
access_time <<= 4;
access_time |= ( ( int )saturn.ram[ accesstime_loc + i ] & 0xf );
}
access_time -= stop;
access_time -= stop;
if (adj_time_pending || in_debugger) {
/*
* We have been inside an interrupt for very long, maybe
* or we are sleeping in the debugger.
* Don't adjust the time, can't come from user, anyhow.
*/
if ( adj_time_pending || in_debugger ) {
/*
* We have been inside an interrupt for very long, maybe
* or we are sleeping in the debugger.
* Don't adjust the time, can't come from user, anyhow.
*/
if ((saturn.timer2 >= 0 && access_time < 0) ||
((unsigned long)saturn.timer2 > access_time)) {
/*
* check OK, return calculated time
*/
ticks.t2_ticks = access_time;
if ( ( saturn.timer2 >= 0 && access_time < 0 ) ||
( ( unsigned long )saturn.timer2 > access_time ) ) {
/*
* check OK, return calculated time
*/
ticks.t2_ticks = access_time;
} else {
/*
* Don't increment timer2, return old value and
* slow down timer2.
*/
ticks.t2_ticks = saturn.timer2;
saturn.t2_tick++;
}
return ticks;
}
diff_time = saturn.timer2;
adj_time = access_time - diff_time;
delta = abs( adj_time );
if ( delta > 0x3c000 ) /* Half a minute */
{
set_0_time += adj_time;
time_offset += adj_time;
access_time -= adj_time;
#ifdef DEBUG_TIMER_ADJUST
fprintf( stderr, "Time adjusted by " );
fprintf( stderr, "%lX", adj_time );
fprintf( stderr, " TICKS, Total offset " );
fprintf( stderr, "%lX", set_0_time );
fprintf( stderr, " TICKS\n" );
#endif
}
if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) ||
( ( unsigned long )saturn.timer2 > access_time ) ) {
/*
* check OK, return calculated time
*/
ticks.t2_ticks = access_time;
} else {
/*
* Don't increment timer2, return old value and
* slow down timer2.
*/
ticks.t2_ticks = saturn.timer2;
saturn.t2_tick++;
/*
* Don't increment timer2, return old value and
* slow down timer2.
*/
ticks.t2_ticks = saturn.timer2;
saturn.t2_tick++;
}
return ticks;
}
diff_time = saturn.timer2;
adj_time = access_time - diff_time;
delta = abs(adj_time);
if (delta > 0x3c000) /* Half a minute */
{
set_0_time += adj_time;
time_offset += adj_time;
access_time -= adj_time;
#ifdef DEBUG_TIMER_ADJUST
fprintf(stderr, "Time adjusted by ");
fprintf(stderr, "%lX", adj_time);
fprintf(stderr, " TICKS, Total offset ");
fprintf(stderr, "%lX", set_0_time);
fprintf(stderr, " TICKS\n");
#endif
}
if ((saturn.timer2 >= 0 && (access_time < 0)) ||
((unsigned long)saturn.timer2 > access_time)) {
/*
* check OK, return calculated time
*/
ticks.t2_ticks = access_time;
} else {
/*
* Don't increment timer2, return old value and
* slow down timer2.
*/
ticks.t2_ticks = saturn.timer2;
saturn.t2_tick++;
}
return ticks;
}

View file

@ -45,18 +45,18 @@
#define IDLE_TIMER 3
typedef struct t1_t2_ticks {
unsigned long t1_ticks;
unsigned long t2_ticks;
unsigned long t1_ticks;
unsigned long t2_ticks;
} t1_t2_ticks;
extern void reset_timer __ProtoType__((int timer));
extern void start_timer __ProtoType__((int timer));
extern void restart_timer __ProtoType__((int timer));
extern void stop_timer __ProtoType__((int timer));
extern word_64 get_timer __ProtoType__((int timer));
extern long diff_timer __ProtoType__((word_64 * t1, word_64 *t2));
extern void reset_timer __ProtoType__( ( int timer ) );
extern void start_timer __ProtoType__( ( int timer ) );
extern void restart_timer __ProtoType__( ( int timer ) );
extern void stop_timer __ProtoType__( ( int timer ) );
extern word_64 get_timer __ProtoType__( ( int timer ) );
extern long diff_timer __ProtoType__( ( word_64 * t1, word_64* t2 ) );
extern t1_t2_ticks get_t1_t2 __ProtoType__((void));
extern void set_accesstime __ProtoType__((void));
extern t1_t2_ticks get_t1_t2 __ProtoType__( ( void ));
extern void set_accesstime __ProtoType__( ( void ));
#endif /* !_TIMER_H */

View file

@ -38,7 +38,7 @@ extern int VERSION_MAJOR;
extern int VERSION_MINOR;
extern int PATCHLEVEL;
extern int COMPILE_VERSION;
extern char *COMPILE_TIME;
extern char *COMPILE_BY;
extern char* COMPILE_TIME;
extern char* COMPILE_BY;
#endif /* !_VERSION_H */

File diff suppressed because it is too large Load diff

View file

@ -92,33 +92,33 @@
#define BLACK 19
typedef struct color_t {
char *name;
int r, g, b;
int mono_rgb;
int gray_rgb;
XColor xcolor;
char* name;
int r, g, b;
int mono_rgb;
int gray_rgb;
XColor xcolor;
} color_t;
extern color_t *colors;
extern color_t* colors;
#define COLOR(c) (colors[(c)].xcolor.pixel)
#define COLOR( c ) ( colors[ ( c ) ].xcolor.pixel )
#define UPDATE_MENU 1
#define UPDATE_DISP 2
typedef struct disp_t {
unsigned int w, h;
Window win;
GC gc;
short mapped;
int offset;
int lines;
unsigned int w, h;
Window win;
GC gc;
short mapped;
int offset;
int lines;
#ifdef HAVE_XSHM
int display_update;
XShmSegmentInfo disp_info;
XImage *disp_image;
XShmSegmentInfo menu_info;
XImage *menu_image;
int display_update;
XShmSegmentInfo disp_info;
XImage* disp_image;
XShmSegmentInfo menu_info;
XImage* menu_image;
#endif
} disp_t;
@ -128,22 +128,22 @@ extern disp_t disp;
extern int shm_flag;
#endif
extern Display *dpy;
extern Display* dpy;
extern int screen;
extern int InitDisplay __ProtoType__((int argc, char **argv));
extern int CreateWindows __ProtoType__((int argc, char **argv));
extern int GetEvent __ProtoType__((void));
extern int InitDisplay __ProtoType__( ( int argc, char** argv ) );
extern int CreateWindows __ProtoType__( ( int argc, char** argv ) );
extern int GetEvent __ProtoType__( ( void ));
extern void adjust_contrast __ProtoType__((int contrast));
extern void refresh_icon __ProtoType__((void));
extern void adjust_contrast __ProtoType__( ( int contrast ) );
extern void refresh_icon __ProtoType__( ( void ));
extern void ShowConnections __ProtoType__((char *w, char *i));
extern void ShowConnections __ProtoType__( ( char* w, char* i ) );
extern void exit_x48 __ProtoType__((int tell_x11));
extern void exit_x48 __ProtoType__( ( int tell_x11 ) );
#ifdef HAVE_XSHM
extern void refresh_display __ProtoType__((void));
extern void refresh_display __ProtoType__( ( void ));
#endif
#endif /* !_X48_X11_H */