ded@aplvax.UUCP (02/18/84)
I recently came across this piece of code: PUSH B PUSH D PUSH H CALL 0000 POP H POP D POP B What is going on here? The pop instructions are never reached since the CALL 0000 sends us into warmstart. If this involves some sort of clever trick, I can't see it. Any comments will be appreciated. -- Don Davis JHU/APL ...decvax!harpo!seismo!umcp-cs!aplvax!ded ...rlgvax!cvl!umcp-cs!aplvax!ded
emigh@ecsvax.UUCP (02/20/84)
[] The question by aplvax!ded involved the following code: PUSH B|PUSH D|PUSH H CALL 0000 POP H|POP D|POP B Don was unsure that the program would ever return, since location 0 is the warm boot. I have most often seen this code when the program calls the BIOS directly. An initialization routine will calculate the positions of the various BIOS calls and store them in place of the 0000. You may have several of these routines in the program, each initialized to a different BIOS call. --Ted Emigh--- decvax!mcnc!ecsvax!emigh p.s. See the current discussion in net.lang concerning self-modifying code.
hoffman@pitt.UUCP (Bob Hoffman) (03/26/84)
I have written code like that (call 0 surrounded by push/pop) when doing direct BIOS calls. The address of the BIOS routine is not known until runtime, and is calculated by looking at the address contained at 0001 and 0002, and adding the offset into the BIOS jump table. If you found this code in a source file, look for someplace where the effective address of the CALL is written into. If you are looking at a COM file, try starting the program and then dumping back out to CP/M, save the memory image, and look at that address again. It will probably have a BIOS entry address in it. Good luck, ---Bob.