nasm

x86 binary patching by calling the nasm executable externally.

hacktools.nasm.run(asmfile)[source]

Apply an asm patch file, with a syntax similar to armips but simplified.

The supported directives are:

  • .open file: opens a file

  • .org 0x100: seeks the opened file to 0x100, everything between this and the next directive is compiled with nasm and written to the file

  • .import 0x200 file: writes the contents of the given file at 0x200

  • .close: closes the opened file (required)

Code is compiled in 16-bit mode for the 186 cpu.

Parameters:

asmfile (str) – Path of the asm patch file.

Return type:

None