Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Method to emit trace logging in MEKA/Emulicious debuggers?

Reply to topic
Author Message
  • Joined: 23 Aug 2009
  • Posts: 67
  • Location: Seattle, WA
Reply with quote
Method to emit trace logging in MEKA/Emulicious debuggers?
Post Posted: Wed Jul 31, 2019 3:56 pm
Is there a method to emit debug logging in a debugger such as MEKA/Emulicious?

Ideally, I'd like to be logging strings to trace the flow of execution. In MEKA, for example, I could emit a log message in the Messages window telling me when a VBLANK got triggered, and what the value at a memory address was.

These log traces wouldn't be executed by the Z80, they would just be instructions that the debugger used.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12913
  • Location: London
Reply with quote
Post Posted: Wed Jul 31, 2019 11:09 pm
It's the opposite of what you asked for (as it consumes Z80 cycles) but there is the SDSC console specification designed for this sort of thing; it was never very popular, and for Meka only exists in a pending PR I wrote.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Aug 2009
  • Posts: 67
  • Location: Seattle, WA
Reply with quote
Post Posted: Thu Aug 01, 2019 3:23 pm
I thought I had remembered such a thing. Even those types of events would be useful, especially for debugging to device. How does your PR emit those strings? Does it invoke an interrupt or callback?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12913
  • Location: London
Reply with quote
Post Posted: Thu Aug 01, 2019 3:55 pm
The Z80 code outputs strings as bytes to a special port, and the emulator prints them to the debug console. There's custom printf style formatting for stuff like registers, memory, etc. It also includes cursor and colour control characters but I didn't implement that as Meka's logger is text only.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 468
Reply with quote
Post Posted: Thu Aug 01, 2019 4:38 pm
In Emulicious you have 2 options. You can either use breakpoints and disable the suspend checkbox. In the breakpoint log you will get informed whenever a breakpoint is hit.

The other option is to use the Tracer. With a condition for Trace or Start and End you can limit the trace to what is of interest for you. You could for example put address = waitVBlank. And it will only trace whenever the address is waitVBlank.
You can set up what registers you want to trace and using Additional Expression you can also print additional information.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Aug 2009
  • Posts: 67
  • Location: Seattle, WA
Reply with quote
Post Posted: Thu Aug 01, 2019 7:55 pm
So could I do something like the following?

1. I want my Game Update to stop before the VBlank
2. I set a flag in memory saying "I'm in Game Update"
3. In the VBlank handler, it checks that flag and prints to the console: "Entered VBlank while still in the Game Update!"
(or, alternately, halts the game and displays that info somewhere).
  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 468
Reply with quote
Post Posted: Thu Aug 01, 2019 8:51 pm
SavagePencil wrote
So could I do something like the following?

1. I want my Game Update to stop before the VBlank
2. I set a flag in memory saying "I'm in Game Update"
3. In the VBlank handler, it checks that flag and prints to the console: "Entered VBlank while still in the Game Update!"
(or, alternately, halts the game and displays that info somewhere).

You can put a breakpoint at the end of your update routine and as condition write "scanline < 192".
If you only want the breakpoint to be logged but not suspend you can uncheck the Suspend checkbox.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!