Big scary shuffling of code to helpfully ease comprehension

This commit is contained in:
Gwenhael Le Moine 2023-05-04 15:53:39 +02:00
parent 91e7ddbee0
commit 7b4039d65c
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
30 changed files with 2133 additions and 2175 deletions

View file

@ -1,8 +1,13 @@
# Makefile to build x48ng without autotools
VERSION_MAJOR = 0
VERSION_MINOR = 9
PATCHLEVEL = 10
COMPILE_VERSION = 0
CC = gcc
CFLAGS = -g -O2
CFLAGS = -g -O2 -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DPATCHLEVEL=$(PATCHLEVEL) -DCOMPILE_VERSION=$(COMPILE_VERSION)
LIBS = -lm -lhistory -lreadline
#possible values: x11, sdl1
@ -36,7 +41,7 @@ dump2rom: src/dump2rom.o
checkrom: src/checkrom.o src/romio.o
$(CC) $(CFLAGS) $(LIBS) $^ -o $@
x48ng: src/main.o src/actions.o src/debugger.o src/device.o src/disasm.o src/emulate.o src/errors.o src/init.o src/lcd.o src/memory.o src/register.o src/resources.o src/romio.o src/rpl.o src/serial.o src/timer.o src/x48.o src/options.o src/resources.o
x48ng: src/main.o src/hp48emu_actions.o src/debugger.o src/device.o src/disasm.o src/hp48_emulate.o src/errors.o src/hp48_init.o src/hp48emu_memory.o src/hp48emu_register.o src/resources.o src/romio.o src/rpl.o src/hp48_serial.o src/timer.o src/x48.o src/resources.o
$(CC) $(CFLAGS) $(LIBS) $^ -o $@
# Cleaning

View file

@ -1,40 +0,0 @@
#ifndef _ANNUNC_H
#define _ANNUNC_H 1
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#endif /* !_ANNUNC_H */

View file

@ -1,8 +0,0 @@
#ifndef _APPEND_H
#define _APPEND_H 1
extern char* append_str( char* buf, const char* string );
extern char* append_tab( char* buf );
extern char* append_tab_16( char* buf );
#endif /* !_APPEND_H */

View file

@ -1,136 +0,0 @@
#ifndef _BUTTONS_H
#define _BUTTONS_H 1
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#if defined( GUI_IS_X11 )
#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 };
#endif
#define colon_width 2
#define colon_height 10
static unsigned char colon_bits[] = { 0x03, 0x03, 0x03, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00 };
#endif /* !_BUTTONS_H */

View file

@ -1,4 +0,0 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 9
#define PATCHLEVEL 10
#define COMPILE_VERSION 0

View file

@ -1,8 +1,16 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#if defined( GUI_IS_X11 )
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#include "hp48.h"
#include "hp48_emu.h"
#include "device.h"
#include "hp48.h"
#include "hp48emu.h"
#include "timer.h"
#include "x48.h"
@ -136,3 +144,470 @@ void check_devices( void ) {
/* else */
/* write(au, &c[1], 1); */
/* } */
/*******/
/* LCD */
/*******/
static int last_annunc_state = -1;
display_t display;
unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
#if defined( GUI_IS_X11 )
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 } /* **** */
};
static unsigned char nibble_bits[ 16 ];
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 );
}
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; /* **** */
}
}
}
#elif defined( GUI_IS_SDL1 )
ann_struct_t 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 } };
#endif
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.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;
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.contrast = saturn.contrast_ctrl;
display.contrast |= ( ( saturn.disp_test & 0x1 ) << 4 );
display.annunc = saturn.annunc;
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) );
#if defined( GUI_IS_X11 )
init_nibble_maps();
#endif
}
static inline void draw_nibble( int c, int r, int val ) {
int x, y;
#if defined( GUI_IS_X11 )
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;
}
#elif defined( GUI_IS_SDL1 )
if ( val != lcd_buffer[ r ][ c ] )
lcd_buffer[ r ][ c ] = val;
x = ( c * 4 ); // x: start in pixels
if ( r <= display.lines )
x -= disp.offset; // Correct the pixels with display offset
y = r; // y: start in pixels
SDLDrawNibble( x, y, val );
#endif
}
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 );
}
}
}
void update_display( void ) {
int i, j;
long addr;
static int old_offset = -1;
static int old_lines = -1;
#if defined( GUI_IS_X11 )
int addr_pad;
int val, line_pad, line_length;
word_20 data_addr, data_addr_2;
#endif
if ( !disp.mapped ) {
#if defined( GUI_IS_X11 )
refresh_icon();
#endif
return;
}
if ( display.on ) {
addr = display.disp_start;
#if defined( GUI_IS_X11 )
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;
}
#if defined( GUI_IS_X11 )
}
#endif
if ( i < DISP_ROWS ) {
addr = display.menu_start;
#if defined( GUI_IS_X11 )
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;
}
#if defined( GUI_IS_X11 )
}
#endif
}
} else {
#if defined( GUI_IS_X11 )
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 );
}
}
#if defined( GUI_IS_X11 )
}
#endif
}
}
void redraw_display( void ) {
#if defined( GUI_IS_X11 )
XClearWindow( dpy, disp.win );
#endif
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;
#if defined( GUI_IS_X11 )
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;
#if defined( GUI_IS_X11 )
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 );
}
#if defined( GUI_IS_X11 )
}
#endif
} else {
#if defined( GUI_IS_X11 )
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 );
}
}
#if defined( GUI_IS_X11 )
}
#endif
}
}
void menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#if defined( GUI_IS_X11 )
int shm_addr;
#endif
int x, y;
offset = ( addr - display.menu_start );
#if defined( GUI_IS_X11 )
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 );
}
#if defined( GUI_IS_X11 )
}
#endif
}
#if defined( GUI_IS_X11 )
struct ann_struct {
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 } };
#endif
void draw_annunc( void ) {
int val;
int i;
val = display.annunc;
if ( val == last_annunc_state )
return;
last_annunc_state = val;
#if defined( GUI_IS_SDL1 )
char sdl_annuncstate[ 6 ];
#endif
for ( i = 0; ann_tbl[ i ].bit; i++ ) {
#if defined( GUI_IS_X11 )
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 );
}
#elif defined( GUI_IS_SDL1 )
if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit )
sdl_annuncstate[ i ] = 1;
else
sdl_annuncstate[ i ] = 0;
#endif
}
#if defined( GUI_IS_X11 )
refresh_icon();
#elif defined( GUI_IS_SDL1 )
SDLDrawAnnunc( sdl_annuncstate );
#endif
}
#if defined( GUI_IS_X11 )
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 );
}
}
#endif
void redraw_annunc( void ) {
last_annunc_state = -1;
draw_annunc();
}

View file

@ -67,15 +67,15 @@ typedef struct device_t {
} device_t;
extern device_t device;
extern void check_devices( void );
extern void check_devices( void ); /* device.c */
/* extern void check_out_register( void ); */
extern void update_display( void );
extern void redraw_display( void );
extern void disp_draw_nibble( word_20 addr, word_4 val );
extern void menu_draw_nibble( word_20 addr, word_4 val );
extern void draw_annunc( void );
extern void redraw_annunc( void );
extern void update_display( void ); /* device_lcd.c */
extern void redraw_display( void ); /* device_lcd.c */
extern void disp_draw_nibble( word_20 addr, word_4 val ); /* device_lcd.c */
extern void menu_draw_nibble( word_20 addr, word_4 val ); /* device_lcd.c */
extern void draw_annunc( void ); /* device_lcd.c */
extern void redraw_annunc( void ); /* device_lcd.c */
#endif /* !_DEVICE_H */

View file

@ -9,6 +9,15 @@
extern int disassembler_mode;
extern const char* mode_name[];
/* #ifndef _APPEND_H */
/* #define _APPEND_H 1 */
extern char* append_str( char* buf, const char* string );
extern char* append_tab( char* buf );
extern char* append_tab_16( char* buf );
/* #endif /\* !_APPEND_H *\/ */
extern word_20 disassemble( word_20 addr, char* out );
#endif /* !_DISASM_H */

121
src/hp.h
View file

@ -1,121 +0,0 @@
#ifndef _HP_H
#define _HP_H 1
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#endif /* !_HP_H */

View file

@ -4,7 +4,26 @@
#include <stdint.h>
#include <sys/time.h>
#include "mmu.h"
/* #ifndef _MMU_H */
/* #define _MMU_H 1 */
#define NR_MCTL 6
#define MCTL_MMIO_SX 0
#define MCTL_SysRAM_SX 1
#define MCTL_PORT1_SX 2
#define MCTL_PORT2_SX 3
#define MCTL_EXTRA_SX 4
#define MCTL_SysROM_SX 5
#define MCTL_MMIO_GX 0
#define MCTL_SysRAM_GX 1
#define MCTL_BANK_GX 2
#define MCTL_PORT1_GX 3
#define MCTL_PORT2_GX 4
#define MCTL_SysROM_GX 5
/* #endif /\* !_MMU_H *\/ */
#define RAM_SIZE_SX 0x10000
#define RAM_SIZE_GX 0x40000
@ -177,14 +196,6 @@ typedef struct saturn_t {
#define NIBBLES_PER_ROW 0x22
#if defined( GUI_IS_SDL1 )
#define DISP_ROWS 64
#define NIBS_PER_BUFFER_ROW ( NIBBLES_PER_ROW + 2 )
extern unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
extern unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
#endif
extern int got_alarm;
extern int set_t1;
@ -196,33 +207,33 @@ extern long sched_adjtime;
extern long schedule_event;
extern display_t display;
extern void init_display( void );
extern void init_display( void ); /* device_lcd.c */
extern saturn_t saturn;
extern void init_saturn( void ); /* hp48_init.c */
extern int exit_emulator( void );
extern int init_emulator( void );
extern void init_active_stuff( void );
extern int exit_emulator( void ); /* hp48_init.c */
extern int init_emulator( void ); /* hp48_init.c */
extern int serial_init( void );
extern void serial_baud( int baud );
extern void transmit_char( void );
extern void receive_char( void );
extern int serial_init( void ); /* hp48_serial.c */
extern void serial_baud( int baud ); /* hp48_serial.c */
extern void transmit_char( void ); /* hp48_serial.c */
extern void receive_char( void ); /* hp48_serial.c */
extern void do_kbd_int( void );
extern void do_interupt( void );
extern void do_kbd_int( void ); /* hp48emu_actions.c */
extern void do_interupt( void ); /* hp48emu_actions.c */
extern void ( *write_nibble )( long addr, int val );
extern int ( *read_nibble )( long addr );
extern int ( *read_nibble_crc )( long addr );
extern void ( *write_nibble )( long addr, int val ); /* hp48emu_memory.c */
extern int ( *read_nibble )( long addr ); /* hp48emu_memory.c */
extern int ( *read_nibble_crc )( long addr ); /* hp48emu_memory.c */
extern void emulate( void );
extern int step_instruction( void );
extern void schedule( void );
extern void emulate( void ); /* hp48_emulate.c */
extern int step_instruction( void ); /* hp48_emulate.c */
extern void schedule( void ); /* hp48_emulate.c */
extern int read_rom( const char* fname );
extern int read_files( void );
extern int write_files( void );
extern int read_rom( const char* fname ); /* hp48_init.c */
extern int read_files( void ); /* hp48_init.c */
extern int write_files( void ); /* hp48_init.c */
extern void load_addr( word_20* dat, long addr, int n );
extern void load_addr( word_20* dat, long addr, int n ); /* hp48_emulate.c */
#endif /* !_HP48_H */

View file

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

View file

@ -4,7 +4,7 @@
#include "debugger.h"
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
#include "timer.h"
#include "x48.h"

View file

@ -7,10 +7,9 @@
#include <string.h>
#include <sys/types.h>
#include "config.h"
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
#include "resources.h"
#include "romio.h"
@ -1572,14 +1571,6 @@ int init_emulator( void ) {
return 0;
}
void init_active_stuff( void ) {
serial_init();
#if defined( GUI_IS_X11 )
init_annunc();
#endif
init_display();
}
int exit_emulator( void ) {
write_files();
return 1;

View file

@ -9,7 +9,7 @@
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
#include "resources.h"
#include "x48.h"

View file

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

99
src/hp48emu.h Normal file
View file

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

View file

@ -5,7 +5,7 @@
#include "debugger.h"
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
#include "romio.h"
#include "timer.h"
#include "x48.h"
@ -20,6 +20,9 @@ int first_press = 1; // PATCH
int conf_bank1 = 0x00000;
int conf_bank2 = 0x00000;
short conf_tab_sx[] = { 1, 2, 2, 2, 2, 0 };
short conf_tab_gx[] = { 1, 2, 2, 2, 2, 0 };
void do_in( void ) {
int i, in, out;
@ -125,9 +128,6 @@ int get_register_bit( unsigned char* reg, int n ) {
return ( ( int )( reg[ n / 4 ] & ( 1 << ( n % 4 ) ) ) > 0 ) ? 1 : 0;
}
short conf_tab_sx[] = { 1, 2, 2, 2, 2, 0 };
short conf_tab_gx[] = { 1, 2, 2, 2, 2, 0 };
void do_reset( void ) {
int i;

View file

@ -6,8 +6,7 @@
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "mmu.h"
#include "hp48emu.h"
#include "resources.h"
#include "romio.h"
#include "x48.h"

View file

@ -2,7 +2,7 @@
#include <stdlib.h>
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
extern long nibble_masks[ 16 ];

View file

@ -1,196 +0,0 @@
#ifndef _ICON_H
#define _ICON_H 1
#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 };
#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 };
#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 };
#define hp48_logo_width 13
#define hp48_logo_height 4
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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#endif /* !_ICON_H */

472
src/lcd.c
View file

@ -1,472 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#if defined( GUI_IS_X11 )
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#include "annunc.h"
#include "device.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "x48.h"
static int last_annunc_state = -1;
display_t display;
unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ];
#if defined( GUI_IS_X11 )
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 } /* **** */
};
static unsigned char nibble_bits[ 16 ];
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 );
}
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; /* **** */
}
}
}
#elif defined( GUI_IS_SDL1 )
ann_struct_t 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 } };
#endif
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.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;
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.contrast = saturn.contrast_ctrl;
display.contrast |= ( ( saturn.disp_test & 0x1 ) << 4 );
display.annunc = saturn.annunc;
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) );
#if defined( GUI_IS_X11 )
init_nibble_maps();
#endif
}
static inline void draw_nibble( int c, int r, int val ) {
int x, y;
#if defined( GUI_IS_X11 )
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;
}
#elif defined( GUI_IS_SDL1 )
if ( val != lcd_buffer[ r ][ c ] )
lcd_buffer[ r ][ c ] = val;
x = ( c * 4 ); // x: start in pixels
if ( r <= display.lines )
x -= disp.offset; // Correct the pixels with display offset
y = r; // y: start in pixels
SDLDrawNibble( x, y, val );
#endif
}
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 );
}
}
}
void update_display( void ) {
int i, j;
long addr;
static int old_offset = -1;
static int old_lines = -1;
#if defined( GUI_IS_X11 )
int addr_pad;
int val, line_pad, line_length;
word_20 data_addr, data_addr_2;
#endif
if ( !disp.mapped ) {
#if defined( GUI_IS_X11 )
refresh_icon();
#endif
return;
}
if ( display.on ) {
addr = display.disp_start;
#if defined( GUI_IS_X11 )
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;
}
#if defined( GUI_IS_X11 )
}
#endif
if ( i < DISP_ROWS ) {
addr = display.menu_start;
#if defined( GUI_IS_X11 )
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;
}
#if defined( GUI_IS_X11 )
}
#endif
}
} else {
#if defined( GUI_IS_X11 )
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 );
}
}
#if defined( GUI_IS_X11 )
}
#endif
}
}
void redraw_display( void ) {
#if defined( GUI_IS_X11 )
XClearWindow( dpy, disp.win );
#endif
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;
#if defined( GUI_IS_X11 )
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;
#if defined( GUI_IS_X11 )
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 );
}
#if defined( GUI_IS_X11 )
}
#endif
} else {
#if defined( GUI_IS_X11 )
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 );
}
}
#if defined( GUI_IS_X11 )
}
#endif
}
}
void menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#if defined( GUI_IS_X11 )
int shm_addr;
#endif
int x, y;
offset = ( addr - display.menu_start );
#if defined( GUI_IS_X11 )
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 );
}
#if defined( GUI_IS_X11 )
}
#endif
}
#if defined( GUI_IS_X11 )
struct ann_struct {
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 } };
#endif
void draw_annunc( void ) {
int val;
int i;
val = display.annunc;
if ( val == last_annunc_state )
return;
last_annunc_state = val;
#if defined( GUI_IS_X11 )
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();
#elif defined( GUI_IS_SDL1 )
char sdl_annuncstate[ 6 ];
for ( i = 0; ann_tbl[ i ].bit; i++ ) {
if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit )
sdl_annuncstate[ i ] = 1;
else
sdl_annuncstate[ i ] = 0;
}
SDLDrawAnnunc( sdl_annuncstate );
#endif
}
#if defined( GUI_IS_X11 )
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 );
}
}
#endif
void redraw_annunc( void ) {
last_annunc_state = -1;
draw_annunc();
}

View file

@ -6,17 +6,13 @@
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <langinfo.h>
#include <locale.h>
#include "debugger.h"
#include "hp48.h"
#include "x48.h"
#if defined( GUI_IS_SDL1 )
#include "resources.h"
#endif
#include <langinfo.h>
#include <locale.h>
#include "x48.h"
char* progname;
char* res_name;
@ -153,8 +149,15 @@ int main( int argc, char** argv ) {
/*
* can't be done before windows exist
*/
init_active_stuff();
{ /* init_active_stuff() */
serial_init();
#if defined( GUI_IS_X11 )
init_annunc();
#endif
init_display();
}
/*
* install a handler for SIGALRM
*/

View file

@ -1,20 +0,0 @@
#ifndef _MMU_H
#define _MMU_H 1
#define NR_MCTL 6
#define MCTL_MMIO_SX 0
#define MCTL_SysRAM_SX 1
#define MCTL_PORT1_SX 2
#define MCTL_PORT2_SX 3
#define MCTL_EXTRA_SX 4
#define MCTL_SysROM_SX 5
#define MCTL_MMIO_GX 0
#define MCTL_SysRAM_GX 1
#define MCTL_BANK_GX 2
#define MCTL_PORT1_GX 3
#define MCTL_PORT2_GX 4
#define MCTL_SysROM_GX 5
#endif /* !_MMU_H */

View file

@ -1,106 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "config.h"
#include "resources.h"
void usage( void ) {
fprintf( stdout, "\n\
%s Version %d.%d.%d\n\
\n\
usage:\n\t%s [-options ...]\n\
\n\
where options include:\n\
-help print out this message\n\
-display <displayname> X server to contact\n\
-name <string> set application name to <string>\n\
-title <string> set window title to <string>\n\
-geometry <geometry> position of window\n\
-iconGeom <geometry> position of icon window\n\
-iconic start iconic\n\
-visual <visualname> use visual <visualname>\n\
-mono force monochrome\n\
-gray force grayscale\n\
-monoIcon force monochrome icon\n\
-smallFont <fontname> <fontname> to draw small labels (MTH - DEL)\n\
-mediumFont <fontname> <fontname> to draw medium label (ENTER)\n\
-largeFont <fontname> <fontname> to draw large labels (Numbers)\n\
-connFont <fontname> <fontname> to display wire & IR connections\n\
-/+xshm turn on/off XShm extension\n\
-version print out version information\n\
-copyright print out copyright information\n\
-warranty print out warranty information\n\
-verbose run verbosive\n\
-quiet run quietly\n\
-/+terminal turn on/off pseudo terminal interface\n\
-/+serial turn on/off serial interface\n\
-line <devicename> use serial line <devicename> for IR connection\n\
-/+debug turn on/off debugger\n\
-disasm <string> use <string> (\'HP\' or \'class\') mnemonics\n\
-reset perform a reset (PC = 0) on startup\n\
-initialize force initialization x48ng from ROM-dump\n\
-rom <filename> if initializing, read ROM from <filename>\n\
-home <directory> use directory ~/<directory> to save x48ng files\n\
-xrm <resource> set Xresource <resource>\n\
-/+throttle turn off/on speed emulation\n\
-/+netbook turn off/on netbook layout\n\
\n",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname );
fflush( stdout );
exit( 1 );
}
void show_version( void ) {
fprintf( stdout, "\n\
%s Version %d.%d.%d",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
}
void show_copyright( void ) {
fprintf( stdout, "\n\
COPYRIGHT\n\
\n\
x48ng is an Emulator/Debugger for the HP-48 Handheld Calculator.\n\
\n\
This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation; either version 2 of the License, or\n\
(at your option) any later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
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" );
}
void show_warranty( void ) {
fprintf( stdout, "\n\
NO WARRANTY\n\
\n\
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n\
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n\
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n\
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n\
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n\
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n\
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n\
REPAIR OR CORRECTION.\n\
\n\
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n\
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n\
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n\
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n\
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" );
}

View file

@ -1,79 +0,0 @@
#ifndef _OPTIONS_H
#define _OPTIONS_H 1
#if defined( GUI_IS_X11 )
#include <X11/Xlib.h>
#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 },
{ "-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" },
{ "-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 },
{ "-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 },
{ "-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 },
{ "-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" },
/*
* 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" },
};
#endif
#endif /* _OPTIONS_H */

View file

@ -35,6 +35,106 @@ char homeDirectory[ 1024 ];
XrmDatabase rdb = ( XrmDatabase )0;
void usage( void ) {
fprintf( stdout, "\n\
%s Version %d.%d.%d\n\
\n\
usage:\n\t%s [-options ...]\n\
\n\
where options include:\n\
-help print out this message\n\
-display <displayname> X server to contact\n\
-name <string> set application name to <string>\n\
-title <string> set window title to <string>\n\
-geometry <geometry> position of window\n\
-iconGeom <geometry> position of icon window\n\
-iconic start iconic\n\
-visual <visualname> use visual <visualname>\n\
-mono force monochrome\n\
-gray force grayscale\n\
-monoIcon force monochrome icon\n\
-smallFont <fontname> <fontname> to draw small labels (MTH - DEL)\n\
-mediumFont <fontname> <fontname> to draw medium label (ENTER)\n\
-largeFont <fontname> <fontname> to draw large labels (Numbers)\n\
-connFont <fontname> <fontname> to display wire & IR connections\n\
-/+xshm turn on/off XShm extension\n\
-version print out version information\n\
-copyright print out copyright information\n\
-warranty print out warranty information\n\
-verbose run verbosive\n\
-quiet run quietly\n\
-/+terminal turn on/off pseudo terminal interface\n\
-/+serial turn on/off serial interface\n\
-line <devicename> use serial line <devicename> for IR connection\n\
-/+debug turn on/off debugger\n\
-disasm <string> use <string> (\'HP\' or \'class\') mnemonics\n\
-reset perform a reset (PC = 0) on startup\n\
-initialize force initialization x48ng from ROM-dump\n\
-rom <filename> if initializing, read ROM from <filename>\n\
-home <directory> use directory ~/<directory> to save x48ng files\n\
-xrm <resource> set Xresource <resource>\n\
-/+throttle turn off/on speed emulation\n\
-/+netbook turn off/on netbook layout\n\
\n",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname );
fflush( stdout );
exit( 1 );
}
void show_version( void ) {
fprintf( stdout, "\n\
%s Version %d.%d.%d",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
}
void show_copyright( void ) {
fprintf( stdout, "\n\
COPYRIGHT\n\
\n\
x48ng is an Emulator/Debugger for the HP-48 Handheld Calculator.\n\
\n\
This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation; either version 2 of the License, or\n\
(at your option) any later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
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" );
}
void show_warranty( void ) {
fprintf( stdout, "\n\
NO WARRANTY\n\
\n\
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n\
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n\
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n\
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n\
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n\
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n\
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n\
REPAIR OR CORRECTION.\n\
\n\
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n\
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n\
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n\
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n\
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" );
}
void get_resources( void ) {
if ( get_boolean_resource( "printVersion", "PrintVersion" ) )
show_version();
@ -333,9 +433,6 @@ void get_resources( void ) {
strcpy( romFileName, "rom.dump" );
}
printf( "homeDirectory: %s\n", homeDirectory );
printf( "romFileName: %s\n", romFileName );
useDebugger = 1;
disassembler_mode = CLASS_MNEMONICS; // HP_MNEMONICS
netbook = 0;

274
src/rpl.c
View file

@ -3,16 +3,280 @@
#include <string.h>
#include <unistd.h>
#include "append.h"
#include "debugger.h"
#include "disasm.h"
#include "hp48.h"
#include "hp48_emu.h"
#include "hp48emu.h"
#include "romio.h"
#include "rpl.h"
#define DEFINE_TRANS_TABLE 1
#include "hp48char.h"
#undef DEFINE_TRANS_TABLE
/* #ifndef _HP48CHAR_H */
/* #define _HP48CHAR_H 1 */
typedef struct trans_tbl_t {
unsigned char hp48_char;
char* trans;
} trans_tbl_t;
trans_tbl_t hp48_trans_tbl[ 256 ] = { { 0, ( char* )"\\0" },
{ 1, ( char* )"\\001" },
{ 2, ( char* )"\\002" },
{ 3, ( char* )"\\003" },
{ 4, ( char* )"\\004" },
{ 5, ( char* )"\\005" },
{ 6, ( char* )"\\006" },
{ 7, ( char* )"\\007" },
{ 8, ( char* )"\\b" },
{ 9, ( char* )"\\t" },
{ 10, ( char* )"\\n" },
{ 11, ( char* )"\\011" },
{ 12, ( char* )"\\f" },
{ 13, ( char* )"\\r" },
{ 14, ( char* )"\\014" },
{ 15, ( char* )"\\015" },
{ 16, ( char* )"\\016" },
{ 17, ( char* )"\\017" },
{ 18, ( char* )"\\018" },
{ 19, ( char* )"\\019" },
{ 20, ( char* )"\\020" },
{ 21, ( char* )"\\021" },
{ 22, ( char* )"\\022" },
{ 23, ( char* )"\\023" },
{ 24, ( char* )"\\024" },
{ 25, ( char* )"\\025" },
{ 26, ( char* )"\\026" },
{ 27, ( char* )"\\027" },
{ 28, ( char* )"\\028" },
{ 29, ( char* )"\\029" },
{ 30, ( char* )"\\030" },
{ 31, ( char* )"\\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, ( char* )"\\127" },
{ 128, ( char* )"\\<)" },
{ 129, ( char* )"\\x-" },
{ 130, ( char* )"\\.V" },
{ 131, ( char* )"\\v/" },
{ 132, ( char* )"\\.S" },
{ 133, ( char* )"\\GS" },
{ 134, ( char* )"\\|>" },
{ 135, ( char* )"\\pi" },
{ 136, ( char* )"\\.d" },
{ 137, ( char* )"\\<=" },
{ 138, ( char* )"\\>=" },
{ 139, ( char* )"\\=/" },
{ 140, ( char* )"\\Ga" },
{ 141, ( char* )"\\->" },
{ 142, ( char* )"\\<-" },
{ 143, ( char* )"\\|v" },
{ 144, ( char* )"\\|^" },
{ 145, ( char* )"\\Gg" },
{ 146, ( char* )"\\Gd" },
{ 147, ( char* )"\\Ge" },
{ 148, ( char* )"\\Gn" },
{ 149, ( char* )"\\Gh" },
{ 150, ( char* )"\\Gl" },
{ 151, ( char* )"\\Gr" },
{ 152, ( char* )"\\Gs" },
{ 153, ( char* )"\\Gt" },
{ 154, ( char* )"\\Gw" },
{ 155, ( char* )"\\GD" },
{ 156, ( char* )"\\PI" },
{ 157, ( char* )"\\GW" },
{ 158, ( char* )"\\[]" },
{ 159, ( char* )"\\oo" },
{ 160, ( char* )"\\160" },
{ 161, ( char* )"\\161" },
{ 162, ( char* )"\\162" },
{ 163, ( char* )"\\163" },
{ 164, ( char* )"\\164" },
{ 165, ( char* )"\\165" },
{ 166, ( char* )"\\166" },
{ 167, ( char* )"\\167" },
{ 168, ( char* )"\\168" },
{ 169, ( char* )"\\169" },
{ 170, ( char* )"\\170" },
{ 171, ( char* )"\\<<" },
{ 172, ( char* )"\\172" },
{ 173, ( char* )"\\173" },
{ 174, ( char* )"\\174" },
{ 175, ( char* )"\\175" },
{ 176, ( char* )"\\^o" },
{ 177, ( char* )"\\177" },
{ 178, ( char* )"\\178" },
{ 179, ( char* )"\\179" },
{ 180, ( char* )"\\180" },
{ 181, ( char* )"\\Gm" },
{ 182, ( char* )"\\182" },
{ 183, ( char* )"\\183" },
{ 184, ( char* )"\\184" },
{ 185, ( char* )"\\185" },
{ 186, ( char* )"\\186" },
{ 187, ( char* )"\\>>" },
{ 188, ( char* )"\\188" },
{ 189, ( char* )"\\189" },
{ 190, ( char* )"\\190" },
{ 191, ( char* )"\\191" },
{ 192, ( char* )"\\192" },
{ 193, ( char* )"\\193" },
{ 194, ( char* )"\\194" },
{ 195, ( char* )"\\195" },
{ 196, ( char* )"\\196" },
{ 197, ( char* )"\\197" },
{ 198, ( char* )"\\198" },
{ 199, ( char* )"\\199" },
{ 200, ( char* )"\\200" },
{ 201, ( char* )"\\201" },
{ 202, ( char* )"\\202" },
{ 203, ( char* )"\\203" },
{ 204, ( char* )"\\204" },
{ 205, ( char* )"\\205" },
{ 206, ( char* )"\\206" },
{ 207, ( char* )"\\207" },
{ 208, ( char* )"\\208" },
{ 209, ( char* )"\\209" },
{ 210, ( char* )"\\210" },
{ 211, ( char* )"\\211" },
{ 212, ( char* )"\\212" },
{ 213, ( char* )"\\213" },
{ 214, ( char* )"\\214" },
{ 215, ( char* )"\\.x" },
{ 216, ( char* )"\\O/" },
{ 217, ( char* )"\\217" },
{ 218, ( char* )"\\218" },
{ 219, ( char* )"\\219" },
{ 220, ( char* )"\\220" },
{ 221, ( char* )"\\221" },
{ 222, ( char* )"\\222" },
{ 223, ( char* )"\\223" },
{ 224, ( char* )"\\224" },
{ 225, ( char* )"\\225" },
{ 226, ( char* )"\\226" },
{ 227, ( char* )"\\227" },
{ 228, ( char* )"\\228" },
{ 229, ( char* )"\\229" },
{ 230, ( char* )"\\230" },
{ 231, ( char* )"\\231" },
{ 232, ( char* )"\\232" },
{ 233, ( char* )"\\233" },
{ 234, ( char* )"\\234" },
{ 235, ( char* )"\\235" },
{ 236, ( char* )"\\236" },
{ 237, ( char* )"\\237" },
{ 238, ( char* )"\\238" },
{ 239, ( char* )"\\239" },
{ 240, ( char* )"\\240" },
{ 241, ( char* )"\\241" },
{ 242, ( char* )"\\242" },
{ 243, ( char* )"\\243" },
{ 244, ( char* )"\\244" },
{ 245, ( char* )"\\245" },
{ 246, ( char* )"\\246" },
{ 247, ( char* )"\\:-" },
{ 248, ( char* )"\\248" },
{ 249, ( char* )"\\249" },
{ 250, ( char* )"\\250" },
{ 251, ( char* )"\\251" },
{ 252, ( char* )"\\252" },
{ 253, ( char* )"\\253" },
{ 254, ( char* )"\\254" },
{ 255, ( char* )"\\255" } };
/* #endif /\* !_HP48CHAR_H *\/ */
struct objfunc {
char* name;

View file

@ -1,498 +0,0 @@
#ifndef _SMALL_H
#define _SMALL_H 1
#define small_ascent 8
#define small_descent 4
#define blank_width 4
#define blank_height 7
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 };
#define lbrace_width 3
#define lbrace_height 7
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 };
#define comma_width 3
#define comma_height 7
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 };
#define two_width 5
#define two_height 7
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 };
#define small_colon_width 2
#define small_colon_height 7
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 };
#define B_width 5
#define B_height 7
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 };
#define D_width 5
#define D_height 7
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 };
#define F_width 5
#define F_height 7
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 };
#define H_width 5
#define H_height 7
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 };
#define J_width 4
#define J_height 7
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 };
#define L_width 4
#define L_height 7
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 };
#define N_width 5
#define N_height 7
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 };
#define P_width 5
#define P_height 7
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 };
#define R_width 5
#define R_height 7
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 };
#define T_width 5
#define T_height 7
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 };
#define V_width 5
#define V_height 7
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 };
#define X_width 5
#define X_height 7
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 };
#define Z_width 5
#define Z_height 7
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 };
#define rbracket_width 3
#define rbracket_height 7
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 };
#define diff_width 5
#define diff_height 7
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 };
#define sigma_width 6
#define sigma_height 9
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 };
#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 };
#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 };
#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 };
#define under_width 6
#define under_height 7
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 };
#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 };
#define equal_width 5
#define equal_height 7
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 };
#define pi_width 6
#define pi_height 7
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 };
#define lcurly_width 5
#define lcurly_height 7
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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
#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 };
typedef struct letter_t {
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 } };
#endif /* !_SMALL_H */

View file

@ -9,22 +9,83 @@
#include <sys/types.h>
#include <sys/utsname.h>
#if defined( GUI_IS_X11 )
#include "icon.h"
#endif
#include "buttons.h"
#include "hp.h"
#include "small.h"
#include "x48.h"
#include "device.h"
#include "errors.h"
#include "hp48.h"
#include "options.h"
#include "resources.h"
#include "romio.h"
#if defined( GUI_IS_X11 )
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 },
{ "-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" },
{ "-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 },
{ "-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 },
{ "-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 },
{ "-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" },
/*
* 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" },
};
static char* defaults[] = {
"*iconic: False",
"*visual: Default",
@ -52,8 +113,6 @@ static char* defaults[] = {
"*disassemblerMnemonics: class",
0 };
extern int XShmQueryExtension( Display* );
extern int XShmGetEventBase( Display* );
static int CompletionType = -1;
extern int saved_argc;
@ -2385,8 +2444,7 @@ void CreateKeypad( unsigned int w, unsigned int h, unsigned int offset_y,
void CreateBezel( unsigned int width, unsigned int height,
unsigned int offset_y, unsigned int offset_x,
keypad_t* keypad ) {
int i; //, x, y;
// Pixmap pix;
int i;
int display_height = DISPLAY_HEIGHT;
int display_width = DISPLAY_WIDTH;

1068
src/x48.h

File diff suppressed because it is too large Load diff