Well, e.g. DexOS uses a call-table. That's this point you've mentioned,
Quote:
Use something like a translation table to which all method calls in the code jump and from where the actual procedure would be called (like a header). This makes it easier to "translate" the code, still requires IDs and identification of the method addresses though
But the easiest thing to do is just hook a OS interrupt, e.g. my OS hooks INT 30h, and make your own handler, for example your ISR for your OS INT will check AH for "function index number", like this:
Code:
cmp ah,0
je TextInputFunctions
cmp ah,1
je DiskFunctions
...
TextInputFunctions:
cmp al,0
je PrintString
cmp al,1
je PrintChar
...
etc, etc. And you can in AL check for e.g. a "sub function" or some type. It depends how you'll design it.
And then, when you have your own working system interrupt with e.g. "print string" which requires ESI to the string, AH=01 and AL=00, you'll execute this in your program:
Code:
mov ah,01 ;e.g. text output fncs
mov al,0 ;e.g. print string
mov esi,TheString
int 30h
...
and it'll print, if you programmed your functions and ISR handler properly.
Regards
inflater