How to debug my code?

SGDK only sub forum

Moderator: Stef

Post Reply
segaMars
Newbie
Posts: 7
Joined: Mon Nov 14, 2016 3:18 pm
Location: Sweden

How to debug my code?

Post by segaMars » Fri Nov 09, 2018 1:22 pm

How do you debug your code?

Is is possible to use breakpoints somehow?

I sit possible to log stuff in the console? like in javascript console.log("hello there!");

I see the gendev emulator has a features called 'messages' and 'watches', perhaps that has something to do with this? :?

Im using viusual studio code btw.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: How to debug my code?

Post by Stef » Fri Nov 09, 2018 2:23 pm

You can use the KLog_xxx method to generate output message in the message Dialog of Gens KMod, really useful for debugging :)

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: How to debug my code?

Post by Miquel » Fri Nov 09, 2018 2:46 pm

Regen has a debugger, and is useful for following current execution.

What I use as a break point is:

Code: Select all

0:	jra 0b
It’s ASM code, but you can build a macro around it. Basically it blocks the cpu at this point, but you can bypass it with Regen. If this code isn’t on an exception exceptions can be executed do.
HELP. Spanish TVs are brain washing people to be hostile to me.

segaMars
Newbie
Posts: 7
Joined: Mon Nov 14, 2016 3:18 pm
Location: Sweden

Re: How to debug my code?

Post by segaMars » Fri Nov 09, 2018 3:52 pm

Thank you! I will try this out when I get home tonight :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: How to debug my code?

Post by Stef » Mon Nov 12, 2018 4:07 pm

I do the same technique using Gens (as i'm familiar with its debugger) using 'N' key to pass to next instruction word.

Post Reply