Bokasm

From Boktai Hacking Wiki
Bokasm
DescriptionTools for extracting MFT files and (de)compiling bytecode of Boktai ROMs.
Target ROMBoktai 1/2/3 (U and J)
AuthorRaphi
LicenseMIT
DependenciesPython 3
Released at2024-01-02
Homepagehttps://git.sr.ht/~raphi/bokasm
Downloadhttps://git.sr.ht/~raphi/bokasm/archive/master.tar.gz


Usage

Extract all MFT files from a ROM:

# This will extract everything into a GAMEID_data/ (in this case U3IJ_data) directory:
python3 -m bokasm.extract boktai_1_j.gba

# Add extra information to the disassembly:
python3 -m bokasm.extract boktai_1_j.gba --verbose --hexdump

Disassemble a single script:

python3 -m bokasm.disasm boktai_1_j.gba 0xe68e36

Assembling a single script:

# Create "script.bin" from "script.asm":
python3 -m bokasm.asm script.asm

# Assemble from stdin to stdout:
printf "return\ni32 0x777\nend" | python3 -m bokasm.asm | xxd

Injecting a modified script into a ROM. If you know what's good for you, the modified script should be the same size or smaller as the original script when assembled. Otherwise you'll corrupt the following script(s).

$EDITOR U3IE_data/scripts/1234.asm

# Create output.gba from original.gba
python3 -m tools.splice \
    --input path/to/original.gba \
    path/to/output.gba \
    U3IE_data \
    # Script ID to inject. You can also specify multiple IDs.
    1234