On 1 Jul 2007 at 13:28, Fred Cisin wrote:
How would you write a subroutine (for C) that would
permit calling an
INT that is defined at runtime? (I didn't know any better ways at the
time)
. . .
MOV BX, offset stepon3
INC BX
MOV [BX], AL ; change the INT to the one specified in AL
. . .
> stepon3: INT 00h
Why not
PUSHF
CALL FAR...?
There are cases where self-modifying code is unavoidable. For
example, on an 8080, 8085 IN our OUT instruction where the port is
not known ahead of time.
Although modifying the code, as in:
LDA PORTNUM
STA INCOCD+1
INCODE:
IN $-$
works--it gets nasty if what you're writing is boot code in ROM. You
have to move your code to RAM to do this. I don't know if the V20
prefetch would kill you in emulation mode on this sort of thing.
Cheers,
Chuck