![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-31 11:43 |
47,815 topics / 349,930 posts / today 0 new / 48,290 members |
| DOS开发编程 & 发展交流 (开发室) » C Language Example Using the RET Interrupt Jump Instruction! |
| Printable Version 1,445 / 3 |
| Floor1 xy_god | Posted 2003-11-07 00:00 |
| 中级用户 Posts 56 Credits 276 | |
|
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 } |
|
| Floor2 xy_god | Posted 2003-11-07 00:00 |
| 中级用户 Posts 56 Credits 276 | |
|
Last time I wrote some assembly code to execute machine instructions and surprisingly nobody replied. This time here's a C language version, let's see if we can study it together! Hehe!
|
|
| Floor3 gale | Posted 2004-02-03 00:00 |
| 初级用户 Posts 17 Credits 139 | |
|
This is too troublesome, just do it directly like this:
void retf(int destseg,int destoff) /*Jump to destseg:destoff to run*/ { asm push destseg asm push destoff asm retf } |
|
| Floor4 qb45 | Posted 2004-02-03 00:00 |
| 高级用户 Posts 194 Credits 677 | |
|
Can I get a QB version??
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |