From 0a2f19ea6664f661aba72803a214687e92e181d4 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 17 Mar 2020 16:37:26 -0400 Subject: Cleaned up the debug prints in the C port of SuBEditor. --- programs/c-ports/subeditor.c | 103 +++++++++++++++---------------------------- programs/c-ports/subeditor.h | 39 ++++++++-------- 2 files changed, 55 insertions(+), 87 deletions(-) (limited to 'programs') diff --git a/programs/c-ports/subeditor.c b/programs/c-ports/subeditor.c index 2d748b9..313c49a 100644 --- a/programs/c-ports/subeditor.c +++ b/programs/c-ports/subeditor.c @@ -513,76 +513,43 @@ int main() { next = 0; } #if debug - uint8_t ln = 0; - mvwprintw(scr, ln++, 0, "scr_row: $%02X, scr_col: $%02X\r", scr_row, scr_col); - mvwprintw(scr, ln++, 0, "scr_str: $%02X, scr_end: $%02X, scr_ptr: $%04X\r", scr_str, scr_end, scr_ptr); - ln+=2; - mvwprintw(scr, ln++, 0, "buffer:\r"); - for (uint16_t i = 0; i < 120; i+=5) { - mvwprintw(scr, ln++, 0, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x, i: $%02X\r" - , buffer[(0x00)+(i*0x10)], buffer[(0x01)+(i*0x10)], buffer[(0x02)+(i*0x10)], buffer[(0x03)+(i*0x10)] - , buffer[(0x04)+(i*0x10)], buffer[(0x05)+(i*0x10)], buffer[(0x06)+(i*0x10)], buffer[(0x07)+(i*0x10)] - , buffer[(0x08)+(i*0x10)], buffer[(0x09)+(i*0x10)], buffer[(0x0A)+(i*0x10)], buffer[(0x0B)+(i*0x10)] - , buffer[(0x0C)+(i*0x10)], buffer[(0x0D)+(i*0x10)], buffer[(0x0E)+(i*0x10)], buffer[(0x0F)+(i*0x10)] - , buffer[(0x10)+(i*0x10)], buffer[(0x11)+(i*0x10)], buffer[(0x12)+(i*0x10)], buffer[(0x13)+(i*0x10)] - , buffer[(0x14)+(i*0x10)], buffer[(0x15)+(i*0x10)], buffer[(0x16)+(i*0x10)], buffer[(0x17)+(i*0x10)] - , buffer[(0x18)+(i*0x10)], buffer[(0x19)+(i*0x10)], buffer[(0x1A)+(i*0x10)], buffer[(0x1B)+(i*0x10)] - , buffer[(0x1C)+(i*0x10)], buffer[(0x1D)+(i*0x10)], buffer[(0x1E)+(i*0x10)], buffer[(0x1F)+(i*0x10)] - , buffer[(0x20)+(i*0x10)], buffer[(0x21)+(i*0x10)], buffer[(0x22)+(i*0x10)], buffer[(0x23)+(i*0x10)] - , buffer[(0x24)+(i*0x10)], buffer[(0x25)+(i*0x10)], buffer[(0x26)+(i*0x10)], buffer[(0x27)+(i*0x10)] - , buffer[(0x28)+(i*0x10)], buffer[(0x29)+(i*0x10)], buffer[(0x2A)+(i*0x10)], buffer[(0x2B)+(i*0x10)] - , buffer[(0x2C)+(i*0x10)], buffer[(0x2D)+(i*0x10)], buffer[(0x2E)+(i*0x10)], buffer[(0x2F)+(i*0x10)] - , buffer[(0x30)+(i*0x10)], buffer[(0x31)+(i*0x10)], buffer[(0x32)+(i*0x10)], buffer[(0x33)+(i*0x10)] - , buffer[(0x34)+(i*0x10)], buffer[(0x35)+(i*0x10)], buffer[(0x36)+(i*0x10)], buffer[(0x37)+(i*0x10)] - , buffer[(0x38)+(i*0x10)], buffer[(0x39)+(i*0x10)], buffer[(0x3A)+(i*0x10)], buffer[(0x3B)+(i*0x10)] - , buffer[(0x3C)+(i*0x10)], buffer[(0x3D)+(i*0x10)], buffer[(0x3E)+(i*0x10)], buffer[(0x3F)+(i*0x10)] - , buffer[(0x40)+(i*0x10)], buffer[(0x41)+(i*0x10)], buffer[(0x42)+(i*0x10)], buffer[(0x43)+(i*0x10)] - , buffer[(0x44)+(i*0x10)], buffer[(0x45)+(i*0x10)], buffer[(0x46)+(i*0x10)], buffer[(0x47)+(i*0x10)] - , buffer[(0x48)+(i*0x10)], buffer[(0x49)+(i*0x10)], buffer[(0x4A)+(i*0x10)], buffer[(0x4B)+(i*0x10)] - , buffer[(0x4C)+(i*0x10)], buffer[(0x4D)+(i*0x10)], buffer[(0x4E)+(i*0x10)], buffer[(0x4F)+(i*0x10)] - , i); + #if !debug_cmd_buf + #define maxline 48 + #else + #define maxline 24 + #endif + uint8_t ln = 0; + mvwprintw(scr, ln++, 0, "scr_row: $%02X, scr_col: $%02X\r", scr_row, scr_col); + mvwprintw(scr, ln++, 0, "scr_str: $%02X, scr_end: $%02X, scr_ptr: $%04X\r", scr_str, scr_end, scr_ptr); + wmove(scr, ++ln, 0); + wprintw(scr, "buffer:\r"); + wmove(scr, ++ln, 0); + ln++; + for (uint16_t i = 0; i < maxline; i++) { + for (uint16_t j = 0; j < 80; j++) { + wprintw(scr, "%02x", buffer[(j+(i*80))]); } - mvwprintw(scr, ln++, 0, "cmd_buf:\r"); - for (uint16_t i = 0; i < 12; i+=5) { - mvwprintw(scr, ln++, 0, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x, i: $%02X\r" - , cmd_buf[(0x00)+(i*0x10)], cmd_buf[(0x01)+(i*0x10)], cmd_buf[(0x02)+(i*0x10)], cmd_buf[(0x03)+(i*0x10)] - , cmd_buf[(0x04)+(i*0x10)], cmd_buf[(0x05)+(i*0x10)], cmd_buf[(0x06)+(i*0x10)], cmd_buf[(0x07)+(i*0x10)] - , cmd_buf[(0x08)+(i*0x10)], cmd_buf[(0x09)+(i*0x10)], cmd_buf[(0x0A)+(i*0x10)], cmd_buf[(0x0B)+(i*0x10)] - , cmd_buf[(0x0C)+(i*0x10)], cmd_buf[(0x0D)+(i*0x10)], cmd_buf[(0x0E)+(i*0x10)], cmd_buf[(0x0F)+(i*0x10)] - , cmd_buf[(0x10)+(i*0x10)], cmd_buf[(0x11)+(i*0x10)], cmd_buf[(0x12)+(i*0x10)], cmd_buf[(0x13)+(i*0x10)] - , cmd_buf[(0x14)+(i*0x10)], cmd_buf[(0x15)+(i*0x10)], cmd_buf[(0x16)+(i*0x10)], cmd_buf[(0x17)+(i*0x10)] - , cmd_buf[(0x18)+(i*0x10)], cmd_buf[(0x19)+(i*0x10)], cmd_buf[(0x1A)+(i*0x10)], cmd_buf[(0x1B)+(i*0x10)] - , cmd_buf[(0x1C)+(i*0x10)], cmd_buf[(0x1D)+(i*0x10)], cmd_buf[(0x1E)+(i*0x10)], cmd_buf[(0x1F)+(i*0x10)] - , cmd_buf[(0x20)+(i*0x10)], cmd_buf[(0x21)+(i*0x10)], cmd_buf[(0x22)+(i*0x10)], cmd_buf[(0x23)+(i*0x10)] - , cmd_buf[(0x24)+(i*0x10)], cmd_buf[(0x25)+(i*0x10)], cmd_buf[(0x26)+(i*0x10)], cmd_buf[(0x27)+(i*0x10)] - , cmd_buf[(0x28)+(i*0x10)], cmd_buf[(0x29)+(i*0x10)], cmd_buf[(0x2A)+(i*0x10)], cmd_buf[(0x2B)+(i*0x10)] - , cmd_buf[(0x2C)+(i*0x10)], cmd_buf[(0x2D)+(i*0x10)], cmd_buf[(0x2E)+(i*0x10)], cmd_buf[(0x2F)+(i*0x10)] - , cmd_buf[(0x30)+(i*0x10)], cmd_buf[(0x31)+(i*0x10)], cmd_buf[(0x32)+(i*0x10)], cmd_buf[(0x33)+(i*0x10)] - , cmd_buf[(0x34)+(i*0x10)], cmd_buf[(0x35)+(i*0x10)], cmd_buf[(0x36)+(i*0x10)], cmd_buf[(0x37)+(i*0x10)] - , cmd_buf[(0x38)+(i*0x10)], cmd_buf[(0x39)+(i*0x10)], cmd_buf[(0x3A)+(i*0x10)], cmd_buf[(0x3B)+(i*0x10)] - , cmd_buf[(0x3C)+(i*0x10)], cmd_buf[(0x3D)+(i*0x10)], cmd_buf[(0x3E)+(i*0x10)], cmd_buf[(0x3F)+(i*0x10)] - , cmd_buf[(0x40)+(i*0x10)], cmd_buf[(0x41)+(i*0x10)], cmd_buf[(0x42)+(i*0x10)], cmd_buf[(0x43)+(i*0x10)] - , cmd_buf[(0x44)+(i*0x10)], cmd_buf[(0x45)+(i*0x10)], cmd_buf[(0x46)+(i*0x10)], cmd_buf[(0x47)+(i*0x10)] - , cmd_buf[(0x48)+(i*0x10)], cmd_buf[(0x49)+(i*0x10)], cmd_buf[(0x4A)+(i*0x10)], cmd_buf[(0x4B)+(i*0x10)] - , cmd_buf[(0x4C)+(i*0x10)], cmd_buf[(0x4D)+(i*0x10)], cmd_buf[(0x4E)+(i*0x10)], cmd_buf[(0x4F)+(i*0x10)] - , i); + wprintw(scr, ", i: $%02X\r", i); + wmove(scr, ln++, 0); + } + #if debug_cmd_buf + wprintw(scr, "cmd_buf:\r"); + wmove(scr, ln++, 0); + for (uint16_t i = 0; i < 12; i++) { + for (uint16_t j = 0; j < 80; j++) { + wprintw(scr, "%02x", cmd_buf[(j+(i*80))]); } - mvwprintw(scr, ln++, 0, "bitabl:\r"); - mvwprintw(scr, ln++, 0, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\r" - , bitabl[0x00], bitabl[0x01], bitabl[0x02], bitabl[0x03] - , bitabl[0x04], bitabl[0x05], bitabl[0x06], bitabl[0x07] - , bitabl[0x08], bitabl[0x09], bitabl[0x0A], bitabl[0x0B] - , bitabl[0x0C], bitabl[0x0D], bitabl[0x0E], bitabl[0x0F]); - - wrefresh(scr); + wprintw(scr, ", i: $%02X\r", i); + wmove(scr, ln++, 0); + } + #endif + wprintw(scr, "bitabl:\r"); + wmove(scr, ln++, 0); + for (uint16_t i = 0; i < 0x10; i++) { + wprintw(scr, "%02x", bitabl[i]); + } + waddch(scr, '\r'); + wrefresh(scr); #endif ch = wgetch(scr); if (ch == 0x11) { diff --git a/programs/c-ports/subeditor.h b/programs/c-ports/subeditor.h index f20088d..ee5536e 100644 --- a/programs/c-ports/subeditor.h +++ b/programs/c-ports/subeditor.h @@ -4,33 +4,34 @@ #include #define debug 0 +#define debug_cmd_buf 0 extern char *buffer; extern char *cmd_buf; -extern uint8_t scr_row = 0; -extern uint8_t scr_col = 0; -extern uint8_t scr_trow = 0; -extern uint8_t scr_tcol = 0; -extern uint16_t scr_ptr = 0; +extern uint8_t scr_row; +extern uint8_t scr_col; +extern uint8_t scr_trow; +extern uint8_t scr_tcol; +extern uint16_t scr_ptr; -extern uint8_t byte = 0; -extern uint8_t mask = 0; +extern uint8_t byte; +extern uint8_t mask; -extern uint8_t a = 0; -extern uint8_t b = 0; -extern uint8_t c = 0; -extern uint8_t d = 0; -extern uint8_t e = 0; -extern uint8_t f = 0; +extern uint8_t a; +extern uint8_t b; +extern uint8_t c; +extern uint8_t d; +extern uint8_t e; +extern uint8_t f; -extern uint8_t bitmask = 0; -extern uint8_t bitabl[16]; +extern uint8_t bitmask; +extern uint8_t bitabl[]; -extern uint8_t scr_str = 0; -extern uint8_t scr_end = 23; -extern uint8_t wrapped = 0; +extern uint8_t scr_str; +extern uint8_t scr_end; +extern uint8_t wrapped; extern void print_str(const char *str); -int16_t str_cmp(const char *s0, uint16_t i, const char *s1, uint16_t j) +int16_t str_cmp(const char *s0, uint16_t i, const char *s1, uint16_t j); extern void subasm(); -- cgit v1.2.3-13-gbd6f