diff options
-rw-r--r-- | extras/gbz80disasm.py | 19 | ||||
-rw-r--r-- | extras/romviz.py | 55 | ||||
-rw-r--r-- | pokered.asm | 6 |
3 files changed, 70 insertions, 10 deletions
diff --git a/extras/gbz80disasm.py b/extras/gbz80disasm.py index c07fad51..1f9f7c6c 100644 --- a/extras/gbz80disasm.py +++ b/extras/gbz80disasm.py @@ -546,6 +546,7 @@ end_08_scripts_with = [ ###0xda, 0xe9, 0xd2, 0xc2, 0xca, 0xc3, 0x38, 0x30, 0x20, 0x28, 0x18, 0xd8, 0xd0, 0xc0, 0xc8, 0xc9 ] relative_jumps = [0x38, 0x30, 0x20, 0x28, 0x18] +relative_unconditional_jumps = [0xc3, 0x18] #TODO: replace call and a pointer with call and a label call_commands = [0xdc, 0xd4, 0xc4, 0xcc, 0xcd] @@ -608,7 +609,7 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000): temp_maybe = maybe_byte temp_maybe += ( ord(rom[offset+1]) << 8) if temp_maybe in opt_table.keys(): - opstr = copy(opt_table[temp_maybe][0]) + opstr = opt_table[temp_maybe][0].lower() if "x" in opstr: for x in range(0, opstr.count("x")): @@ -637,8 +638,8 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000): output += spacing + opstr #+ " ; " + hex(offset) output += "\n" - current_byte_number += 1 - offset += 1 + current_byte_number += 2 + offset += 2 elif maybe_byte in opt_table.keys(): op_code = opt_table[maybe_byte] op_code_type = op_code[1] @@ -720,12 +721,12 @@ def output_bank_opcodes(original_offset, max_byte_count=0x4000): offset += 1 #duck out if this is jp $24d7 - if current_byte == 0xc3: - if number == 0x24d7: #jp - if not has_outstanding_labels(byte_labels): - keep_reading = False - is_data = False - break + if current_byte == 0xc3 or current_byte in relative_unconditional_jumps: + #if number == 0x24d7: #jp + if not has_outstanding_labels(byte_labels): + keep_reading = False + is_data = False + break else: is_data = True diff --git a/extras/romviz.py b/extras/romviz.py new file mode 100644 index 00000000..de8eb596 --- /dev/null +++ b/extras/romviz.py @@ -0,0 +1,55 @@ +#!/usr/bin/python +#author: Bryan Bishop <kanzure@gmail.com> +#date: 2012-01-10 +#show me an image +import Image +from math import floor +import extract_maps +import analyze_incbins + +print "loading rom.." +extract_maps.load_rom() +#extract_maps.load_map_pointers() +#extract_maps.read_all_map_headers() + +print "analyzing incbins.." +analyze_incbins.load_asm() +analyze_incbins.isolate_incbins() +analyze_incbins.process_incbins() + +width = 1024 +height = 1024 + +color_table = {} +print "creating color table..." +for value in range(0, 256): + color_table[value] = (value, value, value) + +im = Image.new("RGB", (width, height)) + +print "drawing base color..." +for pos in range(0, len(extract_maps.rom)): + widthx = pos % width + heighty = floor(pos / height) + #im.putpixel((widthx, heighty), color_table[ord(extract_maps.rom[pos])]) + im.putpixel((widthx, heighty), (0, 0, 0)) + + #print "Searching for incbin... for pos= " + hex(pos) + #incbin_found = analyze_incbins.find_incbin_to_replace_for(pos) + #if incbin_found == None: + # im.putpixel((widthx, heighty), (0, 0, 0)) + #else: + # im.putpixel((widthx, heighty), (255, 255, 255)) + +print "drawing incbins..." +for incbin_key in analyze_incbins.processed_incbins: + incbin = analyze_incbins.processed_incbins[incbin_key] + start = incbin["start"] + end = incbin["end"] + + for pos in range(start, end+1): + widthx = pos % width + heighty = floor(pos / height) + im.putpixel((widthx, heighty), (255, 0, 0)) + +im.save("test.png") diff --git a/pokered.asm b/pokered.asm index 57fc1528..6dbb6338 100644 --- a/pokered.asm +++ b/pokered.asm @@ -26371,8 +26371,12 @@ SSAnne10Text6: ; 0x61dff SSAnne10Text8: ; 0x61e09 TX_FAR _SSAnne10Text8 + db $8 ; 0x61e0d + ld a, $29 + call $13d0 + jp $24d7 -INCBIN "baserom.gbc",$61e0d,$63 +INCBIN "baserom.gbc",$61e16,$61e70 - $61e16 SSAnne10Text7: ; 0x61e70 TX_FAR _SSAnne10Text7 |