summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-10 13:53:24 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-10 13:53:24 -0600
commita6118071a0b0f3c0a43754f3336693f198d2a6da (patch)
treeb27c6d1e107387a7b5b90bc11b38bdaeae8377aa
parent5495504228d9ebb46c9d94a79692b4a2522d2042 (diff)
broken attempt at calling givepoke
-rw-r--r--pokemontools/vba/vba.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pokemontools/vba/vba.py b/pokemontools/vba/vba.py
index cb0070d..515ac8d 100644
--- a/pokemontools/vba/vba.py
+++ b/pokemontools/vba/vba.py
@@ -636,6 +636,36 @@ class crystal(object):
self.call(0x25, (Script_startbattle_address % 0x4000) + 0x4000)
+ def set_script(self, address):
+ """
+ Sets the current script in wram to whatever address.
+ """
+ ScriptBank = 0xd439
+ ScriptPos = 0xd43a
+
+ memory = self.vba.memory
+ memory[ScriptBank] = address / 0x4000
+ memory[ScriptPos] = (((address % 0x4000) + 0x4000) & 0xff00) >> 8
+ memory[ScriptPos] = ((address % 0x4000) + 0x4000) & 0xff
+
+ # TODO: determine if this is necessary
+ #memory[ScriptRunning] = 0xff
+
+ self.vba.memory = memory
+
+ def attempt_call_givepoke(self):
+ """
+ An attempt at calling the givepoke command directly.
+ """
+ givepoke_address = 0x97932
+
+ # 0, 50, 0, 0
+ givepoke_data_address = 0x6ca5
+
+ self.set_script(givepoke_data_address)
+
+ self.call(givepoke_address / 0x4000, (givepoke_address % 0x4000) + 0x4000)
+
def broken_start_random_battle_by_rocksmash_battle_script(self):
"""
This doesn't start a battle.