pokecrystal-board/extras
2012-05-02 01:38:19 -05:00
..
pkmnasm simple lexer 2012-04-26 00:31:53 -05:00
__init__.py gah forgot a file to let preprocessor import macros 2012-04-26 14:16:01 -05:00
chars.py rename textpre.py -> preprocessor.py 2012-04-26 16:58:20 -05:00
crystal.py move the text command classes around 2012-05-01 11:25:05 -05:00
gbz80disasm.py don't delete tempt_opt_table in gbz80disasm 2012-04-26 00:32:38 -05:00
item_constants.py redo item constants (some were missed?) 2012-04-27 15:52:57 -05:00
old_parse_scripts.py add encoding to old_parse_scripts.py 2012-04-18 20:55:16 -05:00
pksv.py Move some data back to avoid a circular import. 2012-04-17 23:33:23 -05:00
pokemon_constants.py Move a bunch of constant data into separate files. 2012-04-17 21:37:46 -05:00
README.md basic README to explain crystal.py 2012-05-02 01:38:19 -05:00

Pokémon Crystal utilities and extras

crystal.py parsees the ROM into classes and objects. It prmarily parses map headers, "second" map headers, map event headers, map script headers, map triggers, map "callbacks", map blockdata, xy triggers, warps, people-events, texts and scripts. The purpose of the file is to parse the ROM into python and then spit it back out with the global to_asm() method.

Simple ASM generation example

Note: throughout these examples it is possible to use reload(crystal) instead of import crystal. Once the module is loaded a first time, it must be reloaded if the file changes and the updates are desired.

import crystal

# parse the ROM
crystal.run_main()

# create a new dump
asm = crystal.Asm()

# insert the first 10 maps
x = 10
asm.insert_multiple_with_dependencies(crystal.all_map_headers[:x])

# dump to extras/output.txt
asm.dump()

After running those lines, cp extras/output.asm main.asm and run git diff main.asm to confirm that changes to main.asm have occurred. Then to test whether or not the inserted ASM compiles use: make clean && make. This will complain very loudly if something is broken.