diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-04-21 02:25:56 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-04-21 02:25:56 -0500 |
commit | c8dd923e7ebf53efc95779284b0a163b68a08fec (patch) | |
tree | 9afb1451b9b8298680c2a0836b5d3409f205447a /crystal.py | |
parent | 15a35a1a4a36cb0ccd91b01d7e003ac28838e539 (diff) |
improve TrainerFragment.to_asm
original-commit-id: 06bc6699dadc2e48c0de6b3041c8619303972ba3
Diffstat (limited to 'crystal.py')
-rw-r--r-- | crystal.py | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1214,6 +1214,7 @@ class MultiByteParam(): def parse(self): self.bytes = rom_interval(self.address, self.size, strings=False) + self.parsed_number = self.bytes[0] + (self.bytes[1] << 8) if hasattr(self, "bank"): self.parsed_address = calculate_pointer_from_bytes_at(self.address, bank=self.bank) else: @@ -2258,6 +2259,23 @@ class TrainerFragment(Command): deps.extend(self.params[6].get_dependencies()) return deps + def to_asm(self): + xspacing = "" + output = "" + output += xspacing + "; bit/flag number\n" + output += xspacing + "db $%.2x"%(self.params[0].parsed_number) + output += "\n\n"+xspacing+"; trainer group && trainer id\n" + output += xspacing + "db %d, %d" % (self.params[1].byte, self.params[2].byte) + output += "\n\n"+xspacing+"; text when seen\n" + output += xspacing + "dw " + self.params[3].to_asm() + output += "\n\n"+xspacing+"; text when trainer beaten\n" + output += xspacing + "dw " + self.params[4].to_asm() + output += "\n\n"+xspacing+"; script when lost\n" + output += xspacing + "dw " + self.params[5].to_asm() + output += "\n\n"+xspacing+"; script when talk again\n" + output += xspacing + "dw " + self.params[6].to_asm() + return output + class TrainerFragmentParam(PointerLabelParam): """used by PeopleEvent to point to trainer data""" |