I am playing around with "patching" an old DOS 16-bit real-mode .exe, trying to change the machine code calls.
The disassembled code is:
push bp mov bp, sp xor ax, ax push ax mov ax, 1 push ax mov ax, 64h push ax ; location_X call f_drawDialogBox; 9a 06 00 70 00 nop ; locationY nop nop ; locationT1 pop bp ; locationT2 retf
All I'm doing is inserting a NOP at locationX and deleting a NOP at locationY - basically just move the code 1 byte down. This completely breaks the program - it crashes.
No problems arise when moving a nop from locationT1 to locationT2
I was told that this is becuase I'm upsetting the stack, and that relocations are "to blame" and that I should read about DOS relocations. I've surfed the web for quite a while but was unable to find anything for DOS (with too much windows stuff floating around).
Can anybody give me an example of how to go about getting something like this to work / point me to a tutorial / good read? My goal is to modify machine code, changing one of the functions and doing CALLs to other functions from that function.