Hey everyone. I decided I'd release this here because some people might find it useful. It's an assembler I just finished for the GameBoy and is pretty powerful. Here's a screenshot.
Here's a full unique feature list from the read-me:
-Dynamic addressing (AKA label support, and the ability to call and jump to them)
-White space can be ignored, so instructions like " ld a , 5F" will assemble successfully. It should be noted that spaces and other characters act the same as commas, so don't feel like you need a comma just because it's proper
-Error checking on-the-spot and highlighting
-Support for just assembling code right away without opening a ROM
-Read-only zones that prevent code from being written in certain areas
-Rewrite zones, which fill a specified area with 00s so you can safely rewrite a chunk of code
-Code previewing, which shows where your code will be written line-by-line
-Safe file IO (warnings when you would lose your code if it was unsaved)
-Code insertion - "This generates code compatible with any language that uses curcly-bracket array assigning in the case you might want to make software automatically insert your assembly into a ROM. This only generates the code containing the values, so you still have to write them to the proper addresses yourself."
-Trace disassembling - the disassembler will start at a certain point and follow jumps, calls, and returns until the call stack is empty
-Bank-changing emulation - this is very weak and only emulates LD A,# and LD (####),A instructions, but when the accumulator is written to 2000-2FFF, the program will attempt to change the current bank if possible. Perhaps full emulation will come in the future
1.0 - Initial Release
1.1 - Fixed a bug that made instruction E9 appear as jp (hl) when it should just be jp hl. Also added instruction DE (sbc a,n)
I noticed that one of the features is "disassembling". Does this mean we can create a disassembly of any Game Boy game?
Because of the possibility to jump to and call the HL register, no. You could come somewhat close if a full emulator was implemented, but even then, there are procedures that depend on memory address values, which determine the value of HL. For example, the scripting system in the Oracles series. The RST 00 procedure uses a pointer table that's specified right after the command is set to be executed. There is no way to emulate every value without some sort of user input. However, this doesn't mean you can't disassemble certain procedures. For example, the procedure shown in the screenshot was the start of the graphics decompression procedure in Oracle of Ages and all I did was have it trace starting at 69C.
Originally Posted by Darthatron
Long time no speak, Lin! Glad to see you're still working on tools. ^_^ This looks good, I hope you won't mind showing me the source. Haha.
Indeed it has. I don't mind, but I'll have you know the GUI stuff isn't pretty. Here are the assembler and disassembler classes and the ugly code used to assemble (includes the dynamic labeling).