pretty-code

This commit is contained in:
Gwenhael Le Moine 2023-05-17 16:16:08 +02:00
parent 9c56f4916b
commit ffdb73a83d
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
4 changed files with 211 additions and 130 deletions

View file

@ -358,7 +358,8 @@ void update_display( void ) {
for ( j = 0; j < line_length; j++ ) {
val = read_nibble( addr++ );
disp.disp_image->data[ data_addr++ ] = nibble_bitmap[ val ];
disp.disp_image->data[ data_addr_2++ ] = nibble_bitmap[ val ];
disp.disp_image->data[ data_addr_2++ ] =
nibble_bitmap[ val ];
}
addr += addr_pad;
data_addr += line_pad;

134
src/x48.c
View file

@ -748,9 +748,26 @@ button_t buttons_sx[] = {
{ "NXT", 0, 0, 0x70, 250, 50, 36, 26, WHITE, "NXT",
0, 0, 0, 0, "L", "PREV", 0, 0, 0, 0 },
{ "COLON", 0, 0, 0x04, 0, 100, 36, 26, WHITE,
0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME",
0, 0 },
{ "COLON",
0,
0,
0x04,
0,
100,
36,
26,
WHITE,
0,
0,
colon_width,
colon_height,
colon_bitmap,
"M",
"UP",
0,
"HOME",
0,
0 },
{ "STO", 0, 0, 0x64, 50, 100, 36, 26, WHITE, "STO",
0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0 },
{ "EVAL", 0, 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL",
@ -761,9 +778,26 @@ button_t buttons_sx[] = {
{ "DOWN", 0, 0, 0x61, 200, 100, 36, 26,
WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "REVIEW",
0, 0, 0, 0 },
{ "RIGHT", 0, 0, 0x60, 250, 100, 36, 26, WHITE,
0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0,
0, 0 },
{ "RIGHT",
0,
0,
0x60,
250,
100,
36,
26,
WHITE,
0,
0,
right_width,
right_height,
right_bitmap,
"R",
"SWAP",
0,
0,
0,
0 },
{ "SIN", 0, 0, 0x34, 0, 150, 36, 26, WHITE, "SIN",
0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0 },
@ -771,8 +805,9 @@ button_t buttons_sx[] = {
0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0 },
{ "TAN", 0, 0, 0x53, 100, 150, 36, 26, WHITE, "TAN",
0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0 },
{ "SQRT", 0, 0, 0x52, 150, 150, 36, 26, WHITE, 0,
0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0, 0 },
{ "SQRT", 0, 0, 0x52, 150, 150, 36, 26,
WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "e",
0, "f", 0, 0 },
{ "POWER", 0, 0, 0x51, 200, 150, 36, 26, WHITE,
0, 0, power_width, power_height, power_bitmap, "W", "g", 0, "LOG",
0, 0 },
@ -992,9 +1027,26 @@ button_t buttons_gx[] = {
{ "NXT", 0, 0, 0x70, 250, 50, 36, 26, WHITE, "NXT",
0, 0, 0, 0, "L", "PREV", 0, "MENU", 0, 0 },
{ "COLON", 0, 0, 0x04, 0, 100, 36, 26, WHITE,
0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME",
0, 0 },
{ "COLON",
0,
0,
0x04,
0,
100,
36,
26,
WHITE,
0,
0,
colon_width,
colon_height,
colon_bitmap,
"M",
"UP",
0,
"HOME",
0,
0 },
{ "STO", 0, 0, 0x64, 50, 100, 36, 26, WHITE, "STO",
0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0 },
{ "EVAL", 0, 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL",
@ -1005,9 +1057,26 @@ button_t buttons_gx[] = {
{ "DOWN", 0, 0, 0x61, 200, 100, 36, 26,
WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "VIEW",
0, 0, 0, 0 },
{ "RIGHT", 0, 0, 0x60, 250, 100, 36, 26, WHITE,
0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0,
0, 0 },
{ "RIGHT",
0,
0,
0x60,
250,
100,
36,
26,
WHITE,
0,
0,
right_width,
right_height,
right_bitmap,
"R",
"SWAP",
0,
0,
0,
0 },
{ "SIN", 0, 0, 0x34, 0, 150, 36, 26, WHITE, "SIN",
0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0 },
@ -1015,8 +1084,9 @@ button_t buttons_gx[] = {
0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0 },
{ "TAN", 0, 0, 0x53, 100, 150, 36, 26, WHITE, "TAN",
0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0 },
{ "SQRT", 0, 0, 0x52, 150, 150, 36, 26, WHITE, 0,
0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0, 0 },
{ "SQRT", 0, 0, 0x52, 150, 150, 36, 26,
WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "n",
0, "o", 0, 0 },
{ "POWER", 0, 0, 0x51, 200, 150, 36, 26, WHITE,
0, 0, power_width, power_height, power_bitmap, "W", "p", 0, "LOG",
0, 0 },
@ -1095,8 +1165,9 @@ button_t buttons_gx[] = {
1, 0, 0, 0, 0, "\002 ", 0, "\001", 0, 0 },
{ "SPC", 0, 0, 0x01, 180, 400, 46, 26, WHITE, "SPC",
0, 0, 0, 0, 0, "\005 ", 0, "z", 0, 0 },
{ "PLUS", 0, 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0,
plus_width, plus_height, plus_bitmap, 0, "x ", 0, "y", 0, 0 },
{ "PLUS", 0, 0, 0x00, 240, 400, 46, 26,
WHITE, 0, 0, plus_width, plus_height, plus_bitmap, 0, "x ",
0, "y", 0, 0 },
{ 0 } };
@ -1150,7 +1221,8 @@ icon_map_t icon_maps_gx[] = {
{ hp48_text_gx_width, hp48_text_gx_height, LABEL, hp48_text_gx_bitmap },
{ hp48_keys_width, hp48_keys_height, BLACK, hp48_keys_bitmap },
{ hp48_orange_width, hp48_orange_height, LEFT, hp48_orange_bitmap },
{ hp48_green_gx_width, hp48_green_gx_height, RIGHT, hp48_green_gx_bitmap } };
{ hp48_green_gx_width, hp48_green_gx_height, RIGHT,
hp48_green_gx_bitmap } };
#define KEYBOARD_HEIGHT ( buttons[ LAST_BUTTON ].y + buttons[ LAST_BUTTON ].h )
#define KEYBOARD_WIDTH ( buttons[ LAST_BUTTON ].x + buttons[ LAST_BUTTON ].w )
@ -2791,7 +2863,8 @@ void DrawMore( unsigned int w, unsigned int h, unsigned int offset_y,
XSetForeground( dpy, gc, COLOR( LOGO ) );
x = DISPLAY_OFFSET_X + hp_width;
y = hp_height + 8 - hp48gx_height;
pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48gx_bitmap,
pix =
XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48gx_bitmap,
hp48gx_width, hp48gx_height );
XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48gx_width,
hp48gx_height, x, y, 1 );
@ -2801,9 +2874,9 @@ void DrawMore( unsigned int w, unsigned int h, unsigned int offset_y,
x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width +
gx_silver_x_hot + 2;
y = 10 + gx_silver_y_hot;
pix =
XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )gx_silver_bitmap,
gx_silver_width, gx_silver_height );
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
( char* )gx_silver_bitmap, gx_silver_width,
gx_silver_height );
XSetStipple( dpy, gc, pix );
XSetTSOrigin( dpy, gc, x, y );
XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_silver_width,
@ -2814,9 +2887,9 @@ void DrawMore( unsigned int w, unsigned int h, unsigned int offset_y,
x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width +
gx_green_x_hot + 2;
y = 10 + gx_green_y_hot;
pix =
XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )gx_green_bitmap,
gx_green_width, gx_green_height );
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
( char* )gx_green_bitmap, gx_green_width,
gx_green_height );
XSetStipple( dpy, gc, pix );
XSetTSOrigin( dpy, gc, x, y );
XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_green_width,
@ -2829,7 +2902,8 @@ void DrawMore( unsigned int w, unsigned int h, unsigned int offset_y,
x = DISPLAY_OFFSET_X;
y = TOP_SKIP - DISP_FRAME - hp48sx_height - 3;
pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48sx_bitmap,
pix =
XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48sx_bitmap,
hp48sx_width, hp48sx_height );
XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48sx_width,
@ -2840,7 +2914,8 @@ void DrawMore( unsigned int w, unsigned int h, unsigned int offset_y,
x = DISPLAY_OFFSET_X + display_width - 1 - science_width;
y = TOP_SKIP - DISP_FRAME - science_height - 4;
pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )science_bitmap,
pix =
XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )science_bitmap,
science_width, science_height );
XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, science_width,
@ -4306,7 +4381,8 @@ void SDLDrawLogo( unsigned int w, unsigned int h, unsigned int cut,
gx_green_x_hot + 2;
y = 10 + gx_green_y_hot;
surf = SDLCreateSurfFromData(
gx_green_width, gx_green_height, gx_green_bitmap, ARGBColors[ RIGHT ],
gx_green_width, gx_green_height, gx_green_bitmap,
ARGBColors[ RIGHT ],
0 ); // Background transparent: draw only green menu
srect.x = 0;
srect.y = 0;

View file

@ -563,9 +563,9 @@ static unsigned char bs_bitmap[] = {
#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 };
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
@ -597,9 +597,9 @@ static unsigned char shr_bitmap[] = {
#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 };
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
@ -640,7 +640,8 @@ static unsigned char blank_bitmap[] = { 0x00, 0x00, 0x00, 0x00,
#define hash_width 5
#define hash_height 7
static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a };
static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a,
0x0a, 0x1f, 0x0a };
#define lbrace_width 3
#define lbrace_height 7
@ -664,7 +665,8 @@ static unsigned char slash_bitmap[] = { 0x04, 0x04, 0x02, 0x02,
#define two_width 5
#define two_height 7
static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f };
static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08,
0x04, 0x02, 0x1f };
#define three_width 5
#define three_height 7
@ -797,7 +799,8 @@ static unsigned char arrow_bitmap[] = { 0x00, 0x08, 0x18, 0x3f,
#define diff_width 5
#define diff_height 7
static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e };
static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e,
0x11, 0x11, 0x0e };
#define integral_width 5
#define integral_height 8
@ -842,8 +845,9 @@ static unsigned char under_bitmap[] = { 0x00, 0x00, 0x00, 0x00,
#define prog_width 16
#define prog_height 7
static unsigned char prog_bitmap[] = { 0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09,
0x90, 0x12, 0x48, 0x24, 0x24, 0x48, 0x12 };
static unsigned char prog_bitmap[] = { 0x48, 0x12, 0x24, 0x24, 0x12,
0x48, 0x09, 0x90, 0x12, 0x48,
0x24, 0x24, 0x48, 0x12 };
#define string_width 10
#define string_height 7
@ -881,10 +885,10 @@ static unsigned char rcurly_bitmap[] = { 0x03, 0x04, 0x04, 0x08,
#define sqr_gx_width 11
#define sqr_gx_height 13
static unsigned char sqr_gx_bitmap[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00,
0x02, 0x00, 0x01, 0x80, 0x07, 0x00, 0x00,
0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14,
0x00, 0x53, 0x00, 0x21, 0x00 };
static unsigned char sqr_gx_bitmap[] = {
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