SMS Power!

Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats
Music - Videos - Development - Translations - Homebrew
Sega8bit & SMS Power! 2013 Event - 10th August

View topic - Meka Debugger Thread

Reply to topic
Author Message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 6320
  • Location: London, UK
Reply with quote
Meka Debugger Thread
Post Posted: Fri Jan 20, 2012 12:56 pm
Please use this thread to ask question about the debugger, provide feedback, bug reports or new features requests.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 6320
  • Location: London, UK
Reply with quote
Post Posted: Fri Jan 20, 2012 12:59 pm
( continuing from discussion on http://www.smspower.org/forums/viewtopic.php?t=13542 )

Zipper wrote
Bock wrote

You can already do that it is one of the earliest feature the debugger had.
"b label". You can use TAB to automatically completion a symbol name.
Use "sym" or "sym xxx" to find symbols.

Hmm. I see now. It works!
Seems there are problems with Sjasm MODULE's eg "MUSIC.play". But I hardly use those.
Thanks. I could not find it in the help inside MEKA.

There might be a parsing problem with the fact that the symbol include a '.' (dot) character. I will look into that.

What couldn't you find inside the help and could you describe where you have looked? There is a specific help pane for the debugger (corresponding to the DEBUGGER.TXT file) and an HELP command within the label that should give enough examples. If you can help me understand what part you may have overlooked I'm happy to take action to increase accessibility or visibility of the features.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Apr 2011
  • Posts: 119
  • Location: Netherlands
Reply with quote
Post Posted: Fri Jan 20, 2012 1:40 pm
I only looked at the debug pane using "H" and "H B".

With "H B" i'd expected it to also state labels.

E.g.
Parameter:
address : breakpoint address, can be range or symbol (label)


That would have helped.
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 6320
  • Location: London, UK
Reply with quote
Post Posted: Fri Jan 20, 2012 2:32 pm
For reference current full help for breakpoints is:

Debugger command - B
--------------------
B/BREAK: Manage breakpoints
Usage:
 B address [..address2]         ; Add CPU breakpoint
 B [access] [bus] address [=xx] ; Add breakpoint
 B LIST                         ; List breakpoints
 B REMOVE id                    ; Remove breakpoint <id>
 B ENABLE id                    ; Enable breakpoint <id>
 B DISABLE id                   ; Disable breakpoint <id>
 B CLEAR                        ; Clear breakpoints
Parameters:
 address : breakpoint address, can be a range
 access  : access to trap, any from r/w/x (rwx)
 bus     : bus/event, one from cpu/io/vram/pal/line (cpu)
 xx      ; byte to compare to, for conditionnal break
 id      : breakpoint identifier
Examples:
 B 0038          ; break when CPU access $0038
 B w io 7f       ; break on IO write to $7F
 B rx e000..ffff ; break on CPU read/exec from $E000+
 B x =0,0,C9     ; break on CPU execution of NOP NOP RET
 B w vram 3f00.. ; break on VRAM write to SAT
 B w pram 0 =03  ; break on PRAM write of color 0 as $03
 B line #13      ; break on display line 13
 
You can add a description to breakpoints, by ending the
command line with a string:
 B 0038 "interrupt"

As a shortcut:
 B nopnop
Is equivalent to:
 B x=0,0 "NOP NOP"

You are right that it doesn't explicitely mention symbols, because they are a more generic feature that apply to anywhere where an address can be passed.

I will add the modification you suggested however because it seems to be such a common case.

Also for reference:
Expression evaluator
--------------------

Mathematical expression can be evaluated by the debugger.
Supported features are:
 - Values:
   - Immediate hexadecimal integer
     (eg: 1234, or $1234 or 0x1234)
   - Immediate binary integer
     (eg: %00101010)
   - Immediate decimal integer
     (eg: #256)
   - Symbols gets replaced by their address.
     (eg: function_label)
   - Z80 registers names gets replaced by their current value.
     (eg: PC, SP, AF, A, BC, B, C, DE, D, E, HL, H, L, IX, IY)
     Pay attention that some registers names are ambiguous with hexadecimal
     constants ('A' is a 10 in hexadecimal). Z80 registers name are always
     given priority over hexadecimal constants.
     Uses the 'Ox' or '$' prefixes to resolve ambiguity.
 - Operators:
   - Integer operators: + - / *
     (eg: 1+2*3 returns 7)
   - Binary operators: & | ^
     (eg: 0xF0 | 0x0F returns 0xFF)
   - Parenthesis: (), forcing priority
     (eg: (1+2)*3 returns 9)

I'll think about how to make it clearer that those features exists, thank you.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2005
  • Posts: 310
  • Location: Auckland, New Zealand
Reply with quote
Post Posted: Sat Jan 21, 2012 11:42 am
I have a related feature request: the ability to set breakpoints on ROM addresses.

For example, there is some data in the Alex Kidd In Miracle World ROM (e.g. at $0f96a - $0fc68) whose purpose is unknown. To find out what the data is for, I'd like to set a breakpoint on the area and play the game until it is triggered. Unfortunately, the best I can do at the moment is set a Z80 breakpoint, using the fact that the game maps banks 2 to 7 of the ROM into slot 2:

b r cpu b96a..bc68

This will be triggered for accesses to $0f96a, but also for $0b96a, $1396a etc. So, each time execution stops, I have to manually check the value at $ffff. It would really help me if it was possible to do:

b r rom f96a..fc68

Thanks
  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2005
  • Posts: 310
  • Location: Auckland, New Zealand
Reply with quote
Post Posted: Sat Jan 21, 2012 11:55 am
Another way to get the same effect would be to support extended conditions on Z80 breakpoints.

For example, a version of b r cpu b96a..bc68 which only breaks when $ffff (or another chosen Z80 address) contains a certain value.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 6320
  • Location: London, UK
Reply with quote
Post Posted: Sun Jan 22, 2012 2:33 pm
Paul,
I have now added this feature.

Please download from following thread:
http://smspower.org/forums/viewtopic.php?p=69794#69794
Feedback welcome.
  View user's profile Send private message Visit poster's website
  • Joined: 10 Dec 2006
  • Posts: 35
Reply with quote
Post Posted: Mon Jan 30, 2012 5:51 am
I suggested for a Visual Sprite RAM viewer earlier in the Meka 8 Dev Timeline, so I think soon that we should add one...

It is to be used in some game development situations.
  View user's profile Send private message
  • Joined: 06 Apr 2011
  • Posts: 119
  • Location: Netherlands
Reply with quote
Post Posted: Wed Feb 22, 2012 11:27 pm
Is it possible to dump the FM registers in Meka?

I am having problems with the custom voices that do not sound as expected and I am clueless why it sounds different.

Tracing the port writes takes ages.

Example:
Good version
SMS version (initial sfx on start is from the PSG not the FM)
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 6320
  • Location: London, UK
Reply with quote
Post Posted: Thu Feb 23, 2012 12:21 am
Zipper, are you able to compile MEKA by yourself?
If so it should be trivial for you to add a few logging lines to print all FM registers, I could guide you through this.

In the meanwhile, are you aware you can use watchpoints to print out all the IO port writes without stopping emulation?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Apr 2011
  • Posts: 119
  • Location: Netherlands
Reply with quote
Post Posted: Fri Feb 24, 2012 10:33 am
Thanks.

I tried the watchpoints (I don't have time to tinker with the Meka code atm). I didn't find any errors in the register values so probably a bug in my code.
  View user's profile Send private message
  • Joined: 06 Apr 2011
  • Posts: 119
  • Location: Netherlands
Reply with quote
Post Posted: Fri Mar 30, 2012 9:03 am
Small update:

The sound issue was a nasty bug (sneaky 1 byte offset error I didn't notice) on my side.

I'll update the MBplay sources for SMS asap.
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!