diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-04-27 16:33:37 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-04-27 16:33:37 -0500 |
commit | 368b3b843dbdaa03747cea6f222f0e4f1d61aa20 (patch) | |
tree | c1a12f3c9bdab68d15bf6f8035c2fd743b8f70e1 /crystal.py | |
parent | a309c6d9ac49ffa6b00883b6761cc9d358c7d890 (diff) |
possibly fix preprocessor/checkmoney issues
original-commit-id: 45c41795f517f420bc0b6cef4d061f767d90915c
Diffstat (limited to 'crystal.py')
-rw-r--r-- | crystal.py | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -1407,7 +1407,29 @@ class MoneyByteParam(MultiByteParam): size = 3 max_value = 0x0F423F should_be_decimal = True + def parse(self): + MultiByteParam.parse(self) + # in the rom as xxyyzz + self.x = self.bytes[0] + self.y = self.bytes[1] + self.z = self.bytes[2] + def to_asm(self): + return str(self.x + self.y << 8 + self.z << 16) + + #this is used by the preprocessor + @staticmethod + def from_asm(value): + #max is 0F423F + #z = 0x0F ; y = 0x42 ; x = 0x3F + #999999 = x + (y << 8) + (z << 16) + + value = int(value) + + x = (value & 0x0000FF) + y = (value & 0x00FF00) >> 8 + z = (value & 0xFF0000) >> 16 + return str(x) + "\ndb "+str(y)+"\ndb "+str(z) class CoinByteParam(MultiByteParam): size = 2 |