summaryrefslogtreecommitdiff
path: root/extras/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-04-27 16:33:37 -0500
committerBryan Bishop <kanzure@gmail.com>2012-04-27 16:33:37 -0500
commit45c41795f517f420bc0b6cef4d061f767d90915c (patch)
treeb4932c40396aef3925b86c7467df7c1102cfdef0 /extras/crystal.py
parent14a35baa3fdc794c3a4f037530554768926e6465 (diff)
possibly fix preprocessor/checkmoney issues
Diffstat (limited to 'extras/crystal.py')
-rw-r--r--extras/crystal.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/extras/crystal.py b/extras/crystal.py
index bd13f6a51..b2ae2e08d 100644
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -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