Merge branch 'main' of ssh://src.le-moine.org:38172/gwh/x48ng
This commit is contained in:
commit
d4e7923a69
6 changed files with 243 additions and 274 deletions
|
@ -99,6 +99,8 @@ int main( int argc, char** argv )
|
|||
/********************/
|
||||
init_emulator();
|
||||
init_serial();
|
||||
init_display();
|
||||
ui_init_LCD();
|
||||
init_ui( argc, argv );
|
||||
|
||||
/************************/
|
||||
|
|
3
src/ui.c
3
src/ui.c
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "runtime_options.h"
|
||||
#include "ui.h"
|
||||
|
@ -147,9 +148,9 @@ void ( *ui_update_LCD )( void );
|
|||
void ( *ui_refresh_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 ui_init_LCD( void ) { memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) ); }
|
||||
void setup_frontend( void )
|
||||
{
|
||||
switch ( frontend_type ) {
|
||||
|
|
10
src/ui.h
10
src/ui.h
|
@ -62,15 +62,15 @@ extern void ( *ui_refresh_LCD )( 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 );
|
||||
|
||||
/*******************/
|
||||
/* used in: main.c */
|
||||
/*******************/
|
||||
extern void ( *init_ui )( int argc, char** argv );
|
||||
|
||||
/*********************************/
|
||||
/* used in: debugger.c, ui_sdl.c */
|
||||
/*********************************/
|
||||
extern void ui_init_LCD( void );
|
||||
|
||||
extern void setup_frontend( void );
|
||||
#endif /* !_X48_GUI_H */
|
||||
|
|
62
src/ui_sdl.c
62
src/ui_sdl.c
|
@ -12,8 +12,7 @@
|
|||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_gfxPrimitives.h> /* lineColor(); pixelColor(); rectangleColor();stringColor(); */
|
||||
|
||||
#include "emulator.h"
|
||||
#include "romio.h"
|
||||
#include "romio.h" /* opt_gx */
|
||||
#include "runtime_options.h"
|
||||
#include "ui.h"
|
||||
#include "ui_inner.h"
|
||||
|
@ -292,12 +291,6 @@ static int showkeylastx, showkeylasty, showkeylastkey;
|
|||
|
||||
static SDL_Surface* sdlwindow;
|
||||
|
||||
/************************/
|
||||
/* functions prototypes */
|
||||
/************************/
|
||||
void sdl_draw_annunc( void );
|
||||
void sdl_update_LCD( void );
|
||||
|
||||
/****************************/
|
||||
/* functions implementation */
|
||||
/****************************/
|
||||
|
@ -1683,19 +1676,19 @@ static inline void draw_nibble( int col, int row, int val )
|
|||
|
||||
static inline void draw_row( long addr, int row )
|
||||
{
|
||||
int v;
|
||||
int nibble;
|
||||
int line_length = NIBBLES_PER_ROW;
|
||||
|
||||
if ( ( display.offset > 3 ) && ( row <= display.lines ) )
|
||||
line_length += 2;
|
||||
|
||||
for ( int i = 0; i < line_length; i++ ) {
|
||||
v = read_nibble( addr + i );
|
||||
if ( v == lcd_nibbles_buffer[ row ][ i ] )
|
||||
nibble = read_nibble( addr + i );
|
||||
if ( nibble == lcd_nibbles_buffer[ row ][ i ] )
|
||||
continue;
|
||||
|
||||
lcd_nibbles_buffer[ row ][ i ] = v;
|
||||
draw_nibble( i, row, v );
|
||||
lcd_nibbles_buffer[ row ][ i ] = nibble;
|
||||
draw_nibble( i, row, nibble );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1934,29 +1927,6 @@ int sdl_get_event( void )
|
|||
return 1;
|
||||
}
|
||||
|
||||
void sdl_adjust_contrast()
|
||||
{
|
||||
SDLCreateColors();
|
||||
SDLCreateAnnunc();
|
||||
|
||||
// redraw LCD
|
||||
memset( lcd_nibbles_buffer, 0, sizeof( lcd_nibbles_buffer ) );
|
||||
|
||||
sdl_update_LCD();
|
||||
|
||||
// redraw annunc
|
||||
last_annunc_state = -1;
|
||||
|
||||
sdl_draw_annunc();
|
||||
}
|
||||
|
||||
void sdl_init_LCD( void )
|
||||
{
|
||||
init_display();
|
||||
|
||||
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
|
||||
}
|
||||
|
||||
void sdl_update_LCD( void )
|
||||
{
|
||||
if ( display.on ) {
|
||||
|
@ -2004,8 +1974,10 @@ void sdl_disp_draw_nibble( word_20 addr, word_4 val )
|
|||
y = offset / display.nibs_per_line;
|
||||
if ( y < 0 || y > 63 )
|
||||
return;
|
||||
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
return;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
draw_nibble( x, y, val );
|
||||
} else {
|
||||
|
@ -2051,6 +2023,22 @@ void sdl_draw_annunc( void )
|
|||
SDLDrawAnnunc( sdl_annuncstate );
|
||||
}
|
||||
|
||||
void sdl_adjust_contrast()
|
||||
{
|
||||
SDLCreateColors();
|
||||
SDLCreateAnnunc();
|
||||
|
||||
// redraw LCD
|
||||
memset( lcd_nibbles_buffer, 0, sizeof( lcd_nibbles_buffer ) );
|
||||
|
||||
sdl_update_LCD();
|
||||
|
||||
// redraw annunc
|
||||
last_annunc_state = -1;
|
||||
|
||||
sdl_draw_annunc();
|
||||
}
|
||||
|
||||
void init_sdl_ui( int argc, char** argv )
|
||||
{
|
||||
/* Set public API to this UI's functions */
|
||||
|
@ -2061,9 +2049,7 @@ void init_sdl_ui( int argc, char** argv )
|
|||
ui_refresh_LCD = sdl_refresh_LCD;
|
||||
ui_adjust_contrast = sdl_adjust_contrast;
|
||||
ui_draw_annunc = sdl_draw_annunc;
|
||||
ui_init_LCD = sdl_init_LCD;
|
||||
|
||||
SDLInit();
|
||||
SDLCreateHP();
|
||||
sdl_init_LCD();
|
||||
}
|
||||
|
|
327
src/ui_text.c
327
src/ui_text.c
|
@ -14,11 +14,8 @@
|
|||
|
||||
#include <ncursesw/curses.h>
|
||||
|
||||
#include "emulator.h"
|
||||
#include "romio.h"
|
||||
#include "runtime_options.h"
|
||||
#include "ui.h"
|
||||
#include "ui_inner.h"
|
||||
#include "runtime_options.h" /* mono, gray, small, tiny, progname */
|
||||
#include "ui.h" /* last_annunc_state, lcd_nibbles_buffer, DISP_ROWS */
|
||||
|
||||
#define LCD_WIDTH 131
|
||||
#define LCD_HEIGHT 64
|
||||
|
@ -34,29 +31,10 @@
|
|||
#define LCD_PIXEL_OFF 2
|
||||
#define LCD_COLORS_PAIR 3
|
||||
|
||||
/************************/
|
||||
/* functions prototypes */
|
||||
/************************/
|
||||
void text_update_LCD( void );
|
||||
|
||||
/****************************/
|
||||
/* functions implementation */
|
||||
/****************************/
|
||||
|
||||
static inline void ncurses_draw_annunciators( void )
|
||||
{
|
||||
wchar_t* annunciators_icons[ 6 ] = { L"↰", L"↱", L"α", L"🪫", L"⌛", L"⇄" };
|
||||
int val = display.annunc;
|
||||
|
||||
if ( val == last_annunc_state )
|
||||
return;
|
||||
|
||||
last_annunc_state = val;
|
||||
|
||||
for ( int i = 0; i < NB_ANNUNCIATORS; i++ )
|
||||
mvaddwstr( 0, 4 + ( i * 4 ), ( ( annunciators_bits[ i ] & val ) == annunciators_bits[ i ] ) ? annunciators_icons[ i ] : L" " );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
/*********/
|
||||
|
@ -211,7 +189,7 @@ static inline void ncurses_draw_lcd_small( void )
|
|||
wrefresh( stdscr );
|
||||
}
|
||||
|
||||
static inline void ncurses_draw_lcd( void )
|
||||
static inline void ncurses_draw_lcd_fullsize( void )
|
||||
{
|
||||
bool bit;
|
||||
int nibble;
|
||||
|
@ -249,7 +227,152 @@ static inline void ncurses_draw_lcd( void )
|
|||
wrefresh( stdscr );
|
||||
}
|
||||
|
||||
static inline int ncurses_get_event( void )
|
||||
static inline void ncurses_draw_lcd( void )
|
||||
{
|
||||
if ( small )
|
||||
ncurses_draw_lcd_small();
|
||||
else if ( tiny )
|
||||
ncurses_draw_lcd_tiny();
|
||||
else
|
||||
ncurses_draw_lcd_fullsize();
|
||||
}
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
static inline void draw_nibble( int col, int row, int val )
|
||||
{
|
||||
/* Dummy, NCurses version draws the whole LCD at once at the end of update_LCD() */
|
||||
}
|
||||
|
||||
/* TODO: duplicate of ui_sdl.c:draw_row() */
|
||||
static inline void draw_row( long addr, int row )
|
||||
{
|
||||
int nibble;
|
||||
int line_length = NIBBLES_PER_ROW;
|
||||
|
||||
if ( ( display.offset > 3 ) && ( row <= display.lines ) )
|
||||
line_length += 2;
|
||||
|
||||
for ( int i = 0; i < line_length; i++ ) {
|
||||
nibble = read_nibble( addr + i );
|
||||
if ( nibble == lcd_nibbles_buffer[ row ][ i ] )
|
||||
continue;
|
||||
|
||||
lcd_nibbles_buffer[ row ][ i ] = nibble;
|
||||
draw_nibble( i, row, nibble );
|
||||
}
|
||||
}
|
||||
|
||||
/**********/
|
||||
/* public */
|
||||
/**********/
|
||||
/* TODO: quasi-duplicate of ui_sdl.c:sdl_update_LCD() */
|
||||
void text_update_LCD( void )
|
||||
{
|
||||
if ( display.on ) {
|
||||
int i;
|
||||
long addr;
|
||||
static int old_offset = -1;
|
||||
static int old_lines = -1;
|
||||
|
||||
addr = display.disp_start;
|
||||
if ( display.offset != old_offset ) {
|
||||
memset( lcd_nibbles_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
|
||||
|
||||
old_offset = display.offset;
|
||||
}
|
||||
if ( display.lines != old_lines ) {
|
||||
memset( &lcd_nibbles_buffer[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) );
|
||||
|
||||
old_lines = display.lines;
|
||||
}
|
||||
for ( i = 0; i <= display.lines; i++ ) {
|
||||
draw_row( addr, i );
|
||||
addr += display.nibs_per_line;
|
||||
}
|
||||
if ( i < DISP_ROWS ) {
|
||||
addr = display.menu_start;
|
||||
for ( ; i < DISP_ROWS; i++ ) {
|
||||
draw_row( addr, i );
|
||||
addr += NIBBLES_PER_ROW;
|
||||
}
|
||||
}
|
||||
} else
|
||||
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
|
||||
|
||||
/* text UI specific from here */
|
||||
ncurses_draw_lcd();
|
||||
}
|
||||
|
||||
/* TODO: duplicate of ui_sdl.c:sdl_refresh_LCD() */
|
||||
void text_refresh_LCD( void ) {}
|
||||
|
||||
/* TODO: duplicate of ui_sdl.c:sdl_disp_draw_nibble() */
|
||||
void text_disp_draw_nibble( word_20 addr, word_4 val )
|
||||
{
|
||||
long offset;
|
||||
int x, y;
|
||||
|
||||
offset = ( addr - display.disp_start );
|
||||
x = offset % display.nibs_per_line;
|
||||
if ( x < 0 || x > 35 )
|
||||
return;
|
||||
if ( display.nibs_per_line != 0 ) {
|
||||
y = offset / display.nibs_per_line;
|
||||
if ( y < 0 || y > 63 )
|
||||
return;
|
||||
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
return;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
draw_nibble( x, y, val );
|
||||
} else {
|
||||
for ( y = 0; y < display.lines; y++ ) {
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
break;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
draw_nibble( x, y, val );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: duplicate of ui_sdl.c:sdl_menu_draw_nibble() */
|
||||
void text_menu_draw_nibble( word_20 addr, word_4 val )
|
||||
{
|
||||
long offset;
|
||||
int x, y;
|
||||
|
||||
offset = ( addr - display.menu_start );
|
||||
x = offset % NIBBLES_PER_ROW;
|
||||
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
|
||||
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
return;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
draw_nibble( x, y, val );
|
||||
}
|
||||
|
||||
void text_draw_annunc( void )
|
||||
{
|
||||
wchar_t* annunciators_icons[ 6 ] = { L"↰", L"↱", L"α", L"🪫", L"⌛", L"⇄" };
|
||||
int val = display.annunc;
|
||||
|
||||
if ( val == last_annunc_state )
|
||||
return;
|
||||
|
||||
last_annunc_state = val;
|
||||
|
||||
for ( int i = 0; i < NB_ANNUNCIATORS; i++ )
|
||||
mvaddwstr( 0, 4 + ( i * 4 ), ( ( annunciators_bits[ i ] & val ) == annunciators_bits[ i ] ) ? annunciators_icons[ i ] : L" " );
|
||||
}
|
||||
|
||||
void text_adjust_contrast( void )
|
||||
{ /* Dummy, NCurses version doesn't hand contrast (yet?) */
|
||||
}
|
||||
|
||||
int text_get_event( void )
|
||||
{
|
||||
int hpkey = -1;
|
||||
uint32_t k;
|
||||
|
@ -460,8 +583,17 @@ static inline int ncurses_get_event( void )
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline void ncurses_init_ui( void )
|
||||
void init_text_ui( int argc, char** argv )
|
||||
{
|
||||
/* Set public API to this UIs functions */
|
||||
ui_disp_draw_nibble = text_disp_draw_nibble;
|
||||
ui_menu_draw_nibble = text_menu_draw_nibble;
|
||||
ui_get_event = text_get_event;
|
||||
ui_update_LCD = text_update_LCD;
|
||||
ui_refresh_LCD = text_refresh_LCD;
|
||||
ui_adjust_contrast = text_adjust_contrast;
|
||||
ui_draw_annunc = text_draw_annunc;
|
||||
|
||||
setlocale( LC_ALL, "" );
|
||||
initscr(); /* initialize the curses library */
|
||||
keypad( stdscr, TRUE ); /* enable keyboard mapping */
|
||||
|
@ -503,144 +635,3 @@ static inline void ncurses_init_ui( void )
|
|||
|
||||
mvprintw( LCD_BOTTOM + 1, 0, "F1: Enter, F2: Left-Shift, F3: Right-Shift, F4: Alpha, F5: On, F7: Quit" );
|
||||
}
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
static inline void draw_row( long addr, int row )
|
||||
{
|
||||
int nibble;
|
||||
int line_length = NIBBLES_PER_ROW;
|
||||
|
||||
if ( ( display.offset > 3 ) && ( row <= display.lines ) )
|
||||
line_length += 2;
|
||||
|
||||
for ( int i = 0; i < line_length; i++ ) {
|
||||
nibble = read_nibble( addr + i );
|
||||
if ( nibble == lcd_nibbles_buffer[ row ][ i ] )
|
||||
continue;
|
||||
|
||||
lcd_nibbles_buffer[ row ][ i ] = nibble;
|
||||
}
|
||||
}
|
||||
|
||||
/**********/
|
||||
/* public */
|
||||
/**********/
|
||||
int text_get_event( void ) { return ncurses_get_event(); }
|
||||
|
||||
void text_adjust_contrast() { text_update_LCD(); }
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
void text_init_LCD( void )
|
||||
{
|
||||
init_display();
|
||||
|
||||
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
|
||||
}
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
void text_update_LCD( void )
|
||||
{
|
||||
if ( display.on ) {
|
||||
int i;
|
||||
long addr;
|
||||
static int old_offset = -1;
|
||||
static int old_lines = -1;
|
||||
|
||||
addr = display.disp_start;
|
||||
if ( display.offset != old_offset ) {
|
||||
memset( lcd_nibbles_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) );
|
||||
|
||||
old_offset = display.offset;
|
||||
}
|
||||
if ( display.lines != old_lines ) {
|
||||
memset( &lcd_nibbles_buffer[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) );
|
||||
|
||||
old_lines = display.lines;
|
||||
}
|
||||
for ( i = 0; i <= display.lines; i++ ) {
|
||||
draw_row( addr, i );
|
||||
addr += display.nibs_per_line;
|
||||
}
|
||||
if ( i < DISP_ROWS ) {
|
||||
addr = display.menu_start;
|
||||
for ( ; i < DISP_ROWS; i++ ) {
|
||||
draw_row( addr, i );
|
||||
addr += NIBBLES_PER_ROW;
|
||||
}
|
||||
}
|
||||
} else
|
||||
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
|
||||
|
||||
if ( small )
|
||||
ncurses_draw_lcd_small();
|
||||
else if ( tiny )
|
||||
ncurses_draw_lcd_tiny();
|
||||
else
|
||||
ncurses_draw_lcd();
|
||||
}
|
||||
|
||||
void text_refresh_LCD( void ) {}
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
void text_disp_draw_nibble( word_20 addr, word_4 val )
|
||||
{
|
||||
long offset;
|
||||
int x, y;
|
||||
|
||||
offset = ( addr - display.disp_start );
|
||||
x = offset % display.nibs_per_line;
|
||||
if ( x < 0 || x > 35 )
|
||||
return;
|
||||
if ( display.nibs_per_line != 0 ) {
|
||||
y = offset / display.nibs_per_line;
|
||||
if ( y < 0 || y > 63 )
|
||||
return;
|
||||
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
return;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
} else {
|
||||
for ( y = 0; y < display.lines; y++ ) {
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
break;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: not specific to tui */
|
||||
void text_menu_draw_nibble( word_20 addr, word_4 val )
|
||||
{
|
||||
long offset;
|
||||
int x, y;
|
||||
|
||||
offset = ( addr - display.menu_start );
|
||||
x = offset % NIBBLES_PER_ROW;
|
||||
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
|
||||
|
||||
if ( val == lcd_nibbles_buffer[ y ][ x ] )
|
||||
return;
|
||||
|
||||
lcd_nibbles_buffer[ y ][ x ] = val;
|
||||
}
|
||||
|
||||
void text_draw_annunc( void ) { ncurses_draw_annunciators(); }
|
||||
|
||||
void init_text_ui( int argc, char** argv )
|
||||
{
|
||||
/* Set public API to this UIs functions */
|
||||
ui_disp_draw_nibble = text_disp_draw_nibble;
|
||||
ui_menu_draw_nibble = text_menu_draw_nibble;
|
||||
ui_get_event = text_get_event;
|
||||
ui_update_LCD = text_update_LCD;
|
||||
ui_refresh_LCD = text_refresh_LCD;
|
||||
ui_adjust_contrast = text_adjust_contrast;
|
||||
ui_draw_annunc = text_draw_annunc;
|
||||
ui_init_LCD = text_init_LCD;
|
||||
|
||||
text_init_LCD();
|
||||
|
||||
ncurses_init_ui();
|
||||
}
|
||||
|
|
113
src/ui_x11.c
113
src/ui_x11.c
|
@ -18,8 +18,7 @@
|
|||
#include <X11/extensions/XShm.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include "emulator.h"
|
||||
#include "romio.h"
|
||||
#include "romio.h" /* opt_gx */
|
||||
#include "runtime_options.h"
|
||||
#include "ui.h"
|
||||
#include "ui_inner.h"
|
||||
|
@ -2911,19 +2910,19 @@ static inline void draw_nibble( int c, int r, int val )
|
|||
|
||||
static inline void draw_row( long addr, int row )
|
||||
{
|
||||
int i, v;
|
||||
int line_length;
|
||||
int nibble;
|
||||
int line_length = NIBBLES_PER_ROW;
|
||||
|
||||
line_length = NIBBLES_PER_ROW;
|
||||
if ( ( display.offset > 3 ) && ( row <= display.lines ) )
|
||||
line_length += 2;
|
||||
for ( i = 0; i < line_length; i++ ) {
|
||||
v = read_nibble( addr + i );
|
||||
if ( v == lcd_nibbles_buffer[ row ][ i ] )
|
||||
|
||||
for ( int i = 0; i < line_length; i++ ) {
|
||||
nibble = read_nibble( addr + i );
|
||||
if ( nibble == lcd_nibbles_buffer[ row ][ i ] )
|
||||
continue;
|
||||
|
||||
lcd_nibbles_buffer[ row ][ i ] = v;
|
||||
draw_nibble( i, row, v );
|
||||
lcd_nibbles_buffer[ row ][ i ] = nibble;
|
||||
draw_nibble( i, row, nibble );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3548,56 +3547,6 @@ void x11_adjust_contrast( void )
|
|||
}
|
||||
}
|
||||
|
||||
void x11_init_LCD( void )
|
||||
{
|
||||
init_display();
|
||||
|
||||
memset( lcd_nibbles_buffer, 0xf0, sizeof( lcd_nibbles_buffer ) );
|
||||
|
||||
/* init nibble_maps */
|
||||
for ( int i = 0; i < 16; i++ )
|
||||
nibble_maps[ i ] = XCreateBitmapFromData( dpy, lcd.win, ( char* )nibbles[ i ], 8, 2 );
|
||||
|
||||
if ( !shm_flag )
|
||||
return;
|
||||
|
||||
if ( lcd.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 x11_update_LCD( void )
|
||||
{
|
||||
int i, j;
|
||||
|
@ -3795,7 +3744,6 @@ void init_x11_ui( int argc, char** argv )
|
|||
ui_refresh_LCD = x11_refresh_LCD;
|
||||
ui_adjust_contrast = x11_adjust_contrast;
|
||||
ui_draw_annunc = x11_draw_annunc;
|
||||
ui_init_LCD = x11_init_LCD;
|
||||
|
||||
save_options( argc, argv );
|
||||
|
||||
|
@ -3809,5 +3757,46 @@ void init_x11_ui( int argc, char** argv )
|
|||
|
||||
init_annunc_pixmaps();
|
||||
|
||||
x11_init_LCD();
|
||||
/* init nibble_maps */
|
||||
for ( int i = 0; i < 16; i++ )
|
||||
nibble_maps[ i ] = XCreateBitmapFromData( dpy, lcd.win, ( char* )nibbles[ i ], 8, 2 );
|
||||
|
||||
if ( !shm_flag )
|
||||
return;
|
||||
|
||||
if ( lcd.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; /* **** */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue