From 8ae1cc8ae42d5a042e88b1cda9d094dae856c987 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sun, 14 Apr 2024 23:07:21 +0200 Subject: [PATCH] explicit struct initialization --- src/bus.c | 44 ++- src/emulator.c | 7 +- src/gui.c | 715 +++++++++++++++++++++++++++++++++++++++++++++---- src/opcodes.c | 544 ++++++++++++++++++------------------- 4 files changed, 967 insertions(+), 343 deletions(-) diff --git a/src/bus.c b/src/bus.c index 1aefe44..045ca55 100644 --- a/src/bus.c +++ b/src/bus.c @@ -14,15 +14,41 @@ #define MAP_WRITE( adr ) ( write_map[ SEG_OF( adr ) ] + OFFSET_OF( adr ) ) BusInfo bus_info = { - // hdw ram sz ram ce1 sz ce1 ce2 sz ce2 nce3 sz nce3 - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // base or size - false, false, false, false, false, false, false, false, false, // configured - false, false, false, // read only - // ce1_bs da19 ben - false, false, false, - // rom ram ce1 ce2 nce3 - NULL, NULL, NULL, NULL, NULL, // data - 0x0, 0x0, 0x0, 0x0, 0x0, 0 // mask + .hdw_base = 0, + .ram_size = 0, + .ram_base = 0, + .ce1_size = 0, + .ce1_base = 0, + .ce2_size = 0, + .ce2_base = 0, + .nce3_size = 0, + .nce3_base = 0, + .hdw_cfg = false, + .ram_sz_cfg = false, + .ram_cfg = false, + .ce1_sz_cfg = false, + .ce1_cfg = false, + .ce2_sz_cfg = false, + .ce2_cfg = false, + .nce3_sz_cfg = false, + .nce3_cfg = false, + .ce1_r_o = false, + .ce2_r_o = false, + .nce3_r_o = false, + .ce1_bs = false, + .da19 = false, + .ben = false, + .rom_data = NULL, + .ram_data = NULL, + .ce1_data = NULL, + .ce2_data = NULL, + .nce3_data = NULL, + .rom_mask = 0, + .ram_mask = 0, + .ce1_mask = 0, + .ce2_mask = 0, + .nce3_mask = 0, + .map_cnt = 0, }; static byte* read_map[ 256 ]; diff --git a/src/emulator.c b/src/emulator.c index 9748595..1408eed 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -30,10 +30,9 @@ typedef struct { } TimerEvent; static CycleEvent cycle_events[] = { - {0, 16, timer1_update }, - {0, 8192, timer2_update }, - {0, 4096, display_update}, - {0, 0, NULL } + {.next = 0, .freq = 16, .proc = timer1_update }, + {.next = 0, .freq = 8192, .proc = timer2_update }, + {.next = 0, .freq = 4096, .proc = display_update}, }; volatile bool please_exit = false; diff --git a/src/gui.c b/src/gui.c index 4dfd2f5..78baa8f 100644 --- a/src/gui.c +++ b/src/gui.c @@ -116,66 +116,665 @@ SDL_Texture* textures_labels_letter[ 49 ]; static const int std_flags = BUTTON_B1RELEASE | BUTTON_B2TOGGLE; static Button gui_buttons[] = { - {0, X_COL( 0 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "A", "", press_A, release_A }, - {1, X_COL( 1 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "B", "", press_B, release_B }, - {2, X_COL( 2 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "C", "", press_C, release_C }, - {3, X_COL( 3 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "D", "", press_D, release_D }, - {4, X_COL( 4 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "E", "", press_E, release_E }, - {5, X_COL( 5 ), Y_LINE( 0 ), UI_K_WIDTH_1, UI_K_HEIGHT_1, std_flags, "", "", "", "F", "", press_F, release_F }, + {.index = 0, + .x = X_COL( 0 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "A", + .label_below = "", + .down = press_A, + .up = release_A }, + {.index = 1, + .x = X_COL( 1 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "B", + .label_below = "", + .down = press_B, + .up = release_B }, + {.index = 2, + .x = X_COL( 2 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "C", + .label_below = "", + .down = press_C, + .up = release_C }, + {.index = 3, + .x = X_COL( 3 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "D", + .label_below = "", + .down = press_D, + .up = release_D }, + {.index = 4, + .x = X_COL( 4 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "E", + .label_below = "", + .down = press_E, + .up = release_E }, + {.index = 5, + .x = X_COL( 5 ), + .y = Y_LINE( 0 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_1, + .flags = std_flags, + .label = "", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "F", + .label_below = "", + .down = press_F, + .up = release_F }, - {6, X_COL( 0 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "MTH", "RAD", "POLAR", "G", "", press_MTH, release_MTH }, - {7, X_COL( 1 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "PRG", "", "CHARS", "H", "", press_PRG, release_PRG }, - {8, X_COL( 2 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "CST", "", "MODES", "I", "", press_CST, release_CST }, - {9, X_COL( 3 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "VAR", "", "MEMORY", "J", "", press_VAR, release_VAR }, - {10, X_COL( 4 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "▲", "", "STACK", "K", "", press_UP, release_UP }, - {11, X_COL( 5 ), Y_LINE( 1 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "NXT", "PREV", "MENU", "L", "", press_NXT, release_NXT }, + {.index = 6, + .x = X_COL( 0 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "MTH", + .label_Lshift = "RAD", + .label_Rshift = "POLAR", + .label_letter = "G", + .label_below = "", + .down = press_MTH, + .up = release_MTH }, + {.index = 7, + .x = X_COL( 1 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "PRG", + .label_Lshift = "", + .label_Rshift = "CHARS", + .label_letter = "H", + .label_below = "", + .down = press_PRG, + .up = release_PRG }, + {.index = 8, + .x = X_COL( 2 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "CST", + .label_Lshift = "", + .label_Rshift = "MODES", + .label_letter = "I", + .label_below = "", + .down = press_CST, + .up = release_CST }, + {.index = 9, + .x = X_COL( 3 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "VAR", + .label_Lshift = "", + .label_Rshift = "MEMORY", + .label_letter = "J", + .label_below = "", + .down = press_VAR, + .up = release_VAR }, + {.index = 10, + .x = X_COL( 4 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "▲", + .label_Lshift = "", + .label_Rshift = "STACK", + .label_letter = "K", + .label_below = "", + .down = press_UP, + .up = release_UP }, + {.index = 11, + .x = X_COL( 5 ), + .y = Y_LINE( 1 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "NXT", + .label_Lshift = "PREV", + .label_Rshift = "MENU", + .label_letter = "L", + .label_below = "", + .down = press_NXT, + .up = release_NXT }, - {12, X_COL( 0 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "'", "UP", "HOME", "M", "", press_QUOTE, release_QUOTE }, - {13, X_COL( 1 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "STO", "REF", "RCL", "N", "", press_STO, release_STO }, - {14, X_COL( 2 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "EVAL", "→NUM", "UNDO", "O", "", press_EVAL, release_EVAL }, - {15, X_COL( 3 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "◀", "", "PICTURE", "P", "", press_LEFT, release_LEFT }, - {16, X_COL( 4 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "▼", "", "VIEW", "Q", "", press_DOWN, release_DOWN }, - {17, X_COL( 5 ), Y_LINE( 2 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "▶", "", "SWAP", "R", "", press_RIGHT, release_RIGHT }, + {.index = 12, + .x = X_COL( 0 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "'", + .label_Lshift = "UP", + .label_Rshift = "HOME", + .label_letter = "M", + .label_below = "", + .down = press_QUOTE, + .up = release_QUOTE }, + {.index = 13, + .x = X_COL( 1 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "STO", + .label_Lshift = "REF", + .label_Rshift = "RCL", + .label_letter = "N", + .label_below = "", + .down = press_STO, + .up = release_STO }, + {.index = 14, + .x = X_COL( 2 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "EVAL", + .label_Lshift = "→NUM", + .label_Rshift = "UNDO", + .label_letter = "O", + .label_below = "", + .down = press_EVAL, + .up = release_EVAL }, + {.index = 15, + .x = X_COL( 3 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "◀", + .label_Lshift = "", + .label_Rshift = "PICTURE", + .label_letter = "P", + .label_below = "", + .down = press_LEFT, + .up = release_LEFT }, + {.index = 16, + .x = X_COL( 4 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "▼", + .label_Lshift = "", + .label_Rshift = "VIEW", + .label_letter = "Q", + .label_below = "", + .down = press_DOWN, + .up = release_DOWN }, + {.index = 17, + .x = X_COL( 5 ), + .y = Y_LINE( 2 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "▶", + .label_Lshift = "", + .label_Rshift = "SWAP", + .label_letter = "R", + .label_below = "", + .down = press_RIGHT, + .up = release_RIGHT }, - {18, X_COL( 0 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "SIN", "ASIN", "𝛛", "S", "", press_SIN, release_SIN }, - {19, X_COL( 1 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "COS", "ACOS", "∫", "T", "", press_COS, release_COS }, - {20, X_COL( 2 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "TAN", "ATAN", "𝚺", "U", "", press_TAN, release_TAN }, - {21, X_COL( 3 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "√x", "x²", "x√y", "V", "", press_SQRT, release_SQRT }, - {22, X_COL( 4 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "y^x", "⏨^x", "LOG", "W", "", press_POW, release_POW }, - {23, X_COL( 5 ), Y_LINE( 3 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "1/x", "e^x", "LN", "X", "", press_INV, release_INV }, + {.index = 18, + .x = X_COL( 0 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "SIN", + .label_Lshift = "ASIN", + .label_Rshift = "𝛛", + .label_letter = "S", + .label_below = "", + .down = press_SIN, + .up = release_SIN }, + {.index = 19, + .x = X_COL( 1 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "COS", + .label_Lshift = "ACOS", + .label_Rshift = "∫", + .label_letter = "T", + .label_below = "", + .down = press_COS, + .up = release_COS }, + {.index = 20, + .x = X_COL( 2 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "TAN", + .label_Lshift = "ATAN", + .label_Rshift = "𝚺", + .label_letter = "U", + .label_below = "", + .down = press_TAN, + .up = release_TAN }, + {.index = 21, + .x = X_COL( 3 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "√x", + .label_Lshift = "x²", + .label_Rshift = "x√y", + .label_letter = "V", + .label_below = "", + .down = press_SQRT, + .up = release_SQRT }, + {.index = 22, + .x = X_COL( 4 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "y^x", + .label_Lshift = "⏨^x", + .label_Rshift = "LOG", + .label_letter = "W", + .label_below = "", + .down = press_POW, + .up = release_POW }, + {.index = 23, + .x = X_COL( 5 ), + .y = Y_LINE( 3 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "1/x", + .label_Lshift = "e^x", + .label_Rshift = "LN", + .label_letter = "X", + .label_below = "", + .down = press_INV, + .up = release_INV }, - {24, X_COL( 0 ), Y_LINE( 4 ), UI_K_WIDTH_enter, UI_K_HEIGHT_2, std_flags, "ENTER", "EQUATION", "MATRIX", "", "", press_ENTER, - release_ENTER }, - {25, X_COL( 2 ), Y_LINE( 4 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "±", "EDIT", "CMD", "Y", "", press_NEG, release_NEG }, - {26, X_COL( 3 ), Y_LINE( 4 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "EEX", "PURG", "ARG", "Z", "", press_EEX, release_EEX }, - {27, X_COL( 4 ), Y_LINE( 4 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "DEL", "", "CLEAR", "", "", press_DEL, release_DEL }, - {28, X_COL( 5 ), Y_LINE( 4 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "←", "", "DROP", "", "", press_BKSP, release_BKSP }, + {.index = 24, + .x = X_COL( 0 ), + .y = Y_LINE( 4 ), + .w = UI_K_WIDTH_enter, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "ENTER", + .label_Lshift = "EQUATION", + .label_Rshift = "MATRIX", + .label_letter = "", + .label_below = "", + .down = press_ENTER, + .up = release_ENTER }, + {.index = 25, + .x = X_COL( 2 ), + .y = Y_LINE( 4 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "±", + .label_Lshift = "EDIT", + .label_Rshift = "CMD", + .label_letter = "Y", + .label_below = "", + .down = press_NEG, + .up = release_NEG }, + {.index = 26, + .x = X_COL( 3 ), + .y = Y_LINE( 4 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "EEX", + .label_Lshift = "PURG", + .label_Rshift = "ARG", + .label_letter = "Z", + .label_below = "", + .down = press_EEX, + .up = release_EEX }, + {.index = 27, + .x = X_COL( 4 ), + .y = Y_LINE( 4 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "DEL", + .label_Lshift = "", + .label_Rshift = "CLEAR", + .label_letter = "", + .label_below = "", + .down = press_DEL, + .up = release_DEL }, + {.index = 28, + .x = X_COL( 5 ), + .y = Y_LINE( 4 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "←", + .label_Lshift = "", + .label_Rshift = "DROP", + .label_letter = "", + .label_below = "", + .down = press_BKSP, + .up = release_BKSP }, - {29, X_COL( 0 ), Y_LINE( 5 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "α", "USER", "ENTRY", "", "", press_ALPHA, release_ALPHA }, - {30, X2_COL( 1 ), Y_LINE( 5 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "7", "", "SOLVE", "", "", press_7, release_7 }, - {31, X2_COL( 2 ), Y_LINE( 5 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "8", "", "PLOT", "", "", press_8, release_8 }, - {32, X2_COL( 3 ), Y_LINE( 5 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "9", "", "SYMBOLIC", "", "", press_9, release_9 }, - {33, X2_COL( 4 ) + 2, Y_LINE( 5 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "÷", "( )", "#", "", "", press_DIV, release_DIV }, + {.index = 29, + .x = X_COL( 0 ), + .y = Y_LINE( 5 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "α", + .label_Lshift = "USER", + .label_Rshift = "ENTRY", + .label_letter = "", + .label_below = "", + .down = press_ALPHA, + .up = release_ALPHA }, + {.index = 30, + .x = X2_COL( 1 ), + .y = Y_LINE( 5 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "7", + .label_Lshift = "", + .label_Rshift = "SOLVE", + .label_letter = "", + .label_below = "", + .down = press_7, + .up = release_7 }, + {.index = 31, + .x = X2_COL( 2 ), + .y = Y_LINE( 5 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "8", + .label_Lshift = "", + .label_Rshift = "PLOT", + .label_letter = "", + .label_below = "", + .down = press_8, + .up = release_8 }, + {.index = 32, + .x = X2_COL( 3 ), + .y = Y_LINE( 5 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "9", + .label_Lshift = "", + .label_Rshift = "SYMBOLIC", + .label_letter = "", + .label_below = "", + .down = press_9, + .up = release_9 }, + {.index = 33, + .x = X2_COL( 4 ) + 2, + .y = Y_LINE( 5 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "÷", + .label_Lshift = "( )", + .label_Rshift = "#", + .label_letter = "", + .label_below = "", + .down = press_DIV, + .up = release_DIV }, - {34, X_COL( 0 ), Y_LINE( 6 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "⮢", "", "", "", "", press_LSHIFT, release_LSHIFT }, - {35, X2_COL( 1 ), Y_LINE( 6 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "4", "", "TIME", "", "", press_4, release_4 }, - {36, X2_COL( 2 ), Y_LINE( 6 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "5", "", "STAT", "", "", press_5, release_5 }, - {37, X2_COL( 3 ), Y_LINE( 6 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "6", "", "UNITS", "", "", press_6, release_6 }, - {38, X2_COL( 4 ) + 2, Y_LINE( 6 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "×", "[ ]", "_", "", "", press_MULT, release_MULT }, + {.index = 34, + .x = X_COL( 0 ), + .y = Y_LINE( 6 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "⮢", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "", + .label_below = "", + .down = press_LSHIFT, + .up = release_LSHIFT }, + {.index = 35, + .x = X2_COL( 1 ), + .y = Y_LINE( 6 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "4", + .label_Lshift = "", + .label_Rshift = "TIME", + .label_letter = "", + .label_below = "", + .down = press_4, + .up = release_4 }, + {.index = 36, + .x = X2_COL( 2 ), + .y = Y_LINE( 6 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "5", + .label_Lshift = "", + .label_Rshift = "STAT", + .label_letter = "", + .label_below = "", + .down = press_5, + .up = release_5 }, + {.index = 37, + .x = X2_COL( 3 ), + .y = Y_LINE( 6 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "6", + .label_Lshift = "", + .label_Rshift = "UNITS", + .label_letter = "", + .label_below = "", + .down = press_6, + .up = release_6 }, + {.index = 38, + .x = X2_COL( 4 ) + 2, + .y = Y_LINE( 6 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "×", + .label_Lshift = "[ ]", + .label_Rshift = "_", + .label_letter = "", + .label_below = "", + .down = press_MULT, + .up = release_MULT }, - {39, X_COL( 0 ), Y_LINE( 7 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "⮣", "", "", "", "", press_RSHIFT, release_RSHIFT }, - {40, X2_COL( 1 ), Y_LINE( 7 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "1", "", "I/O", "", "", press_1, release_1 }, - {41, X2_COL( 2 ), Y_LINE( 7 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "2", "", "LIBRARY", "", "", press_2, release_2 }, - {42, X2_COL( 3 ), Y_LINE( 7 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "3", "", "EQ LIB", "", "", press_3, release_3 }, - {43, X2_COL( 4 ) + 2, Y_LINE( 7 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "-", "« »", "\" \"", "", "", press_MINUS, release_MINUS }, + {.index = 39, + .x = X_COL( 0 ), + .y = Y_LINE( 7 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "⮣", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "", + .label_below = "", + .down = press_RSHIFT, + .up = release_RSHIFT }, + {.index = 40, + .x = X2_COL( 1 ), + .y = Y_LINE( 7 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "1", + .label_Lshift = "", + .label_Rshift = "I/O", + .label_letter = "", + .label_below = "", + .down = press_1, + .up = release_1 }, + {.index = 41, + .x = X2_COL( 2 ), + .y = Y_LINE( 7 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "2", + .label_Lshift = "", + .label_Rshift = "LIBRARY", + .label_letter = "", + .label_below = "", + .down = press_2, + .up = release_2 }, + {.index = 42, + .x = X2_COL( 3 ), + .y = Y_LINE( 7 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "3", + .label_Lshift = "", + .label_Rshift = "EQ LIB", + .label_letter = "", + .label_below = "", + .down = press_3, + .up = release_3 }, + {.index = 43, + .x = X2_COL( 4 ) + 2, + .y = Y_LINE( 7 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "-", + .label_Lshift = "« »", + .label_Rshift = "\" \"", + .label_letter = "", + .label_below = "", + .down = press_MINUS, + .up = release_MINUS }, - {44, X_COL( 0 ), Y_LINE( 8 ), UI_K_WIDTH_1, UI_K_HEIGHT_2, std_flags, "ON", "CONT", "OFF", "", "CANCEL", press_ON, release_ON }, - {45, X2_COL( 1 ), Y_LINE( 8 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "0", "=", "→", "", "", press_0, release_0 }, - {46, X2_COL( 2 ), Y_LINE( 8 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, ".", ",", "⮐", "", "", press_PERIOD, release_PERIOD }, - {47, X2_COL( 3 ), Y_LINE( 8 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "SPC", "𝛑", "⦨", "", "", press_SPC, release_SPC }, - {48, X2_COL( 4 ) + 2, Y_LINE( 8 ), UI_K_WIDTH_2, UI_K_HEIGHT_2, std_flags, "+", "{ }", ": :", "", "", press_PLUS, release_PLUS }, + {.index = 44, + .x = X_COL( 0 ), + .y = Y_LINE( 8 ), + .w = UI_K_WIDTH_1, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "ON", + .label_Lshift = "CONT", + .label_Rshift = "OFF", + .label_letter = "", + .label_below = "CANCEL", + .down = press_ON, + .up = release_ON }, + {.index = 45, + .x = X2_COL( 1 ), + .y = Y_LINE( 8 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "0", + .label_Lshift = "=", + .label_Rshift = "→", + .label_letter = "", + .label_below = "", + .down = press_0, + .up = release_0 }, + {.index = 46, + .x = X2_COL( 2 ), + .y = Y_LINE( 8 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = ".", + .label_Lshift = ",", + .label_Rshift = "⮐", + .label_letter = "", + .label_below = "", + .down = press_PERIOD, + .up = release_PERIOD }, + {.index = 47, + .x = X2_COL( 3 ), + .y = Y_LINE( 8 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "SPC", + .label_Lshift = "𝛑", + .label_Rshift = "⦨", + .label_letter = "", + .label_below = "", + .down = press_SPC, + .up = release_SPC }, + {.index = 48, + .x = X2_COL( 4 ) + 2, + .y = Y_LINE( 8 ), + .w = UI_K_WIDTH_2, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "+", + .label_Lshift = "{ }", + .label_Rshift = ": :", + .label_letter = "", + .label_below = "", + .down = press_PLUS, + .up = release_PLUS }, - {49, X_COL( 0 ), Y_LINE( 9 ), 40, UI_K_HEIGHT_2, std_flags, "load file", "", "", "", "", press_LoadFile, release_LoadFile}, + {.index = 49, + .x = X_COL( 0 ), + .y = Y_LINE( 9 ), + .w = 40, + .h = UI_K_HEIGHT_2, + .flags = std_flags, + .label = "load file", + .label_Lshift = "", + .label_Rshift = "", + .label_letter = "", + .label_below = "", + .down = press_LoadFile, + .up = release_LoadFile}, }; static colors_t colors = { @@ -187,13 +786,13 @@ static colors_t colors = { .lcd_pixon = {.r = 37, .g = 61, .b = 84, .a = 255}, .button_bg = {.r = 16, .g = 26, .b = 39, .a = 33 }, - .button_active = {255, 255, 39, 33 }, - .button_inactive = {0, 0, 0, 255 }, - .label = {255, 255, 255, 255 }, - .Lshift = {191, 192, 236, 255 }, - .Rshift = {125, 215, 235, 255 }, - .letter = {255, 255, 255, 255 }, - .below = {128, 108, 29, 255 }, + .button_active = {.r = 255, .g = 255, .b = 39, .a = 33 }, + .button_inactive = {.r = 0, .g = 0, .b = 0, .a = 255}, + .label = {.r = 255, .g = 255, .b = 255, .a = 255}, + .Lshift = {.r = 191, .g = 192, .b = 236, .a = 255}, + .Rshift = {.r = 125, .g = 215, .b = 235, .a = 255}, + .letter = {.r = 255, .g = 255, .b = 255, .a = 255}, + .below = {.r = 128, .g = 108, .b = 29, .a = 255}, }; static inline void _init_keyboard_textures( Button* calcbuttons ) diff --git a/src/opcodes.c b/src/opcodes.c index e854c99..fa6054c 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -822,324 +822,324 @@ static void opFC_F( byte* opc ) // r=-r-1 A } static Opcode opcodes0[ 16 ] = { - {op00, NULL, "RTNSXM" }, - {op01, NULL, "RTN" }, - {op02_3, NULL, "RTNSC" }, - {op02_3, NULL, "RTNCC" }, - {op04_5, NULL, "SETHEX" }, - {op04_5, NULL, "SETDEC" }, - {op06, NULL, "RSTK=C" }, - {op07, NULL, "C=RSTK" }, - {op08, NULL, "CLRST" }, - {op09, NULL, "C=ST" }, - {op0A, NULL, "ST=C" }, - {op0B, NULL, "CSTEX" }, - {op0C, NULL, "P=P+1" }, - {op0D, NULL, "P=P-1" }, - {op0E, NULL, "%r3=%r3%&3%s3 %F2A"}, - {op0F, NULL, "RTI" } + {.exec = op00, .next = NULL, .dissasm = "RTNSXM" }, + {.exec = op01, .next = NULL, .dissasm = "RTN" }, + {.exec = op02_3, .next = NULL, .dissasm = "RTNSC" }, + {.exec = op02_3, .next = NULL, .dissasm = "RTNCC" }, + {.exec = op04_5, .next = NULL, .dissasm = "SETHEX" }, + {.exec = op04_5, .next = NULL, .dissasm = "SETDEC" }, + {.exec = op06, .next = NULL, .dissasm = "RSTK=C" }, + {.exec = op07, .next = NULL, .dissasm = "C=RSTK" }, + {.exec = op08, .next = NULL, .dissasm = "CLRST" }, + {.exec = op09, .next = NULL, .dissasm = "C=ST" }, + {.exec = op0A, .next = NULL, .dissasm = "ST=C" }, + {.exec = op0B, .next = NULL, .dissasm = "CSTEX" }, + {.exec = op0C, .next = NULL, .dissasm = "P=P+1" }, + {.exec = op0D, .next = NULL, .dissasm = "P=P-1" }, + {.exec = op0E, .next = NULL, .dissasm = "%r3=%r3%&3%s3 %F2A"}, + {.exec = op0F, .next = NULL, .dissasm = "RTI" } }; static Opcode opcodes13[ 16 ] = { - {op13a, NULL, "D0=A" }, - {op13a, NULL, "D1=A" }, - {op13a, NULL, "AD0EX" }, - {op13a, NULL, "AD1EX" }, - {op13a, NULL, "D0=C" }, - {op13a, NULL, "D1=C" }, - {op13a, NULL, "CD0EX" }, - {op13a, NULL, "CD1EX" }, - {op13b, NULL, "D0=AS" }, - {op13b, NULL, "D1=AS" }, - {op13b, NULL, "AD0EXS"}, - {op13b, NULL, "AD1EXS"}, - {op13b, NULL, "D0=CS" }, - {op13b, NULL, "D1=CS" }, - {op13b, NULL, "CD0EXS"}, - {op13b, NULL, "CD1EXS"} + {.exec = op13a, .next = NULL, .dissasm = "D0=A" }, + {.exec = op13a, .next = NULL, .dissasm = "D1=A" }, + {.exec = op13a, .next = NULL, .dissasm = "AD0EX" }, + {.exec = op13a, .next = NULL, .dissasm = "AD1EX" }, + {.exec = op13a, .next = NULL, .dissasm = "D0=C" }, + {.exec = op13a, .next = NULL, .dissasm = "D1=C" }, + {.exec = op13a, .next = NULL, .dissasm = "CD0EX" }, + {.exec = op13a, .next = NULL, .dissasm = "CD1EX" }, + {.exec = op13b, .next = NULL, .dissasm = "D0=AS" }, + {.exec = op13b, .next = NULL, .dissasm = "D1=AS" }, + {.exec = op13b, .next = NULL, .dissasm = "AD0EXS"}, + {.exec = op13b, .next = NULL, .dissasm = "AD1EXS"}, + {.exec = op13b, .next = NULL, .dissasm = "D0=CS" }, + {.exec = op13b, .next = NULL, .dissasm = "D1=CS" }, + {.exec = op13b, .next = NULL, .dissasm = "CD0EXS"}, + {.exec = op13b, .next = NULL, .dissasm = "CD1EXS"} }; static Opcode opcodes15[ 16 ] = { - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15a, NULL, "%D2 %F3" }, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"}, - {op15b, NULL, "%D2 %I3+1"} + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15a, .next = NULL, .dissasm = "%D2 %F3" }, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"}, + {.exec = op15b, .next = NULL, .dissasm = "%D2 %I3+1"} }; static Opcode opcodes1[ 16 ] = { - {op10, NULL, "R%i2=%a2" }, - {op11, NULL, "%a2=R%i2" }, - {op12, NULL, "%a2R%i2EX" }, - {NULL, opcodes13, NULL }, - {op14, NULL, "%D2 %B2" }, - {NULL, opcodes15, NULL }, - {op16_7, NULL, "D0=D0+ %I2+1"}, - {op16_7, NULL, "D1=D1+ %I2+1"}, - {op18_C, NULL, "D0=D0- %I2+1"}, - {op19_D, NULL, "D0=(2) %X22" }, - {op1A_E, NULL, "D0=(4) %X24" }, - {op1B_F, NULL, "D0=(5) %X25" }, - {op18_C, NULL, "D1=D1- %I2+1"}, - {op19_D, NULL, "D1=(2) %X22" }, - {op1A_E, NULL, "D1=(4) %X24" }, - {op1B_F, NULL, "D1=(5) %X25" }, + {.exec = op10, .next = NULL, .dissasm = "R%i2=%a2" }, + {.exec = op11, .next = NULL, .dissasm = "%a2=R%i2" }, + {.exec = op12, .next = NULL, .dissasm = "%a2R%i2EX" }, + {.exec = NULL, .next = opcodes13, .dissasm = NULL }, + {.exec = op14, .next = NULL, .dissasm = "%D2 %B2" }, + {.exec = NULL, .next = opcodes15, .dissasm = NULL }, + {.exec = op16_7, .next = NULL, .dissasm = "D0=D0+ %I2+1"}, + {.exec = op16_7, .next = NULL, .dissasm = "D1=D1+ %I2+1"}, + {.exec = op18_C, .next = NULL, .dissasm = "D0=D0- %I2+1"}, + {.exec = op19_D, .next = NULL, .dissasm = "D0=(2) %X22" }, + {.exec = op1A_E, .next = NULL, .dissasm = "D0=(4) %X24" }, + {.exec = op1B_F, .next = NULL, .dissasm = "D0=(5) %X25" }, + {.exec = op18_C, .next = NULL, .dissasm = "D1=D1- %I2+1"}, + {.exec = op19_D, .next = NULL, .dissasm = "D1=(2) %X22" }, + {.exec = op1A_E, .next = NULL, .dissasm = "D1=(4) %X24" }, + {.exec = op1B_F, .next = NULL, .dissasm = "D1=(5) %X25" }, }; static Opcode opcodes808[ 16 ] = { - {op8080, NULL, "INTON" }, - {op8081, NULL, "RSI" }, - {op8082, NULL, "LA #%N4" }, - {NULL, NULL, NULL }, - {op8084_5_8_9, NULL, "ABIT=0 %I4" }, - {op8084_5_8_9, NULL, "ABIT=1 %I4" }, - {op8086_7_A_B, NULL, "?ABIT=0 %I4, %G52YES %T52+5"}, - {op8086_7_A_B, NULL, "?ABIT=1 %I4, %G52YES %T52+5"}, - {op8084_5_8_9, NULL, "CBIT=0 %I4" }, - {op8084_5_8_9, NULL, "CBIT=1 %I4" }, - {op8086_7_A_B, NULL, "?CBIT=0 %I4, %G52YES %T52+5"}, - {op8086_7_A_B, NULL, "?CBIT=1 %I4, %G52YES %T52+5"}, - {op808C_E, NULL, "PC=(A)" }, - {NULL, NULL, NULL }, - {op808C_E, NULL, "PC=(C)" }, - {op808F, NULL, "INTOFF" } + {.exec = op8080, .next = NULL, .dissasm = "INTON" }, + {.exec = op8081, .next = NULL, .dissasm = "RSI" }, + {.exec = op8082, .next = NULL, .dissasm = "LA #%N4" }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = op8084_5_8_9, .next = NULL, .dissasm = "ABIT=0 %I4" }, + {.exec = op8084_5_8_9, .next = NULL, .dissasm = "ABIT=1 %I4" }, + {.exec = op8086_7_A_B, .next = NULL, .dissasm = "?ABIT=0 %I4, %G52YES %T52+5"}, + {.exec = op8086_7_A_B, .next = NULL, .dissasm = "?ABIT=1 %I4, %G52YES %T52+5"}, + {.exec = op8084_5_8_9, .next = NULL, .dissasm = "CBIT=0 %I4" }, + {.exec = op8084_5_8_9, .next = NULL, .dissasm = "CBIT=1 %I4" }, + {.exec = op8086_7_A_B, .next = NULL, .dissasm = "?CBIT=0 %I4, %G52YES %T52+5"}, + {.exec = op8086_7_A_B, .next = NULL, .dissasm = "?CBIT=1 %I4, %G52YES %T52+5"}, + {.exec = op808C_E, .next = NULL, .dissasm = "PC=(A)" }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = op808C_E, .next = NULL, .dissasm = "PC=(C)" }, + {.exec = op808F, .next = NULL, .dissasm = "INTOFF" } }; static Opcode opcodes80[ 16 ] = { - {op800_1, NULL, "OUT=CS" }, - {op800_1, NULL, "OUT=C" }, - {op802_3, NULL, "A=IN" }, - {op802_3, NULL, "C=IN" }, - {op804, NULL, "UNCONFIG"}, - {op805, NULL, "CONFIG" }, - {op806, NULL, "C=ID" }, - {op807, NULL, "SHUTDN" }, - {NULL, opcodes808, NULL }, - {op809, NULL, "C+P+1" }, - {op80A, NULL, "RESET" }, - {NULL, NULL, NULL }, - {op80C, NULL, "C=P %I3" }, - {op80D, NULL, "P=C %I3" }, - {NULL, NULL, NULL }, - {op80F, NULL, "CPEX %I3"} + {.exec = op800_1, .next = NULL, .dissasm = "OUT=CS" }, + {.exec = op800_1, .next = NULL, .dissasm = "OUT=C" }, + {.exec = op802_3, .next = NULL, .dissasm = "A=IN" }, + {.exec = op802_3, .next = NULL, .dissasm = "C=IN" }, + {.exec = op804, .next = NULL, .dissasm = "UNCONFIG"}, + {.exec = op805, .next = NULL, .dissasm = "CONFIG" }, + {.exec = op806, .next = NULL, .dissasm = "C=ID" }, + {.exec = op807, .next = NULL, .dissasm = "SHUTDN" }, + {.exec = NULL, .next = opcodes808, .dissasm = NULL }, + {.exec = op809, .next = NULL, .dissasm = "C+P+1" }, + {.exec = op80A, .next = NULL, .dissasm = "RESET" }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = op80C, .next = NULL, .dissasm = "C=P %I3" }, + {.exec = op80D, .next = NULL, .dissasm = "P=C %I3" }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = op80F, .next = NULL, .dissasm = "CPEX %I3"} }; static Opcode opcodes81Af[ 16 ] = { - {op81Af0, NULL, "R%i5=%a5 %F3A" }, - {op81Af1, NULL, "%a5=R%i5 %F3A" }, - {op81Af2, NULL, "%a5R%i5EX %F3A"}, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL } + {.exec = op81Af0, .next = NULL, .dissasm = "R%i5=%a5 %F3A" }, + {.exec = op81Af1, .next = NULL, .dissasm = "%a5=R%i5 %F3A" }, + {.exec = op81Af2, .next = NULL, .dissasm = "%a5R%i5EX %F3A"}, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL } }; static Opcode opcodes81A[ 16 ] = { - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL}, - {NULL, opcodes81Af, NULL} + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL}, + {.exec = NULL, .next = opcodes81Af, .dissasm = NULL} }; static Opcode opcodes81B[ 16 ] = { - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {op81B2_3, NULL, "PC=A"}, - {op81B2_3, NULL, "PC=C"}, - {op81B4_5, NULL, "A=PC"}, - {op81B4_5, NULL, "C=PC"}, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL }, - {NULL, NULL, NULL } + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = op81B2_3, .next = NULL, .dissasm = "PC=A"}, + {.exec = op81B2_3, .next = NULL, .dissasm = "PC=C"}, + {.exec = op81B4_5, .next = NULL, .dissasm = "A=PC"}, + {.exec = op81B4_5, .next = NULL, .dissasm = "C=PC"}, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL }, + {.exec = NULL, .next = NULL, .dissasm = NULL } }; static Opcode opcodes81[ 16 ] = { - {op810_3, NULL, "ASLC" }, - {op810_3, NULL, "BSLC" }, - {op810_3, NULL, "CSLC" }, - {op810_3, NULL, "DSLC" }, - {op814_7, NULL, "ASRC" }, - {op814_7, NULL, "BSRC" }, - {op814_7, NULL, "CSRC" }, - {op814_7, NULL, "DSRC" }, - {op818, NULL, "%u4=%u4%~4CON %F3A, %I6+1"}, - {op819, NULL, "%u4SRB %F3A" }, - {NULL, opcodes81A, NULL }, - {NULL, opcodes81B, NULL }, - {op81C_F, NULL, "ASRB" }, - {op81C_F, NULL, "BSRB" }, - {op81C_F, NULL, "CSRB" }, - {op81C_F, NULL, "DSRB" } + {.exec = op810_3, .next = NULL, .dissasm = "ASLC" }, + {.exec = op810_3, .next = NULL, .dissasm = "BSLC" }, + {.exec = op810_3, .next = NULL, .dissasm = "CSLC" }, + {.exec = op810_3, .next = NULL, .dissasm = "DSLC" }, + {.exec = op814_7, .next = NULL, .dissasm = "ASRC" }, + {.exec = op814_7, .next = NULL, .dissasm = "BSRC" }, + {.exec = op814_7, .next = NULL, .dissasm = "CSRC" }, + {.exec = op814_7, .next = NULL, .dissasm = "DSRC" }, + {.exec = op818, .next = NULL, .dissasm = "%u4=%u4%~4CON %F3A, %I6+1"}, + {.exec = op819, .next = NULL, .dissasm = "%u4SRB %F3A" }, + {.exec = NULL, .next = opcodes81A, .dissasm = NULL }, + {.exec = NULL, .next = opcodes81B, .dissasm = NULL }, + {.exec = op81C_F, .next = NULL, .dissasm = "ASRB" }, + {.exec = op81C_F, .next = NULL, .dissasm = "BSRB" }, + {.exec = op81C_F, .next = NULL, .dissasm = "CSRB" }, + {.exec = op81C_F, .next = NULL, .dissasm = "DSRB" } }; static Opcode opcodes8[ 16 ] = { - {NULL, opcodes80, NULL }, - {NULL, opcodes81, NULL }, - {op82, NULL, "HST=0 #%X21" }, - {op83, NULL, "?HST=0 #%X21, %G32YES %T32+3"}, - {op84_5, NULL, "ST=0 %I2" }, - {op84_5, NULL, "ST=1 %I2" }, - {op86_7, NULL, "?ST=0 %I2, %G32YES %T32+3" }, - {op86_7, NULL, "?ST=1 %I2, %G32YES %T32+3" }, - {op88_9, NULL, "?P# %I2, %G32YES %T32+3" }, - {op88_9, NULL, "?P= %I2, %G32YES %T32+3" }, - {op8A, NULL, "?%u2%#2%z2 A, %G32YES %T32+3"}, - {op8B, NULL, "?%u2%>2%v2 A, %G32YES %T32+3"}, - {op8C, NULL, "GOLONG %R24+2" }, - {op8D, NULL, "GOVLNG %X25" }, - {op8E, NULL, "GOSUBL %R24+6" }, - {op8F, NULL, "GOSBVL %X25" }, + {.exec = NULL, .next = opcodes80, .dissasm = NULL }, + {.exec = NULL, .next = opcodes81, .dissasm = NULL }, + {.exec = op82, .next = NULL, .dissasm = "HST=0 #%X21" }, + {.exec = op83, .next = NULL, .dissasm = "?HST=0 #%X21, %G32YES %T32+3"}, + {.exec = op84_5, .next = NULL, .dissasm = "ST=0 %I2" }, + {.exec = op84_5, .next = NULL, .dissasm = "ST=1 %I2" }, + {.exec = op86_7, .next = NULL, .dissasm = "?ST=0 %I2, %G32YES %T32+3" }, + {.exec = op86_7, .next = NULL, .dissasm = "?ST=1 %I2, %G32YES %T32+3" }, + {.exec = op88_9, .next = NULL, .dissasm = "?P# %I2, %G32YES %T32+3" }, + {.exec = op88_9, .next = NULL, .dissasm = "?P= %I2, %G32YES %T32+3" }, + {.exec = op8A, .next = NULL, .dissasm = "?%u2%#2%z2 A, %G32YES %T32+3"}, + {.exec = op8B, .next = NULL, .dissasm = "?%u2%>2%v2 A, %G32YES %T32+3"}, + {.exec = op8C, .next = NULL, .dissasm = "GOLONG %R24+2" }, + {.exec = op8D, .next = NULL, .dissasm = "GOVLNG %X25" }, + {.exec = op8E, .next = NULL, .dissasm = "GOSUBL %R24+6" }, + {.exec = op8F, .next = NULL, .dissasm = "GOSBVL %X25" }, }; static Opcode opcodes9[ 16 ] = { - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9a, NULL, "?%u2%#2%z2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"}, - {op9b, NULL, "?%u2%>2%v2 %F1, %G32YES %T32+3"} + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9a, .next = NULL, .dissasm = "?%u2%#2%z2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"}, + {.exec = op9b, .next = NULL, .dissasm = "?%u2%>2%v2 %F1, %G32YES %T32+3"} }; static Opcode opcodesA[ 16 ] = { - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAa, NULL, "%t2=%t2%+2%w2 %F1"}, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" }, - {opAb, NULL, "%x2%=2%y2%E2 %F1" } + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAa, .next = NULL, .dissasm = "%t2=%t2%+2%w2 %F1"}, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" }, + {.exec = opAb, .next = NULL, .dissasm = "%x2%=2%y2%E2 %F1" } }; static Opcode opcodesBb[ 16 ] = { - {opBb0_3, NULL, "ASL %F1" }, - {opBb0_3, NULL, "BSL %F1" }, - {opBb0_3, NULL, "CSL %F1" }, - {opBb0_3, NULL, "DSL %F1" }, - {opBb4_7, NULL, "ASR %F1" }, - {opBb4_7, NULL, "BSR %F1" }, - {opBb4_7, NULL, "CSR %F1" }, - {opBb4_7, NULL, "DSR %F1" }, - {opBb8_B, NULL, "A=-A %F1" }, - {opBb8_B, NULL, "B=-B %F1" }, - {opBb8_B, NULL, "C=-C %F1" }, - {opBb8_B, NULL, "D=-D %F1" }, - {opBbC_F, NULL, "A=-A-1 %F1"}, - {opBbC_F, NULL, "B=-B-1 %F1"}, - {opBbC_F, NULL, "C=-C-1 %F1"}, - {opBbC_F, NULL, "D=-D-1 %F1"} + {.exec = opBb0_3, .next = NULL, .dissasm = "ASL %F1" }, + {.exec = opBb0_3, .next = NULL, .dissasm = "BSL %F1" }, + {.exec = opBb0_3, .next = NULL, .dissasm = "CSL %F1" }, + {.exec = opBb0_3, .next = NULL, .dissasm = "DSL %F1" }, + {.exec = opBb4_7, .next = NULL, .dissasm = "ASR %F1" }, + {.exec = opBb4_7, .next = NULL, .dissasm = "BSR %F1" }, + {.exec = opBb4_7, .next = NULL, .dissasm = "CSR %F1" }, + {.exec = opBb4_7, .next = NULL, .dissasm = "DSR %F1" }, + {.exec = opBb8_B, .next = NULL, .dissasm = "A=-A %F1" }, + {.exec = opBb8_B, .next = NULL, .dissasm = "B=-B %F1" }, + {.exec = opBb8_B, .next = NULL, .dissasm = "C=-C %F1" }, + {.exec = opBb8_B, .next = NULL, .dissasm = "D=-D %F1" }, + {.exec = opBbC_F, .next = NULL, .dissasm = "A=-A-1 %F1"}, + {.exec = opBbC_F, .next = NULL, .dissasm = "B=-B-1 %F1"}, + {.exec = opBbC_F, .next = NULL, .dissasm = "C=-C-1 %F1"}, + {.exec = opBbC_F, .next = NULL, .dissasm = "D=-D-1 %F1"} }; static Opcode opcodesB[ 16 ] = { - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {opBa, NULL, "%t2=%p2%-2%q2 %F1"}, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL }, - {NULL, opcodesBb, NULL } + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = opBa, .next = NULL, .dissasm = "%t2=%p2%-2%q2 %F1"}, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL }, + {.exec = NULL, .next = opcodesBb, .dissasm = NULL } }; static Opcode opcodesF[ 16 ] = { - {opF0_3, NULL, "ASL A" }, - {opF0_3, NULL, "BSL A" }, - {opF0_3, NULL, "CSL A" }, - {opF0_3, NULL, "DSL A" }, - {opF4_7, NULL, "ASR A" }, - {opF4_7, NULL, "BSR A" }, - {opF4_7, NULL, "CSR A" }, - {opF4_7, NULL, "DSR A" }, - {opF8_B, NULL, "A=-A A" }, - {opF8_B, NULL, "B=-B A" }, - {opF8_B, NULL, "C=-C A" }, - {opF8_B, NULL, "D=-D A" }, - {opFC_F, NULL, "A=-A-1 A"}, - {opFC_F, NULL, "B=-B-1 A"}, - {opFC_F, NULL, "C=-C-1 A"}, - {opFC_F, NULL, "D=-D-1 A"}, + {.exec = opF0_3, .next = NULL, .dissasm = "ASL A" }, + {.exec = opF0_3, .next = NULL, .dissasm = "BSL A" }, + {.exec = opF0_3, .next = NULL, .dissasm = "CSL A" }, + {.exec = opF0_3, .next = NULL, .dissasm = "DSL A" }, + {.exec = opF4_7, .next = NULL, .dissasm = "ASR A" }, + {.exec = opF4_7, .next = NULL, .dissasm = "BSR A" }, + {.exec = opF4_7, .next = NULL, .dissasm = "CSR A" }, + {.exec = opF4_7, .next = NULL, .dissasm = "DSR A" }, + {.exec = opF8_B, .next = NULL, .dissasm = "A=-A A" }, + {.exec = opF8_B, .next = NULL, .dissasm = "B=-B A" }, + {.exec = opF8_B, .next = NULL, .dissasm = "C=-C A" }, + {.exec = opF8_B, .next = NULL, .dissasm = "D=-D A" }, + {.exec = opFC_F, .next = NULL, .dissasm = "A=-A-1 A"}, + {.exec = opFC_F, .next = NULL, .dissasm = "B=-B-1 A"}, + {.exec = opFC_F, .next = NULL, .dissasm = "C=-C-1 A"}, + {.exec = opFC_F, .next = NULL, .dissasm = "D=-D-1 A"}, }; Opcode opcodes[ 16 ] = { - {NULL, opcodes0, NULL }, - {NULL, opcodes1, NULL }, - {op2, NULL, "P= %I1" }, - {op3, NULL, "LC #%N1" }, - {op4, NULL, "%G12C %T12+1" }, - {op5, NULL, "%G12NC %T12+1" }, - {op6, NULL, "GOTO %R13+1" }, - {op7, NULL, "GOSUB %R13+4" }, - {NULL, opcodes8, NULL }, - {NULL, opcodes9, NULL }, - {NULL, opcodesA, NULL }, - {NULL, opcodesB, NULL }, - {opC, NULL, "%t1=%t1%+1%w1 A"}, - {opD, NULL, "%x1%=1%y1%E1 A" }, - {opE, NULL, "%t1=%p1%-1%q1 A"}, - {NULL, opcodesF, NULL } + {.exec = NULL, .next = opcodes0, .dissasm = NULL }, + {.exec = NULL, .next = opcodes1, .dissasm = NULL }, + {.exec = op2, .next = NULL, .dissasm = "P= %I1" }, + {.exec = op3, .next = NULL, .dissasm = "LC #%N1" }, + {.exec = op4, .next = NULL, .dissasm = "%G12C %T12+1" }, + {.exec = op5, .next = NULL, .dissasm = "%G12NC %T12+1" }, + {.exec = op6, .next = NULL, .dissasm = "GOTO %R13+1" }, + {.exec = op7, .next = NULL, .dissasm = "GOSUB %R13+4" }, + {.exec = NULL, .next = opcodes8, .dissasm = NULL }, + {.exec = NULL, .next = opcodes9, .dissasm = NULL }, + {.exec = NULL, .next = opcodesA, .dissasm = NULL }, + {.exec = NULL, .next = opcodesB, .dissasm = NULL }, + {.exec = opC, .next = NULL, .dissasm = "%t1=%t1%+1%w1 A"}, + {.exec = opD, .next = NULL, .dissasm = "%x1%=1%y1%E1 A" }, + {.exec = opE, .next = NULL, .dissasm = "%t1=%p1%-1%q1 A"}, + {.exec = NULL, .next = opcodesF, .dissasm = NULL } };