Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi :)
i have heard we can not use interrupt services directly
in OSes(windows,Linux)and we have to use system calls,so how assemblers like nasm and tasm run the interrupt services in OS?

example :

MOV BH,00
MOV AH,0EH
MOV AL,41H
MOV BL,07H
INT 10H
Posted

Nowadays there are special debug registers that can be used:
http://ftp.utcluj.ro/pub/users/nedevschi/PMP/protected86/protgemode/translate_cdebugreg.html[^]

You set the breakpoint address in one of the debug registers and set the corresponding flags to make it effective. Another way, for older processors would be to use INT 3.

Here another link for more info:
http://www.logix.cz/michal/doc/i386/chp12-03.htm[^]

Good luck!
 
Share this answer
 
The code you posted is real mode 16 bit assembler. Those days, it was perfectly okay to invoke interrupts directly, and you could even do it from languages like C, Pascal and Basic (depending on the compiler you used).

Btw, the assemblers themselves do not invoke any interrupts, they just generate the required machine code for calling an interrupt. At run time, it's the CPU that executes the code and when it encounters an interrupt instruction, the interrupt is fired.

In modern day protected mode development, you can still call interrupts (in a fashion), but you need to be running in kernel mode. If you are serious about learning assembly language, I would advise you to get a more updated book. Don't waste too much time studying 16 bit assembly, you might as well go learn the PDP-11 instruction set in that case.
 
Share this answer
 
v3
Comments
Espen Harlinn 7-Feb-11 14:38pm    
Good answer
They cannot.
Windows, for instance, won't allow such a call (please, Google for 'protected mode').
:)
 
Share this answer
 
v2
Comments
E.F. Nijboer 7-Feb-11 10:17am    
Sure it can because it is 16-bit code that will run perfectly when compiled as .com program. Here a link to an example with .asm source so you can also see that INT 10H is actually called. You can run the demo using windows XP without any trouble.
http://muzso.hu/2006/04/09/ripples-a-256-byte-demo
INT 10H isn't an interrupt, strictly speaking.

An interrupt is when a piece of hardware needs to have something done, and raises a special kind of alert to the processor to get it's attention immediately. It does this so that action can be taken as quickly as possible, rather than waiting until the processor has nothing else to do.

For example, a physical serial port may receive a character, and it needs to hand it off to the processor before another one is received and it has no-where to put it. (In practice they are buffered, but the interrupt still happens).

The processor gets the alert signal, saves what it is doing, works out which hardware signalled the interrupt, and begins executing the code to handle that particular interrupt. When it is finished, it resumes exactly where it left off.

INT 10H and it's other little pals do not do that: they are software calls to OS methods, and are a way to elevate a user so that he can do privileged operations, that he is normally forbidden to do to prevent him messing things up.
 
Share this answer
 
Comments
E.F. Nijboer 7-Feb-11 10:10am    
Just for the record... INT 10H is a software interrupt for video services (by the bios) and is raised using the INT 10H instruction.
OriginalGriff 7-Feb-11 10:17am    
Yes I know :laugh: I've called it often enough!
It still isn't an interrupt, it's a call to a BIOS function with some special processing...
E.F. Nijboer 7-Feb-11 10:26am    
But that function is called using a software interrupt :-D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900