summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-11-07 00:58:58 -0500
committeryenatch <yenatch@gmail.com>2013-11-07 00:58:58 -0500
commit5612a982abb7b5de72868ca7ccaa89641c6e3d22 (patch)
tree771bff690b72686c1a7b1714ca094d942702b199
parent2d30d0bca7905b1e95c8af0eb43208642b3df0a5 (diff)
add some extra music command classes
-rw-r--r--pokemontools/crystal.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py
index d8f254a..e4238ba 100644
--- a/pokemontools/crystal.py
+++ b/pokemontools/crystal.py
@@ -2411,7 +2411,7 @@ class BigEndianParam:
return value
class DecimalBigEndianParam(BigEndianParam):
- should_be_decimal = True
+ should_be_decimal = True
music_commands = {
0xD0: ["octave 8"],
@@ -2504,6 +2504,31 @@ def create_music_command_classes(debug=False):
music_classes = create_music_command_classes()
+class OctaveParam(DecimalParam):
+ @staticmethod
+ def from_asm(value):
+ value = int(value)
+ return hex(0xd8 - value).replace("0x", "$")
+
+class OctaveCommand(Command):
+ macro_name = "octave"
+ size = 0
+ end = False
+ param_types = {
+ 0: {"name": "octave", "class": OctaveParam},
+ }
+ allowed_lengths = [1]
+ override_byte_check = True
+
+class ChannelCommand(Command):
+ macro_name = "channel"
+ size = 3
+ override_byte_check = True
+ param_types = {
+ 0: {"name": "id", "class": DecimalParam},
+ 1: {"name": "address", "class": PointerLabelParam},
+ }
+
class callchannel(Command):
id = 0xFD
macro_name = "callchannel"