The GameTank emulator contains a few tools to debug your program:
Setting breakpoints in Code Stepper isn't always easy when the program was written in C. Here is a tip to create breakpoints:
breakpoint() function void breakpoint() {}
int main () {
...
breakpoint();
// Doing some stuff that needs to be debugged
...
}
_breakpoint (don't forget to enable breakpoints)breakpoint() functionIn order to better understand how the assembly code shown in the Code Stepper relates to the original C code:
makefile and add –add-source to the CFLAGS valuemake build/main.sibuild/main.si. The original C lines will be inserted as comments, e.g.;
; if (tile_val & 0x20) {
;
L000D: lda _tile_val
and #$20
beq L000E
;
; tmp = 1;
;
lda #$01
sta _tmp