I need to generate a far jump instruction to jump to another ISR(Interrupt Service Routine). I'm developing a 32-bit FreeDOS application.
After reading OW manuals(cguide.pdf and clr.pdf), I figured out two ways that compiled successfully w/o any warning or error.
/* Code Snippet #1 */
#pragma aux old08 aborts ;
void (__interrupt __far *old08)(void); // function pointer declaration
void __interrupt __far new08(void) {
/* Do some processing here ... */
(*old08)(); /* OW will now generate a jump inst. instead of call*/
}
The other approach that I figured out is:
/* Code Snippet #2 */
static void jumpToOld08(void);
# pragma aux jumpToOld08 = \
".686p" \
" DB 0xEA" \
"off_old08 DD 0" \
"sel_old08 DW 0" ;
void __interrupt __far new08(void){
/* Do some processing here ... */
jumpToOld08();
}
extern unsigned short sel_old08;
extern unsigned int off_old08;
sel_old08 = ( __segment )FP_SEG(old08);
off_old08 = FP_OFF(old08);
Now my question is which of the above two ways is more correct or better? Any ideas or opinions?
Are there any other ways to accomplish this?