Thread: [Tool] Visual Boy Advance SDL H2
View Single Post
  #1    
Old October 8th, 2011 (07:24 PM). Edited October 29th, 2011 by JPAN.
JPAN JPAN is offline
pokemon rom researcher
 
Join Date: Dec 2008
Posts: 102
After getting tired of working on my latest project, I decided it was time for something more relaxed and less time consuming. So, I decided to implement some new functionalities (and fix some old ones) on VBA-SDL-H.

Let me start by saying, I didn't make VBA. So, all credit to the original work goes to Forgotten and the rest of his team, and to all other contributers which can be found on the readme file (which I didn't alter), or in the VBA-SDL-H page.

So, what did I do to this new version? The changes aren't that big. Basically, changed the old breakpoint system to a new version that is capable of conditional breaking, and added support for string-viewing using a character table (with some modifications). But, to enumerating them:

Changed the way old Break worked
All breaks are now stored independantly in a new structure, and on memory, four flags are mantained that indicate the type of break that is present. They can be of ARM, Thumb, Read or Write.
The old method replaced the code at the location with the breakpoint symbol, and when it stopped there, it was replaced it with the actual code. That caused a somewhat annoying bug where the original code would be lost, leaving you with BE00 as the only knonw instruction code.
The old breakpoint symbol is still available for work, though, so normal, homebrew code should work as intended.

Created Conditional breaks
With the new system in place, you can now break anywhere equaly. But sometimes, you may wish to break only if a certain value was reached.(For example, when working on the item codes, sometimes I had to wait until the value written on memory was the item one. It took several passes.)
This new code allow for such situations. You can now only break when a certain value is reached, or when a set of conditions are met.

Created Register breaks
You can set a break on register change, that will break if a certain condition dependant on the register happened. This type of break is very heavy on the emulator, and can reduce maximum speed. My tests showed a difference from ~500% speed with it off to ~200% with it on. That is a big difference. When not in use, you can disable this behaviour by typing disable breg on the console.
Break on register may be useful for looping situations where you want to check certain values but not stop on that code every single time, or for loop-breaking interruptions that change a knonw register, but won't happen while only using next.

Table support
You can load a character table. It would work with the same one used with translhextion, and with some changes, would even print newlines and terminate strings correctly. With the tbl command, you can load such a table onto the emulator, and then with the ms command you can see the results. You can disable and re-enable the table behaviour using disable tbl, if you want to switch between ASCII and your string type. The other 'm' commands (such as mb), will always display ASCII, regardless of the table. That is because the Table entries can sometimes be quite big (5 characters long), and would create a new line, messing up the byte table.

Fill memory
Using the fillb, fillh and fillw commands, you can fill portions of memory with the byte to word of your choice.

Edit memory now accepts multiple entries
eb, eh and ew now allow for multiple consecutive entries. That means you can now enter any sequence of bytes you want, without repeating eb a number of times.

New quit commands
I got tired of trying to exit the debugger with quit when q was the right command. So, now adding to those two we also have exit and bye to get out. More can be added easily.

Command Alias
Same reason as above, but for some others. h, help and ? are interchangeable, continue for c, next for n. More can be added if needed.

Added to the Symbol evaluator
eval has been here for a while, and is used naturally on pretty much all commands that require number parsing. It did not support, however negate and negative operators. Negative is placing a - before the expression (-0x50), negate is placing a ~ before the number (~0x1). Could probably add more if needed, but the native VBA parser separates by using space, so expressions cannot contain spaces.

The contents of the ZIP file include the executable (windows only), Source code (so unix users aren't left out, the code is GCC compatible) if you want to check out how it was implemented (some stuff are wierd looking, but I guarantee, it's for performance reasons).
For instructions on how to use the controls, use help [commandName] for most instructions, or help breg for break register use, help break for generic break help, and help bm, bl, bd, bc for specific help with break make (bt, bw, br, and the like), break list (bl, btl, bxl, bil, and the like), break delete (btd, bwd, bad, and the like), and break clear (bc, bic, bac, and the like) respectively.

PS: A modified, emulator-ready table is also given.

EDIT:
Bug fixed. It now always show the correct break on ARM and THUMB breaks
Also, added new features:

Copy memory
Using the copyb, copyh and copyw, you can copy blocks of data from one location of memory to another, like from the ROM to RAM, or RAM to RAM.

Reload
Using the reload command, you can reload the currently open ROM, or open a new one by specifying the path afterwards.

Run commands from a text file
Creating a txt file with the commands you want to run (any of the defined debugger commands), then calling execute with the file. You can use it to run long breakpoint commands, or resume debugging a code location through several sessions.
__________________
Here are the links for my work


Currently working on:
Battle Script Documentation
Another large project