int 86

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
eddyb

int 86

Post by eddyb »

I saw many things(such as: video implementation, mouse control, etc.) that uses int 86. So I need to make an compatible funtion. Generating intrrerupt is simple, but i don't know how to move some data in registers. Can anyone help me? please...

PS: I use C/inline asm :roll: :roll: :?: :?:
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Moved from OS Design and Theory. Not sure if this really belongs in General Programming - could you be a little more specific please - 'int 86'? Do you just mean that you want to be able to handle interrupts on an x86, do you want to use real mode BIOS interrupts or do you want to do something else where I have missed the point completely?

If you want to move data from memory to registers and vice versa, I suggest you look around for a good assembly programming tutorial.

Cheers,
Adam
eddyb

Post by eddyb »

I said I want to use only C and inline assembler.
What I Want is int86(INT int_no, REGS in_regs, REGS out_regs), a native dos function.
This function copies in_regs to registries, make an software intrerupt , and copies registries to out_regs.
Uses:

Code: Select all

union REGS regs;

regs.h.ah = 0x00;
regs.h.al = 0x13;
int86(0x10,&regs,&regs);
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Yup....

Post by DeletedAccount »

int86 function is something specific to dos ... you may check out the geninterrupt function ....(turbo C specific )

Code: Select all

_AX = 0x3;
geninterrupt(0x10);
it should be very easy to implement .... eg... define the Regs structure ...
... save the initial regs ... call the given int ( or use a far jmp) ... save the resulting regs ....
eddyb

Post by eddyb »

I have regs struct, I can make an intreerupt using inline asm.
But how I can acces registries from C?
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Post by DeletedAccount »

hint ... i beleive u r using turbo C or borland C (somewhat apparent from ur question ) ...u can directly access and mauplate registers like

Code: Select all

_AX = 0x4C00;
unsigned int exit code = _AX ;

...etc ...
using inline asm is easy as welll ....

Code: Select all

char crap;
asm
{
   mov crap,al
}


the segment addr of int is : 0000
and the offset is : int_num * 4

eg address of function int 21h h is in mem location 0000:0x21*4
eddyb

Post by eddyb »

:(( i use djgpp/gcc. i can do this on my compiler?
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Post by DeletedAccount »

Sorry ... you cant .... AS AJ pointed out ..you should read a good book on assembly language or 80x86 architecture .... I have provided u enough information .. or hints ... We are not here to do your work .. you should put some effort on ur part .... I am sorry if i sound rude .... :(
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

GCC is aimed at protected mode code, Turbo C and friends for real mode. You can't call bios interrupts directly from protected mode, you need to provide the proper environment first.

Given that you want to do video stuff, I suggest look at the various threads on the matter.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
eddyb

Post by eddyb »

I have installed turbo c. Now how i can use my code to this compiler? Are there incompatibilities?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

STFW! :evil:
eddyb

Post by eddyb »

please...:?
Can I make my compiler:D?(something like hacking gcc, etc)
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

eddyb wrote:please...:?
Can I make my compiler:D?(something like hacking gcc, etc)
Really, you don't know what you're talking about. Let it go.


JAL
eddyb

Post by eddyb »

so, ho i do in inline asm do this:
set 0x10 to %dx
set 0x13 to%ax
call int 0x3
?
on my djgpp compiler inline asm is confusing.. :?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post by Brendan »

Hi,
eddyb wrote:on my djgpp compiler inline asm is confusing.. :?
This inline assembly tutorial for GCC might help (but then again, it might not help if you don't have enough basic knowledge)...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Locked