// SREG bit names
const char * _sreg_bit_name = "cznvshti";
-#ifdef NO_COLOR
- #define FONT_RED
- #define FONT_DEFAULT
-#else
- #define FONT_RED "\e[31m"
- #define FONT_DEFAULT "\e[0m"
-#endif
-
/*
* Handle "touching" registers, marking them changed.
* This is used only for debugging purposes to be able to
extern "C" {
#endif
+#ifdef NO_COLOR
+ #define FONT_GREEN
+ #define FONT_RED
+ #define FONT_DEFAULT
+#else
+ #define FONT_GREEN "\e[32m"
+ #define FONT_RED "\e[31m"
+ #define FONT_DEFAULT "\e[0m"
+#endif
+
/*
* Instruction decoder, run ONE instruction
*/
#define DUMP_STACK() \
for (int i = avr->trace_data->stack_frame_index; i; i--) {\
int pci = i-1;\
- printf("\e[31m*** %04x: %-25s sp %04x\e[0m\n",\
+ printf(FONT_RED "*** %04x: %-25s sp %04x\n" FONT_DEFAULT,\
avr->trace_data->stack_frame[pci].pc, \
avr->trace_data->codeline ? avr->trace_data->codeline[avr->trace_data->stack_frame[pci].pc>>1]->symbol : "unknown", \
avr->trace_data->stack_frame[pci].sp);\
printf("*** CYCLE %" PRI_avr_cycle_count "PC %04x\n", avr->cycle, avr->pc);\
for (int i = OLD_PC_SIZE-1; i > 0; i--) {\
int pci = (avr->trace_data->old_pci + i) & 0xf;\
- printf("\e[31m*** %04x: %-25s RESET -%d; sp %04x\e[0m\n",\
+ printf(FONT_RED "*** %04x: %-25s RESET -%d; sp %04x\n" FONT_DEFAULT,\
avr->trace_data->old[pci].pc, avr->trace_data->codeline ? avr->trace_data->codeline[avr->trace_data->old[pci].pc>>1]->symbol : "unknown", OLD_PC_SIZE-i, avr->trace_data->old[pci].sp);\
}\
printf("Stack Ptr %04x/%04x = %d \n", _avr_sp_get(avr), avr->ramend, avr->ramend - _avr_sp_get(avr));\