How to debug my code?

SGDK only sub forum

Moderator: Stef

Post Reply
segaMars
Newbie
Posts: 6
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.

User avatar
Stef
Very interested
Posts: 2781
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 :)

User avatar
Miquel
Very interested
Posts: 341
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.
Yeah, I see you have to hive hope for the “believers” and the “non- believers”. Don’t worry I know.
“How much you have yet to learn”, is usually what them tell me when I fail to comprehend.

segaMars
Newbie
Posts: 6
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 :)

User avatar
Stef
Very interested
Posts: 2781
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

Who is online

Users browsing this forum: No registered users and 2 guests