-
Hello,
I am using MASM32 assembler. I would like to use DOS and BIOS interrupts in my assembly language program.
Whenever I use the int 21H or int 10H command , the computer hangs up,
I have used the following program code
.386
.MODEL FLAT, stdcall
start : mov ax,00;
mov dx,ax;
int 10h;
end start
The assembly sequence works well in Turbo Pascal, but not in Masm.
Please advise in detail how I can go about programming in assembly, some basic help will do.
Thank you
arun
-
umm........
int21 isnt all of it..you also have to give control back to dos... int21 just moves the program "back to dos" so to speak... you have to use another code which i cannot remember exactly at the moment..to give control back to dosbut in one of the other asm posts there is a link to icelizons' or whatever his name is..and you will find all the info you need there :)
-
Iczelion's site is at win32asm.cjb.net :)
-
BIOS Interrupts
Hi,
I have seen the site and the tutorials they offer. There they have mentioned about Vxd s and device drivers. Is'nt there a easier way to use interrupts.
I wanted to check the system time using the BIOS, I have noticed that the MASM32 has api calls for this function.
Do these api calls have a machine code equvalent, also is it possible to make TSRs (Terminate ans Stay Resident programs) with these api's
Thank you
Arun
-
the interrupt codes are:
int 20: exit to dos
int 29: exit to dos
int 21 (mov ah, 4c)(mov al, errorcode)-returns error code)
I recommend the 21 one because the 21 interrupt has been expanded to give windows functionality.
-
To answer the first question (about 2 months later :) )
I think that to use interrupts you need to use a Dos complier.
Once I tried to use interrupts in Visual Studio and and I got a beautiful blue screen :-)
Even with a Dos compiler, I think that windows does some emulation.
I used the function 0h of int 17h to tell the bios to send a caracter to the printer. I got the windows spooler telling me that there was no paper in the printer. :confused:
I don't think that the bios got the call :)
I think that to use Masm32, you NEED to use api instead of interrupts since it's a windows compiler.
Krushstone
-
I'm pretty sure the BIOS interrupt is 10h not 17h. Also, you don't need a DOS compiler to run interrupts. You can use interrupts in windows console apps too. I don't know what language you were using in Visual Studio but VC++ should definatley support the use of interrupts. Unless you are making a win32 application than you can't.
-
interrupts:
10h is for video mode
11h is for configuration
12h is for memory size
13h is for hard drives and floppy
14h is for serial interface
15h is for joystick and memory stuff
16h is for keyboard
17h is for printer
18h is for BASIC rom
19h is for booting
1Ah is for clock
and they are all related to the bios
what language? assembly...
void main(void)
{
_asm{
mov ah,02h;
mov dl,36h;
int 21h;
}
}
The only console choice that I have in VC++ is win32 console application, and I get an access violation in win2k when I try to use an interrupt.
I'm curious about how you can use interrupts in visual c++ ...
Krushstone
-
I have never used VC++ but try this...
Code:
#include <dos.h>
void printchar(char chr)
{
_AH = 9;
_AL = chr; /* character to be written */
_BH = 0; /* video page */
_BL = 1; /* video attribute */
_CX = 1; /* repetition of chr */
geninterrupt(0x10); /* call the interrupt */
}
And I guess I was dead wrong about 10h being the only interrupt :o hehe. I am still learning about this stuff...
-
You can get a copy of 'DOS Programmer's Reference' by Dettmann & Wyatt.
All of the interrupts are disussed in excruciating detail, plus it goes into some undocumented interrupts.:D
-
DOS/BIOS interrupts
Hi,
DOS/BIOS are used only in DOS environment and not in Windows. I think one needs a device driver to access the BIOS/DOS .
barnabas
-
that's not exactly true. The interrupts are there for all to use, but when windows is ran, it redirects them so that they become "virtual". every dos session in windows uses unique interrupts that windows juggles.
IF you try to access certain dos interrupts, depending on windows version, it might refuse you access to them due to the possibility of screwing the os up. But many of them are available using c++. Most of the old blocked out ones have been replaced with "windows safe" add-ons to interrupt 21 that do the same thing, but in the windows environment.
For example, this is the only way you can read/write to a disk sector in win 95/98/me (nt has an api call)
-
Uhh guys.. Just do a search for Ralph Brown's Inturrupt list on the web. It will show you EVERY known INT you want to know and how to use them.
INT are INT. They are not for DOS or Windows ONLY but for BOTH. They are nothing more then procedures that MS has setup for programmers to call when they need to do something. For example:
DOS uses Int 21 with AX=9 to print something to the screen. However, windows doesn't use it becuase it has it's own set of Print screen procedures to call. Some INT are called by windows to print graphics to the screen. So it depends on what the OS is doing that will determin what INT is needed.
I recreated my own INT for DOS once. It's not that hard. You can see examples of it at my website.
http://ossourcecode.tripod.com
Have fun.. :)
-
at the end of program use
int 20h
your pc will not hung