const char *errmsg(const uint8_t code) { // lookup error text uint8_t i; for (i=0; i < sizeof(err_tab) / sizeof(struct err_struct); i++) { if (code == rom_read_byte( (uint8_t *) &err_tab[i].code)) return (const char *) rom_read_pointer (&err_tab[i].str); } return STR_EMPTY; // default if code not in table }
static WORD rom_read_word(LONG addr) { return (rom_read_byte(addr)<<8)|rom_read_byte(addr+1); }