Created
March 1, 2013 05:56
-
-
Save kanzure/5062729 to your computer and use it in GitHub Desktop.
vba-call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call(bank, address): | |
""" | |
Jumps into a function at a certain address. | |
""" | |
registers = get_registers() | |
push = [ | |
registers[0], | |
registers[5], | |
registers[4], | |
registers[3], | |
registers[2], | |
0x3bb7, | |
] | |
for value in push: | |
registers[1] -= 2 | |
if value > 0xFF: | |
set_memory_at(registers[1] - 1, value >> 8) | |
set_memory_at(registers[1], value & 0xFF) | |
else: | |
set_memory_at(registers[1], value) | |
if get_memory_at(registers[1]) != value: | |
print "wrong value at " + hex(registers[1]) + " expected " + hex(value) + " but got " + hex(get_memory_at(registers[1])) | |
registers[2] = (bank << 8) | (registers[2] & 0xff) | |
registers[5] = address | |
#registers[0] = 0x2d63 # FarJump | |
set_registers(registers) | |
nstep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment