I have a partly-written emulation program for the 8086 CPU. And I'm not sure how to go about adding I/O capabilities to it. The emulator implements a subset of the 8086 instruction set described here.
I plan to implement bios routines for character I/O in
int 10 and
int 16. But then I realized that the bios code is still just machine code, so I'll still need some extra step to peek outside of the VM and call "host" functions like
The two option that occur to me are to use the
out instructions and then implementation of those opcodes can do the file I/O; -or- I think I could use the
esc instructions and have a sort of "watchdog" on the instruction stream, and the watchdog can call extra code.
Which of these would be less headache in moving forward to a full emulator that can run dos programs? Is there another, better way I haven't thought of?