C Language example using the interrupt jump instruction RET!
/*********************************************/
/* C language example using interrupt jump instruction */
/* Author: xy_god */
/* Debugged and passed under tc2.0 */
/*********************************************/
#include "dos.h"
#include "stdio.h"
#include "conio.h"
void setretint(); /*Set interrupt 96H as an interrupt jump interrupt,
entry address as follows: x, segment address; bx, off
set address*/
void retf(int destseg,int destoff);/*Jump to destseg:destoff to run*/
main()/*****************Main function**************************/
{
int segsrc=0x2000,offsrc=0x0000;int i=0;
char abscode={0x00,0x0D,0xB4,0x09,0x00,0x0F,/*Machine instruction code*/
0xB0,0x2A,0x00,0x11,0xB7,0x00,
0x00,0x13,0xB3,0xDA,0x00,0x15,
0xB9,0x05,0x00,0x00,0x18,0xCD,0x10};
for(i=0;i<=24;i++)
pokeb(segsrc,offsrc+i,abscode);
setretint();
retf(0x2000,0x000);
}
void retf(int destseg,int destoff) /*Jump to destseg:destoff to run*/
{
asm mov cx,destseg
asm mov bx,destoff
asm int 96h
}
void setretint()/*Set interrupt 96H as an interrupt jump interrupt,
Entry address as follows:
cx, segment address, bx, offset address*/
{
int segsrc=0x1000,offsrc=0x0000;int i=0;
char abscode={0x8B,0xC1, /*MOV AX,CX*/
0x50, /*PUSH AX */
0x8B,0xC3,/*MOV AX,BX*/
0x50, /*PUSH AX */
0xCB}; /*RETF */
for(i=0;i<=6;i++)
pokeb(segsrc,offsrc+i,abscode);
asm MOV AX,1000h /*Set the entry address of interrupt 96h*/
asm MOV DS,AX
asm MOV DX,0000h
asm MOV AL,96h
asm MOV AH,25H
asm INT 21H
}
/*********************************************/
/* C language example using interrupt jump instruction */
/* Author: xy_god */
/* Debugged and passed under tc2.0 */
/*********************************************/
#include "dos.h"
#include "stdio.h"
#include "conio.h"
void setretint(); /*Set interrupt 96H as an interrupt jump interrupt,
entry address as follows: x, segment address; bx, off
set address*/
void retf(int destseg,int destoff);/*Jump to destseg:destoff to run*/
main()/*****************Main function**************************/
{
int segsrc=0x2000,offsrc=0x0000;int i=0;
char abscode={0x00,0x0D,0xB4,0x09,0x00,0x0F,/*Machine instruction code*/
0xB0,0x2A,0x00,0x11,0xB7,0x00,
0x00,0x13,0xB3,0xDA,0x00,0x15,
0xB9,0x05,0x00,0x00,0x18,0xCD,0x10};
for(i=0;i<=24;i++)
pokeb(segsrc,offsrc+i,abscode);
setretint();
retf(0x2000,0x000);
}
void retf(int destseg,int destoff) /*Jump to destseg:destoff to run*/
{
asm mov cx,destseg
asm mov bx,destoff
asm int 96h
}
void setretint()/*Set interrupt 96H as an interrupt jump interrupt,
Entry address as follows:
cx, segment address, bx, offset address*/
{
int segsrc=0x1000,offsrc=0x0000;int i=0;
char abscode={0x8B,0xC1, /*MOV AX,CX*/
0x50, /*PUSH AX */
0x8B,0xC3,/*MOV AX,BX*/
0x50, /*PUSH AX */
0xCB}; /*RETF */
for(i=0;i<=6;i++)
pokeb(segsrc,offsrc+i,abscode);
asm MOV AX,1000h /*Set the entry address of interrupt 96h*/
asm MOV DS,AX
asm MOV DX,0000h
asm MOV AL,96h
asm MOV AH,25H
asm INT 21H
}
临河居士
http://www.xygod.pc5.org
http://www.xygod.pc5.org


