This commit is contained in:
Gwenhael Le Moine 2023-09-18 17:50:09 +02:00
parent a6fa514d3d
commit d7a5472d22
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
8 changed files with 219 additions and 221 deletions

View file

@ -10,7 +10,7 @@
#include "runtime_options.h"
#include "emulator.h"
#include "romio.h"
#include "ui.h" /* ui__init_LCD(); ui__update_LCD(); */
#include "ui.h" /* ui_init_LCD(); ui_update_LCD(); */
#include "debugger.h"
#define MAX_ARGS 16
@ -3656,8 +3656,8 @@ static void cmd_load( int argc, char** argv ) {
free( tmp_saturn.port2 );
/* After reloading state we need to refresh the UI's LCD */
ui__init_LCD();
ui__update_LCD();
ui_init_LCD();
ui_update_LCD();
} else {
printf( "Loading emulator-state from files failed.\n" );
if ( saturn.rom )
@ -4184,14 +4184,17 @@ int debug( void ) {
if ( enter_debugger & USER_INTERRUPT )
if ( verbose )
printf( "usnterrupt (SIGINT) ignored\n" );
exit_emulator();
exit( 1 );
if ( enter_debugger & BREAKPOINT_HIT )
if ( verbose )
printf( "breakpoint hit at 0x%.5lX ignored\n", saturn.PC );
if ( enter_debugger & TRAP_INSTRUCTION )
if ( verbose )
printf( "trap instruction at 0x%.5lX ignored\n", saturn.PC );
enter_debugger = 0;
return 0;
}
@ -4201,7 +4204,7 @@ int debug( void ) {
*/
if ( device.display_touched ) {
device.display_touched = 0;
ui__update_LCD();
ui_update_LCD();
}
/*
@ -4342,7 +4345,6 @@ int debug( void ) {
void emulate_debug( void ) {
do {
step_instruction();
if ( exec_flags & EXEC_BKPT ) {
@ -4352,9 +4354,7 @@ void emulate_debug( void ) {
}
}
if ( schedule_event-- == 0 ) {
if ( schedule_event-- == 0 )
schedule();
}
} while ( !enter_debugger );
}

View file

@ -5,7 +5,7 @@
#include "emulator.h"
#include "emulator_inner.h"
#include "romio.h"
#include "ui.h" /* ui__get_event(); ui__update_LCD(); */
#include "ui.h" /* ui_get_event(); ui_update_LCD(); */
#include "debugger.h" /* in_debugger, enter_debugger */
@ -253,7 +253,7 @@ int get_identification( void ) {
void do_shutdown( void ) {
if ( device.display_touched ) {
device.display_touched = 0;
ui__update_LCD();
ui_update_LCD();
}
stop_timer( RUN_TIMER );
@ -281,7 +281,7 @@ void do_shutdown( void ) {
set_t1 = ticks.t1_ticks;
interrupt_called = 0;
if ( ui__get_event() && interrupt_called )
if ( ui_get_event() && interrupt_called )
wake = 1;
if ( saturn.timer2 <= 0 ) {

View file

@ -4,7 +4,7 @@
#include <sys/time.h>
#include "runtime_options.h" /* throttle */
#include "ui.h" /* ui__get_event(); ui__adjust_contrast(); ui__update_LCD(); ui__draw_annunc(); */
#include "ui.h" /* ui_get_event(); ui_adjust_contrast(); ui_update_LCD(); ui_draw_annunc(); */
#include "debugger.h" /* enter_debugger, TRAP_INSTRUCTION, ILLEGAL_INSTRUCTION */
#include "emulator.h"
#include "emulator_inner.h"
@ -2285,7 +2285,7 @@ inline void schedule( void ) {
/* UI */
if ( device.display_touched > 0 && device.display_touched-- == 1 ) {
device.display_touched = 0;
ui__update_LCD();
ui_update_LCD();
}
if ( device.display_touched > 0 )
@ -2293,12 +2293,12 @@ inline void schedule( void ) {
if ( device.contrast_touched ) {
device.contrast_touched = 0;
ui__adjust_contrast();
ui_adjust_contrast();
}
if ( device.ann_touched ) {
device.ann_touched = 0;
ui__draw_annunc();
ui_draw_annunc();
}
/* serial */
@ -2446,9 +2446,9 @@ inline void schedule( void ) {
if ( got_alarm ) {
got_alarm = 0;
ui__update_LCD();
ui_update_LCD();
ui__get_event();
ui_get_event();
}
}

View file

@ -7,7 +7,7 @@
#include "emulator.h"
#include "emulator_inner.h"
#include "romio.h"
#include "ui.h" /* ui__disp_draw_nibble(); ui__menu_draw_nibble(); */
#include "ui.h" /* ui_disp_draw_nibble(); ui_menu_draw_nibble(); */
#include "runtime_options.h"
#define MCTL_MMIO_SX 0
@ -491,13 +491,13 @@ void write_nibble_sx( long addr, int val ) {
return;
if ( addr >= display.disp_start && addr < display.disp_end )
ui__disp_draw_nibble( addr, val );
ui_disp_draw_nibble( addr, val );
if ( display.lines == 63 )
return;
if ( addr >= display.menu_start && addr < display.menu_end )
ui__menu_draw_nibble( addr, val );
ui_menu_draw_nibble( addr, val );
}
void write_nibble_gx( long addr, int val ) {
@ -660,13 +660,13 @@ void write_nibble_gx( long addr, int val ) {
return;
if ( addr >= display.disp_start && addr < display.disp_end )
ui__disp_draw_nibble( addr, val );
ui_disp_draw_nibble( addr, val );
if ( display.lines == 63 )
return;
if ( addr >= display.menu_start && addr < display.menu_end )
ui__menu_draw_nibble( addr, val );
ui_menu_draw_nibble( addr, val );
}
int read_nibble_sx( long addr ) {

View file

@ -1,37 +1,37 @@
#include "ui.h"
#include "runtime_options.h"
void ( *ui__disp_draw_nibble )( word_20 addr, word_4 val );
void ( *ui__menu_draw_nibble )( word_20 addr, word_4 val );
int ( *ui__get_event )( void );
void ( *ui__update_LCD )( void );
void ( *ui__adjust_contrast )( void );
void ( *ui__draw_annunc )( void );
void ( *ui__init_LCD )( void );
void ( *ui_disp_draw_nibble )( word_20 addr, word_4 val );
void ( *ui_menu_draw_nibble )( word_20 addr, word_4 val );
int ( *ui_get_event )( void );
void ( *ui_update_LCD )( void );
void ( *ui_adjust_contrast )( void );
void ( *ui_draw_annunc )( void );
void ( *ui_init_LCD )( void );
void ( *init_ui )( int argc, char** argv );
void setup_frontend( void ) {
switch ( frontend_type ) {
case FRONTEND_SDL:
ui__disp_draw_nibble = ui_sdl__disp_draw_nibble;
ui__menu_draw_nibble = ui_sdl__menu_draw_nibble;
ui__get_event = ui_sdl__get_event;
ui__update_LCD = ui_sdl__update_LCD;
ui__adjust_contrast = ui_sdl__adjust_contrast;
ui__draw_annunc = ui_sdl__draw_annunc;
ui__init_LCD = ui_sdl__init_LCD;
ui_disp_draw_nibble = sdl_disp_draw_nibble;
ui_menu_draw_nibble = sdl_menu_draw_nibble;
ui_get_event = sdl_get_event;
ui_update_LCD = sdl_update_LCD;
ui_adjust_contrast = sdl_adjust_contrast;
ui_draw_annunc = sdl_draw_annunc;
ui_init_LCD = sdl_init_LCD;
init_ui = init_sdl_ui;
break;
case FRONTEND_X11:
default:
ui__disp_draw_nibble = ui_x11__disp_draw_nibble;
ui__menu_draw_nibble = ui_x11__menu_draw_nibble;
ui__get_event = ui_x11__get_event;
ui__update_LCD = ui_x11__update_LCD;
ui__adjust_contrast = ui_x11__adjust_contrast;
ui__draw_annunc = ui_x11__draw_annunc;
ui__init_LCD = ui_x11__init_LCD;
ui_disp_draw_nibble = x11_disp_draw_nibble;
ui_menu_draw_nibble = x11_menu_draw_nibble;
ui_get_event = x11_get_event;
ui_update_LCD = x11_update_LCD;
ui_adjust_contrast = x11_adjust_contrast;
ui_draw_annunc = x11_draw_annunc;
ui_init_LCD = x11_init_LCD;
init_ui = init_x11_ui;
break;
}

View file

@ -6,26 +6,26 @@
/*************/
/* functions */
/*************/
extern void ui_sdl__disp_draw_nibble( word_20 addr, word_4 val );
extern void ui_x11__disp_draw_nibble( word_20 addr, word_4 val );
extern void sdl_disp_draw_nibble( word_20 addr, word_4 val );
extern void x11_disp_draw_nibble( word_20 addr, word_4 val );
extern void ui_sdl__menu_draw_nibble( word_20 addr, word_4 val );
extern void ui_x11__menu_draw_nibble( word_20 addr, word_4 val );
extern void sdl_menu_draw_nibble( word_20 addr, word_4 val );
extern void x11_menu_draw_nibble( word_20 addr, word_4 val );
extern int ui_sdl__get_event( void );
extern int ui_x11__get_event( void );
extern int sdl_get_event( void );
extern int x11_get_event( void );
extern void ui_sdl__update_LCD( void );
extern void ui_x11__update_LCD( void );
extern void sdl_update_LCD( void );
extern void x11_update_LCD( void );
extern void ui_sdl__adjust_contrast( void );
extern void ui_x11__adjust_contrast( void );
extern void sdl_adjust_contrast( void );
extern void x11_adjust_contrast( void );
extern void ui_sdl__draw_annunc( void );
extern void ui_x11__draw_annunc( void );
extern void sdl_draw_annunc( void );
extern void x11_draw_annunc( void );
extern void ui_sdl__init_LCD( void );
extern void ui_x11__init_LCD( void );
extern void sdl_init_LCD( void );
extern void x11_init_LCD( void );
extern void init_sdl_ui( int argc, char** argv );
extern void init_x11_ui( int argc, char** argv );
@ -36,29 +36,29 @@ extern void init_x11_ui( int argc, char** argv );
/*************************/
/* used in: emu_memory.c */
/*************************/
extern void ( *ui__disp_draw_nibble )( word_20 addr, word_4 val );
extern void ( *ui__menu_draw_nibble )( word_20 addr, word_4 val );
extern void ( *ui_disp_draw_nibble )( word_20 addr, word_4 val );
extern void ( *ui_menu_draw_nibble )( word_20 addr, word_4 val );
/*****************************************/
/* used in: emu_actions.c, emu_emulate.c */
/*****************************************/
extern int ( *ui__get_event )( void );
extern int ( *ui_get_event )( void );
/*****************************************************/
/* used in: emu_actions.c, emu_emulate.c, debugger.c */
/*****************************************************/
extern void ( *ui__update_LCD )( void );
extern void ( *ui_update_LCD )( void );
/**************************/
/* used in: emu_emulate.c */
/**************************/
extern void ( *ui__adjust_contrast )( void );
extern void ( *ui__draw_annunc )( void );
extern void ( *ui_adjust_contrast )( void );
extern void ( *ui_draw_annunc )( void );
/*********************************/
/* used in: debugger.c, ui_sdl.c */
/*********************************/
extern void ( *ui__init_LCD )( void );
extern void ( *ui_init_LCD )( void );
/*******************/
/* used in: main.c */

View file

@ -51,17 +51,17 @@
/* typedef */
/***********/
typedef struct ui_sdl__color_t {
typedef struct sdl_color_t {
const char* name;
int r, g, b;
} ui_sdl__color_t;
} sdl_color_t;
typedef struct ui_sdl__keypad_t {
typedef struct sdl_keypad_t {
unsigned int width;
unsigned int height;
} ui_sdl__keypad_t;
} sdl_keypad_t;
typedef struct ui_sdl__button_t {
typedef struct sdl_button_t {
const char* name;
short pressed;
short extra;
@ -85,11 +85,11 @@ typedef struct ui_sdl__button_t {
SDL_Surface* surfaceup;
SDL_Surface* surfacedown;
} ui_sdl__button_t;
} sdl_button_t;
// This mimicks the structure formerly lcd.c, except with SDL surfaces instead
// of Pixmaps.
typedef struct ui_sdl__ann_struct_t {
typedef struct sdl_ann_struct_t {
int bit;
int x;
int y;
@ -99,57 +99,57 @@ typedef struct ui_sdl__ann_struct_t {
SDL_Surface* surfaceon;
SDL_Surface* surfaceoff;
} ui_sdl__ann_struct_t;
} sdl_ann_struct_t;
/*************/
/* variables */
/*************/
ui_sdl__keypad_t keypad;
ui_sdl__color_t* sdl_colors;
sdl_keypad_t keypad;
sdl_color_t* sdl_colors;
ui_sdl__color_t sdl_colors_sx[] = { { "white", 255, 255, 255 },
{ "left", 255, 166, 0 },
{ "right", 0, 210, 255 },
{ "but_top", 109, 93, 93 },
{ "button", 90, 77, 77 },
{ "but_bot", 76, 65, 65 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 109, 78, 78 },
{ "pad", 90, 64, 64 },
{ "pad_bot", 76, 54, 54 },
{ "disp_pad_top", 155, 118, 84 },
{ "disp_pad", 124, 94, 67 },
{ "disp_pad_bot", 100, 75, 53 },
{ "logo", 204, 169, 107 },
{ "logo_back", 64, 64, 64 },
{ "label", 202, 184, 144 },
{ "frame", 0, 0, 0 },
{ "underlay", 60, 42, 42 },
{ "black", 0, 0, 0 },
{ 0 } };
sdl_color_t sdl_colors_sx[] = { { "white", 255, 255, 255 },
{ "left", 255, 166, 0 },
{ "right", 0, 210, 255 },
{ "but_top", 109, 93, 93 },
{ "button", 90, 77, 77 },
{ "but_bot", 76, 65, 65 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 109, 78, 78 },
{ "pad", 90, 64, 64 },
{ "pad_bot", 76, 54, 54 },
{ "disp_pad_top", 155, 118, 84 },
{ "disp_pad", 124, 94, 67 },
{ "disp_pad_bot", 100, 75, 53 },
{ "logo", 204, 169, 107 },
{ "logo_back", 64, 64, 64 },
{ "label", 202, 184, 144 },
{ "frame", 0, 0, 0 },
{ "underlay", 60, 42, 42 },
{ "black", 0, 0, 0 },
{ 0 } };
ui_sdl__color_t sdl_colors_gx[] = { { "white", 255, 255, 255 },
{ "left", 255, 186, 255 },
{ "right", 0, 255, 204 },
{ "but_top", 104, 104, 104 },
{ "button", 88, 88, 88 },
{ "but_bot", 74, 74, 74 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 88, 88, 88 },
{ "pad", 74, 74, 74 },
{ "pad_bot", 64, 64, 64 },
{ "disp_pad_top", 128, 128, 138 },
{ "disp_pad", 104, 104, 110 },
{ "disp_pad_bot", 84, 84, 90 },
{ "logo", 176, 176, 184 },
{ "logo_back", 104, 104, 110 },
{ "label", 240, 240, 240 },
{ "frame", 0, 0, 0 },
{ "underlay", 104, 104, 110 },
{ "black", 0, 0, 0 },
{ 0 } };
sdl_color_t sdl_colors_gx[] = { { "white", 255, 255, 255 },
{ "left", 255, 186, 255 },
{ "right", 0, 255, 204 },
{ "but_top", 104, 104, 104 },
{ "button", 88, 88, 88 },
{ "but_bot", 74, 74, 74 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 88, 88, 88 },
{ "pad", 74, 74, 74 },
{ "pad_bot", 64, 64, 64 },
{ "disp_pad_top", 128, 128, 138 },
{ "disp_pad", 104, 104, 110 },
{ "disp_pad_bot", 84, 84, 90 },
{ "logo", 176, 176, 184 },
{ "logo_back", 104, 104, 110 },
{ "label", 240, 240, 240 },
{ "frame", 0, 0, 0 },
{ "underlay", 104, 104, 110 },
{ "black", 0, 0, 0 },
{ 0 } };
// This will take the value of the defines, but can be run-time modified
unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP,
@ -159,9 +159,9 @@ unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP,
unsigned int ARGBColors[ BLACK + 1 ];
ui_sdl__button_t* buttons = 0;
sdl_button_t* buttons = 0;
ui_sdl__button_t buttons_sx[] = {
sdl_button_t buttons_sx[] = {
{ "A",
0,
0,
@ -485,7 +485,7 @@ ui_sdl__button_t buttons_sx[] = {
{ 0 } };
ui_sdl__button_t buttons_gx[] = {
sdl_button_t buttons_gx[] = {
{ "A",
0,
0,
@ -809,7 +809,7 @@ ui_sdl__button_t buttons_gx[] = {
{ 0 } };
ui_sdl__ann_struct_t ann_tbl[] = {
sdl_ann_struct_t ann_tbl[] = {
{ ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0, 0 },
{ ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap, 0,
0 },
@ -2619,7 +2619,7 @@ static inline void draw_nibble( int c, int r, int val ) {
SDLDrawNibble( x, y, val );
}
/* void ui_sdl__draw_nibble( int c, int r, int val ) { draw_nibble( c, r, val );
/* void sdl_draw_nibble( int c, int r, int val ) { draw_nibble( c, r, val );
* }
*/
@ -2663,7 +2663,7 @@ void SDLCreateHP( void ) {
free( buttons );
buttons = 0;
}
buttons = ( ui_sdl__button_t* )malloc( sizeof( buttons_gx ) );
buttons = ( sdl_button_t* )malloc( sizeof( buttons_gx ) );
if ( opt_gx )
memcpy( buttons, buttons_gx, sizeof( buttons_gx ) );
@ -2692,7 +2692,7 @@ void SDLCreateHP( void ) {
/**********/
/* public */
/**********/
int ui_sdl__get_event( void ) {
int sdl_get_event( void ) {
SDL_Event event;
int hpkey;
int rv;
@ -2875,7 +2875,7 @@ int ui_sdl__get_event( void ) {
return 1;
}
void ui_sdl__update_LCD( void ) {
void sdl_update_LCD( void ) {
int i, j;
long addr;
static int old_offset = -1;
@ -2918,7 +2918,7 @@ void ui_sdl__update_LCD( void ) {
}
}
void ui_sdl__disp_draw_nibble( word_20 addr, word_4 val ) {
void sdl_disp_draw_nibble( word_20 addr, word_4 val ) {
long offset;
int x, y;
@ -2944,7 +2944,7 @@ void ui_sdl__disp_draw_nibble( word_20 addr, word_4 val ) {
}
}
void ui_sdl__menu_draw_nibble( word_20 addr, word_4 val ) {
void sdl_menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
int x, y;
@ -2957,7 +2957,7 @@ void ui_sdl__menu_draw_nibble( word_20 addr, word_4 val ) {
}
}
void ui_sdl__draw_annunc( void ) {
void sdl_draw_annunc( void ) {
int val;
val = display.annunc;
@ -2975,7 +2975,7 @@ void ui_sdl__draw_annunc( void ) {
SDLDrawAnnunc( sdl_annuncstate );
}
void ui_sdl__adjust_contrast() {
void sdl_adjust_contrast() {
SDLCreateColors();
SDLCreateAnnunc();
@ -2983,15 +2983,15 @@ void ui_sdl__adjust_contrast() {
memset( sdl_disp_buf, 0, sizeof( sdl_disp_buf ) );
memset( sdl_lcd_buffer, 0, sizeof( sdl_lcd_buffer ) );
ui_sdl__update_LCD();
sdl_update_LCD();
// redraw annunc
sdl_last_annunc_state = -1;
ui_sdl__draw_annunc();
sdl_draw_annunc();
}
void ui_sdl__init_LCD( void ) {
void sdl_init_LCD( void ) {
display.on = ( int )( saturn.disp_io & 0x8 ) >> 3;
display.disp_start = ( saturn.disp_addr & 0xffffe );
@ -3026,5 +3026,5 @@ void ui_sdl__init_LCD( void ) {
void init_sdl_ui( int argc, char** argv ) {
SDLInit();
SDLCreateHP();
ui_sdl__init_LCD();
sdl_init_LCD();
}

View file

@ -1,3 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <pwd.h>
#include <string.h>
@ -6,17 +8,15 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <X11/cursorfont.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/extensions/XShm.h>
#include <X11/cursorfont.h>
#include "runtime_options.h"
#include "emulator.h"
@ -223,21 +223,21 @@ static unsigned char hp48_green_gx_bitmap[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 };
typedef struct ui_x11__color_t {
typedef struct x11_color_t {
const char* name;
int r, g, b;
int mono_rgb;
int gray_rgb;
XColor xcolor;
} ui_x11__color_t;
} x11_color_t;
typedef struct ui_x11__keypad_t {
typedef struct x11_keypad_t {
unsigned int width;
unsigned int height;
Pixmap pixmap;
} ui_x11__keypad_t;
} x11_keypad_t;
typedef struct disp_t {
unsigned int w, h;
@ -256,7 +256,7 @@ typedef struct disp_t {
XImage* menu_image;
} disp_t;
typedef struct ui_x11__button_t {
typedef struct x11_button_t {
const char* name;
short pressed;
short extra;
@ -281,11 +281,11 @@ typedef struct ui_x11__button_t {
Pixmap map;
Pixmap down;
Window xwin;
} ui_x11__button_t;
} x11_button_t;
// This mimicks the structure formerly lcd.c, except with SDL surfaces instead
// of Pixmaps.
typedef struct ui_x11__ann_struct_t {
typedef struct x11_ann_struct_t {
int bit;
int x;
int y;
@ -294,7 +294,7 @@ typedef struct ui_x11__ann_struct_t {
unsigned char* bits;
Pixmap pixmap;
} ui_x11__ann_struct_t;
} x11_ann_struct_t;
typedef struct icon_t {
unsigned int w;
@ -303,8 +303,8 @@ typedef struct icon_t {
unsigned char* bits;
} icon_map_t;
ui_x11__keypad_t x11_keypad;
ui_x11__color_t* x11_colors;
x11_keypad_t x11_keypad;
x11_color_t* x11_colors;
static XrmOptionDescRec options[] = {
{ "-display", ".display", XrmoptionSepArg, ( void* )0 },
@ -414,7 +414,7 @@ int does_backing_store;
int color_mode;
int icon_color_mode;
int useXShm;
int useXShm = 1;
int netbook;
char* res_name;
@ -422,7 +422,7 @@ char* res_class;
XrmDatabase rdb = ( XrmDatabase )0;
ui_x11__color_t x11_colors_sx[] = {
x11_color_t x11_colors_sx[] = {
{ "white",
255,
255,
@ -547,7 +547,7 @@ ui_x11__color_t x11_colors_sx[] = {
{ "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ 0 } };
ui_x11__color_t x11_colors_gx[] = {
x11_color_t x11_colors_gx[] = {
{ "white",
255,
255,
@ -672,9 +672,9 @@ ui_x11__color_t x11_colors_gx[] = {
{ "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ 0 } };
ui_x11__button_t* x11_buttons = 0;
x11_button_t* x11_buttons = 0;
ui_x11__button_t x11_buttons_sx[] = {
x11_button_t x11_buttons_sx[] = {
{ "A",
0,
0,
@ -1017,7 +1017,7 @@ ui_x11__button_t x11_buttons_sx[] = {
{ 0 } };
ui_x11__button_t x11_buttons_gx[] = {
x11_button_t x11_buttons_gx[] = {
{ "A",
0,
0,
@ -1397,7 +1397,7 @@ unsigned char nibbles[ 16 ][ 2 ] = {
static unsigned char nibble_bitmap[ 16 ];
ui_x11__ann_struct_t x11_ann_tbl[] = {
x11_ann_struct_t x11_ann_tbl[] = {
{ ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0 },
{ ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap,
0 },
@ -1606,7 +1606,7 @@ void fatal_exit( char* error, char* advice );
int AllocColors( void );
int merge_app_defaults( char* path, XrmDatabase* db );
int InitDisplay( int argc, char** argv );
void ui_x11__adjust_contrast( void );
void x11_adjust_contrast( void );
int x11_SmallTextWidth( const char* string, unsigned int length );
void exit_x48( int tell_x11 );
int DrawSmallString( Display* the_dpy, Drawable d, GC the_gc, int x, int y,
@ -1616,12 +1616,12 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small,
void DrawButtons( void );
int DrawButton( int i );
void CreateBackground( int width, int height, int w_top, int h_top,
ui_x11__keypad_t* x11_keypad );
x11_keypad_t* x11_keypad );
void CreateKeypad( unsigned int w, unsigned int h, unsigned int offset_y,
unsigned int offset_x, ui_x11__keypad_t* x11_keypad );
void CreateBezel( ui_x11__keypad_t* x11_keypad );
void DrawMore( unsigned int offset_y, ui_x11__keypad_t* x11_keypad );
void DrawKeypad( ui_x11__keypad_t* x11_keypad );
unsigned int offset_x, x11_keypad_t* x11_keypad );
void CreateBezel( x11_keypad_t* x11_keypad );
void DrawMore( unsigned int offset_y, x11_keypad_t* x11_keypad );
void DrawKeypad( x11_keypad_t* x11_keypad );
void CreateIcon( void );
void refresh_icon( void );
void DrawIcon( void );
@ -1638,13 +1638,13 @@ int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen );
int x11_button_pressed( int b );
int x11_button_released( int b );
void ShowConnections( char* wire, char* ir );
int ui_x11__get_event( void );
void ui_x11__init_LCD( void );
void ui_x11__update_LCD( void );
int x11_get_event( void );
void x11_init_LCD( void );
void x11_update_LCD( void );
void redraw_display( void );
void ui_x11__disp_draw_nibble( word_20 addr, word_4 val );
void ui_x11__menu_draw_nibble( word_20 addr, word_4 val );
void ui_x11__draw_annunc( void );
void x11_disp_draw_nibble( word_20 addr, word_4 val );
void x11_menu_draw_nibble( word_20 addr, word_4 val );
void x11_draw_annunc( void );
void init_annunc( void );
void redraw_annunc( void );
@ -2839,7 +2839,7 @@ int DrawButton( int i ) {
}
void CreateBackground( int width, int height, int w_top, int h_top,
ui_x11__keypad_t* x11_keypad ) {
x11_keypad_t* x11_keypad ) {
XSetBackground( dpy, gc, COLOR( PAD ) );
XSetForeground( dpy, gc, COLOR( PAD ) );
@ -2852,7 +2852,7 @@ void CreateBackground( int width, int height, int w_top, int h_top,
}
void CreateKeypad( unsigned int w, unsigned int h, unsigned int offset_y,
unsigned int offset_x, ui_x11__keypad_t* x11_keypad ) {
unsigned int offset_x, x11_keypad_t* x11_keypad ) {
int i, x, y;
int wl, wr, ws;
Pixmap pix;
@ -3159,7 +3159,7 @@ void CreateKeypad( unsigned int w, unsigned int h, unsigned int offset_y,
}
}
void CreateBezel( ui_x11__keypad_t* x11_keypad ) {
void CreateBezel( x11_keypad_t* x11_keypad ) {
int i;
int display_height = DISPLAY_HEIGHT;
int display_width = DISPLAY_WIDTH;
@ -3288,7 +3288,7 @@ void CreateBezel( ui_x11__keypad_t* x11_keypad ) {
( int )( DISPLAY_OFFSET_Y + display_height - 2 ) );
}
void DrawMore( unsigned int offset_y, ui_x11__keypad_t* x11_keypad ) {
void DrawMore( unsigned int offset_y, x11_keypad_t* x11_keypad ) {
Pixmap pix;
int cut = 0;
int x, y;
@ -3581,7 +3581,7 @@ void DrawMore( unsigned int offset_y, ui_x11__keypad_t* x11_keypad ) {
}
}
void DrawKeypad( ui_x11__keypad_t* x11_keypad ) {
void DrawKeypad( x11_keypad_t* x11_keypad ) {
XCopyArea( dpy, x11_keypad->pixmap, mainW, gc, 0, 0, x11_keypad->width,
x11_keypad->height, 0, 0 );
}
@ -4896,7 +4896,7 @@ void redraw_display( void ) {
XClearWindow( dpy, disp.win );
memset( x11_disp_buf, 0, sizeof( x11_disp_buf ) );
memset( x11_lcd_buffer, 0, sizeof( x11_lcd_buffer ) );
ui_x11__update_LCD();
x11_update_LCD();
}
void init_annunc( void ) {
@ -4908,14 +4908,14 @@ void init_annunc( void ) {
void redraw_annunc( void ) {
x11_last_annunc_state = -1;
ui_x11__draw_annunc();
x11_draw_annunc();
}
/**********/
/* public */
/**********/
void ui_x11__adjust_contrast( void ) {
void x11_adjust_contrast( void ) {
int gray = 0;
int r = 0, g = 0, b = 0;
unsigned long old;
@ -4978,7 +4978,7 @@ void ui_x11__adjust_contrast( void ) {
}
}
int ui_x11__get_event( void ) {
int x11_get_event( void ) {
XEvent xev;
XClientMessageEvent* cm;
int i, wake, bufs = 2;
@ -5070,7 +5070,7 @@ int ui_x11__get_event( void ) {
if ( !disp.mapped ) {
disp.mapped = 1;
ui_x11__update_LCD();
x11_update_LCD();
redraw_annunc();
}
break;
@ -5612,7 +5612,7 @@ int ui_x11__get_event( void ) {
return wake;
}
void ui_x11__init_LCD( void ) {
void x11_init_LCD( void ) {
display.on = ( int )( saturn.disp_io & 0x8 ) >> 3;
display.disp_start = ( saturn.disp_addr & 0xffffe );
@ -5648,53 +5648,51 @@ void ui_x11__init_LCD( void ) {
memset( x11_lcd_buffer, 0xf0, sizeof( x11_lcd_buffer ) );
/* init nibble_maps */
int i;
for ( i = 0; i < 16; i++ ) {
for ( int 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_bitmap[ 0x0 ] = 0x00; /* ---- */
nibble_bitmap[ 0x1 ] = 0xc0; /* *--- */
nibble_bitmap[ 0x2 ] = 0x30; /* -*-- */
nibble_bitmap[ 0x3 ] = 0xf0; /* **-- */
nibble_bitmap[ 0x4 ] = 0x0c; /* --*- */
nibble_bitmap[ 0x5 ] = 0xcc; /* *-*- */
nibble_bitmap[ 0x6 ] = 0x3c; /* -**- */
nibble_bitmap[ 0x7 ] = 0xfc; /* ***- */
nibble_bitmap[ 0x8 ] = 0x03; /* ---* */
nibble_bitmap[ 0x9 ] = 0xc3; /* *--* */
nibble_bitmap[ 0xa ] = 0x33; /* -*-* */
nibble_bitmap[ 0xb ] = 0xf3; /* **-* */
nibble_bitmap[ 0xc ] = 0x0f; /* --** */
nibble_bitmap[ 0xd ] = 0xcf; /* *-** */
nibble_bitmap[ 0xe ] = 0x3f; /* -*** */
nibble_bitmap[ 0xf ] = 0xff; /* **** */
} else {
nibble_bitmap[ 0x0 ] = 0x00; /* ---- */
nibble_bitmap[ 0x1 ] = 0x03; /* *--- */
nibble_bitmap[ 0x2 ] = 0x0c; /* -*-- */
nibble_bitmap[ 0x3 ] = 0x0f; /* **-- */
nibble_bitmap[ 0x4 ] = 0x30; /* --*- */
nibble_bitmap[ 0x5 ] = 0x33; /* *-*- */
nibble_bitmap[ 0x6 ] = 0x3c; /* -**- */
nibble_bitmap[ 0x7 ] = 0x3f; /* ***- */
nibble_bitmap[ 0x8 ] = 0xc0; /* ---* */
nibble_bitmap[ 0x9 ] = 0xc3; /* *--* */
nibble_bitmap[ 0xa ] = 0xcc; /* -*-* */
nibble_bitmap[ 0xb ] = 0xcf; /* **-* */
nibble_bitmap[ 0xc ] = 0xf0; /* --** */
nibble_bitmap[ 0xd ] = 0xf3; /* *-** */
nibble_bitmap[ 0xe ] = 0xfc; /* -*** */
nibble_bitmap[ 0xf ] = 0xff; /* **** */
}
if ( !shm_flag )
return;
if ( disp.disp_image->bitmap_bit_order == MSBFirst ) {
nibble_bitmap[ 0x0 ] = 0x00; /* ---- */
nibble_bitmap[ 0x1 ] = 0xc0; /* *--- */
nibble_bitmap[ 0x2 ] = 0x30; /* -*-- */
nibble_bitmap[ 0x3 ] = 0xf0; /* **-- */
nibble_bitmap[ 0x4 ] = 0x0c; /* --*- */
nibble_bitmap[ 0x5 ] = 0xcc; /* *-*- */
nibble_bitmap[ 0x6 ] = 0x3c; /* -**- */
nibble_bitmap[ 0x7 ] = 0xfc; /* ***- */
nibble_bitmap[ 0x8 ] = 0x03; /* ---* */
nibble_bitmap[ 0x9 ] = 0xc3; /* *--* */
nibble_bitmap[ 0xa ] = 0x33; /* -*-* */
nibble_bitmap[ 0xb ] = 0xf3; /* **-* */
nibble_bitmap[ 0xc ] = 0x0f; /* --** */
nibble_bitmap[ 0xd ] = 0xcf; /* *-** */
nibble_bitmap[ 0xe ] = 0x3f; /* -*** */
nibble_bitmap[ 0xf ] = 0xff; /* **** */
} else {
nibble_bitmap[ 0x0 ] = 0x00; /* ---- */
nibble_bitmap[ 0x1 ] = 0x03; /* *--- */
nibble_bitmap[ 0x2 ] = 0x0c; /* -*-- */
nibble_bitmap[ 0x3 ] = 0x0f; /* **-- */
nibble_bitmap[ 0x4 ] = 0x30; /* --*- */
nibble_bitmap[ 0x5 ] = 0x33; /* *-*- */
nibble_bitmap[ 0x6 ] = 0x3c; /* -**- */
nibble_bitmap[ 0x7 ] = 0x3f; /* ***- */
nibble_bitmap[ 0x8 ] = 0xc0; /* ---* */
nibble_bitmap[ 0x9 ] = 0xc3; /* *--* */
nibble_bitmap[ 0xa ] = 0xcc; /* -*-* */
nibble_bitmap[ 0xb ] = 0xcf; /* **-* */
nibble_bitmap[ 0xc ] = 0xf0; /* --** */
nibble_bitmap[ 0xd ] = 0xf3; /* *-** */
nibble_bitmap[ 0xe ] = 0xfc; /* -*** */
nibble_bitmap[ 0xf ] = 0xff; /* **** */
}
}
void ui_x11__update_LCD( void ) {
void x11_update_LCD( void ) {
int i, j;
long addr;
static int old_offset = -1;
@ -5800,7 +5798,7 @@ void ui_x11__update_LCD( void ) {
refresh_display();
}
void ui_x11__disp_draw_nibble( word_20 addr, word_4 val ) {
void x11_disp_draw_nibble( word_20 addr, word_4 val ) {
long offset;
int shm_addr;
int x, y;
@ -5847,7 +5845,7 @@ void ui_x11__disp_draw_nibble( word_20 addr, word_4 val ) {
}
}
void ui_x11__menu_draw_nibble( word_20 addr, word_4 val ) {
void x11_menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
int shm_addr;
int x, y;
@ -5871,7 +5869,7 @@ void ui_x11__menu_draw_nibble( word_20 addr, word_4 val ) {
}
}
void ui_x11__draw_annunc( void ) {
void x11_draw_annunc( void ) {
int val;
val = display.annunc;
@ -5914,5 +5912,5 @@ void init_x11_ui( int argc, char** argv ) {
init_annunc();
ui_x11__init_LCD();
x11_init_LCD();
}