Advertisement

asm version of _dos_setvect (..)

Started by March 01, 2001 06:58 PM
2 comments, last by farmersckn 23 years, 11 months ago
Hey, how would one go about doing _dos_set/getvect in asm? even C code, if it''s possible. Thanks. farmersckn oh, one more thing. could someone show me how to do an interrupt handler that is a member function?
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
Hi

things have changed a LOT from the DOS ASM era...now is WIN32ASM or LinuxASM....so

assuming is win32 you want: you need to make a VXD to be able to work with INT''s...check out Iczelions site for an uptodate tutorial on ASM in Windows ERA....

http://members.nbci.com/_XMCM/winasm/index.html
obysoft
Advertisement
actually, i''d like to know how to do it for dos. i''m using Turbo C 3.0 for my compiler, as that is what we use in our c.s. class. My final is gonna be a dos game in 13h, i wanted to know how to set the interrupt for my own purposes though.
thanks, farmersckn
Here is TurboC 2.01 real-mode code for handling interrupt vectors. It should be of some use to you...

  void save_vector(unsigned num, vector_t *v){	        asm push es;	asm push bx;	asm push di;	asm xor bx,bx;	asm mov es,bx;	asm mov bx,[num];	asm shl bx,2;	asm les bx,[es:bx];	asm mov di,[v];	asm mov [di],bx;	asm mov [di+2],es;	asm pop di;	asm pop bx;	asm pop es;}void install_handler(unsigned num, handler_t h){	        asm push es;	asm push bx;        asm xor bx,bx;	asm mov es,bx;	asm mov bx,[num];	asm shl bx,2;	asm pushf;	asm cli;	asm mov ax,word ptr [h];	asm mov [es:bx],ax;	asm mov ax,word ptr [h+2];	asm mov [es:bx+2],ax;	asm popf;	asm pop bx;	asm pop es;}void restore_vector(unsigned num, vector_t *v){	        asm push es;	asm push bx;	asm push di;	asm xor bx,bx;	asm mov es,bx;	asm mov bx,[num];	asm shl bx,2;	asm mov di,[v];	asm pushf;	asm cli;	asm mov ax,[di];	asm mov [es:bx],ax;	asm mov ax,[di+2];	asm mov [es:bx+2],ax;	asm popf;	asm pop di;	asm pop bx;	asm pop es;}  


Martee
Magnum Games.NET
All your code are belong to us.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers

This topic is closed to new replies.

Advertisement