From a6118071a0b0f3c0a43754f3336693f198d2a6da Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 10 Nov 2013 13:53:24 -0600 Subject: broken attempt at calling givepoke --- pokemontools/vba/vba.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'pokemontools/vba/vba.py') 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. -- cgit v1.2.3