Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Hello everybody,
I've started to write my own ROMs disassembler, how does it work now:
I start at offset 0x0100 of ROM image and try to interpret content according to [2]. I don't emulate processor (except bank switching), only follow control instructions (CALL, JP, JR, RST) when needed. When the control instruction is unconditional (JP a16, JR r8 etc.) I follow the specified address, when it is conditional I follow both addresses (e.g. CALL NZ,a16, I follow the a16 and then return to pc+3 address). There is only one control instruction, that parameter address can change dynamically - JP (HL), all other control instructions have fixed address (I ignore this instruction, haven't seen it being used yet).
edit: available at https://github.com/mmuszkow/gb-disasm
It works with ROMs from [1], but when trying to disassemble something a little bit more complex like Dr.Mario (32KB Cart, ROM Only), I think the output is incorrect (e.g. in one place I have jump which address seems incorrect to me - JP C,$8F04).
I have some concerns:
1. RST instruction, I skip this instruction (pc += 1), if I understand correctly it is some kind of internal "function" call. Is this OK?
2. Address translation, at the beginning I want to be able to interpret 2 kinds of ROMs:
- ROM only - address is mapped directly to offset in ROM image (0x0000 - 0x7FFF).
- MBC1 - adresses 0x0000-0x3FFF are mapped directly to offset in ROM, adresses 0x4000-0x7FFF are mapped to (bank*0x4000)+addr in ROM image. Is this OK?
3. Are there any "original" ROMs dis-assemblies I can test on? I have found only Pokemon, but it's to complex to be analyzed. I'm looking for something simpler, preferably 32KB ROM or MBC1.
[1] http://www.devrs.com/gb/asmcode.php
[2] http://pastraiser.com/cpu/gameboy/gameboy_opcodes.html
Example of Dr.Mario disassembly:
[0x00000100] 0x00 NOP [0x00000101] 0xC3 0x50 0x01 JP,$0150 [0x00000150] 0xC3 0xE8 0x01 JP,$01E8 [0x00000153] 0x01 0x0E 0xD0 LD BC,$D00E [0x00000156] 0x0A LD A,(BC) [0x00000157] 0xA7 AND A [0x00000158] 0x20 0x0D JR NZ,$0D [0x0000015A] 0xF0 0xCF LDH A,($CF) [0x0000015C] 0xFE 0xFE CP,$FE [0x0000015E] 0x20 0x04 JR NZ,$04 [0x00000160] 0x3E 0x01 LD A,$01 [0x00000162] 0x18 0x01 JR,$01 [0x00000164] 0xAF XOR A [0x00000165] 0x02 LD (BC),A [0x00000166] 0xC9 RET [0x00000167] 0xFA 0x46 0xD0 LD A,($D046) [0x0000016A] 0xE0 0x01 LDH ($01),A [0x0000016C] 0x18 0xF6 JR,$F6 [0x000001E8] 0xAF XOR A [0x000001E9] 0x21 0xFF 0xDF LD HL,$DFFF [0x000001EC] 0x0E 0x10 LD C,$10 [0x000001EE] 0x06 0x00 LD B,$00 [0x000001F0] 0x32 LD (HL-),A [0x000001F1] 0x05 DEC B [0x000001F2] 0x20 0xFC JR NZ,$FC [0x000001F4] 0x0D DEC C [0x000001F5] 0x20 0xF9 JR NZ,$F9 [0x000001F7] 0x3E 0x0D LD A,$0D [0x000001F9] 0xF3 DI [0x000001FA] 0xE0 0x0F LDH ($0F),A [0x000001FC] 0xE0 0xFF LDH ($FF),A [0x000001FE] 0xAF XOR A [0x000001FF] 0xE0 0x42 LDH ($42),A [0x00000201] 0xE0 0x43 LDH ($43),A [0x00000203] 0xE0 0xA4 LDH ($A4),A [0x00000205] 0xE0 0x41 LDH ($41),A [0x00000207] 0xE0 0x01 LDH ($01),A [0x00000209] 0xE0 0x02 LDH ($02),A [0x0000020B] 0xEA 0x00 0xD0 LD ($D000),A [0x0000020E] 0xEA 0x01 0xD0 LD ($D001),A [0x00000211] 0x3E 0x80 LD A,$80 [0x00000213] 0xE0 0x40 LDH ($40),A [0x00000215] 0xF0 0x44 LDH A,($44) [0x00000217] 0xFE 0x94 CP,$94 [0x00000219] 0x20 0xFA JR NZ,$FA [0x0000021B] 0x3E 0x03 LD A,$03 [0x0000021D] 0xE0 0x40 LDH ($40),A [0x0000021F] 0x3E 0xE1 LD A,$E1 [0x00000221] 0xE0 0x47 LDH ($47),A [0x00000223] 0xE0 0x48 LDH ($48),A [0x00000225] 0x3E 0xE5 LD A,$E5 [0x00000227] 0xE0 0x49 LDH ($49),A [0x00000229] 0x21 0x26 0xFF LD HL,$FF26 [0x0000022C] 0x3E 0x80 LD A,$80 [0x0000022E] 0x32 LD (HL-),A [0x0000022F] 0x3E 0xFF LD A,$FF [0x00000231] 0x32 LD (HL-),A [0x00000232] 0x36 0x77 LD (HL),$77 [0x00000234] 0x21 0x06 0xFF LD HL,$FF06 [0x00000237] 0x3E 0xBF LD A,$BF [0x00000239] 0x22 LD (HL+),A [0x0000023A] 0x3E 0x04 LD A,$04 [0x0000023C] 0x77 LD (HL),A [0x0000023D] 0x3E 0x01 LD A,$01 [0x0000023F] 0x00 NOP [0x00000240] 0x00 NOP [0x00000241] 0x00 NOP [0x00000242] 0x31 0xFF 0xCF LD SP,$CFFF [0x00000245] 0xAF XOR A [0x00000246] 0x21 0xFF 0xDF LD HL,$DFFF [0x00000249] 0x06 0x00 LD B,$00 [0x0000024B] 0x32 LD (HL-),A [0x0000024C] 0x05 DEC B [0x0000024D] 0x20 0xFC JR NZ,$FC [0x0000024F] 0x21 0xFF 0xCF LD HL,$CFFF [0x00000252] 0x0E 0x10 LD C,$10 [0x00000254] 0x06 0x00 LD B,$00 [0x00000256] 0x32 LD (HL-),A [0x00000257] 0x05 DEC B [0x00000258] 0x20 0xFC JR NZ,$FC [0x0000025A] 0x0D DEC C [0x0000025B] 0x20 0xF9 JR NZ,$F9 [0x0000025D] 0x21 0xFF 0x9F LD HL,$9FFF [0x00000260] 0x0E 0x20 LD C,$20 [0x00000262] 0xAF XOR A [0x00000263] 0x06 0x00 LD B,$00 [0x00000265] 0x32 LD (HL-),A [0x00000266] 0x05 DEC B [0x00000267] 0x20 0xFC JR NZ,$FC [0x00000269] 0x0D DEC C [0x0000026A] 0x20 0xF9 JR NZ,$F9 [0x0000026C] 0x21 0xFF 0xFE LD HL,$FEFF [0x0000026F] 0x06 0x00 LD B,$00 [0x00000271] 0x32 LD (HL-),A [0x00000272] 0x05 DEC B [0x00000273] 0x20 0xFC JR NZ,$FC [0x00000275] 0x21 0xFE 0xFF LD HL,$FFFE [0x00000278] 0x06 0x80 LD B,$80 [0x0000027A] 0x32 LD (HL-),A [0x0000027B] 0x05 DEC B [0x0000027C] 0x20 0xFC JR NZ,$FC [0x0000027E] 0x0E 0xB6 LD C,$B6 [0x00000280] 0x06 0x0A LD B,$0A [0x00000282] 0x21 0x86 0x23 LD HL,$2386 [0x00000285] 0x2A LD A,(HL+) [0x00000286] 0xE2 LD (C),A [0x00000287] 0x0C INC C [0x00000288] 0x05 DEC B [0x00000289] 0x20 0xFA JR NZ,$FA [0x0000028B] 0xCD 0xA3 0x20 CALL,$20A3 [0x0000028E] 0xCD 0xF3 0x7F CALL,$7FF3 [0x00000291] 0xCD 0xBB 0x20 CALL,$20BB [0x00000294] 0x3E 0x0D LD A,$0D [0x00000296] 0xE0 0xFF LDH ($FF),A [0x00000298] 0x3E 0x80 LD A,$80 [0x0000029A] 0xE0 0x40 LDH ($40),A [0x0000029C] 0xAF XOR A [0x0000029D] 0xE0 0x0F LDH ($0F),A [0x0000029F] 0xE0 0x4A LDH ($4A),A [0x000002A1] 0xE0 0x4B LDH ($4B),A [0x000002A3] 0xE0 0xE1 LDH ($E1),A [0x000002A5] 0xE0 0x9C LDH ($9C),A [0x000002A7] 0xFB EI [0x000002A8] 0xF3 DI [0x000002A9] 0xFA 0xF1 0xC4 LD A,($C4F1) [0x000002AC] 0xA7 AND A [0x000002AD] 0x28 0x11 JR Z,$11 [0x000002AF] 0xF0 0xCC LDH A,($CC) [0x000002B1] 0xA7 AND A [0x000002B2] 0x3E 0x00 LD A,$00 [0x000002B4] 0xE0 0xCC LDH ($CC),A [0x000002B6] 0x20 0x04 JR NZ,$04 [0x000002B8] 0x3E 0xE0 LD A,$E0 [0x000002BA] 0x18 0x02 JR,$02 [0x000002BC] 0xF0 0xF2 LDH A,($F2) [0x000002BE] 0xE0 0xD0 LDH ($D0),A [0x000002C0] 0xFB EI [0x000002C1] 0xCD 0x34 0x04 CALL,$0434 [0x000002C4] 0xCD 0x1C 0x23 CALL,$231C [0x000002C7] 0x21 0x89 0xDF LD HL,$DF89 [0x000002CA] 0x7E LD A,(HL) [0x000002CB] 0xA7 AND A [0x000002CC] 0x28 0x05 JR Z,$05 [0x000002CE] 0xAF XOR A [0x000002CF] 0x77 LD (HL),A [0x000002D0] 0xCD 0x02 0x30 CALL,$3002 [0x000002D3] 0xCD 0x55 0x04 CALL,$0455 [0x000002D3] 0xCD 0x55 0x04 CALL,$0455 [0x000002D6] 0xF0 0xE4 LDH A,($E4) [0x000002D6] 0xF0 0xE4 LDH A,($E4) [0x000002D8] 0xA7 AND A [0x000002D9] 0x20 0x5F JR NZ,$5F [0x000002DB] 0xF0 0xB1 LDH A,($B1) [0x000002DD] 0xA7 AND A [0x000002DE] 0x28 0x31 JR Z,$31 [0x000002E0] 0xFA 0xF1 0xC4 LD A,($C4F1) [0x000002E3] 0xA7 AND A [0x000002E4] 0x28 0x0B JR Z,$0B [0x000002E6] 0xF0 0xAB LDH A,($AB) [0x000002E8] 0xA7 AND A [0x000002E9] 0x20 0x06 JR NZ,$06 [0x000002EB] 0xCD 0x64 0x03 CALL,$0364 [0x000002EE] 0xCD 0xE4 0x03 CALL,$03E4 [0x000002F1] 0xF0 0xDE LDH A,($DE) [0x000002F1] 0xF0 0xDE LDH A,($DE) [0x000002F3] 0xEA 0x8F 0xDF LD ($DF8F),A [0x000002F6] 0xA7 AND A [0x000002F7] 0x28 0x0C JR Z,$0C [0x000002F9] 0xFE 0x01 CP,$01 [0x000002FB] 0x28 0x0C JR Z,$0C [0x000002FD] 0xFE 0x02 CP,$02 [0x000002FF] 0x28 0x0C JR Z,$0C [0x00000301] 0x3E 0xD8 LD A,$D8 [0x00000303] 0x18 0x0A JR,$0A [0x00000305] 0x3E 0xBF LD A,$BF [0x00000307] 0x18 0x06 JR,$06 [0x00000309] 0x3E 0xC8 LD A,$C8 [0x0000030B] 0x18 0x02 JR,$02 [0x0000030D] 0x3E 0xD0 LD A,$D0 [0x0000030F] 0xE0 0x06 LDH ($06),A [0x00000311] 0xF0 0xCB LDH A,($CB) [0x00000313] 0xFE 0x60 CP,$60 [0x00000315] 0x28 0x23 JR Z,$23 [0x00000317] 0xF0 0x80 LDH A,($80) [0x00000319] 0xE6 0x0F AND,$0F [0x0000031B] 0xFE 0x0F CP,$0F [0x0000031D] 0x20 0x1B JR NZ,$1B [0x0000031F] 0xF0 0xB1 LDH A,($B1) [0x00000321] 0xA7 AND A [0x00000322] 0xCA 0xE8 0x01 JP Z,$01E8 [0x00000325] 0xCF RST 08H [0x00000326] 0xCF RST 08H [0x00000327] 0xAF XOR A [0x00000328] 0xE0 0xCC LDH ($CC),A [0x0000032A] 0x3E 0xF0 LD A,$F0 [0x0000032C] 0xE0 0x01 LDH ($01),A [0x0000032E] 0x3E 0x81 LD A,$81 [0x00000330] 0xE0 0x02 LDH ($02),A [0x00000332] 0xF0 0xCC LDH A,($CC) [0x00000334] 0xA7 AND A [0x00000335] 0x28 0xFB JR Z,$FB [0x00000337] 0xC3 0xE8 0x01 JP,$01E8 [0x0000033A] 0x21 0xA6 0xFF LD HL,$FFA6 [0x0000033D] 0x06 0x02 LD B,$02 [0x0000033F] 0x7E LD A,(HL) [0x00000340] 0xA7 AND A [0x00000341] 0x28 0x01 JR Z,$01 [0x00000343] 0x35 DEC (HL) [0x00000344] 0x2C INC L [0x00000345] 0x05 DEC B [0x00000346] 0x20 0xF7 JR NZ,$F7 [0x00000348] 0x21 0xE2 0xFF LD HL,$FFE2 [0x0000034B] 0x34 INC (HL) [0x0000034C] 0x21 0xE5 0xFF LD HL,$FFE5 [0x0000034F] 0x34 INC (HL) [0x00000350] 0x21 0xE6 0xFF LD HL,$FFE6 [0x00000353] 0x34 INC (HL) [0x00000354] 0x21 0xE7 0xFF LD HL,$FFE7 [0x00000357] 0x34 INC (HL) [0x00000358] 0x76 HALT [0x00000359] 0xF0 0x85 LDH A,($85) [0x0000035B] 0xA7 AND A [0x0000035C] 0x28 0xFA JR Z,$FA [0x0000035E] 0xAF XOR A [0x0000035F] 0xE0 0x85 LDH ($85),A [0x00000361] 0xC3 0xA8 0x02 JP,$02A8 [0x00000364] 0xF0 0xDC LDH A,($DC) [0x00000366] 0xA7 AND A [0x00000367] 0x20 0x3A JR NZ,$3A [0x00000369] 0xF0 0xD0 LDH A,($D0) [0x0000036B] 0xFE 0xFD CP,$FD [0x0000036D] 0x28 0x0A JR Z,$0A [0x0000036F] 0xFE 0xF8 CP,$F8 [0x00000371] 0x28 0x21 JR Z,$21 [0x00000373] 0xFE 0x55 CP,$55 [0x00000375] 0xD0 RET NC [0x00000376] 0xE0 0xD3 LDH ($D3),A [0x00000378] 0xC9 RET [0x00000379] 0xAF XOR A [0x0000037A] 0xE0 0xD0 LDH ($D0),A [0x0000037C] 0x3E 0xF8 LD A,$F8 [0x0000037E] 0xE0 0xF4 LDH ($F4),A [0x00000380] 0x06 0x17 LD B,$17 [0x00000382] 0xF0 0xB1 LDH A,($B1) [0x00000384] 0xA7 AND A [0x00000385] 0x20 0x05 JR NZ,$05 [0x00000387] 0x3E 0x01 LD A,$01 [0x00000389] 0xE0 0xA9 LDH ($A9),A [0x0000038B] 0xC9 RET [0x0000038C] 0x3E 0x10 LD A,$10 [0x0000038E] 0xE0 0xA6 LDH ($A6),A [0x00000390] 0x78 LD A,B [0x00000391] 0xE0 0xE1 LDH ($E1),A [0x00000393] 0xC9 RET [0x00000394] 0x3E 0xFD LD A,$FD [0x00000396] 0xE0 0xF4 LDH ($F4),A [0x00000398] 0x06 0x0F LD B,$0F [0x0000039A] 0xF0 0xB1 LDH A,($B1) [0x0000039C] 0xA7 AND A [0x0000039D] 0x28 0xED JR Z,$ED [0x0000039F] 0x06 0x17 LD B,$17 [0x000003A1] 0x18 0xE9 JR,$E9 [0x000003A3] 0xFA 0xA4 0xC0 LD A,($C0A4) [0x000003A6] 0xA7 AND A [0x000003A7] 0xC8 RET Z [0x000003A8] 0xFE 0xE0 CP,$E0 [0x000003AA] 0xC8 RET Z [0x000003AB] 0x47 LD B,A [0x000003AC] 0x78 LD A,B [0x000003AD] 0xE6 0xC0 AND,$C0 [0x000003AF] 0x20 0x06 JR NZ,$06 [0x000003B1] 0xCB 0x20 SLA B [0x000003B3] 0xCB 0x20 SLA B [0x000003B5] 0x18 0xF5 JR,$F5 [0x000003B7] 0x48 LD C,B [0x000003B8] 0xF0 0xD9 LDH A,($D9) [0x000003BA] 0x57 LD D,A [0x000003BB] 0x7A LD A,D [0x000003BC] 0xE6 0xC0 AND,$C0 [0x000003BE] 0x20 0x11 JR NZ,$11 [0x000003C0] 0x79 LD A,C [0x000003C1] 0xE6 0xC0 AND,$C0 [0x000003C3] 0x28 0x19 JR Z,$19 [0x000003C5] 0xCB 0x21 SLA C [0x000003C7] 0xCB 0x12 RL D [0x000003C9] 0xCB 0x21 SLA C [0x000003CB] 0xCB 0x12 RL D [0x000003CD] 0x79 LD A,C [0x000003CE] 0xA7 AND A [0x000003CF] 0x20 0xEA JR NZ,$the Big N [0x000003D1] 0x7A LD A,D [0x000003D1] 0x7A LD A,D [0x000003D2] 0xE0 0xD9 LDH ($D9),A [0x000003D4] 0xEA 0x16 0xD0 LD ($D016),A [0x000003D7] 0xAF XOR A [0x000003D8] 0xE0 0xDC LDH ($DC),A [0x000003DA] 0xEA 0xA4 0xC0 LD ($C0A4),A [0x000003DD] 0xC9 RET [0x000003DE] 0xCB 0x21 SLA C [0x000003E0] 0xCB 0x21 SLA C [0x000003E2] 0x18 0xDC JR,$DC [0x000003E4] 0x11 0x08 0xD0 LD DE,$D008 [0x000003E7] 0x21 0xDD 0xFF LD HL,$FFDD [0x000003EA] 0x7E LD A,(HL) [0x000003EB] 0xFE 0x02 CP,$02 [0x000003ED] 0x28 0x27 JR Z,$27 [0x000003EF] 0xFE 0x01 CP,$01 [0x000003F1] 0x28 0x16 JR Z,$16 [0x000003F3] 0x1A LD A,(DE) [0x000003F4] 0xA7 AND A [0x000003F5] 0xC0 RET NZ [0x000003F6] 0xFA 0x0E 0xD0 LD A,($D00E) [0x000003F9] 0xA7 AND A [0x000003FA] 0x20 0x04 JR NZ,$04 [0x000003FC] 0xF0 0xD1 LDH A,($D1) [0x000003FE] 0x18 0x03 JR,$03 [0x00000400] 0xFA 0x46 0xD0 LD A,($D046) [0x00000403] 0xE0 0xCF LDH ($CF),A [0x00000405] 0x1A LD A,(DE) [0x00000406] 0x3C INC A [0x00000407] 0x12 LD (DE),A [0x00000408] 0xC9 RET [0x00000409] 0x1A LD A,(DE) [0x0000040A] 0xA7 AND A [0x0000040B] 0xC0 RET NZ [0x0000040C] 0x3E 0xFE LD A,$FE [0x0000040E] 0xE0 0xCF LDH ($CF),A [0x00000410] 0x1A LD A,(DE) [0x00000411] 0x3C INC A [0x00000412] 0x12 LD (DE),A [0x00000413] 0x36 0x02 LD (HL),$02 [0x00000415] 0xC9 RET [0x00000416] 0x1A LD A,(DE) [0x00000417] 0xA7 AND A [0x00000418] 0xC0 RET NZ [0x00000419] 0xF0 0xD8 LDH A,($D8) [0x0000041B] 0xE0 0xCF LDH ($CF),A [0x0000041D] 0xEA 0x46 0xD0 LD ($D046),A [0x00000420] 0xAF XOR A [0x00000421] 0xE0 0xD8 LDH ($D8),A [0x00000423] 0x77 LD (HL),A [0x00000424] 0x3C INC A [0x00000425] 0x12 LD (DE),A [0x00000426] 0xF0 0xCB LDH A,($CB) [0x00000428] 0xFE 0x60 CP,$60 [0x0000042A] 0x3E 0x0B LD A,$0B [0x0000042C] 0x28 0x02 JR Z,$02 [0x0000042E] 0x3E 0x08 LD A,$08 [0x00000430] 0xEA 0xE0 0xDF LD ($DFE0),A [0x00000433] 0xC9 RET [0x00000434] 0xFA 0x3A 0xD0 LD A,($D03A) [0x00000437] 0xA7 AND A [0x00000438] 0xC0 RET NZ [0x00000439] 0xF0 0xCB LDH A,($CB) [0x0000043B] 0xFE 0x30 CP,$30 [0x0000043D] 0xC0 RET NZ [0x0000043E] 0xF0 0xCF LDH A,($CF) [0x00000440] 0xE0 0x01 LDH ($01),A [0x00000442] 0xCD 0x53 0x01 CALL,$0153 [0x00000445] 0xAF XOR A [0x00000446] 0xEA 0x08 0xD0 LD ($D008),A [0x00000449] 0xFA 0xF1 0xC4 LD A,($C4F1) [0x0000044C] 0xA7 AND A [0x0000044D] 0x20 0x01 JR NZ,$01 [0x0000044F] 0xCF RST 08H [0x00000450] 0x3E 0x81 LD A,$81 [0x00000452] 0xE0 0x02 LDH ($02),A [0x00000454] 0xC9 RET [0x00000455] 0xF0 0xE1 LDH A,($E1) [0x00000457] 0xEF RST 28H [0x00000458] 0x92 SUB D [0x00000459] 0x04 INC B [0x0000045A] 0xDA 0x04 0x8F JP C,$8F04 [0x0000045D] 0x0B DEC BC [0x0000045E] 0xC6 0x2F ADD A,$2F [0x00000460] 0xB4 OR H [0x00000461] 0x0E 0xC8 LD C,$C8 [0x00000463] 0x0F RRCA [0x00000464] 0x39 ADD HL,SP [0x00000465] 0x11 0xF4 0x14 LD DE,$14F4 [0x00000468] 0x90 SUB B [0x00000469] 0x15 DEC D [0x0000046A] 0xE8 0x0B ADD SP,$0B [0x0000046C] 0x6F LD L,A [0x0000046D] 0x33 INC SP [0x0000046E] 0x88 ADC A,B [0x0000046F] 0x05 DEC B [0x00000470] 0x79 LD A,C [0x00000471] 0x06 0x48 LD B,$48 [0x00000473] 0x08 0xD6 0x09 LD ($09D6),SP [0x00000476] 0xF5 PUSH AF [0x00000477] 0x12 LD (DE),A [0x00000478] 0xB8 CP B [0x00000479] 0x13 INC DE [0x0000047A] 0x32 LD (HL-),A [0x0000047B] 0x14 INC D [0x0000047C] 0xFB EI [0x0000047D] 0x20 0x01 JR NZ,$01 [0x0000047F] 0x16 0x9B LD D,$9B [0x00000480] 0x9B SBC A,E [0x00000481] 0x05 DEC B [0x00000482] 0xAF XOR A [0x00000483] 0x21 0xEB 0x0D LD HL,$0DEB [0x00000486] 0xAB XOR E [0x00000487] 0x12 LD (DE),A [0x00000488] 0x74 LD (HL),H [0x00000489] 0x16 0x58 LD D,$58 [0x0000048B] 0x32 LD (HL-),A [0x0000048C] 0xE8 0x16 ADD SP,$16 [0x0000048E] 0xA3 AND E [0x0000048F] 0x14 INC D [0x00000490] 0xC8 RET Z [0x00000491] 0x20 0xCD JR NZ,$CD [0x00000493] 0x50 LD D,B [0x00000494] 0x22 LD (HL+),A [0x00000495] 0xCD 0x40 0x1E CALL,$1E40 [0x00000498] 0x11 0x26 0x5C LD DE,$5C26 [0x0000049B] 0xCD 0xC9 0x20 CALL,$20C9 [0x0000049E] 0x3E 0x83 LD A,$83 [0x000004A0] 0xE0 0x40 LDH ($40),A [0x000004A2] 0xAF XOR A [0x000004A3] 0xEA 0x3A 0xD0 LD ($D03A),A [0x000004A6] 0xE0 0x01 LDH ($01),A [0x000004A8] 0xE0 0xCF LDH ($CF),A [0x000004AA] 0xE0 0xD0 LDH ($D0),A [0x000004AC] 0xE0 0xF2 LDH ($F2),A [0x000004AE] 0xE0 0xB1 LDH ($B1),A [0x000004B0] 0xEA 0xF1 0xC4 LD ($C4F1),A [0x000004B3] 0x3C INC A [0x000004B4] 0xE0 0xE1 LDH ($E1),A [0x000004B6] 0xE0 0xE4 LDH ($E4),A [0x000004B8] 0x21 0x00 0xC0 LD HL,$C000 [0x000004BB] 0x36 0x70 LD (HL),$70 [0x000004BD] 0x2C INC L [0x000004BE] 0x36 0x20 LD (HL),$20 [0x000004C0] 0x2C INC L [0x000004C1] 0x36 0x9B LD (HL),$9B [0x000004C3] 0x3E 0x03 LD A,$03 [0x000004C5] 0xE0 0xAD LDH ($AD),A [0x000004C7] 0xE0 0xAE LDH ($AE),A [0x000004C9] 0x3E 0x02 LD A,$02 [0x000004CB] 0xE0 0xF0 LDH ($F0),A [0x000004CD] 0x3E 0xFF LD A,$FF [0x000004CF] 0xE0 0xA6 LDH ($A6),A [0x000004D1] 0x3E 0x01 LD A,$01 [0x000004D3] 0xEA 0x54 0xD0 LD ($D054),A [0x000004D6] 0xEA 0xE0 0xDF LD ($DFE0),A [0x000004D9] 0xC9 RET [0x00001E40] 0x21 0x00 0xC0 LD HL,$C000 [0x00001E43] 0x06 0xA0 LD B,$A0 [0x00001E45] 0xAF XOR A [0x00001E46] 0x22 LD (HL+),A [0x00001E47] 0x05 DEC B [0x00001E48] 0x20 0xFC JR NZ,$FC [0x00001E4A] 0xC9 RET [0x000020A3] 0x21 0xFF 0x9B LD HL,$9BFF [0x000020A6] 0x01 0x00 0x04 LD BC,$0400 [0x000020A9] 0x3E 0xFF LD A,$FF [0x000020AB] 0x32 LD (HL-),A [0x000020AC] 0x0B DEC BC [0x000020AD] 0x78 LD A,B [0x000020AE] 0xB1 OR C [0x000020AF] 0x20 0xF8 JR NZ,$F8 [0x000020B1] 0xC9 RET [0x000020B2] 0x2A LD A,(HL+) [0x000020B3] 0x12 LD (DE),A [0x000020B4] 0x13 INC DE [0x000020B5] 0x0B DEC BC [0x000020B6] 0x78 LD A,B [0x000020B7] 0xB1 OR C [0x000020B8] 0x20 0xF8 JR NZ,$F8 [0x000020BA] 0xC9 RET [0x000020BB] 0x21 0x9E 0x3D LD HL,$3D9E [0x000020BE] 0x11 0x00 0x80 LD DE,$8000 [0x000020C1] 0x01 0xFF 0x17 LD BC,$17FF [0x000020C4] 0xCD 0xB2 0x20 CALL,$20B2 [0x000020C7] 0xC9 RET [0x000020C9] 0x21 0x00 0x98 LD HL,$9800 [0x000020CC] 0x06 0x12 LD B,$12 [0x000020CE] 0xE5 PUSH HL [0x000020CF] 0x0E 0x14 LD C,$14 [0x000020D1] 0x1A LD A,(DE) [0x000020D2] 0x22 LD (HL+),A [0x000020D3] 0x13 INC DE [0x000020D4] 0x0D DEC C [0x000020D5] 0x20 0xFA JR NZ,$FA [0x000020D7] 0xE1 POP HL [0x000020D8] 0xD5 PUSH DE [0x000020D9] 0x11 0x20 0x00 LD DE,$0020 [0x000020DC] 0x19 ADD HL,DE [0x000020DD] 0xD1 POP DE [0x000020DE] 0x05 DEC B [0x000020DF] 0x20 0xED JR NZ,$ED [0x000020E1] 0xC9 RET [0x0000231C] 0x3E 0x20 LD A,$20 [0x0000231E] 0xE0 0x00 LDH ($00),A [0x00002320] 0xF0 0x00 LDH A,($00) [0x00002322] 0xF0 0x00 LDH A,($00) [0x00002324] 0xF0 0x00 LDH A,($00) [0x00002326] 0xF0 0x00 LDH A,($00) [0x00002328] 0x2F CPL [0x00002329] 0xE6 0x0F AND,$0F [0x0000232B] 0xCB 0x37 SWAP A [0x0000232D] 0x47 LD B,A [0x0000232E] 0x3E 0x10 LD A,$10 [0x00002330] 0xE0 0x00 LDH ($00),A [0x00002332] 0xF0 0x00 LDH A,($00) [0x00002334] 0xF0 0x00 LDH A,($00) [0x00002336] 0xF0 0x00 LDH A,($00) [0x00002338] 0xF0 0x00 LDH A,($00) [0x0000233A] 0xF0 0x00 LDH A,($00) [0x0000233C] 0xF0 0x00 LDH A,($00) [0x0000233E] 0xF0 0x00 LDH A,($00) [0x00002340] 0xF0 0x00 LDH A,($00) [0x00002342] 0xF0 0x00 LDH A,($00) [0x00002344] 0xF0 0x00 LDH A,($00) [0x00002346] 0x2F CPL [0x00002347] 0xE6 0x0F AND,$0F [0x00002349] 0xB0 OR B [0x0000234A] 0x4F LD C,A [0x0000234B] 0xF0 0x80 LDH A,($80) [0x0000234D] 0xA9 XOR C [0x0000234E] 0xA1 AND C [0x0000234F] 0xE0 0x81 LDH ($81),A [0x00002351] 0x79 LD A,C [0x00002352] 0xE0 0x80 LDH ($80),A [0x00002354] 0x3E 0x30 LD A,$30 [0x00002356] 0xE0 0x00 LDH ($00),A [0x00002358] 0xC9 RET [0x00003002] 0xF0 0xE4 LDH A,($E4) [0x00003004] 0xA7 AND A [0x00003005] 0x20 0x0C JR NZ,$0C [0x00003007] 0x06 0x01 LD B,$01 [0x00003009] 0xF0 0xC1 LDH A,($C1) [0x0000300B] 0xA7 AND A [0x0000300C] 0x28 0x0B JR Z,$0B [0x0000300E] 0x04 INC B [0x0000300F] 0xFE 0x01 CP,$01 [0x00003011] 0x28 0x06 JR Z,$06 [0x00003013] 0x3E 0x07 LD A,$07 [0x00003013] 0x3E 0x07 LD A,$07 [0x00003015] 0xEA 0xE8 0xDF LD ($DFE8),A [0x00003018] 0xC9 RET [0x00003019] 0x78 LD A,B [0x0000301A] 0xEA 0xE8 0xDF LD ($DFE8),A [0x0000301D] 0xC9 RET [0x00006507] 0x3E 0xFF LD A,$FF [0x00006509] 0xE0 0x25 LDH ($25),A [0x0000650B] 0x3E 0x03 LD A,$03 [0x0000650D] 0xEA 0x78 0xDF LD ($DF78),A [0x00006510] 0xAF XOR A [0x00006511] 0xEA 0xE9 0xDF LD ($DFE9),A [0x00006514] 0xAF XOR A [0x00006515] 0xEA 0xE1 0xDF LD ($DFE1),A [0x00006518] 0xEA 0xF1 0xDF LD ($DFF1),A [0x0000651B] 0xEA 0xF9 0xDF LD ($DFF9),A [0x0000651E] 0xEA 0x9F 0xDF LD ($DF9F),A [0x00006521] 0xEA 0xAF 0xDF LD ($DFAF),A [0x00006524] 0xEA 0xBF 0xDF LD ($DFBF),A [0x00006527] 0xEA 0xCF 0xDF LD ($DFCF),A [0x0000652A] 0xEA 0x7E 0xDF LD ($DF7E),A [0x0000652D] 0xEA 0x7F 0xDF LD ($DF7F),A [0x00006530] 0xEA 0x8F 0xDF LD ($DF8F),A [0x00006533] 0xEA 0x8D 0xDF LD ($DF8D),A [0x00006536] 0xEA 0x8E 0xDF LD ($DF8E),A [0x00006539] 0xEA 0x8A 0xDF LD ($DF8A),A [0x0000653C] 0xEA 0x8B 0xDF LD ($DF8B),A [0x0000653F] 0x3E 0x08 LD A,$08 [0x00006541] 0xE0 0x12 LDH ($12),A [0x00006543] 0xE0 0x17 LDH ($17),A [0x00006545] 0xE0 0x21 LDH ($21),A [0x00006547] 0x3E 0x80 LD A,$80 [0x00006549] 0xE0 0x14 LDH ($14),A [0x0000654B] 0xE0 0x19 LDH ($19),A [0x0000654D] 0xE0 0x23 LDH ($23),A [0x0000654F] 0xAF XOR A [0x00006550] 0xE0 0x10 LDH ($10),A [0x00006552] 0xE0 0x1A LDH ($1A),A [0x00006554] 0xC9 RET [0x00007FF3] 0xC3 0x07 0x65 JP,$6507
Last edited by mjm (2013-02-20 17:29:01)
Offline
"- MBC1 - adresses 0x0000-0x3FFF are mapped directly to offset in ROM, adresses 0x4000-0x7FFF are mapped to (bank*0x4000)+addr in ROM image. Is this OK?
3. Are there any "original" ROMs dis-assemblies I can test on? I have found only Pokemon, but it's to complex to be analyzed. I'm looking for something simpler, preferably 32KB ROM or MBC1."
Your 2nd question seems right. If an address is in bank 02, at location 4000, an appropriate term would be "02:4000" or "02x4000" as you have.
Your 3rd question.... I think the best and easiest way would be to create a simple test rom with ASM, then disassemble that ROM. This would allow you to add increasing complexity to see how your program handles disassembling it. I'd recommend against disassembling GBDK games though, as I've disassembled my own GBDK creation and found all kinds of junk code. You could probably find some homebrew made in ASM with the source available to compare to.
Last edited by paulc (2013-02-19 01:24:24)
Offline
2. For example in Super Mario Land I have:
[0x0000020D] 0x3E 0x03 LD A,$03 [0x0000020F] 0xEA 0x00 0x20 LD ($2000),A
This means change to memory bank 3.
edit: rephrasing the question
PC (Program Counter) and call/jump addresses
0x0000-0x3FFF -> physically still mapped to 0x0000-0x3FFF
0x4000-0x7FFF -> physically remapped to 0xC000-0xFFFF, am I right?
3. As I said before, I've already disassembled some home-brew games correctly, but I am looking for something "original".
Last edited by mjm (2013-02-19 06:21:05)
Offline
The additional banks are always in #x4000-7FFF.
So 0x4000, 1x4000, 2x4000, 3x4000, etc.
$C000 is WRAM then you're going up into hardware registers. So pretty sure that's not it.
Sorry, I didn't see anything in your post about that you've already tried disassembling homebrew.
Offline
paulc wrote:
So 0x4000, 1x4000, 2x4000, 3x4000, etc.
That's a novel, but incorrect way of writing the addresses. 0x is the hexadecimal prefix in C and related languages, and there's no such notation as 1x, 2x etc for different banks. no$gmb and later BGB are using a colon notation, like 01:4000.
Online
I think you'll be better off thinking about the ROM in terms of banks rather than a linear chunk.
0x4000 x (in SML case) 4 banks
00:0000-3FFF on GB - 0000-3FFF in file
01:4000-7FFF on GB - 4000-7FFF in file
02:4000-7FFF on GB - 8000-BFFF in file
03:4000-7FFF on GB - C000-FFFF in file
etc for larger ROM images.
The hard part in a disassembler is that knowing which ROM bank a CALL is going to in isn't always clear from the routines, as the bank switch may be done in a prior routine. There are quite a few games that have JP XXXX at 0x4000, 0x4003, 0x4006 etc that point to code elsewhere in the bank, but every bank has those JPs at the beginning, so you end up with a CALL 0x4000 that can be valid in a dozen banks, and a single CALL 0x4000 in Bank 0 that is used for calling routines in many different banks.
For your disassembler to be useful, it should maintain a database of references that can be manually tagged to specific banks, or have the user manually enter it into a comment field for that particular opcode line.
Offline
At the moment I can't even disassemble correctly Tetris so I will think about banks switching later
I use Testris ROM (MD5: 982ed5d2b12a0377eb14bcdc4123744e) and as reference the BGB emulator (it has an option to dump the asm code). It's a 32KB ROM without any MBC. My disassembly starts failing at instruction:
[0x000002A0] 0xCD 0x95 0x27 CALL,$2795
Disassembly after following the call is totally different than that produced by BGB. Before everything is OK.
I've put the results of my battle against the GameBoy on github:
https://github.com/mmuszkow/gb-disasm
Code is written in pure C, big part of it is auto-generated. Binary of Windows version is not up to date (I have only access to Linux right now), I will update it tomorrow.
Testris disassembly:
[0x00000100] 0x00 NOP [0x00000101] 0xC3 0x50 0x01 JP,$0150 [0x00000150] 0xC3 0x0C 0x02 JP,$020C [0x0000020C] 0xAF XOR A [0x0000020D] 0x21 0xFF 0xDF LD HL,$DFFF [0x00000210] 0x0E 0x10 LD C,$10 [0x00000212] 0x06 0x00 LD B,$00 [0x00000214] 0x32 LD (HL-),A [0x00000215] 0x05 DEC B [0x00000216] 0x20 0xFC JR NZ,$FC ; 0x214 [0x00000218] 0x0D DEC C [0x00000219] 0x20 0xF9 JR NZ,$F9 ; 0x214 [0x0000021B] 0x3E 0x01 LD A,$01 [0x0000021D] 0xF3 DI [0x0000021E] 0xE0 0x0F LDH ($0F),A [0x00000220] 0xE0 0xFF LDH ($FF),A [0x00000222] 0xAF XOR A [0x00000223] 0xE0 0x42 LDH ($42),A [0x00000225] 0xE0 0x43 LDH ($43),A [0x00000227] 0xE0 0xA4 LDH ($A4),A [0x00000229] 0xE0 0x41 LDH ($41),A [0x0000022B] 0xE0 0x01 LDH ($01),A [0x0000022D] 0xE0 0x02 LDH ($02),A [0x0000022F] 0x3E 0x80 LD A,$80 [0x00000231] 0xE0 0x40 LDH ($40),A [0x00000233] 0xF0 0x44 LDH A,($44) [0x00000235] 0xFE 0x94 CP,$94 [0x00000237] 0x20 0xFA JR NZ,$FA ; 0x233 [0x00000239] 0x3E 0x03 LD A,$03 [0x0000023B] 0xE0 0x40 LDH ($40),A [0x0000023D] 0x3E 0xE4 LD A,$E4 [0x0000023F] 0xE0 0x47 LDH ($47),A [0x00000241] 0xE0 0x48 LDH ($48),A [0x00000243] 0x3E 0xC4 LD A,$C4 [0x00000245] 0xE0 0x49 LDH ($49),A [0x00000247] 0x21 0x26 0xFF LD HL,$FF26 [0x0000024A] 0x3E 0x80 LD A,$80 [0x0000024C] 0x32 LD (HL-),A [0x0000024D] 0x3E 0xFF LD A,$FF [0x0000024F] 0x32 LD (HL-),A [0x00000250] 0x36 0x77 LD (HL),$77 [0x00000252] 0x3E 0x01 LD A,$01 [0x00000254] 0xEA 0x00 0x20 LD ($2000),A [0x00000257] 0x31 0xFF 0xCF LD SP,$CFFF [0x0000025A] 0xAF XOR A [0x0000025B] 0x21 0xFF 0xDF LD HL,$DFFF [0x0000025E] 0x06 0x00 LD B,$00 [0x00000260] 0x32 LD (HL-),A [0x00000261] 0x05 DEC B [0x00000262] 0x20 0xFC JR NZ,$FC ; 0x260 [0x00000264] 0x21 0xFF 0xCF LD HL,$CFFF [0x00000267] 0x0E 0x10 LD C,$10 [0x00000269] 0x06 0x00 LD B,$00 [0x0000026B] 0x32 LD (HL-),A [0x0000026C] 0x05 DEC B [0x0000026D] 0x20 0xFC JR NZ,$FC ; 0x26B [0x0000026F] 0x0D DEC C [0x00000270] 0x20 0xF9 JR NZ,$F9 ; 0x26B [0x00000272] 0x21 0xFF 0x9F LD HL,$9FFF [0x00000275] 0x0E 0x20 LD C,$20 [0x00000277] 0xAF XOR A [0x00000278] 0x06 0x00 LD B,$00 [0x0000027A] 0x32 LD (HL-),A [0x0000027B] 0x05 DEC B [0x0000027C] 0x20 0xFC JR NZ,$FC ; 0x27A [0x0000027E] 0x0D DEC C [0x0000027F] 0x20 0xF9 JR NZ,$F9 ; 0x27A [0x00000281] 0x21 0xFF 0xFE LD HL,$FEFF [0x00000284] 0x06 0x00 LD B,$00 [0x00000286] 0x32 LD (HL-),A [0x00000287] 0x05 DEC B [0x00000288] 0x20 0xFC JR NZ,$FC ; 0x286 [0x0000028A] 0x21 0xFE 0xFF LD HL,$FFFE [0x0000028D] 0x06 0x80 LD B,$80 [0x0000028F] 0x32 LD (HL-),A [0x00000290] 0x05 DEC B [0x00000291] 0x20 0xFC JR NZ,$FC ; 0x28F [0x00000293] 0x0E 0xB6 LD C,$B6 [0x00000295] 0x06 0x0C LD B,$0C [0x00000297] 0x21 0x7F 0x2A LD HL,$2A7F [0x0000029A] 0x2A LD A,(HL+) [0x0000029B] 0xE2 LD (C),A [0x0000029C] 0x0C INC C [0x0000029D] 0x05 DEC B [0x0000029E] 0x20 0xFA JR NZ,$FA ; 0x29A [0x000002A0] 0xCD 0x95 0x27 CALL,$2795 [0x000002A3] 0xCD 0xF3 0x7F CALL,$7FF3 [0x000002A6] 0x3E 0x09 LD A,$09 [0x000002A8] 0xE0 0xFF LDH ($FF),A [0x000002AA] 0x3E 0x37 LD A,$37 [0x000002AC] 0xE0 0xC0 LDH ($C0),A [0x000002AE] 0x3E 0x1C LD A,$1C [0x000002B0] 0xE0 0xC1 LDH ($C1),A [0x000002B2] 0x3E 0x24 LD A,$24 [0x000002B4] 0xE0 0xE1 LDH ($E1),A [0x000002B6] 0x3E 0x80 LD A,$80 [0x000002B8] 0xE0 0x40 LDH ($40),A [0x000002BA] 0xFB EI [0x000002BB] 0xAF XOR A [0x000002BC] 0xE0 0x0F LDH ($0F),A [0x000002BE] 0xE0 0x4A LDH ($4A),A [0x000002C0] 0xE0 0x4B LDH ($4B),A [0x000002C2] 0xE0 0x06 LDH ($06),A [0x000002C4] 0xCD 0xA6 0x29 CALL,$29A6 [0x000002C7] 0xCD 0xF8 0x02 CALL,$02F8 [0x000002F8] 0xF0 0xE1 LDH A,($E1) [0x000002FA] 0xEF RST 28H [0x000002FB] 0xCE 0x1B ADC A,$1B [0x000002FD] 0xE2 LD (C),A [0x000002FE] 0x1C INC E [0x000002FF] 0x44 LD B,H [0x00000300] 0x12 LD (DE),A [0x00000301] 0x7B LD A,E [0x00000302] 0x12 LD (DE),A [0x00000303] 0x06 0x1D LD B,$1D [0x00000305] 0x26 0x1D LD H,$1D [0x00000307] 0xAE XOR (HL) [0x00000308] 0x03 INC BC [0x00000309] 0x79 LD A,C [0x0000030A] 0x04 INC B [0x0000030B] 0x44 LD B,H [0x0000030C] 0x14 INC D [0x0000030D] 0x8C ADC A,H [0x0000030E] 0x14 INC D [0x0000030F] 0x07 RLCA [0x00000310] 0x1A LD A,(DE) [0x00000311] 0xC0 RET NZ [0x00000312] 0x1D DEC E [0x00000313] 0x16 0x1F LD D,$1F [0x00000315] 0x1F RRA [0x00000316] 0x1F RRA [0x00000317] 0x25 DEC H [0x00000318] 0x15 DEC D [0x00000319] 0xB0 OR B [0x0000031A] 0x14 INC D [0x0000031B] 0x7B LD A,E [0x0000031C] 0x15 DEC D [0x0000031D] 0xBF CP A [0x0000031E] 0x15 DEC D [0x0000031F] 0x29 ADD HL,HL [0x00000320] 0x16 0x7A LD D,$7A [0x00000322] 0x16 0xEB LD D,$EB [0x00000324] 0x16 0x13 LD D,$13 [0x00000326] 0x19 ADD HL,DE [0x00000327] 0x77 LD (HL),A [0x00000328] 0x06 0x2C LD B,$2C [0x0000032A] 0x07 RLCA [0x0000032B] 0x25 DEC H [0x0000032C] 0x08 0xE4 0x08 LD ($08E4),SP [0x0000032F] 0x31 0x0B 0xEB LD SP,$EB0B [0x00000332] 0x0C INC C [0x00000333] 0xD2 0x0A 0x32 JP NC,$320A [0x00000336] 0x0D DEC C [0x00000337] 0x23 INC HL [0x00000338] 0x0E 0x12 LD C,$12 [0x0000033A] 0x11 0x99 0x0D LD DE,$0D99 [0x0000033D] 0x8A ADC A,D [0x0000033E] 0x0E 0xCE LD C,$CE [0x00000340] 0x1D DEC E [0x00000341] 0x41 LD B,C [0x00000342] 0x1E 0x69 LD E,$69 [0x00000344] 0x03 INC BC [0x00000345] 0x93 SUB E [0x00000346] 0x03 INC BC [0x00000347] 0x67 LD H,A [0x00000348] 0x11 0xE6 0x11 LD DE,$11E6 [0x00002795] 0x21 0xFF 0x9B LD HL,$9BFF [0x00002798] 0x01 0x00 0x04 LD BC,$0400 [0x0000279B] 0x3E 0x2F LD A,$2F [0x0000279D] 0x32 LD (HL-),A [0x0000279E] 0x0B DEC BC [0x0000279F] 0x78 LD A,B [0x000027A0] 0xB1 OR C [0x000027A1] 0x20 0xF8 JR NZ,$F8 ; 0x279B [0x000027A3] 0xC9 RET [0x000029A6] 0x3E 0x20 LD A,$20 [0x000029A8] 0xE0 0x00 LDH ($00),A [0x000029AA] 0xF0 0x00 LDH A,($00) [0x000029AC] 0xF0 0x00 LDH A,($00) [0x000029AE] 0xF0 0x00 LDH A,($00) [0x000029B0] 0xF0 0x00 LDH A,($00) [0x000029B2] 0x2F CPL [0x000029B3] 0xE6 0x0F AND,$0F [0x000029B5] 0xCB 0x37 SWAP A [0x000029B7] 0x47 LD B,A [0x000029B8] 0x3E 0x10 LD A,$10 [0x000029BA] 0xE0 0x00 LDH ($00),A [0x000029BC] 0xF0 0x00 LDH A,($00) [0x000029BE] 0xF0 0x00 LDH A,($00) [0x000029C0] 0xF0 0x00 LDH A,($00) [0x000029C2] 0xF0 0x00 LDH A,($00) [0x000029C4] 0xF0 0x00 LDH A,($00) [0x000029C6] 0xF0 0x00 LDH A,($00) [0x000029C8] 0xF0 0x00 LDH A,($00) [0x000029CA] 0xF0 0x00 LDH A,($00) [0x000029CC] 0xF0 0x00 LDH A,($00) [0x000029CE] 0xF0 0x00 LDH A,($00) [0x000029D0] 0x2F CPL [0x000029D1] 0xE6 0x0F AND,$0F [0x000029D3] 0xB0 OR B [0x000029D4] 0x4F LD C,A [0x000029D5] 0xF0 0x80 LDH A,($80) [0x000029D7] 0xA9 XOR C [0x000029D8] 0xA1 AND C [0x000029D9] 0xE0 0x81 LDH ($81),A [0x000029DB] 0x79 LD A,C [0x000029DC] 0xE0 0x80 LDH ($80),A [0x000029DE] 0x3E 0x30 LD A,$30 [0x000029E0] 0xE0 0x00 LDH ($00),A [0x000029E2] 0xC9 RET [0x0000320C] 0x18 0x20 JR,$20 ; 0x322C [0x0000322C] 0x18 0x00 JR,$00 ; 0x322C [0x000069A5] 0xAF XOR A [0x000069A6] 0xEA 0xE1 0xDF LD ($DFE1),A [0x000069A9] 0xEA 0xE9 0xDF LD ($DFE9),A [0x000069AC] 0xEA 0xF1 0xDF LD ($DFF1),A [0x000069AF] 0xEA 0xF9 0xDF LD ($DFF9),A [0x000069B2] 0xEA 0x9F 0xDF LD ($DF9F),A [0x000069B5] 0xEA 0xAF 0xDF LD ($DFAF),A [0x000069B8] 0xEA 0xBF 0xDF LD ($DFBF),A [0x000069BB] 0xEA 0xCF 0xDF LD ($DFCF),A [0x000069BE] 0x3E 0xFF LD A,$FF [0x000069C0] 0xE0 0x25 LDH ($25),A [0x000069C2] 0x3E 0x03 LD A,$03 [0x000069C4] 0xEA 0x78 0xDF LD ($DF78),A [0x000069C7] 0x3E 0x08 LD A,$08 [0x000069C9] 0xE0 0x12 LDH ($12),A [0x000069CB] 0xE0 0x17 LDH ($17),A [0x000069CD] 0xE0 0x21 LDH ($21),A [0x000069CF] 0x3E 0x80 LD A,$80 [0x000069D1] 0xE0 0x14 LDH ($14),A [0x000069D3] 0xE0 0x19 LDH ($19),A [0x000069D5] 0xE0 0x23 LDH ($23),A [0x000069D7] 0xAF XOR A [0x000069D8] 0xE0 0x10 LDH ($10),A [0x000069DA] 0xE0 0x1A LDH ($1A),A [0x000069DC] 0xC9 RET [0x00007FF3] 0xC3 0xA5 0x69 JP,$69A5
Last edited by mjm (2013-02-20 17:29:42)
Offline
There's also a commercial release that has its source code available: Mr. Doh!
That might be a good one to compare to since, in theory, the ROM should match the source.
Offline
will this program be able to recognize the difference between code and data?
Offline
Yes, now by default it only prints code and with -a option whole assembly (however printing data content is not yet implemented).
Mr.Do! assembly was very useful to see how original games were written, thanks! Unfortunately it seems that ROM doesn't exactly match the source. I tried to convert the assembly to format acceptable by rgbasm to create ROM from that code, but gave up (rgbasm doesn't support for example ds 10, $A0 instruction).
Offline