~raphi/bokasm

Boktai script (dis)assembler
1a8bb1da — Raphael Robatsch a month ago
progress analyzer
4a0cf20c — Raphael Robatsch a month ago
pointer analyzer
a64abebf — Raphael Robatsch a month ago
offsets

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~raphi/bokasm
read/write
git@git.sr.ht:~raphi/bokasm

You can also use your local clone with git send-email.

#Boktai script (dis)assembler

Tools for assembling and disassembling Boktai bytecode.

#Game support

Full support:

  • Boktai 1 (J)
  • Boktai 1 (U)

Partial support:

  • TODO: Fix text decoding of new characters
  • Boktai 2 (J, Rev 0)
  • Boktai 2 (J, Rev 1)
  • Boktai 2 (U)
  • Boktai 3 (J)
  • Boktai 3 (J) with fan translation patch

No support:

  • Any (E) release

#Usage

Extract all scripts from a ROM:

# This will extract everything into a GAMEID_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

#Assembly syntax

TODO better documentation, for now...

; Semicolons start single-line comments

; General instruction syntax
mnemonic arg1, arg2, named_arg=value1, named_arg2=value2

; Strings are enclosed in double-quotes. You must manually add a null
terminator if you want one. The supported escape sequences are \x and \".
string "hello world\x00"

; Single quotes are equivalent to a u8 immediate. The following instructions
are all equal.
keyword 'i'
keyword 105
keyword 0x69

#License

MIT