Calling functions by address

Clarence Dold cdold at starfish.Convergent.COM
Sat Sep 10 03:45:35 AEST 1988


 From article <679 at mssx.UUCP>, by src at mssx.UUCP (Pleschutznig Andreas):
> 
> So we thought of doing that job by declaring the addresses of the emulation 
> routines and jumping to the routines by address like this
> 
> 	(*addressarray[code]);
> 
> I know, I know that *does not* work, but maybe there is someone knowing to
> get around.

I don't know about that not working, but this one does work.
For QuickC, running on a PC, jumps to a ROM based routine (actually the 
reset jump for an 8088 CPU chip).
I use this same method to 'wrap' the ROM based disk format that is contained
in BIOS ROM on the controller card with a friendlier menu.

main ()
{
  void (far *bye) ();
  int far *pt;

  pt = ((int far *) (0x0000472L);
  *pt = 0x1234;                    /* for warm boot */
  /*  *pt = 0x0000;  */           /* for cold boot */

  bye = (void far *) 0x0ffff0000L;
  (*bye) ();
}
-- 
Clarence A Dold - cdold at starfish.Convergent.COM		(408) 435-5274
		...pyramid!ctnews!mitisft!professo!dold
		P.O.Box 6685, San Jose, CA 95150-6685



More information about the Comp.std.c mailing list