News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[M2] [ASM] Good GB ASM tutorials?

Started by RT-55J, February 02, 2014, 04:00:08 AM

Previous topic - Next topic

RT-55J

Alternate title: I got a breakpoint to work like I wanted. Now what?

Long story short: I decided to do some hardcore debugging to find out how some data I found in Metroid 2 should be interpreted. After a bit of searching, I found that BGB did a pretty bang-up job (no$gb couldn't do on-access breakpoints, from my cursory examination). Anyhow, after a bit of messing around, I was able to set a breakpoint in the level data that would trigger upon hitting the first screen transition and nowhere else (pic), and from there I figured that I could step through the instructions and figure out what's going on. But's it's all Greek to me.

As far as I can tell, the code at that point loads the value from 0x4300 + an arbitrary offset, does a couple bitwise things, and then loads some stuff from an array (?) in WRAM. The problem here is that I don't actually understand what's going on down at the logic-level, so I feel like I'm just guessing what each opcode does. So, in addition to a no-nonsense tutorial on the subject, I feel like a "plain English" description of what each line is doing would help me understand what's going on better ("...and then it loads the value from 0x1234 into the A register" counts as plain English to me). What I'd like to eventually be able to figure out is (a) where the array in WRAM is pulled from/generated and (b) how is this all interpreted.

(Here's the documentation I'm currently using: GB memory map (helpful), opcode list (obtuse (duh)).)

Quote58

Looks quite similar to SNES asm, so I may take a look at some point (m2 is a favourite of mine, so I'd love to see some progress made with hacking it)

Antidote

Find some Z80 tutorials, since the GB is largely based on the Z80 processor, bare in mind that the CPU is NOT a Z80 but a highly customized CPU that is Z80-like.

P.JBoy

If you ever come onto the metconst IRC, I'd be happy to give you a hand with this sorta thing
...