#include #include "ui48_common.h" #include "ui48_inner.h" #include "ui48_sdl2.h" #include "ui48_ncurses.h" letter_t small_font[ 128 ] = { {0, 0, 0 }, {nl_gx_width, nl_gx_height, nl_gx_bits }, /* \x01 == \n gx */ {comma_gx_width, comma_gx_height, comma_gx_bits }, /* \x02 == comma gx */ {arrow_gx_width, arrow_gx_height, arrow_gx_bits }, /* \x03 == \-> gx */ {equal_gx_width, equal_gx_height, equal_gx_bits }, /* \x04 == equal gx */ {pi_gx_width, pi_gx_height, pi_gx_bits }, /* \x05 == pi gx */ {arrow_width, arrow_height, arrow_bits }, /* \x06 == left arrow */ {diff_width, diff_height, diff_bits }, /* \x07 == differential */ {integral_width, integral_height, integral_bits }, /* \x08 == integral */ {sigma_width, sigma_height, sigma_bits }, /* \x09 == sigma */ {sqr_width, sqr_height, sqr_bits }, /* \x0a == sqr */ {root_width, root_height, root_bits }, /* \x0b == root */ {pow10_width, pow10_height, pow10_bits }, /* \x0c == pow10 */ {exp_width, exp_height, exp_bits }, /* \x0d == exp */ {prog_width, prog_height, prog_bits }, /* \x0e == << >> */ {string_width, string_height, string_bits }, /* \x0f == " " */ {nl_width, nl_height, nl_bits }, /* \x10 == New Line # 16 */ {pi_width, pi_height, pi_bits }, /* \x11 == pi */ {angle_width, angle_height, angle_bits }, /* \x12 == angle */ {sqr_gx_width, sqr_gx_height, sqr_gx_bits }, /* \x13 == sqr gx */ {root_gx_width, root_gx_height, root_gx_bits }, /* \x14 == root gx */ {pow10_gx_width, pow10_gx_height, pow10_gx_bits }, /* \x15 == pow10 gx */ {exp_gx_width, exp_gx_height, exp_gx_bits }, /* \x16 == exp gx */ {parens_gx_width, parens_gx_height, parens_gx_bits }, /* \x17 == ( ) gx */ {hash_gx_width, hash_gx_height, hash_gx_bits }, /* \x18 == # gx */ {bracket_gx_width, bracket_gx_height, bracket_gx_bits }, /* \x19 == [] gx */ {under_gx_width, under_gx_height, under_gx_bits }, /* \x1a == _ gx */ {prog_gx_width, prog_gx_height, prog_gx_bits }, /* \x1b == << >> gx */ {quote_gx_width, quote_gx_height, quote_gx_bits }, /* \x1c == " " gx */ {curly_gx_width, curly_gx_height, curly_gx_bits }, /* \x1d == {} gx */ {colon_gx_width, colon_gx_height, colon_gx_bits }, /* \x1e == :: gx */ {angle_gx_width, angle_gx_height, angle_gx_bits }, /* \x1f == angle gx */ {blank_width, blank_height, blank_bits }, /* # 32 */ {0, 0, 0 }, {0, 0, 0 }, {hash_width, hash_height, hash_bits }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {lbrace_width, lbrace_height, lbrace_bits }, {rbrace_width, rbrace_height, rbrace_bits }, {0, 0, 0 }, {0, 0, 0 }, {comma_width, comma_height, comma_bits }, {0, 0, 0 }, {0, 0, 0 }, {slash_width, slash_height, slash_bits }, {zero_width, zero_height, zero_bits }, /* # 48 */ {one_width, one_height, one_bits }, {two_width, two_height, two_bits }, {three_width, three_height, three_bits }, {four_width, four_height, four_bits }, {five_width, five_height, five_bits }, {six_width, six_height, six_bits }, {seven_width, seven_height, seven_bits }, {eight_width, eight_height, eight_bits }, {nine_width, nine_height, nine_bits }, {small_colon_width, small_colon_height, small_colon_bits}, {0, 0, 0 }, {0, 0, 0 }, {equal_width, equal_height, equal_bits }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, /* # 64 */ {A_width, A_height, A_bits }, {B_width, B_height, B_bits }, {C_width, C_height, C_bits }, {D_width, D_height, D_bits }, {E_width, E_height, E_bits }, {F_width, F_height, F_bits }, {G_width, G_height, G_bits }, {H_width, H_height, H_bits }, {I_width, I_height, I_bits }, {J_width, J_height, J_bits }, {K_width, K_height, K_bits }, {L_width, L_height, L_bits }, {M_width, M_height, M_bits }, {N_width, N_height, N_bits }, {O_width, O_height, O_bits }, {P_width, P_height, P_bits }, /* # 80 */ {Q_width, Q_height, Q_bits }, {R_width, R_height, R_bits }, {S_width, S_height, S_bits }, {T_width, T_height, T_bits }, {U_width, U_height, U_bits }, {V_width, V_height, V_bits }, {W_width, W_height, W_bits }, {X_width, X_height, X_bits }, {Y_width, Y_height, Y_bits }, {Z_width, Z_height, Z_bits }, {lbracket_width, lbracket_height, lbracket_bits }, {0, 0, 0 }, {rbracket_width, rbracket_height, rbracket_bits }, {0, 0, 0 }, {under_width, under_height, under_bits }, {0, 0, 0 }, /* # 96 */ {0, 0, 0 }, /* a */ {0, 0, 0 }, /* b */ {0, 0, 0 }, /* c */ {d_width, d_height, d_bits }, {e_width, e_height, e_bits }, {0, 0, 0 }, /* f */ {0, 0, 0 }, /* g */ {0, 0, 0 }, /* h */ {i_width, i_height, i_bits }, {0, 0, 0 }, /* j */ {0, 0, 0 }, /* k */ {0, 0, 0 }, /* l */ {0, 0, 0 }, /* m */ {0, 0, 0 }, /* n */ {0, 0, 0 }, /* o */ {p_width, p_height, p_bits }, {0, 0, 0 }, /* q */ {r_width, r_height, r_bits }, {s_width, s_height, s_bits }, {t_width, t_height, t_bits }, {0, 0, 0 }, /* u */ {v_width, v_height, v_bits }, {w_width, w_height, w_bits }, {0, 0, 0 }, /* x */ {y_width, y_height, y_bits }, {0, 0, 0 }, /* z */ {lcurly_width, lcurly_height, lcurly_bits }, {0, 0, 0 }, {rcurly_width, rcurly_height, rcurly_bits }, {0, 0, 0 }, {0, 0, 0 }, /* 127 */ }; letter_t big_font[ 128 ] = { {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, /* # 16 */ {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, /* # 32 */ {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {big_font_dot_width, big_font_dot_height, big_font_dot_bits}, /* # 46 */ {0, 0, 0 }, {big_font_0_width, big_font_0_height, big_font_0_bits }, /* # 48 */ {big_font_1_width, big_font_1_height, big_font_1_bits }, {big_font_2_width, big_font_2_height, big_font_2_bits }, {big_font_3_width, big_font_3_height, big_font_3_bits }, {big_font_4_width, big_font_4_height, big_font_4_bits }, {big_font_5_width, big_font_5_height, big_font_5_bits }, {big_font_6_width, big_font_6_height, big_font_6_bits }, {big_font_7_width, big_font_7_height, big_font_7_bits }, {big_font_8_width, big_font_8_height, big_font_8_bits }, {big_font_9_width, big_font_9_height, big_font_9_bits }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, /* # 64 */ {big_font_A_width, big_font_A_height, big_font_A_bits }, {0, 0, 0 }, {big_font_C_width, big_font_C_height, big_font_C_bits }, {big_font_D_width, big_font_D_height, big_font_D_bits }, {big_font_E_width, big_font_E_height, big_font_E_bits }, {0, 0, 0 }, {big_font_G_width, big_font_G_height, big_font_G_bits }, {big_font_H_width, big_font_H_height, big_font_H_bits }, {big_font_I_width, big_font_I_height, big_font_I_bits }, {0, 0, 0 }, {0, 0, 0 }, {big_font_L_width, big_font_L_height, big_font_L_bits }, {big_font_M_width, big_font_M_height, big_font_M_bits }, {big_font_N_width, big_font_N_height, big_font_N_bits }, {big_font_O_width, big_font_O_height, big_font_O_bits }, {big_font_P_width, big_font_P_height, big_font_P_bits }, /* # 80 */ {0, 0, 0 }, {big_font_R_width, big_font_R_height, big_font_R_bits }, {big_font_S_width, big_font_S_height, big_font_S_bits }, {big_font_T_width, big_font_T_height, big_font_T_bits }, {0, 0, 0 }, {big_font_V_width, big_font_V_height, big_font_V_bits }, {0, 0, 0 }, {big_font_X_width, big_font_X_height, big_font_X_bits }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, /* # 96 */ {0, 0, 0 }, /* a */ {0, 0, 0 }, /* b */ {0, 0, 0 }, /* c */ {0, 0, 0 }, /* d */ {0, 0, 0 }, /* e */ {0, 0, 0 }, /* f */ {0, 0, 0 }, /* g */ {0, 0, 0 }, /* h */ {0, 0, 0 }, /* i */ {0, 0, 0 }, /* j */ {0, 0, 0 }, /* k */ {0, 0, 0 }, /* l */ {0, 0, 0 }, /* m */ {0, 0, 0 }, /* n */ {0, 0, 0 }, /* o */ {0, 0, 0 }, /* p */ {0, 0, 0 }, /* q */ {0, 0, 0 }, /* r */ {0, 0, 0 }, /* s */ {0, 0, 0 }, /* t */ {0, 0, 0 }, /* u */ {0, 0, 0 }, /* v */ {0, 0, 0 }, /* w */ {0, 0, 0 }, /* x */ {0, 0, 0 }, /* y */ {0, 0, 0 }, /* z */ {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 }, {0, 0, 0 } }; color_t colors_sx[ NB_COLORS ] = { { /* #ffffff */ .name = "white", .r = 255, .g = 255, .b = 255, .a = 255, .mono_rgb = 255, .gray_rgb = 255, }, { /* #ffa600 */ .name = "left", .r = 255, .g = 166, .b = 0, .a = 255, .mono_rgb = 255, .gray_rgb = 230, }, { /* #00d2ff */ .name = "right", .r = 0, .g = 210, .b = 255, .a = 255, .mono_rgb = 255, .gray_rgb = 169, }, { /* #6d5d5d */ .name = "but_top", .r = 109, .g = 93, .b = 93, .a = 255, .mono_rgb = 0, .gray_rgb = 91, }, { /* #5a4d4d */ .name = "button", .r = 90, .g = 77, .b = 77, .a = 255, .mono_rgb = 0, .gray_rgb = 81, }, { /* #4c4141 */ .name = "but_bot", .r = 76, .g = 65, .b = 65, .a = 255, .mono_rgb = 0, .gray_rgb = 69, }, { /* #cadd5c */ .name = "lcd_col", .r = 202, .g = 221, .b = 92, .a = 255, .mono_rgb = 255, .gray_rgb = 205, }, { /* #000080 */ .name = "pix_col", .r = 0, .g = 0, .b = 128, .a = 255, .mono_rgb = 0, .gray_rgb = 20, }, { /* #6d4e4e */ .name = "pad_top", .r = 109, .g = 78, .b = 78, .a = 255, .mono_rgb = 0, .gray_rgb = 88, }, { /* #5a4040 */ .name = "pad", .r = 90, .g = 64, .b = 64, .a = 255, .mono_rgb = 0, .gray_rgb = 73, }, { /* #4c3636 */ .name = "pad_bot", .r = 76, .g = 54, .b = 54, .a = 255, .mono_rgb = 0, .gray_rgb = 60, }, { /* #9b7654 */ .name = "disp_pad_top", .r = 155, .g = 118, .b = 84, .a = 255, .mono_rgb = 0, .gray_rgb = 124, }, { /* #7c5e43 */ .name = "disp_pad", .r = 124, .g = 94, .b = 67, .a = 255, .mono_rgb = 0, .gray_rgb = 99, }, { /* #644b35 */ .name = "disp_pad_bot", .r = 100, .g = 75, .b = 53, .a = 255, .mono_rgb = 0, .gray_rgb = 79, }, { /* #cca96b */ .name = "logo", .r = 204, .g = 169, .b = 107, .a = 255, .mono_rgb = 255, .gray_rgb = 172, }, { /* #404040 */ .name = "logo_back", .r = 64, .g = 64, .b = 64, .a = 255, .mono_rgb = 0, .gray_rgb = 65, }, { /* #cab890 */ .name = "label", .r = 202, .g = 184, .b = 144, .a = 255, .mono_rgb = 255, .gray_rgb = 185, }, { /* #000000 */ .name = "frame", .r = 0, .g = 0, .b = 0, .a = 255, .mono_rgb = 255, .gray_rgb = 0, }, { /* #3c2a2a */ .name = "underlay", .r = 60, .g = 42, .b = 42, .a = 255, .mono_rgb = 0, .gray_rgb = 48, }, { /* #000000 */ .name = "black", .r = 0, .g = 0, .b = 0, .a = 255, .mono_rgb = 0, .gray_rgb = 0, }, }; color_t colors_gx[ NB_COLORS ] = { { /* #FFFFFF */ .name = "white", .r = 255, .g = 255, .b = 255, .a = 255, .mono_rgb = 255, .gray_rgb = 255, }, { /* #ffbaff */ .name = "left", .r = 255, .g = 186, .b = 255, .a = 255, .mono_rgb = 255, .gray_rgb = 220, }, { /* #00ffcc */ .name = "right", .r = 0, .g = 255, .b = 204, .a = 255, .mono_rgb = 255, .gray_rgb = 169, }, { /* #646464 */ .name = "but_top", .r = 104, .g = 104, .b = 104, .a = 255, .mono_rgb = 0, .gray_rgb = 104, }, { /* #585858 */ .name = "button", .r = 88, .g = 88, .b = 88, .a = 255, .mono_rgb = 0, .gray_rgb = 88, }, { /* #4a4a4a */ .name = "but_bot", .r = 74, .g = 74, .b = 74, .a = 255, .mono_rgb = 0, .gray_rgb = 74, }, { /* #cadd5c */ .name = "lcd_col", .r = 202, .g = 221, .b = 92, .a = 255, .mono_rgb = 255, .gray_rgb = 205, }, { /* #000080 */ .name = "pix_col", .r = 0, .g = 0, .b = 128, .a = 255, .mono_rgb = 0, .gray_rgb = 20, }, { /* #585858 */ .name = "pad_top", .r = 88, .g = 88, .b = 88, .a = 255, .mono_rgb = 0, .gray_rgb = 88, }, { /* #4a4a4a */ .name = "pad", .r = 74, .g = 74, .b = 74, .a = 255, .mono_rgb = 0, .gray_rgb = 74, }, { /* #404040 */ .name = "pad_bot", .r = 64, .g = 64, .b = 64, .a = 255, .mono_rgb = 0, .gray_rgb = 64, }, { /* #808080 */ .name = "disp_pad_top", .r = 128, .g = 128, .b = 138, .a = 255, .mono_rgb = 0, .gray_rgb = 128, }, { /* #68686E */ .name = "disp_pad", .r = 104, .g = 104, .b = 110, .a = 255, .mono_rgb = 0, .gray_rgb = 104, }, { /* #54545a */ .name = "disp_pad_bot", .r = 84, .g = 84, .b = 90, .a = 255, .mono_rgb = 0, .gray_rgb = 84, }, { /* #b0b0b8 */ .name = "logo", .r = 176, .g = 176, .b = 184, .a = 255, .mono_rgb = 255, .gray_rgb = 176, }, { /* #68686e */ .name = "logo_back", .r = 104, .g = 104, .b = 110, .a = 255, .mono_rgb = 0, .gray_rgb = 104, }, { /* #f0f0f0 */ .name = "label", .r = 240, .g = 240, .b = 240, .a = 255, .mono_rgb = 255, .gray_rgb = 240, }, { /* #000000 */ .name = "frame", .r = 0, .g = 0, .b = 0, .a = 255, .mono_rgb = 255, .gray_rgb = 0, }, { /* #68686e */ .name = "underlay", .r = 104, .g = 104, .b = 110, .a = 255, .mono_rgb = 0, .gray_rgb = 104, }, { /* #000000 */ .name = "black", .r = 0, .g = 0, .b = 0, .a = 255, .mono_rgb = 0, .gray_rgb = 0, }, }; button_t buttons_sx[ NB_KEYS ] = { {.name = "A", .x = 0, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "A", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "B", .x = 50, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "B", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "C", .x = 100, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "C", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "D", .x = 150, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "D", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "E", .x = 200, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "E", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "F", .x = 250, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "F", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "MTH", .x = 0, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "MTH", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "G", .left = "PRINT", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "PRG", .x = 50, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "PRG", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "H", .left = "I/O", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "CST", .x = 100, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "CST", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "I", .left = "MODES", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "VAR", .x = 150, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "VAR", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "J", .left = "MEMORY", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "UP", .x = 200, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = up_width, .lh = up_height, .lb = up_bitmap, .letter = "K", .left = "LIBRARY", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "NXT", .x = 250, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "NXT", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "L", .left = "PREV", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "QUOTE", .x = 0, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = quote_width, .lh = quote_height, .lb = quote_bitmap, .letter = "M", .left = "UP", .is_menu = 0, .right = "HOME", .sub = 0 }, {.name = "STO", .x = 50, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = "STO", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "N", .left = "DEF", .is_menu = 0, .right = "RCL", .sub = 0 }, {.name = "EVAL", .x = 100, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = "EVAL", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "O", .left = "\x80Q", .is_menu = 0, .right = "\x80NUM", .sub = 0 }, {.name = "LEFT", .x = 150, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = left_width, .lh = left_height, .lb = left_bitmap, .letter = "P", .left = "GRAPH", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "DOWN", .x = 200, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = down_width, .lh = down_height, .lb = down_bitmap, .letter = "Q", .left = "REVIEW", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "RIGHT", .x = 250, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = right_width, .lh = right_height, .lb = right_bitmap, .letter = "R", .left = "SWAP", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "SIN", .x = 0, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "SIN", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "S", .left = "ASIN", .is_menu = 0, .right = "\x07", .sub = 0 }, {.name = "COS", .x = 50, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "COS", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "T", .left = "ACOS", .is_menu = 0, .right = "\x08", .sub = 0 }, {.name = "TAN", .x = 100, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "TAN", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "U", .left = "ATAN", .is_menu = 0, .right = "\x09", .sub = 0 }, {.name = "SQRT", .x = 150, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = sqrt_width, .lh = sqrt_height, .lb = sqrt_bitmap, .letter = "V", .left = "\x0a", .is_menu = 0, .right = "\x0b", .sub = 0 }, {.name = "POWER", .x = 200, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = power_width, .lh = power_height, .lb = power_bitmap, .letter = "W", .left = "\x0c", .is_menu = 0, .right = "LOG", .sub = 0 }, {.name = "INV", .x = 250, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = inv_width, .lh = inv_height, .lb = inv_bitmap, .letter = "X", .left = "\x0d", .is_menu = 0, .right = "LN", .sub = 0 }, {.name = "ENTER", .x = 0, .y = 200, .w = 86, .h = 26, .lc = WHITE, .label = "ENTER", .font_size = 2, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "EQUATION", .is_menu = 0, .right = "MATRIX", .sub = 0 }, {.name = "NEG", .x = 100, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = neg_width, .lh = neg_height, .lb = neg_bitmap, .letter = "Y", .left = "EDIT", .is_menu = 0, .right = "VISIT", .sub = 0 }, {.name = "EEX", .x = 150, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = "EEX", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "Z", .left = "2D", .is_menu = 0, .right = "3D", .sub = 0 }, {.name = "DEL", .x = 200, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = "DEL", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "PURGE", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "BS", .x = 250, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = bs_width, .lh = bs_height, .lb = bs_bitmap, .letter = 0, .left = "DROP", .is_menu = 0, .right = "CLR", .sub = 0 }, {.name = "ALPHA", .x = 0, .y = 250, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = alpha_width, .lh = alpha_height, .lb = alpha_bitmap, .letter = 0, .left = "USR", .is_menu = 0, .right = "ENTRY", .sub = 0 }, {.name = "7", .x = 60, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "7", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "SOLVE", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "8", .x = 120, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "8", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "PLOT", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "9", .x = 180, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "9", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "ALGEBRA", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "DIV", .x = 240, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = div_width, .lh = div_height, .lb = div_bitmap, .letter = 0, .left = "( )", .is_menu = 0, .right = "#", .sub = 0 }, {.name = "SHL", .x = 0, .y = 300, .w = 36, .h = 26, .lc = LEFT, .label = 0, .font_size = 0, .lw = shl_width, .lh = shl_height, .lb = shl_bitmap, .letter = 0, .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "4", .x = 60, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "4", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "TIME", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "5", .x = 120, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "5", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "STAT", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "6", .x = 180, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "6", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "UNITS", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "MUL", .x = 240, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = mul_width, .lh = mul_height, .lb = mul_bitmap, .letter = 0, .left = "[ ]", .is_menu = 0, .right = "_", .sub = 0 }, {.name = "SHR", .x = 0, .y = 350, .w = 36, .h = 26, .lc = RIGHT, .label = 0, .font_size = 0, .lw = shr_width, .lh = shr_height, .lb = shr_bitmap, .letter = 0, .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "1", .x = 60, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "1", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "RAD", .is_menu = 0, .right = "POLAR", .sub = 0 }, {.name = "2", .x = 120, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "2", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "STACK", .is_menu = 0, .right = "ARG", .sub = 0 }, {.name = "3", .x = 180, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "3", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "CMD", .is_menu = 0, .right = "MENU", .sub = 0 }, {.name = "MINUS", .x = 240, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = minus_width, .lh = minus_height, .lb = minus_bitmap, .letter = 0, .left = "\x0e", .is_menu = 0, .right = "\x0f", .sub = 0 }, {.name = "ON", .x = 0, .y = 400, .w = 36, .h = 26, .lc = WHITE, .label = "ON", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "CONT", .is_menu = 0, .right = "OFF", .sub = "ATTN"}, {.name = "0", .x = 60, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = "0", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "= ", .is_menu = 0, .right = " \x80", .sub = 0 }, {.name = "PERIOD", .x = 120, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = ".", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = ",", .is_menu = 0, .right = " \x10", .sub = 0 }, {.name = "SPC", .x = 180, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = "SPC", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "\x11 ", .is_menu = 0, .right = " \x12", .sub = 0 }, {.name = "PLUS", .x = 240, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = plus_width, .lh = plus_height, .lb = plus_bitmap, .letter = 0, .left = "{ }", .is_menu = 0, .right = ": :", .sub = 0 }, }; button_t buttons_gx[ NB_KEYS ] = { {.name = "A", .x = 0, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "A", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "B", .x = 50, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "B", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "C", .x = 100, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "C", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "D", .x = 150, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "D", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "E", .x = 200, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "E", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "F", .x = 250, .y = 0, .w = 36, .h = 23, .lc = WHITE, .label = 0, .font_size = 0, .lw = menu_label_width, .lh = menu_label_height, .lb = menu_label_bitmap, .letter = "F", .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "MTH", .x = 0, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "MTH", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "G", .left = "RAD", .is_menu = 0, .right = "POLAR", .sub = 0 }, {.name = "PRG", .x = 50, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "PRG", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "H", .left = 0, .is_menu = 0, .right = "CHARS", .sub = 0 }, {.name = "CST", .x = 100, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "CST", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "I", .left = 0, .is_menu = 0, .right = "MODES", .sub = 0 }, {.name = "VAR", .x = 150, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "VAR", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "J", .left = 0, .is_menu = 0, .right = "MEMORY", .sub = 0 }, {.name = "UP", .x = 200, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = up_width, .lh = up_height, .lb = up_bitmap, .letter = "K", .left = 0, .is_menu = 0, .right = "STACK", .sub = 0 }, {.name = "NXT", .x = 250, .y = 50, .w = 36, .h = 26, .lc = WHITE, .label = "NXT", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "L", .left = "PREV", .is_menu = 0, .right = "MENU", .sub = 0 }, {.name = "QUOTE", .x = 0, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = quote_width, .lh = quote_height, .lb = quote_bitmap, .letter = "M", .left = "UP", .is_menu = 0, .right = "HOME", .sub = 0 }, {.name = "STO", .x = 50, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = "STO", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "N", .left = "DEF", .is_menu = 0, .right = "RCL", .sub = 0 }, {.name = "EVAL", .x = 100, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = "EVAL", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "O", .left = "\x06NUM", .is_menu = 0, .right = "UNDO", .sub = 0 }, {.name = "LEFT", .x = 150, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = left_width, .lh = left_height, .lb = left_bitmap, .letter = "P", .left = "PICTURE", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "DOWN", .x = 200, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = down_width, .lh = down_height, .lb = down_bitmap, .letter = "Q", .left = "VIEW", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "RIGHT", .x = 250, .y = 100, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = right_width, .lh = right_height, .lb = right_bitmap, .letter = "R", .left = "SWAP", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "SIN", .x = 0, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "SIN", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "S", .left = "ASIN", .is_menu = 0, .right = "\x07", .sub = 0 }, {.name = "COS", .x = 50, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "COS", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "T", .left = "ACOS", .is_menu = 0, .right = "\x08", .sub = 0 }, {.name = "TAN", .x = 100, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = "TAN", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "U", .left = "ATAN", .is_menu = 0, .right = "\x09", .sub = 0 }, {.name = "SQRT", .x = 150, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = sqrt_width, .lh = sqrt_height, .lb = sqrt_bitmap, .letter = "V", .left = "\x13", .is_menu = 0, .right = "\x14", .sub = 0 }, {.name = "POWER", .x = 200, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = power_width, .lh = power_height, .lb = power_bitmap, .letter = "W", .left = "\x15", .is_menu = 0, .right = "LOG", .sub = 0 }, {.name = "INV", .x = 250, .y = 150, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = inv_width, .lh = inv_height, .lb = inv_bitmap, .letter = "X", .left = "\x16", .is_menu = 0, .right = "LN", .sub = 0 }, {.name = "ENTER", .x = 0, .y = 200, .w = 86, .h = 26, .lc = WHITE, .label = "ENTER", .font_size = 2, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "EQUATION", .is_menu = 0, .right = "MATRIX", .sub = 0 }, {.name = "NEG", .x = 100, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = neg_width, .lh = neg_height, .lb = neg_bitmap, .letter = "Y", .left = "EDIT", .is_menu = 0, .right = "CMD", .sub = 0 }, {.name = "EEX", .x = 150, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = "EEX", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = "Z", .left = "PURG", .is_menu = 0, .right = "ARG", .sub = 0 }, {.name = "DEL", .x = 200, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = "DEL", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "CLEAR", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "BS", .x = 250, .y = 200, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = bs_width, .lh = bs_height, .lb = bs_bitmap, .letter = 0, .left = "DROP", .is_menu = 0, .right = 0, .sub = 0 }, {.name = "ALPHA", .x = 0, .y = 250, .w = 36, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = alpha_width, .lh = alpha_height, .lb = alpha_bitmap, .letter = 0, .left = "USER", .is_menu = 0, .right = "ENTRY", .sub = 0 }, {.name = "7", .x = 60, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "7", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "SOLVE", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "8", .x = 120, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "8", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "PLOT", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "9", .x = 180, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = "9", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "SYMBOLIC", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "DIV", .x = 240, .y = 250, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = div_width, .lh = div_height, .lb = div_bitmap, .letter = 0, .left = "\x17 ", .is_menu = 0, .right = "\x18", .sub = 0 }, {.name = "SHL", .x = 0, .y = 300, .w = 36, .h = 26, .lc = LEFT, .label = 0, .font_size = 0, .lw = shl_width, .lh = shl_height, .lb = shl_bitmap, .letter = 0, .left = 0, .is_menu = 0, .right = 0, .sub = 0 }, {.name = "4", .x = 60, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "4", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "TIME", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "5", .x = 120, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "5", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "STAT", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "6", .x = 180, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = "6", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "UNITS", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "MUL", .x = 240, .y = 300, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = mul_width, .lh = mul_height, .lb = mul_bitmap, .letter = 0, .left = "\x19 ", .is_menu = 0, .right = "\x1a", .sub = 0 }, {.name = "SHR", .x = 0, .y = 350, .w = 36, .h = 26, .lc = RIGHT, .label = 0, .font_size = 0, .lw = shr_width, .lh = shr_height, .lb = shr_bitmap, .letter = 0, .left = " ", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "1", .x = 60, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "1", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "I/O", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "2", .x = 120, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "2", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "LIBRARY", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "3", .x = 180, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = "3", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "EQ LIB", .is_menu = 1, .right = 0, .sub = 0 }, {.name = "MINUS", .x = 240, .y = 350, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = minus_width, .lh = minus_height, .lb = minus_bitmap, .letter = 0, .left = "\x1b ", .is_menu = 0, .right = "\x1c", .sub = 0 }, {.name = "ON", .x = 0, .y = 400, .w = 36, .h = 26, .lc = WHITE, .label = "ON", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "CONT", .is_menu = 0, .right = "OFF", .sub = "CANCEL"}, {.name = "0", .x = 60, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = "0", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "\x04 ", .is_menu = 0, .right = "\x03", .sub = 0 }, {.name = "PERIOD", .x = 120, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = ".", .font_size = 1, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "\x02 ", .is_menu = 0, .right = "\x01", .sub = 0 }, {.name = "SPC", .x = 180, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = "SPC", .font_size = 0, .lw = 0, .lh = 0, .lb = 0, .letter = 0, .left = "\x05 ", .is_menu = 0, .right = "\x1f", .sub = 0 }, {.name = "PLUS", .x = 240, .y = 400, .w = 46, .h = 26, .lc = WHITE, .label = 0, .font_size = 0, .lw = plus_width, .lh = plus_height, .lb = plus_bitmap, .letter = 0, .left = "\x1d ", .is_menu = 0, .right = "\x1e", .sub = 0 }, }; void ( *ui_get_event )( void ); void ( *ui_update_display )( void ); void ( *ui_start )( config_t* config ); void ( *ui_stop )( void ); void setup_ui( config_t* config ) { switch ( config->frontend ) { case FRONTEND_NCURSES: setup_frontend_ncurses(); break; case FRONTEND_SDL: default: setup_frontend_sdl(); break; } } void close_and_exit( void ) { exit_emulator(); ui_stop(); exit( 0 ); }