Error on BIOS disassembly
kdridi opened this issue · 1 comments
kdridi commented
I tried to disassemble the BIOS using this (nice) tool.
I create the cartridge using this python3 script
#!/usr/bin/env python3
code = bytearray([
0x31, 0xFE, 0xFF, 0xAF, 0x21, 0xFF, 0x9F, 0x32, 0xCB, 0x7C, 0x20, 0xFB, 0x21, 0x26, 0xFF, 0x0E,
0x11, 0x3E, 0x80, 0x32, 0xE2, 0x0C, 0x3E, 0xF3, -- snip --
])
rom = code + bytearray([0x00] * (32768 - len(code)))
with open("bios.gb", "wb") as out_file:
out_file.write(rom)
The mgbdis creates some files but when I looked in bank_000.asm, I found is an error
; Disassembly of "bios.gb"
; This file was created with:
; mgbdis v1.4 - Game Boy ROM disassembler by Matt Currie and contributors.
; https://github.com/mattcurrie/mgbdis
SECTION "ROM Bank $000", ROM0[$0]
RST_00::
ld sp, $fffe
xor a
ld hl, $9fff
jr_000_0007:
ld [hl-], a
RST_08::
bit 7, h
jr nz, jr_000_0007
ld hl, $ff26
db $0e ; <<<<<<<<<<<<<< ERROR
RST_10::
ld de, $803e
ld [hl-], a
ld [c], a
inc c
ld a, $f3
The tool seems to skip the disassembly of the 0x09 opcode (LD c, n) that has to consume an other byte.
mattcurrie commented
For disassembling boot ROMs you will want to remove the default symbols on the lines linked below, as they force mgbdis to have instructions starting at those addresses:
Lines 21 to 47 in b41f5c8
It would be nice if there was an option to disable these for cases where they aren't relevant :)
(Also note I've just edited your issue to remove the bulk of the boot ROM file).