Created
March 5, 2013 23:58
-
-
Save 0xc010d/5095544 to your computer and use it in GitHub Desktop.
Insert 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
doc = Document.getCurrentDocument() | |
seg = doc.getCurrentSegment() | |
adr = doc.getCurrentAddress() | |
dstStr = Document.ask("Enter destination address:") | |
if dstStr != None: | |
dst = int(dstStr, 16) | |
offset = dst - (adr + 6) | |
after = adr + 6 | |
while seg.getTypeAtAddress(after) == Segment.TYPE_NEXT: | |
after = after + 1 | |
seg.writeByte(adr + 0, 0xFF) | |
seg.writeByte(adr + 1, 0x15) | |
seg.writeByte(adr + 2, ((offset >> 0) & 255)) | |
seg.writeByte(adr + 3, ((offset >> 8) & 255)) | |
seg.writeByte(adr + 4, ((offset >> 16) & 255)) | |
seg.writeByte(adr + 5, ((offset >> 24) & 255)) | |
seg.markAsCode(adr) | |
adr = adr + 6 | |
while adr < after: | |
seg.writeByte(adr, 0x90) | |
seg.markAsCode(adr) | |
adr = adr + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment