Post subject: GBC memory regions
Skilled player (1707)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
http://www.chibiakumas.com/z80/Gameboy.php Compared to the above, how does one interpret the regions in the hex editor/RAM watch? For instance, if one wants to check the C000-CFFF "4KB Work RAM Bank 0 (WRAM)" region, how does one do that on BizHawk? WRAM doesn't even go up to C000. The top of the hex editor says: "GB WRAM 0x8000 addresses" The left side has some numbers that range from 0x0000-0x7FF0. Do I add the top number (0x8000) with the one in the side to get the address? How about the "SP" register in the "Trace logger"? For instance:
366C:  F5        PUSH AF             A:bc B:00 C:6e D:c0 E:63 F:50 H:c0 L:af LY:90 SP:cfe3  Cy:1041059548
Which region is 0xCFE3 in BizHawk hex editor?
Editor, Skilled player (1941)
Joined: 6/15/2005
Posts: 3247
0xCFE3 would be in System Bus. You can also access it from WRAM using 0x0FE3. System Bus 0xC000-0xDFFF corresponds to WRAM 0x0000-0x1FFF. Edit: The top number is the size of the region. E.g. WRAM size is 0x2000; System Bus size is 0x10000. Edit 2: Oh, I forgot you were talking about GBC, not GB. In that case WRAM has size 0x8000; there are 4 different 0x2000 banks in WRAM. At any given time, one of them is loaded in System Bus 0xC000-0xDFFF.
Skilled player (1707)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Alright, thanks. Is it normal that the tracelog outputs the same thing, when a WRAM value is frozen during a point where it's supposed to change? In this case, 0x5020 (WRAM) in Harry Potter: Chamber of Secrets (GBC) is responsible for MP. Freezing it vs not freezing it when it's supposed to decrement seems to give the same trace log when done on the frame it decrements. Is this normal?
Alyosha
He/Him
Editor, Expert player (3535)
Joined: 11/30/2014
Posts: 2732
Location: US
'Freezing' a value in Bizhawk doesn't actually freeze it. What it does is write the desired value at the start of a frame, then run the emulator core for that frame, then write it again at the end of the frame. So in your example, the trace log will still have the proper decrement since the core isn't blocking the write for the decrement. Then it will rewrite the non-decremented value again so you won't see it as decremented in the memory tools. Since you are trying to use a trace log, obviously this is very unhelpful to you. I could make it work correctly for GBHawk at the cost of some % performance, but it's not going to happen for gambatte. Fixing this would be a long term goal.
Skilled player (1707)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Alright, thanks. Any suggestions on how to debug gameboy color games, outside simulating the z80 entirely?
Alyosha
He/Him
Editor, Expert player (3535)
Joined: 11/30/2014
Posts: 2732
Location: US
jlun2 wrote:
Alright, thanks. Any suggestions on how to debug gameboy color games, outside simulating the z80 entirely?
Not sure exactly what you are looking for. If you want actual debugging utilities I think only BGB really has anything substantial. Maybe sameboy has some debugging utilities as well but not sure how detailed they are.