Compare commits

...

6 commits

Author SHA1 Message Date
Gwenhael Le Moine
576063d929
bring back monitor 2024-09-24 14:35:11 +02:00
Gwenhael Le Moine
4dc6b4cf42
remove X11 dependencies 2024-09-24 14:24:20 +02:00
Gwenhael Le Moine
c21f364d2d
[ui48_sdl2] fixed LCD offsets 2024-09-24 14:16:25 +02:00
Gwenhael Le Moine
8c9c6501a5
naming 2024-09-24 13:54:33 +02:00
Gwenhael Le Moine
0cddd29ecd
\o/ Working ui48 integration ! 2024-09-24 13:47:04 +02:00
Gwenhael Le Moine
e815d96e3e
bring in first part of ui48 2024-09-24 11:09:24 +02:00
21 changed files with 5708 additions and 31 deletions

View file

@ -9,23 +9,36 @@
PREFIX = /usr
DOCDIR = $(PREFIX)/doc/saturn
VERSION_MAJOR = 0
VERSION_MINOR = 0
PATCHLEVEL = 0
OPTIM ?= 2
CFLAGS ?= -O$(OPTIM) -D_GNU_SOURCE=1 -I./src/ -I./libChf/src/ -L./libChf
CFLAGS ?= -O$(OPTIM) \
-D_GNU_SOURCE=1 \
-I./src/ \
-I./libChf/src/ \
-L./libChf \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DPATCHLEVEL=$(PATCHLEVEL)
LIBS = -lm -lChf -lXm -lutil
X11CFLAGS = $(shell pkg-config --cflags x11 xext)
X11LIBS = $(shell pkg-config --libs x11 xext xt)
# X11CFLAGS = $(shell pkg-config --cflags x11 xext)
# X11LIBS = $(shell pkg-config --libs x11 xext xt)
SDLCFLAGS = $(shell pkg-config --cflags sdl2)
SDLLIBS = $(shell pkg-config --libs sdl2)
NCURSESCFLAGS = $(shell pkg-config --cflags ncursesw)
NCURSESDLLIBS = $(shell pkg-config --libs ncursesw)
NCURSESLIBS = $(shell pkg-config --libs ncursesw)
FULL_WARNINGS = no
DOTOS = src/cpu.o \
DOTOS = src/ui48_config.o \
src/cpu.o \
src/debug.o \
src/dis.o \
src/disk_io.o \
@ -40,10 +53,16 @@ DOTOS = src/cpu.o \
src/romram.o \
src/romram49.o \
src/serial.o \
src/x11_lcd.o \
src/x11.o \
src/x_func.o \
src/main.o
src/ui48_common.o \
src/ui48_sdl2.o \
src/ui48_ncurses.o \
src/ui48_emulator.o \
src/ui48_main.o
# \
# src/x11_lcd.o \
# src/x11.o \
# src/x11_main.o
MSFS = src/MSFs/cpu.msf \
src/MSFs/debug.msf \
@ -93,10 +112,10 @@ override CFLAGS := -std=c11 \
$(call cc-option,-Wlogical-op) \
$(call cc-option,-Wno-unknown-warning-option) \
$(EXTRA_WARNING_FLAGS) \
$(X11CFLAGS) \
$(SDLCFLAGS) \
$(NCURSESCFLAGS) \
$(CFLAGS)
# $(X11CFLAGS) \
override CPPFLAGS := -I./src/ -D_GNU_SOURCE=1 \
$(CPPFLAGS)

8
dist/saturn48gx vendored
View file

@ -21,10 +21,14 @@ fi
RAM=''
if [ ! -e "$STATEDIR"/ram ]; then
RAM=-reset
RAM=--reset
else
RAM="--ram ram"
fi
[ ! -e "$STATEDIR"/port1 ] && dd if=/dev/zero of="$STATEDIR"/port1 bs=1k count=128
[ ! -e "$STATEDIR"/port2 ] && dd if=/dev/zero of="$STATEDIR"/port2 bs=1k count=4096
./saturn -face hp48 -hw hp48 -stateDir "$STATEDIR" -rom gxrom-r $RAM -port1 port1 -port2 port2 "$@"
#./saturn --hw hp48 --48gx --state-dir "$STATEDIR" --rom gxrom-r $RAM --port1 port1 --port2 port2 --mod mod --cpu cpu --hdw hdw "$@"
./saturn --hw hp48 --48gx --state-dir $STATEDIR --rom gxrom-r $RAM --port1 port1 --port2 port2 --mod mod --cpu cpu --hdw hdw "$@"

View file

@ -124,6 +124,10 @@
.- */
#include <stdbool.h>
#include "ui48_config.h"
/* CHF_EXTENDED_INFO:
Define this symbol if extended information is desired during condition
handling; this is usually useful only for debugging purposes.
@ -275,9 +279,9 @@
---------------------------------------------------------------------------*/
struct Args {
int reset; /* 2.1: Force emulator reset */
int monitor; /* 2.1: Call monitor() on startup */
int batchXfer; /* 3.15: Non-interactive file transfers */
bool reset; /* 2.1: Force emulator reset */
bool monitor; /* 2.1: Call monitor() on startup */
bool batchXfer; /* 3.15: Non-interactive file transfers */
char* mod_file_name;
char* cpu_file_name;
char* hdw_file_name;

View file

@ -221,8 +221,8 @@ static void EmulatorLoop( void )
}
/* LCD update */
if ( ( t1_count++ & LCD_T1_MASK ) == 0 )
DrawLcd();
/* if ( ( t1_count++ & LCD_T1_MASK ) == 0 ) */
/* DrawLcd(); */
/* Emulator Interrupt Request */
if ( ( t1_count & INT_T1_MASK ) == 0 && emulator_int_req ) {
@ -231,7 +231,7 @@ static void EmulatorLoop( void )
}
/* X Events handling */
HandleXEvents();
/* HandleXEvents(); */
/* Handle serial port */
HandleSerial();
@ -325,7 +325,7 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
this ensures that the latest LCD updated actually
get to the screen.
*/
DrawLcd();
// DrawLcd();
/* Handle serial port activity before entering the outer idle
loop, because this could possibly bring the cpu out of
@ -399,7 +399,7 @@ static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s,
- the given timeout expires
*/
debug1( DEBUG_C_TIMERS, CPU_I_IDLE_X_LOOP, ms );
IdleXLoop( ms );
// IdleXLoop( ms );
/* End of idle loop; compute actual elapsed time */
gettimeofday( &end_idle, NULL );

172
src/ui48_bitmaps_big_font.h Normal file
View file

@ -0,0 +1,172 @@
#ifndef _UI48_BITMAPS_BIG_FONT_H
#define _UI48_BITMAPS_BIG_FONT_H 1
#define big_font_dot_width 8
#define big_font_dot_height 13
static unsigned char big_font_dot_bits[] = {
0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0,
};
#define big_font_0_width 8
#define big_font_0_height 13
static unsigned char big_font_0_bits[] = {
24, 60, 102, 102, 195, 195, 195, 195, 195, 102, 102, 60, 24,
};
#define big_font_1_width 8
#define big_font_1_height 13
static unsigned char big_font_1_bits[] = {
24, 28, 30, 27, 24, 24, 24, 24, 24, 24, 24, 24, 255,
};
#define big_font_2_width 8
#define big_font_2_height 13
static unsigned char big_font_2_bits[] = {
60, 102, 195, 195, 192, 192, 96, 56, 12, 6, 3, 3, 255,
};
#define big_font_3_width 8
#define big_font_3_height 13
static unsigned char big_font_3_bits[] = {
60, 102, 195, 195, 192, 96, 56, 96, 192, 195, 195, 102, 60,
};
#define big_font_4_width 8
#define big_font_4_height 13
static unsigned char big_font_4_bits[] = {
96, 112, 120, 108, 102, 99, 99, 255, 96, 96, 96, 96, 96,
};
#define big_font_5_width 8
#define big_font_5_height 13
static unsigned char big_font_5_bits[] = {
255, 3, 3, 3, 3, 59, 103, 192, 192, 192, 195, 102, 60,
};
#define big_font_6_width 8
#define big_font_6_height 13
static unsigned char big_font_6_bits[] = {
60, 102, 67, 3, 3, 59, 103, 195, 195, 195, 195, 102, 60,
};
#define big_font_7_width 8
#define big_font_7_height 13
static unsigned char big_font_7_bits[] = {
255, 192, 192, 96, 96, 48, 48, 24, 24, 12, 12, 6, 6,
};
#define big_font_8_width 8
#define big_font_8_height 13
static unsigned char big_font_8_bits[] = {
60, 102, 195, 195, 195, 102, 60, 102, 195, 195, 195, 102, 60,
};
#define big_font_9_width 8
#define big_font_9_height 13
static unsigned char big_font_9_bits[] = {
62, 195, 195, 195, 195, 195, 230, 220, 192, 192, 194, 102, 60,
};
#define big_font_A_width 8
#define big_font_A_height 10
static unsigned char big_font_A_bits[] = {
30, 51, 51, 51, 51, 51, 63, 51, 51, 51,
};
#define big_font_C_width 8
#define big_font_C_height 10
static unsigned char big_font_C_bits[] = {
30, 51, 51, 3, 3, 3, 3, 51, 51, 30,
};
#define big_font_D_width 8
#define big_font_D_height 10
static unsigned char big_font_D_bits[] = {
15, 27, 51, 51, 51, 51, 51, 51, 27, 15,
};
#define big_font_E_width 8
#define big_font_E_height 10
static unsigned char big_font_E_bits[] = {
63, 3, 3, 3, 31, 3, 3, 3, 3, 63,
};
#define big_font_G_width 8
#define big_font_G_height 10
static unsigned char big_font_G_bits[] = {
30, 51, 51, 3, 3, 59, 51, 51, 51, 30,
};
#define big_font_H_width 8
#define big_font_H_height 10
static unsigned char big_font_H_bits[] = {
51, 51, 51, 51, 63, 51, 51, 51, 51, 51,
};
#define big_font_I_width 8
#define big_font_I_height 10
static unsigned char big_font_I_bits[] = {
63, 12, 12, 12, 12, 12, 12, 12, 12, 63,
};
#define big_font_L_width 8
#define big_font_L_height 10
static unsigned char big_font_L_bits[] = {
3, 3, 3, 3, 3, 3, 3, 3, 3, 63,
};
#define big_font_M_width 8
#define big_font_M_height 10
static unsigned char big_font_M_bits[] = {
33, 51, 51, 63, 63, 51, 51, 51, 51, 51,
};
#define big_font_N_width 8
#define big_font_N_height 10
static unsigned char big_font_N_bits[] = {
51, 51, 55, 55, 55, 59, 59, 59, 51, 51,
};
#define big_font_O_width 8
#define big_font_O_height 10
static unsigned char big_font_O_bits[] = {
30, 51, 51, 51, 51, 51, 51, 51, 51, 30,
};
#define big_font_P_width 8
#define big_font_P_height 10
static unsigned char big_font_P_bits[] = {
31, 51, 51, 51, 51, 31, 3, 3, 3, 3,
};
#define big_font_R_width 8
#define big_font_R_height 10
static unsigned char big_font_R_bits[] = {
31, 51, 51, 51, 31, 27, 51, 51, 51, 51,
};
#define big_font_S_width 8
#define big_font_S_height 10
static unsigned char big_font_S_bits[] = {
30, 51, 51, 6, 12, 12, 24, 51, 51, 30,
};
#define big_font_T_width 8
#define big_font_T_height 10
static unsigned char big_font_T_bits[] = {
63, 12, 12, 12, 12, 12, 12, 12, 12, 12,
};
#define big_font_V_width 8
#define big_font_V_height 10
static unsigned char big_font_V_bits[] = {
51, 51, 51, 51, 51, 51, 51, 30, 30, 12,
};
#define big_font_X_width 8
#define big_font_X_height 10
static unsigned char big_font_X_bits[] = {
51, 51, 30, 30, 12, 12, 30, 30, 51, 51,
};
#endif /* _UI48_BITMAPS_BIG_FONT_H 1 */

224
src/ui48_bitmaps_misc.h Normal file
View file

@ -0,0 +1,224 @@
#ifndef _UI48_BITMAPS_MISC_H
#define _UI48_BITMAPS_MISC_H 1
#define hp_width 96
#define hp_height 24
static unsigned char hp_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf8, 0x9f, 0xfd, 0x3f, 0x60, 0xcc, 0x6f, 0x66, 0x83, 0xdf, 0xff, 0x3f, 0xfc, 0x9f, 0xf1, 0x7f, 0x60, 0xcc,
0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc7, 0xc0, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc3, 0x80,
0x7f, 0x60, 0xcc, 0x40, 0x26, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x61, 0x00, 0x7f, 0xe0, 0xcf, 0xcf, 0x36, 0x83, 0x1f, 0x06, 0x06,
0xfc, 0x60, 0x00, 0x7e, 0x60, 0xcc, 0xc0, 0x36, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x30, 0x00, 0x7e, 0x60, 0xcc, 0x80, 0x19, 0x83,
0x01, 0x06, 0x06, 0x7c, 0xb0, 0x68, 0x7c, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06, 0x7c, 0xf8, 0xf9, 0x7c, 0x60, 0xcc,
0x8f, 0x19, 0xbf, 0x1f, 0x06, 0x06, 0x7c, 0x98, 0xcd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0x66, 0x7c, 0xe0, 0x87, 0x81, 0x67, 0x0c, 0xc3, 0xcf, 0x0f,
0x7c, 0x66, 0x66, 0x7c, 0x60, 0xcc, 0xc3, 0x6c, 0x86, 0xc7, 0xd8, 0x18, 0x7c, 0x66, 0x3f, 0x7e, 0x60, 0x4c, 0x62, 0x60, 0x83,
0xc4, 0xd8, 0x30, 0xfc, 0x00, 0x03, 0x7e, 0x60, 0x6c, 0x66, 0xe0, 0xc1, 0xcc, 0xd8, 0x30, 0xfc, 0x80, 0x01, 0x7f, 0xe0, 0x67,
0x66, 0xe0, 0xc1, 0xcc, 0xcf, 0x30, 0xfc, 0x81, 0x81, 0x7f, 0x60, 0xe0, 0x67, 0x60, 0xc3, 0xcf, 0xcc, 0x30, 0xfc, 0xc3, 0xc0,
0x7f, 0x60, 0x30, 0x6c, 0x60, 0x66, 0xd8, 0xd8, 0x30, 0xfc, 0xcf, 0xf0, 0x7f, 0x60, 0x30, 0xcc, 0x6c, 0x6c, 0xd8, 0xd8, 0x18,
0xf8, 0x6f, 0xfe, 0x3f, 0x60, 0x30, 0x8c, 0x67, 0x78, 0xd8, 0xd8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define hp48sx_width 42
#define hp48sx_height 10
static unsigned char hp48sx_bitmap[] = { 0xe0, 0xf1, 0xc3, 0x3f, 0x87, 0x03, 0xf0, 0xf9, 0xe7, 0x7f, 0xc7, 0x01, 0xf8, 0x39, 0xe7,
0x70, 0xee, 0x00, 0xdc, 0x39, 0xe7, 0x00, 0x7e, 0x00, 0xee, 0xf0, 0xe3, 0x0f, 0x3c, 0x00,
0xe7, 0xf8, 0xc1, 0x1f, 0x1c, 0x00, 0xff, 0x9d, 0x03, 0x1c, 0x3e, 0x00, 0xff, 0x9d, 0x3b,
0x1c, 0x3f, 0x00, 0x70, 0xfc, 0xfb, 0x9f, 0x73, 0x00, 0x70, 0xf8, 0xf1, 0xcf, 0x71, 0x00 };
#define hp48gx_width 44
#define hp48gx_height 14
static unsigned char hp48gx_bitmap[] = {
0x00, 0xc3, 0x03, 0x7c, 0x0c, 0x0c, 0x80, 0xe3, 0x07, 0xff, 0x0c, 0x0e, 0xc0, 0x33, 0x86, 0xc3, 0x1c, 0x06, 0xe0, 0x31, 0xc6,
0xc0, 0x18, 0x03, 0xb0, 0x31, 0xe6, 0x00, 0xb0, 0x01, 0x98, 0x31, 0x63, 0x00, 0xf0, 0x01, 0x8c, 0xe1, 0x61, 0x00, 0xe0, 0x00,
0xc6, 0xb8, 0x31, 0xfc, 0x70, 0x00, 0xc7, 0x18, 0x33, 0xfc, 0xf8, 0x00, 0xff, 0x0d, 0x33, 0x60, 0xd8, 0x00, 0xff, 0x0d, 0x73,
0x60, 0x8c, 0x01, 0x60, 0x8c, 0x63, 0x30, 0x86, 0x03, 0x60, 0xfc, 0xe1, 0x3f, 0x07, 0x03, 0x60, 0xf8, 0x80, 0x37, 0x03, 0x03 };
#define science_width 131
#define science_height 8
static unsigned char science_bitmap[] = {
0x38, 0x1c, 0xf2, 0x09, 0x7d, 0x79, 0xe2, 0x80, 0x2f, 0xe4, 0x41, 0x08, 0x79, 0x20, 0x3c, 0xc2, 0x07, 0x44, 0x22, 0x12,
0x08, 0x11, 0x09, 0x12, 0x81, 0x20, 0x22, 0x62, 0x08, 0x89, 0x30, 0x44, 0x42, 0x00, 0x02, 0x01, 0x09, 0x94, 0x88, 0x04,
0x09, 0x40, 0x40, 0x11, 0x52, 0x94, 0x88, 0x28, 0x42, 0x21, 0x00, 0x1c, 0x01, 0xf9, 0x94, 0x88, 0x3c, 0x09, 0xc0, 0xc7,
0xf0, 0x51, 0x94, 0x84, 0x28, 0x3e, 0xe1, 0x03, 0xa0, 0x00, 0x09, 0x94, 0x88, 0x04, 0x05, 0x40, 0xc0, 0x10, 0x48, 0x94,
0x44, 0x24, 0x22, 0x21, 0x00, 0xa1, 0xa0, 0x04, 0xa2, 0x44, 0x82, 0x04, 0x21, 0xa0, 0x08, 0xfc, 0xa2, 0x42, 0x7e, 0xa1,
0x10, 0x00, 0x91, 0x90, 0x04, 0x42, 0x44, 0x82, 0x84, 0x20, 0x10, 0x09, 0x84, 0x42, 0x22, 0x42, 0xb1, 0x10, 0x00, 0x0e,
0x8f, 0x7c, 0x42, 0x44, 0x82, 0x78, 0xe0, 0x0b, 0x09, 0x82, 0x42, 0x1e, 0x41, 0x9f, 0xf7, 0x01 };
#define gx_128K_ram_x_hot 1
#define gx_128K_ram_y_hot 8
#define gx_128K_ram_width 43
#define gx_128K_ram_height 31
static unsigned char gx_128K_ram_bitmap[] = {
0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xe2, 0xdf, 0xff,
0xff, 0x03, 0x00, 0x9c, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00,
0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xdd, 0xff, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xdd, 0xff, 0xbf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xdf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xef, 0x03, 0x00,
0xfe, 0xd7, 0xff, 0xf7, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfb, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfc, 0x03, 0x00, 0xfe, 0x1f, 0x3f,
0xff, 0x03, 0x00, 0xfe, 0xdf, 0xc0, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xc4, 0x30, 0x12, 0x1c, 0x44, 0x04, 0x27, 0x49, 0x0a, 0x24, 0x46, 0x04, 0x84, 0x39, 0x06, 0x24, 0xc9, 0x06,
0x62, 0x24, 0x07, 0x9e, 0xaf, 0x06, 0x12, 0x24, 0x09, 0x92, 0xa8, 0x05, 0xf2, 0x18, 0x11, 0x52, 0x28, 0x05 };
#define gx_silver_x_hot 0
#define gx_silver_y_hot 8
#define gx_silver_width 35
#define gx_silver_height 21
static unsigned char gx_silver_bitmap[] = {
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0xc4,
0x40, 0x00, 0x00, 0x00, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x42, 0x00, 0x00, 0x02, 0x01, 0x42,
0x00, 0x00, 0x02, 0x01, 0x44, 0x00, 0x00, 0x01, 0xfd, 0xff, 0xff, 0xff, 0x07, 0x01, 0x44, 0x00, 0x80, 0x00, 0x01, 0x48, 0x00,
0x40, 0x00, 0x01, 0x48, 0x00, 0x20, 0x00, 0x00, 0x50, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x60, 0x00, 0x06,
0x00, 0x00, 0xc0, 0x81, 0x01, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 };
#define gx_green_x_hot 11
#define gx_green_y_hot 0
#define gx_green_width 34
#define gx_green_height 22
static unsigned char gx_green_bitmap[] = {
0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc,
0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00,
0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00,
0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03 };
#define ann_alpha_width 15
#define ann_alpha_height 12
static unsigned char ann_alpha_bitmap[] = { 0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c,
0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 };
#define ann_battery_width 15
#define ann_battery_height 12
static unsigned char ann_battery_bitmap[] = { 0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49,
0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 };
#define ann_busy_width 15
#define ann_busy_height 12
static unsigned char ann_busy_bitmap[] = { 0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f };
#define ann_io_width 15
#define ann_io_height 12
static unsigned char ann_io_bitmap[] = { 0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f,
0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 };
#define ann_left_width 15
#define ann_left_height 12
static unsigned char ann_left_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78,
0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 };
#define ann_right_width 15
#define ann_right_height 12
static unsigned char ann_right_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60,
0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f };
/* #endif /\* !_ANNUNC_H *\/ */
/* #ifndef _BUTTONS_H */
/* #define _BUTTONS_H 1 */
#define menu_label_width 24
#define menu_label_height 11
static unsigned char menu_label_bitmap[] = { 0xfe, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x7f };
#define up_width 11
#define up_height 11
static unsigned char up_bitmap[] = { 0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8,
0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07 };
#define down_width 11
#define down_height 11
static unsigned char down_bitmap[] = { 0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8,
0x00, 0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00 };
#define left_width 11
#define left_height 11
static unsigned char left_bitmap[] = { 0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff,
0x07, 0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04 };
#define right_width 11
#define right_height 11
static unsigned char right_bitmap[] = { 0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff,
0x07, 0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00 };
#define sqrt_width 20
#define sqrt_height 11
static unsigned char sqrt_bitmap[] = { 0x00, 0xff, 0x0f, 0x00, 0x01, 0x08, 0x00, 0x01, 0x08, 0x80, 0x8c, 0x01, 0x80, 0x58, 0x01, 0x80, 0x38,
0x00, 0x47, 0x30, 0x00, 0x4c, 0x30, 0x00, 0x58, 0x78, 0x00, 0x30, 0x6a, 0x01, 0x20, 0xc6, 0x00 };
#define power_width 17
#define power_height 14
static unsigned char power_bitmap[] = { 0x00, 0x8c, 0x01, 0x00, 0x58, 0x01, 0x00, 0x38, 0x00, 0xc8, 0x30, 0x00, 0x9c, 0x30,
0x00, 0x98, 0x78, 0x00, 0x58, 0x6a, 0x01, 0x58, 0xc6, 0x00, 0x38, 0x00, 0x00, 0x30,
0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00 };
#define inv_width 18
#define inv_height 13
static unsigned char inv_bitmap[] = { 0x0c, 0x04, 0x00, 0x0f, 0x06, 0x00, 0x0c, 0x02, 0x00, 0x0c, 0x03, 0x00, 0x0c,
0x01, 0x00, 0x8c, 0x19, 0x03, 0x8c, 0xb0, 0x02, 0xcc, 0x70, 0x00, 0x40, 0x60,
0x00, 0x60, 0x60, 0x00, 0x20, 0xf0, 0x00, 0x30, 0xd4, 0x02, 0x10, 0x8c, 0x01 };
#define neg_width 21
#define neg_height 11
static unsigned char neg_bitmap[] = { 0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x18, 0x30, 0x00, 0xff, 0x18, 0x00, 0xff, 0x18, 0x00, 0x18, 0x0c,
0x00, 0x18, 0x0c, 0x00, 0x18, 0xc6, 0x1f, 0x00, 0xc6, 0x1f, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00 };
#define bs_width 11
#define bs_height 11
static unsigned char bs_bitmap[] = { 0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff,
0x07, 0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00 };
#define alpha_width 12
#define alpha_height 10
static unsigned char alpha_bitmap[] = { 0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83, 0x05, 0x83, 0x05,
0x83, 0x03, 0x83, 0x01, 0x83, 0x01, 0x46, 0x09, 0x3c, 0x06 };
#define div_width 10
#define div_height 10
static unsigned char div_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00 };
#define shl_width 24
#define shl_height 14
static unsigned char shl_bitmap[] = { 0xfe, 0xff, 0x7f, 0xff, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x3f, 0xfe, 0xff, 0x1f, 0xff,
0xff, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xf8, 0x0f, 0x00, 0xf0, 0x1f, 0xff, 0xf1, 0x3f,
0xfe, 0xf1, 0x7f, 0xfc, 0xf1, 0xff, 0xfc, 0xf1, 0xff, 0xff, 0xf1, 0xfe, 0xff, 0x71 };
#define mul_width 10
#define mul_height 10
static unsigned char mul_bitmap[] = { 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00,
0x78, 0x00, 0xfc, 0x00, 0xce, 0x01, 0x87, 0x03, 0x03, 0x03 };
#define shr_width 24
#define shr_height 14
static unsigned char shr_bitmap[] = { 0xfe, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x7f, 0xfc, 0xff, 0xff,
0xf8, 0x3f, 0x00, 0xf0, 0x1f, 0x00, 0xe0, 0x0f, 0x00, 0xf0, 0x8f, 0xff, 0xf8, 0x8f,
0x7f, 0xfc, 0x8f, 0x3f, 0xfe, 0x8f, 0x3f, 0xff, 0x8f, 0xff, 0xff, 0x8e, 0xff, 0x7f };
#define minus_width 10
#define minus_height 10
static unsigned char minus_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define plus_width 10
#define plus_height 10
static unsigned char plus_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xff, 0x03,
0xff, 0x03, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00 };
#define quote_width 2
#define quote_height 10
static unsigned char quote_bitmap[] = { 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
/* Below used only for X11 */
#define last_width 120
#define last_height 6
static unsigned char last_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc6, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, 0x49, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x8f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc9, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 };
#endif /* _UI48_BITMAPS_MISC_H 1 */

View file

@ -0,0 +1,423 @@
#ifndef _UI48_BITMAPS_SMALL_FONT_H
#define _UI48_BITMAPS_SMALL_FONT_H 1
#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 zero_width 5
#define zero_height 7
static unsigned char zero_bits[] = {
14, 17, 25, 21, 19, 17, 14,
};
#define one_width 5
#define one_height 7
static unsigned char one_bits[] = {
4, 6, 5, 4, 4, 4, 31,
};
#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 four_width 5
#define four_height 7
static unsigned char four_bits[] = {
8, 12, 10, 9, 31, 8, 8,
};
#define five_width 5
#define five_height 7
static unsigned char five_bits[] = {
31, 1, 1, 15, 16, 16, 15,
};
#define six_width 5
#define six_height 7
static unsigned char six_bits[] = {
14, 17, 1, 15, 17, 17, 14,
};
#define seven_width 5
#define seven_height 7
static unsigned char seven_bits[] = {
31, 16, 8, 4, 2, 1, 1,
};
#define eight_width 5
#define eight_height 7
static unsigned char eight_bits[] = {
14, 17, 17, 14, 17, 17, 14,
};
#define nine_width 5
#define nine_height 7
static unsigned char nine_bits[] = {
14, 17, 17, 30, 16, 17, 14,
};
#define small_colon_width 2
#define small_colon_height 7
static unsigned char small_colon_bits[] = { 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00 };
#define d_width 5
#define d_height 7
static unsigned char d_bits[] = {
16, 16, 30, 17, 17, 30, 0,
};
#define e_width 5
#define e_height 7
static unsigned char e_bits[] = {
0, 14, 17, 15, 1, 14, 0,
};
#define i_width 5
#define i_height 7
static unsigned char i_bits[] = {
4, 0, 6, 4, 4, 14, 0,
};
#define p_width 5
#define p_height 7
static unsigned char p_bits[] = {
0, 15, 17, 17, 15, 1, 1,
};
#define r_width 5
#define r_height 7
static unsigned char r_bits[] = {
0, 29, 3, 1, 1, 1, 0,
};
#define s_width 5
#define s_height 7
static unsigned char s_bits[] = {
0, 30, 1, 14, 16, 15, 0,
};
#define t_width 5
#define t_height 7
static unsigned char t_bits[] = {
2, 15, 2, 2, 2, 12, 0,
};
#define v_width 5
#define v_height 7
static unsigned char v_bits[] = {
0, 17, 17, 10, 10, 4, 0,
};
#define w_width 5
#define w_height 7
static unsigned char w_bits[] = {
0, 17, 17, 21, 21, 10, 0,
};
#define y_width 5
#define y_height 7
static unsigned char y_bits[] = {
0, 0, 17, 17, 30, 16, 15,
};
#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 };
#endif /* _UI48_BITMAPS_SMALL_FONT_H 1 */

2291
src/ui48_common.c Normal file

File diff suppressed because it is too large Load diff

18
src/ui48_common.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef _UI48_COMMON_H
#define _UI48_COMMON_H 1
#include "ui48_config.h"
/*************************************************/
/* public API: if it's there it's used elsewhere */
/*************************************************/
extern void ( *ui_get_event )( void );
extern void ( *ui_update_display )( void );
extern void ( *ui_start )( config_t* config );
extern void ( *ui_stop )( void );
extern void setup_ui( config_t* config );
extern void close_and_exit( void );
#endif /* !_UI48_COMMON_H */

271
src/ui48_config.c Normal file
View file

@ -0,0 +1,271 @@
#include <assert.h>
#include <errno.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <getopt.h>
#include "ui48_config.h"
static config_t config = {
.progname = ( char* )"ui48",
.model = MODEL_48GX,
.verbose = false,
.shiftless = false,
.frontend = FRONTEND_SDL,
.mono = false,
.gray = false,
.chromeless = false,
.fullscreen = false,
.scale = 1.0,
.tiny = false,
.small = false,
.wire_name = ( char* )"/dev/wire",
.ir_name = ( char* )"/dev/ir",
/* from args.h */
.reset = false,
.monitor = false,
.batchXfer = false,
.state_dir_path = ( char* )".",
.mod_file_name = ( char* )"mod",
.cpu_file_name = ( char* )"cpu",
.hdw_file_name = ( char* )"hdw",
.rom_file_name = ( char* )"rom",
.ram_file_name = ( char* )"ram",
.port_1_file_name = ( char* )"port1",
.port_2_file_name = ( char* )"port2",
.hw = ( char* )"hp48", /* 2.1: Hardware configuration (unused) */
};
/* Path/name dynamic allocator */
/* static char* GetPathname( char* path, char* name ) */
/* { */
/* char* s = malloc( strlen( path ) + strlen( name ) + 2 ); */
/* strcpy( s, path ); */
/* strcat( s, "/" ); */
/* strcat( s, name ); */
/* return s; */
/* } */
config_t* config_init( int argc, char* argv[] )
{
int option_index;
int c = '?';
int clopt_model = -1;
int clopt_verbose = -1;
int clopt_shiftless = -1;
int clopt_frontend = -1;
int clopt_mono = -1;
int clopt_gray = -1;
int clopt_chromeless = -1;
int clopt_fullscreen = -1;
double clopt_scale = -1.0;
int clopt_tiny = -1;
int clopt_small = -1;
int clopt_reset = -1;
int clopt_monitor = -1;
int clopt_batchXfer = -1;
char* clopt_state_dir_path;
char* clopt_mod_file_name;
char* clopt_cpu_file_name;
char* clopt_hdw_file_name;
char* clopt_rom_file_name;
char* clopt_ram_file_name;
char* clopt_port_1_file_name;
char* clopt_port_2_file_name;
char* clopt_hw;
const char* optstring = "h";
struct option long_options[] = {
{"help", no_argument, NULL, 'h' },
{"48sx", no_argument, &clopt_model, MODEL_48SX },
{"48gx", no_argument, &clopt_model, MODEL_48GX },
{"40g", no_argument, &clopt_model, MODEL_40G },
{"49g", no_argument, &clopt_model, MODEL_49G },
{"verbose", no_argument, &clopt_verbose, true },
{"shiftless", no_argument, &clopt_shiftless, true },
{"gui", no_argument, &clopt_frontend, FRONTEND_SDL },
{"tui", no_argument, &clopt_frontend, FRONTEND_NCURSES},
{"tui-small", no_argument, NULL, 6110 },
{"tui-tiny", no_argument, NULL, 6120 },
{"mono", no_argument, &clopt_mono, true },
{"gray", no_argument, &clopt_gray, true },
{"chromeless", no_argument, &clopt_chromeless, true },
{"fullscreen", no_argument, &clopt_fullscreen, true },
{"scale", required_argument, NULL, 7110 },
{"reset", no_argument, &clopt_reset, true },
{"monitor", no_argument, &clopt_monitor, true },
{"batchXfer", no_argument, &clopt_batchXfer, true },
{"state-dir", required_argument, NULL, 8999 },
{"mod", required_argument, NULL, 8000 },
{"cpu", required_argument, NULL, 8010 },
{"hdw", required_argument, NULL, 8020 },
{"rom", required_argument, NULL, 8030 },
{"ram", required_argument, NULL, 8040 },
{"port1", required_argument, NULL, 8050 },
{"port2", required_argument, NULL, 8060 },
{"hw", required_argument, NULL, 8070 },
{0, 0, 0, 0 }
};
const char* help_text = "usage: %s [options]\n"
"options:\n"
" -h --help what you are reading\n"
" --gui graphical (SDL2) front-end (default: true)\n"
" --tui text front-end (default: false)\n"
" --tui-small text small front-end (2×2 pixels per character) (default: "
"false)\n"
" --tui-tiny text tiny front-end (2×4 pixels per character) (default: "
"false)\n"
" --chromeless only show display (default: "
"false)\n"
" --fullscreen make the UI fullscreen "
"(default: false)\n"
" --scale=<n> make the UI scale <n> times "
"(default: 1.0)\n"
" --mono make the UI monochrome (default: "
"false)\n"
" --gray make the UI grayscale (default: "
"false)\n"
" --48gx make the GUI looks like a HP 48GX (default: "
"auto)\n"
" --48sx make the GUI looks like a HP 48SX (default: "
"auto)\n"
" --shiftless don't map the shift keys to let them free for numbers (default: "
"false)\n";
while ( c != EOF ) {
c = getopt_long( argc, argv, optstring, long_options, &option_index );
switch ( c ) {
case 'h':
fprintf( stderr, help_text, config.progname );
exit( 0 );
break;
case 6110:
clopt_frontend = FRONTEND_NCURSES;
clopt_small = true;
break;
case 6120:
clopt_frontend = FRONTEND_NCURSES;
clopt_tiny = true;
break;
case 7110:
clopt_scale = atof( optarg );
break;
case 8999:
clopt_state_dir_path = optarg;
break;
case 8000:
clopt_mod_file_name = optarg;
break;
case 8010:
clopt_cpu_file_name = optarg;
break;
case 8020:
clopt_hdw_file_name = optarg;
break;
case 8030:
clopt_rom_file_name = optarg;
break;
case 8040:
clopt_ram_file_name = optarg;
break;
case 8050:
clopt_port_1_file_name = optarg;
break;
case 8060:
clopt_port_2_file_name = optarg;
break;
case 8070:
clopt_hw = optarg;
break;
default:
break;
}
}
if ( optind < argc ) {
fprintf( stderr, "Invalid arguments : " );
while ( optind < argc )
fprintf( stderr, "%s\n", argv[ optind++ ] );
fprintf( stderr, "\n" );
}
/****************************************************/
/* 2. treat command-line params which have priority */
/****************************************************/
if ( clopt_verbose != -1 )
config.verbose = clopt_verbose == true;
if ( clopt_model != -1 )
config.model = clopt_model;
if ( clopt_frontend != -1 )
config.frontend = clopt_frontend;
if ( clopt_chromeless != -1 )
config.chromeless = clopt_chromeless == true;
if ( clopt_fullscreen != -1 )
config.fullscreen = clopt_fullscreen == true;
if ( clopt_scale > 0.0 )
config.scale = clopt_scale;
if ( clopt_mono != -1 )
config.mono = clopt_mono == true;
if ( clopt_small != -1 )
config.small = clopt_small == true;
if ( clopt_tiny != -1 )
config.tiny = clopt_tiny == true;
if ( clopt_gray != -1 )
config.gray = clopt_gray == true;
if ( clopt_shiftless != -1 )
config.shiftless = clopt_shiftless == true;
if ( clopt_reset != -1 )
config.reset = clopt_reset;
if ( clopt_monitor != -1 )
config.monitor = clopt_monitor;
if ( clopt_batchXfer != -1 )
config.batchXfer = clopt_batchXfer;
if ( clopt_state_dir_path != NULL )
config.state_dir_path = strdup( clopt_state_dir_path );
if ( clopt_mod_file_name != NULL )
config.mod_file_name = strdup( clopt_mod_file_name );
if ( clopt_cpu_file_name != NULL )
config.cpu_file_name = strdup( clopt_cpu_file_name );
if ( clopt_hdw_file_name != NULL )
config.hdw_file_name = strdup( clopt_hdw_file_name );
if ( clopt_rom_file_name != NULL )
config.rom_file_name = strdup( clopt_rom_file_name );
if ( clopt_ram_file_name != NULL )
config.ram_file_name = strdup( clopt_ram_file_name );
if ( clopt_port_1_file_name != NULL )
config.port_1_file_name = strdup( clopt_port_1_file_name );
if ( clopt_port_2_file_name != NULL )
config.port_2_file_name = strdup( clopt_port_2_file_name );
if ( clopt_hw != NULL )
config.hw = strdup( clopt_hw );
fprintf( stderr, "config.chromeless = %s\n\n", config.chromeless ? "true" : "false" );
return &config;
}

55
src/ui48_config.h Normal file
View file

@ -0,0 +1,55 @@
#ifndef _UI48_CONFIG_H
#define _UI48_CONFIG_H 1
#include <stdbool.h>
#define FRONTEND_SDL 1
#define FRONTEND_NCURSES 2
#define MODEL_48SX 485
#define MODEL_48GX 486
#define MODEL_40G 406
#define MODEL_49G 496
typedef struct {
char* progname;
int model;
bool verbose;
bool shiftless;
int frontend;
bool mono;
bool gray;
bool chromeless;
bool fullscreen;
double scale;
bool tiny;
bool small;
char* wire_name;
char* ir_name;
/* from args.h */
bool reset; /* 2.1: Force emulator reset */
bool monitor; /* 2.1: Call monitor() on startup */
bool batchXfer; /* 3.15: Non-interactive file transfers */
char* state_dir_path;
char* mod_file_name;
char* cpu_file_name;
char* hdw_file_name;
char* rom_file_name;
char* ram_file_name;
char* port_1_file_name;
char* port_2_file_name;
char* hw; /* 2.1: Hardware configuration (unused) */
} config_t;
/*************/
/* functions */
/*************/
extern config_t* config_init( int argc, char* argv[] );
#endif /* !_UI48_CONFIG_H */

178
src/ui48_emulator.c Normal file
View file

@ -0,0 +1,178 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ui48_config.h"
#include "ui48_emulator.h"
#include "config.h"
#include "keyb.h"
#include "modules.h"
static config_t config;
typedef struct hpkey_t {
int code;
bool pressed;
char* inOut;
} hpkey_t;
static hpkey_t keyboard48[ NB_KEYS ] = {
/* From top left to bottom right */
{0x14, false, "1/10"},
{0x84, false, "8/10"},
{0x83, false, "8/08"},
{0x82, false, "8/04"},
{0x81, false, "8/02"},
{0x80, false, "8/01"},
{0x24, false, "2/10"},
{0x74, false, "7/10"},
{0x73, false, "7/08"},
{0x72, false, "7/04"},
{0x71, false, "7/02"},
{0x70, false, "7/01"},
{0x04, false, "0/10"},
{0x64, false, "6/10"},
{0x63, false, "6/08"},
{0x62, false, "6/04"},
{0x61, false, "6/02"},
{0x60, false, "6/01"},
{0x34, false, "3/10"},
{0x54, false, "5/10"},
{0x53, false, "5/08"},
{0x52, false, "5/04"},
{0x51, false, "5/02"},
{0x50, false, "5/01"},
{0x44, false, "4/10"},
{0x43, false, "4/08"},
{0x42, false, "4/04"},
{0x41, false, "4/02"},
{0x40, false, "4/01"},
{0x35, false, "3/20"},
{0x33, false, "3/08"},
{0x32, false, "3/04"},
{0x31, false, "3/02"},
{0x30, false, "3/01"},
{0x25, false, "2/20"},
{0x23, false, "2/08"},
{0x22, false, "2/04"},
{0x21, false, "2/02"},
{0x20, false, "2/01"},
{0x15, false, "1/20"},
{0x13, false, "1/08"},
{0x12, false, "1/04"},
{0x11, false, "1/02"},
{0x10, false, "1/01"},
{0x8000, false, "*" },
{0x03, false, "0/08"},
{0x02, false, "0/04"},
{0x01, false, "0/02"},
{0x00, false, "0/01"},
};
void press_key( int hpkey )
{
// Check not already pressed (may be important: avoids a useless do_kbd_int)
if ( keyboard48[ hpkey ].pressed )
return;
keyboard48[ hpkey ].pressed = true;
KeybPress( keyboard48[ hpkey ].inOut );
}
void release_key( int hpkey )
{
// Check not already released (not critical)
if ( !keyboard48[ hpkey ].pressed )
return;
keyboard48[ hpkey ].pressed = false;
KeybRelease( keyboard48[ hpkey ].inOut );
}
bool is_key_pressed( int hpkey ) { return keyboard48[ hpkey ].pressed; }
unsigned char get_annunciators( void ) { return mod_status.hdw.lcd_ann; }
bool get_display_state( void ) { return mod_status.hdw.lcd_on; }
void get_lcd_buffer( int* target )
{
Address addr = mod_status.hdw.lcd_base_addr;
int x, y;
Nibble v;
/* Scan active display rows */
for ( y = 0; y <= mod_status.hdw.lcd_vlc; y++ ) {
/* Scan columns */
for ( x = 0; x < NIBBLES_PER_ROW; x++ ) {
v = FetchNibble( addr++ );
for ( int nx = 0; nx < 4; nx++ )
target[ ( y * 131 ) + ( x * 4 ) + nx ] = v & ( 1 << ( nx & 3 ) );
}
addr += mod_status.hdw.lcd_line_offset;
}
/* Scan menu display rows */
addr = mod_status.hdw.lcd_menu_addr;
#define MAX_ROWS 64
for ( ; y < MAX_ROWS; y++ ) {
/* Scan columns */
for ( x = 0; x < NIBBLES_PER_ROW; x++ ) {
v = FetchNibble( addr++ );
for ( int nx = 0; nx < 4; nx++ )
target[ ( y * 131 ) + ( x * 4 ) + nx ] = v & ( 1 << ( nx & 3 ) );
}
}
}
int get_contrast( void ) { return mod_status.hdw.lcd_contrast; }
struct Args args;
/* Path/name dynamic allocator */
static char* GetPathname( char* path, char* name )
{
char* s = malloc( strlen( path ) + strlen( name ) + 2 );
strcpy( s, path );
strcat( s, "/" );
strcat( s, name );
return s;
}
void init_emulator( config_t* conf )
{
config = *conf;
/* Fill the emulator options data structure. */
args.reset = config.reset;
args.monitor = config.monitor;
args.batchXfer = config.batchXfer;
args.mod_file_name = GetPathname( config.state_dir_path, config.mod_file_name );
args.cpu_file_name = GetPathname( config.state_dir_path, config.cpu_file_name );
args.hdw_file_name = GetPathname( config.state_dir_path, config.hdw_file_name );
args.rom_file_name = GetPathname( config.state_dir_path, config.rom_file_name );
args.ram_file_name = GetPathname( config.state_dir_path, config.ram_file_name );
args.port_1_file_name = GetPathname( config.state_dir_path, config.port_1_file_name );
args.port_2_file_name = GetPathname( config.state_dir_path, config.port_2_file_name );
args.hw = config.hw;
EmulatorInit();
}
void exit_emulator( void ) { EmulatorExit( SAVE_AND_EXIT ); }

103
src/ui48_emulator.h Normal file
View file

@ -0,0 +1,103 @@
#ifndef _UI48_EMULATOR_H
#define _UI48_EMULATOR_H 1
#include <stdbool.h>
#include "ui48_config.h"
// Keys
#define HPKEY_A 0
#define HPKEY_B 1
#define HPKEY_C 2
#define HPKEY_D 3
#define HPKEY_E 4
#define HPKEY_F 5
#define HPKEY_MTH 6
#define HPKEY_PRG 7
#define HPKEY_CST 8
#define HPKEY_VAR 9
#define HPKEY_UP 10
#define HPKEY_NXT 11
#define HPKEY_QUOTE 12
#define HPKEY_STO 13
#define HPKEY_EVAL 14
#define HPKEY_LEFT 15
#define HPKEY_DOWN 16
#define HPKEY_RIGHT 17
#define HPKEY_SIN 18
#define HPKEY_COS 19
#define HPKEY_TAN 20
#define HPKEY_SQRT 21
#define HPKEY_POWER 22
#define HPKEY_INV 23
#define HPKEY_ENTER 24
#define HPKEY_NEG 25
#define HPKEY_EEX 26
#define HPKEY_DEL 27
#define HPKEY_BS 28
#define HPKEY_ALPHA 29
#define HPKEY_7 30
#define HPKEY_8 31
#define HPKEY_9 32
#define HPKEY_DIV 33
#define HPKEY_SHL 34
#define HPKEY_4 35
#define HPKEY_5 36
#define HPKEY_6 37
#define HPKEY_MUL 38
#define HPKEY_SHR 39
#define HPKEY_1 40
#define HPKEY_2 41
#define HPKEY_3 42
#define HPKEY_MINUS 43
#define HPKEY_ON 44
#define HPKEY_0 45
#define HPKEY_PERIOD 46
#define HPKEY_SPC 47
#define HPKEY_PLUS 48
#define FIRST_HPKEY HPKEY_A
#define LAST_HPKEY HPKEY_PLUS
#define NB_KEYS ( LAST_HPKEY + 1 )
#define KEYS_BUFFER_SIZE 9
// Annunciators
#define NB_ANNUNCIATORS 6
#define ANN_LEFT 0x81
#define ANN_RIGHT 0x82
#define ANN_ALPHA 0x84
#define ANN_BATTERY 0x88
#define ANN_BUSY 0x90
#define ANN_IO 0xa0
// LCD
#define NIBBLES_PER_ROW 34
#define LCD_WIDTH 131
#define LCD_HEIGHT 64
/*************************************************/
/* public API: if it's there it's used elsewhere */
/*************************************************/
extern void press_key( int hpkey );
extern void release_key( int hpkey );
extern bool is_key_pressed( int hpkey );
extern void init_emulator( config_t* conf );
extern void exit_emulator( void );
extern unsigned char get_annunciators( void );
extern bool get_display_state( void );
extern void get_lcd_buffer( int* target );
extern int get_contrast( void );
#endif /* !_UI48_EMULATOR_H */

93
src/ui48_inner.h Normal file
View file

@ -0,0 +1,93 @@
#ifndef _UI48_INNER_H
#define _UI48_INNER_H 1
#include "ui48_emulator.h"
#include "ui48_bitmaps_misc.h"
#include "ui48_bitmaps_small_font.h"
#include "ui48_bitmaps_big_font.h"
// Colors
/* SX GX */
#define WHITE 0 /* #ffffff #ffffff */
#define LEFT 1 /* #ffa600 #ffbaff */
#define RIGHT 2 /* #00d2ff #00ffcc */
#define BUT_TOP 3 /* #6d5d5d #646464 */
#define BUTTON 4 /* #5a4d4d #585858 */
#define BUT_BOT 5 /* #4c4141 #4a4a4a */
#define LCD 6 /* #cadd5c #cadd5c */
#define PIXEL 7 /* #000080 #000080 */
#define PAD_TOP 8 /* #6d4e4e #585858 */
#define PAD 9 /* #5a4040 #4a4a4a */
#define PAD_BOT 10 /* #4c3636 #404040 */
#define DISP_PAD_TOP 11 /* #9b7654 #808080 */
#define DISP_PAD 12 /* #7c5e43 #68686e */
#define DISP_PAD_BOT 13 /* #644b35 #54545a */
#define LOGO 14 /* #cca96b #b0b0b8 */
#define LOGO_BACK 15 /* #404040 #68686e */
#define LABEL 16 /* #cab890 #f0f0f0 */
#define FRAME 17 /* #000000 #000000 */
#define UNDERLAY 18 /* #3c2a2a #68686e */
#define BLACK 19 /* #000000 #000000 */
#define FIRST_COLOR WHITE
#define LAST_COLOR BLACK
#define NB_COLORS ( LAST_COLOR + 1 )
/***********/
/* typedef */
/***********/
typedef struct letter_t {
unsigned int w, h;
unsigned char* bits;
} letter_t;
typedef struct color_t {
const char* name;
int r, g, b, a;
int mono_rgb;
int gray_rgb;
} color_t;
typedef struct button_t {
const char* name;
int x, y;
int w, h;
int lc;
const char* label;
short font_size;
unsigned int lw, lh;
unsigned char* lb;
const char* letter;
const char* left;
short is_menu;
const char* right;
const char* sub;
} button_t;
/*************/
/* variables */
/*************/
extern letter_t small_font[ 128 ];
extern letter_t big_font[ 128 ];
extern color_t colors_sx[ NB_COLORS ];
extern color_t colors_gx[ NB_COLORS ];
extern button_t buttons_sx[ NB_KEYS ];
extern button_t buttons_gx[ NB_KEYS ];
#define small_ascent 8
#define small_descent 4
/*************/
/* functions */
/*************/
extern int SmallTextWidth( const char* string, unsigned int length );
extern int BigTextWidth( const char* string, unsigned int length );
#endif /* _UI48_INNER_H */

196
src/ui48_main.c Normal file
View file

@ -0,0 +1,196 @@
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "ui48_config.h"
#include "ui48_emulator.h"
#include "ui48_common.h"
#include "config.h"
#include "cpu.h"
#include "monitor.h"
#define SPEED_HZ_UI 64
/* Chf condition codes (main program only) */
#define CHF_MODULE_ID MAIN_CHF_MODULE_ID
#include <Chf.h>
#define MAIN_M_COPYRIGHT 501
#define MAIN_M_LICENSE 502
/*---------------------------------------------------------------------------
Chf parameters - Do not change.
---------------------------------------------------------------------------*/
#define CONDITION_STACK_SIZE 16
#define HANDLER_STACK_SIZE 8
/* Conditional prefix and mandatory suffix to make a message catalog
name from argv[0]
*/
static const char cat_prefix[] = "./";
static const char cat_suffix[] = ".cat";
#define CAT_PREFIX_LEN ( sizeof( cat_prefix ) + 1 )
#define CAT_SUFFIX_LEN ( sizeof( cat_suffix ) + 1 )
static void adjust_setlocale( void )
{
fprintf( stderr, "saturn-W-locale probably bad; reverting to C locale\n" );
putenv( "LC_ALL=C" );
putenv( "LC_COLLATE=C" );
putenv( "LC_CTYPE=C" );
putenv( "LC_MESSAGES=C" );
putenv( "LC_MONETARY=C" );
putenv( "LC_NUMERIC=C" );
putenv( "LC_TIME=C" );
putenv( "LANG=C" );
}
void signal_handler( int sig )
{
switch ( sig ) {
/* case SIGINT: /\* Ctrl-C *\/ */
/* enter_debugger |= USER_INTERRUPT; */
/* break; */
case SIGALRM:
ui_get_event();
ui_update_display();
break;
case SIGPIPE:
ui_stop();
exit_emulator();
exit( 0 );
default:
break;
}
}
int main( int argc, char** argv )
{
config_t* config = config_init( argc, argv );
char* cat_name;
int st;
int retry = 0;
if ( ( cat_name = malloc( strlen( argv[ 0 ] ) + CAT_PREFIX_LEN + CAT_SUFFIX_LEN + 1 ) ) == NULL ) {
fprintf( stderr, "saturn-E-cat_name initialization failed\n" );
exit( EXIT_FAILURE );
}
/* Generate catalog name, without optional prefix */
strcpy( cat_name, argv[ 0 ] );
strcat( cat_name, cat_suffix );
/* 3.15: Retry the initialization steps below two times; before trying
the second time, adjust the setlocale() environment variables
with adjust_setlocale()
*/
while ( retry < 2 ) {
/* Chf initialization with msgcat subsystem; notice that on
some systems (e.g. Digital UNIX) catopen() can succeed even
if it was not able to open the right message catalog;
better try it now.
*/
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, NULL ) == NULL )
fprintf( stderr, "saturn-E-Primary Chf initialization failed (%d)\n", st );
else
break;
/* Bring down Chf before initializing it again */
if ( st == CHF_S_OK )
ChfExit();
/* Try alternate message catalog name (with prefix) */
strcpy( cat_name, cat_prefix );
strcat( cat_name, argv[ 0 ] );
strcat( cat_name, cat_suffix );
if ( ( st = ChfMsgcatInit( argv[ 0 ], /* Application's name */
CHF_DEFAULT, /* Options */
cat_name, /* Name of the message catalog */
CONDITION_STACK_SIZE, /* Size of the condition stack */
HANDLER_STACK_SIZE, /* Size of the handler stack */
EXIT_FAILURE /* Abnormal exit code */
) ) != CHF_S_OK ||
ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, NULL ) == NULL )
fprintf( stderr, "saturn-E-Alternate Chf initialization failed (%d)\n", st );
else
break;
/* Bring down Chf before initializing it again */
if ( st == CHF_S_OK )
ChfExit();
/* Attempt to adjust setlocale() environment variables */
if ( retry++ == 0 )
adjust_setlocale();
}
if ( retry == 2 ) {
fprintf( stderr, "saturn-F-Application aborted\n" );
exit( EXIT_FAILURE );
}
/* cat_name no longer needed */
free( cat_name );
/* 3.9: Print out MAIN_M_COPYRIGHT and MAIN_M_LICENSE on stdout now */
fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_COPYRIGHT, "" ), "$Revision: 4.1 $" );
/* fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); */
init_emulator( config );
/* (G)UI */
setup_ui( config );
ui_start( config );
sigset_t set;
struct sigaction sa;
sigemptyset( &set );
sigaddset( &set, SIGALRM );
sa.sa_handler = signal_handler;
sa.sa_mask = set;
#ifdef SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction( SIGALRM, &sa, ( struct sigaction* )0 );
/************************************/
/* set the real time interval timer */
/************************************/
/*
Every <interval>µs setitimer will trigger a SIGALRM
which will getUI events and refresh UI in signal_handler
*/
struct itimerval it;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 1000000 / SPEED_HZ_UI;
it.it_value.tv_sec = 0;
it.it_value.tv_usec = 1000000 / SPEED_HZ_UI;
setitimer( ITIMER_REAL, &it, ( struct itimerval* )0 );
if ( config->monitor )
/* Invoke Monitor */
Monitor();
else
/* Call Emulator directly */
Emulator();
/* never reached */
return EXIT_SUCCESS;
}

504
src/ui48_ncurses.c Normal file
View file

@ -0,0 +1,504 @@
#include <ctype.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <locale.h>
#include <wchar.h>
#include <curses.h>
#include "ui48_config.h"
#include "ui48_emulator.h"
#include "ui48_common.h"
#include "ui48_inner.h"
#define COLORS ( config.model == MODEL_48GX ? colors_gx : colors_sx )
#define BUTTONS ( config.model == MODEL_48GX ? buttons_gx : buttons_sx )
#define LCD_OFFSET_X 1
#define LCD_OFFSET_Y 1
#define LCD_BOTTOM LCD_OFFSET_Y + ( config.small ? ( LCD_HEIGHT / 2 ) : config.tiny ? ( LCD_HEIGHT / 4 ) : LCD_HEIGHT )
#define LCD_RIGHT LCD_OFFSET_X + ( ( config.small || config.tiny ) ? ( LCD_WIDTH / 2 ) + 1 : LCD_WIDTH )
#define LCD_COLOR_BG 48
#define LCD_COLOR_FG 49
#define LCD_PIXEL_ON 1
#define LCD_PIXEL_OFF 2
#define LCD_COLORS_PAIR 3
/*************/
/* variables */
/*************/
static config_t config;
static int lcd_pixels_buffer[ LCD_WIDTH * LCD_HEIGHT ];
static int last_annunciators = -1;
// static int last_contrast = -1;
/****************************/
/* functions implementation */
/****************************/
static inline wchar_t eight_bits_to_braille_char( bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7, bool b8 )
{
/*********/
/* b1 b4 */
/* b2 b5 */
/* b3 b6 */
/* b7 b8 */
/*********/
wchar_t chr = 0x2800;
if ( b1 )
chr |= 1; // 0b0000000000000001;
if ( b2 )
chr |= 2; // 0b0000000000000010;
if ( b3 )
chr |= 4; // 0b0000000000000100;
if ( b4 )
chr |= 8; // 0b0000000000001000;
if ( b5 )
chr |= 16; // 0b0000000000010000;
if ( b6 )
chr |= 32; // 0b0000000000100000;
if ( b7 )
chr |= 64; // 0b0000000001000000;
if ( b8 )
chr |= 128; // 0b0000000010000000;
return chr;
}
static inline void ncurses_draw_lcd_tiny( void )
{
bool b1, b2, b3, b4, b5, b6, b7, b8;
int step_x = 2;
int step_y = 4;
wchar_t line[ 66 ]; /* ( LCD_WIDTH / step_x ) + 1 */
if ( !config.mono && has_colors() )
attron( COLOR_PAIR( LCD_COLORS_PAIR ) );
for ( int y = 0; y < LCD_HEIGHT; y += step_y ) {
wcscpy( line, L"" );
for ( int x = 0; x < LCD_WIDTH; x += step_x ) {
b1 = lcd_pixels_buffer[ ( y * LCD_WIDTH ) + x ];
b4 = lcd_pixels_buffer[ ( y * LCD_WIDTH ) + x + 1 ];
b2 = lcd_pixels_buffer[ ( ( y + 1 ) * LCD_WIDTH ) + x ];
b5 = lcd_pixels_buffer[ ( ( y + 1 ) * LCD_WIDTH ) + x + 1 ];
b3 = lcd_pixels_buffer[ ( ( y + 2 ) * LCD_WIDTH ) + x ];
b6 = lcd_pixels_buffer[ ( ( y + 2 ) * LCD_WIDTH ) + x + 1 ];
b7 = lcd_pixels_buffer[ ( ( y + 3 ) * LCD_WIDTH ) + x ];
b8 = lcd_pixels_buffer[ ( ( y + 3 ) * LCD_WIDTH ) + x + 1 ];
wchar_t pixels = eight_bits_to_braille_char( b1, b2, b3, b4, b5, b6, b7, b8 );
wcsncat( line, &pixels, 1 );
}
mvaddwstr( LCD_OFFSET_Y + ( y / step_y ), LCD_OFFSET_X, line );
}
if ( !config.mono && has_colors() )
attroff( COLOR_PAIR( LCD_COLORS_PAIR ) );
wrefresh( stdscr );
}
static inline wchar_t four_bits_to_quadrant_char( bool top_left, bool top_right, bool bottom_left, bool bottom_right )
{
if ( top_left ) {
if ( top_right ) {
if ( bottom_left )
return bottom_right ? L'' : L''; /* 0x2588 0x2598 */
else
return bottom_right ? L'' : L''; /* 0x259C 0x2580 */
} else {
if ( bottom_left )
return bottom_right ? L'' : L'';
else
return bottom_right ? L'' : L'';
}
} else {
if ( top_right ) {
if ( bottom_left )
return bottom_right ? L'' : L'';
else
return bottom_right ? L'' : L'';
} else {
if ( bottom_left )
return bottom_right ? L'' : L'';
else
return bottom_right ? L'' : L' ';
}
}
}
static inline void ncurses_draw_lcd_small( void )
{
bool top_left, top_right, bottom_left, bottom_right;
int step_x = 2;
int step_y = 2;
wchar_t line[ 66 ]; /* ( LCD_WIDTH / step_x ) + 1 */
if ( !config.mono && has_colors() )
attron( COLOR_PAIR( LCD_COLORS_PAIR ) );
for ( int y = 0; y < LCD_HEIGHT; y += step_y ) {
wcscpy( line, L"" );
for ( int x = 0; x < LCD_WIDTH; x += step_x ) {
top_left = lcd_pixels_buffer[ ( y * LCD_WIDTH ) + x ];
top_right = lcd_pixels_buffer[ ( y * LCD_WIDTH ) + x + 1 ];
bottom_left = lcd_pixels_buffer[ ( ( y + 1 ) * LCD_WIDTH ) + x ];
bottom_right = lcd_pixels_buffer[ ( ( y + 1 ) * LCD_WIDTH ) + x + 1 ];
wchar_t pixels = four_bits_to_quadrant_char( top_left, top_right, bottom_left, bottom_right );
wcsncat( line, &pixels, 1 );
}
mvaddwstr( LCD_OFFSET_Y + ( y / step_y ), LCD_OFFSET_X, line );
}
if ( !config.mono && has_colors() )
attroff( COLOR_PAIR( LCD_COLORS_PAIR ) );
wrefresh( stdscr );
}
static inline void ncurses_draw_lcd_fullsize( void )
{
bool bit;
wchar_t line[ LCD_WIDTH ];
if ( !config.mono && has_colors() )
attron( COLOR_PAIR( LCD_COLORS_PAIR ) );
for ( int y = 0; y < LCD_HEIGHT; ++y ) {
wcscpy( line, L"" );
for ( int x = 0; x < LCD_WIDTH; ++x ) {
bit = lcd_pixels_buffer[ ( y * LCD_WIDTH ) + x ];
wchar_t pixel = bit ? L'' : L' ';
wcsncat( line, &pixel, 1 );
}
mvaddwstr( LCD_OFFSET_Y + y, LCD_OFFSET_X, line );
}
if ( !config.mono && has_colors() )
attroff( COLOR_PAIR( LCD_COLORS_PAIR ) );
wrefresh( stdscr );
}
static inline void ncurses_draw_lcd( void )
{
if ( config.tiny )
ncurses_draw_lcd_tiny();
else if ( config.small )
ncurses_draw_lcd_small();
else
ncurses_draw_lcd_fullsize();
}
static void ui_init_LCD( void ) { memset( lcd_pixels_buffer, 0, sizeof( lcd_pixels_buffer ) ); }
static void ncurses_update_annunciators( void )
{
const wchar_t* annunciators_icons[ 6 ] = { L"", L"", L"α", L"🪫", L"", L"" };
const int annunciators_bits[ NB_ANNUNCIATORS ] = { ANN_LEFT, ANN_RIGHT, ANN_ALPHA, ANN_BATTERY, ANN_BUSY, ANN_IO };
int annunciators = get_annunciators();
if ( last_annunciators == annunciators )
return;
last_annunciators = annunciators;
for ( int i = 0; i < NB_ANNUNCIATORS; i++ )
mvaddwstr( 0, 4 + ( i * 4 ),
( ( annunciators_bits[ i ] & annunciators ) == annunciators_bits[ i ] ) ? annunciators_icons[ i ] : L" " );
}
/**********/
/* public */
/**********/
void ui_update_display_ncurses( void )
{
// apply_contrast();
if ( get_display_state() ) {
get_lcd_buffer( lcd_pixels_buffer );
} else
ui_init_LCD();
ncurses_update_annunciators();
ncurses_draw_lcd();
}
void ui_get_event_ncurses( void )
{
int hpkey = -1;
uint32_t k;
/* Start fresh and mark all keys as released */
// release_all_keys();
/* Iterate over all currently pressed keys and mark them as pressed */
while ( ( k = getch() ) ) {
if ( k == ( uint32_t )ERR )
break;
switch ( k ) {
case '0':
hpkey = HPKEY_0;
break;
case '1':
hpkey = HPKEY_1;
break;
case '2':
hpkey = HPKEY_2;
break;
case '3':
hpkey = HPKEY_3;
break;
case '4':
hpkey = HPKEY_4;
break;
case '5':
hpkey = HPKEY_5;
break;
case '6':
hpkey = HPKEY_6;
break;
case '7':
hpkey = HPKEY_7;
break;
case '8':
hpkey = HPKEY_8;
break;
case '9':
hpkey = HPKEY_9;
break;
case 'a':
hpkey = HPKEY_A;
break;
case 'b':
hpkey = HPKEY_B;
break;
case 'c':
hpkey = HPKEY_C;
break;
case 'd':
hpkey = HPKEY_D;
break;
case 'e':
hpkey = HPKEY_E;
break;
case 'f':
hpkey = HPKEY_F;
break;
case 'g':
hpkey = HPKEY_MTH;
break;
case 'h':
hpkey = HPKEY_PRG;
break;
case 'i':
hpkey = HPKEY_CST;
break;
case 'j':
hpkey = HPKEY_VAR;
break;
case 'k':
case KEY_UP:
hpkey = HPKEY_UP;
break;
case 'l':
hpkey = HPKEY_NXT;
break;
case 'm':
hpkey = HPKEY_QUOTE;
break;
case 'n':
hpkey = HPKEY_STO;
break;
case 'o':
hpkey = HPKEY_EVAL;
break;
case 'p':
case KEY_LEFT:
hpkey = HPKEY_LEFT;
break;
case 'q':
case KEY_DOWN:
hpkey = HPKEY_DOWN;
break;
case 'r':
case KEY_RIGHT:
hpkey = HPKEY_RIGHT;
break;
case 's':
hpkey = HPKEY_SIN;
break;
case 't':
hpkey = HPKEY_COS;
break;
case 'u':
hpkey = HPKEY_TAN;
break;
case 'v':
hpkey = HPKEY_SQRT;
break;
case 'w':
hpkey = HPKEY_POWER;
break;
case 'x':
hpkey = HPKEY_INV;
break;
case 'y':
hpkey = HPKEY_NEG;
break;
case 'z':
hpkey = HPKEY_EEX;
break;
case ' ':
hpkey = HPKEY_SPC;
break;
case KEY_DC:
hpkey = HPKEY_DEL;
break;
case '.':
hpkey = HPKEY_PERIOD;
break;
case '+':
hpkey = HPKEY_PLUS;
break;
case '-':
hpkey = HPKEY_MINUS;
break;
case '*':
hpkey = HPKEY_MUL;
break;
case '/':
hpkey = HPKEY_DIV;
break;
case KEY_F( 1 ):
case KEY_ENTER:
case '\n':
case ',':
hpkey = HPKEY_ENTER;
break;
case KEY_BACKSPACE:
case 127:
case '\b':
hpkey = HPKEY_BS;
break;
case KEY_F( 2 ):
case '[':
case 339: /* PgUp */
hpkey = HPKEY_SHL;
break;
case KEY_F( 3 ):
case ']':
case 338: /* PgDn */
hpkey = HPKEY_SHR;
break;
case KEY_F( 4 ):
case ';':
case KEY_IC: /* Ins */
hpkey = HPKEY_ALPHA;
break;
case KEY_F( 5 ):
case '\\':
case 27: /* Esc */
case 262: /* Home */
hpkey = HPKEY_ON;
break;
case KEY_F( 7 ):
case '|': /* Shift+\ */
case KEY_SEND: /* Shift+End */
case KEY_F( 10 ):
// please_exit = true;
close_and_exit();
break;
}
if ( !is_key_pressed( hpkey ) )
press_key( hpkey );
}
}
void ui_stop_ncurses( void )
{
nodelay( stdscr, FALSE );
echo();
endwin();
}
void ui_start_ncurses( config_t* conf )
{
if ( config.verbose )
fprintf( stderr, "UI is ncurses\n" );
config = *conf;
setlocale( LC_ALL, "" );
initscr(); /* initialize the curses library */
keypad( stdscr, TRUE ); /* enable keyboard mapping */
nodelay( stdscr, TRUE );
curs_set( 0 );
cbreak(); /* take input chars one at a time, no wait for \n */
noecho();
nonl(); /* tell curses not to do NL->CR/NL on output */
if ( !config.mono && has_colors() ) {
start_color();
if ( config.gray ) {
init_color( LCD_COLOR_BG, COLORS[ LCD ].gray_rgb, COLORS[ LCD ].gray_rgb, COLORS[ LCD ].gray_rgb );
init_color( LCD_COLOR_FG, COLORS[ PIXEL ].gray_rgb, COLORS[ PIXEL ].gray_rgb, COLORS[ PIXEL ].gray_rgb );
} else {
init_color( LCD_COLOR_BG, COLORS[ LCD ].r, COLORS[ LCD ].g, COLORS[ LCD ].b );
init_color( LCD_COLOR_FG, COLORS[ PIXEL ].r, COLORS[ PIXEL ].g, COLORS[ PIXEL ].b );
}
init_pair( LCD_PIXEL_OFF, LCD_COLOR_BG, LCD_COLOR_BG );
init_pair( LCD_PIXEL_ON, LCD_COLOR_FG, LCD_COLOR_FG );
init_pair( LCD_COLORS_PAIR, LCD_COLOR_FG, LCD_COLOR_BG );
}
mvaddch( 0, 0, ACS_ULCORNER );
mvaddch( LCD_BOTTOM, 0, ACS_LLCORNER );
mvaddch( 0, LCD_RIGHT, ACS_URCORNER );
mvaddch( LCD_BOTTOM, LCD_RIGHT, ACS_LRCORNER );
mvhline( 0, 1, ACS_HLINE, LCD_RIGHT - 1 );
mvhline( LCD_BOTTOM, 1, ACS_HLINE, LCD_RIGHT - 1 );
mvvline( 1, 0, ACS_VLINE, LCD_BOTTOM - 1 );
mvvline( 1, LCD_RIGHT, ACS_VLINE, LCD_BOTTOM - 1 );
mvprintw( 0, 2, "[ | | | | | ]" ); /* annunciators */
mvprintw( 0, LCD_RIGHT - 18, "< %s v%i.%i.%i >", config.progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
mvprintw( LCD_BOTTOM, 2, "[ wire: %s ]-[ IR: %s ]-[ contrast: %i ]", config.wire_name, config.ir_name, get_contrast() );
mvprintw( LCD_BOTTOM + 1, 0, "F1: Enter, F2: Left-Shift, F3: Right-Shift, F4: Alpha, F5: On, F7: Quit" );
}
void setup_frontend_ncurses( void )
{
ui_get_event = ui_get_event_ncurses;
ui_update_display = ui_update_display_ncurses;
ui_start = ui_start_ncurses;
ui_stop = ui_stop_ncurses;
}

6
src/ui48_ncurses.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef _UI48_NCURSES_H
#define _UI48_NCURSES_H 1
extern void setup_frontend_ncurses( void );
#endif /* _UI48_NCURSES_H */

1110
src/ui48_sdl2.c Normal file

File diff suppressed because it is too large Load diff

6
src/ui48_sdl2.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef _UI48_SDL2_H
#define _UI48_SDL2_H 1
extern void setup_frontend_sdl( void );
#endif /* _UI48_SDL2_H */

View file

@ -94,8 +94,8 @@ static char rcs_id[] = "$Id: x_func.c,v 4.1 2000/12/11 09:54:19 cibrario Rel $";
#include <ctype.h>
#include <string.h>
#include <X11/Xlib.h> /* Main X header */
#include <X11/Intrinsic.h> /* Main Xt header */
/* #include <X11/Xlib.h> /\* Main X header *\/ */
/* #include <X11/Intrinsic.h> /\* Main Xt header *\/ */
#include "config.h"
#include "machdep.h"
@ -133,7 +133,7 @@ static char* NameFromD1( void )
{
Address addr = cpu_status.D1; /* Points to the IDNT body */
int len = ByteFromAddress( addr ); /* IDNT length */
char* name = XtMalloc( len + 1 ); /* IDNT name buffer */
char* name = malloc( len + 1 ); /* IDNT name buffer */
int c;
/* Read the name; toascii() is there to avoid 'strange' characters */
@ -300,19 +300,19 @@ static void SetupXfer( int msg, const char* def_msg, FsbContinuation cont )
debug1( DEBUG_C_TRACE, X_FUNC_I_CALLED, "SetupXfer" );
if ( CpuHaltAllowed() ) {
char* fsb_title = XtNewString( ChfGetMessage( CHF_MODULE_ID, msg, def_msg ) );
/* char* fsb_title = XtNewString( ChfGetMessage( CHF_MODULE_ID, msg, def_msg ) ); */
char* fsb_file = NameFromD1();
/* char* fsb_file = NameFromD1(); */
ActivateFSB( fsb_title, fsb_file, cont );
/* // ActivateFSB( fsb_title, fsb_file, cont ); */
/* Free *before* CpuHaltRequest() because it does not return, and
ActivateFSB() copied its argument when necessary.
*/
XtFree( fsb_title );
XtFree( fsb_file );
/* /\* Free *before* CpuHaltRequest() because it does not return, and */
/* ActivateFSB() copied its argument when necessary. */
/* *\/ */
/* XtFree( fsb_title ); */
/* XtFree( fsb_file ); */
( void )CpuHaltRequest();
/* ( void )CpuHaltRequest(); */
} else {
ChfCondition X_FUNC_E_NO_HALT, CHF_ERROR ChfEnd;
ChfSignal();