Archived

This topic is now archived and is closed to further replies.

Devril

ASM & vc

Recommended Posts

Hey all! Im trying to make an function that uses ASM, but evrytime I use an interrupt it crashes the program. For example: void MyFunction() { _asm { xor ax,ax mov ah,2ch int 21h } } this gets the current time, anyway, when it reaches the "int 21h", it crashes the program. Any sugestions? Thanks in advance

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

are you programming a dos console app?

Share this post


Link to post
Share on other sites
Ya, and win32 apps to!
Btw, ive been searching the net how to use ASM files in the vc, but I didnt find anything.

Share this post


Link to post
Share on other sites
I believe that x86 interrupts cannot be used in Windows programs. Not even in console applications. Don''t know if it''s an absolute fact...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Look here http://spiff.tripnet.se/~iczelion/ . It deals with win32 asm coding

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You cannot use int calls in Win32 apps. Console apps are still Win32 apps, just without a GUI. You can only use int''s in real DOS apps, which VC won''t generate.

You shouldn''t be using DOS int calls these days anyway. Learn how to do whatever you want to do using Win32 API calls.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
then you can do it simply on an old dos c compiler

Share this post


Link to post
Share on other sites
I think im going to read those tuts on the http://spiff.tripnet.se/~iczelion/ to see if I learn something!

Share this post


Link to post
Share on other sites
Damm, it still wont work :|

i tried with the cur code
char milie;

_asm
{
push dx
push ax
mov ah,2ch
int 21h
mov milie, dl
pop ax
pop dx

}
and it still gets that error of ilegal operation

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have no clue on where is the error but i suggest you get a tutorial on how to interface c and assembler when doin dos apps ..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you cannot call the old dos interupts when your program operates under the win32 protected mode.. Even if you make a console app with VC it´s still going to use win32. All interupt handling must be handled by programs that have the rights to use the interupts, such as graphic card drivers etc... If you really need to call thoose interupts you have to either make a program that have the rights to do it, make it a 16bit dos program (VC can´t do this) or get your program running under a diffrent dos extender if you need 32bit program.

Share this post


Link to post
Share on other sites
Like everyone says, you just can''t use interuppts. Let me know if you want MASM 5.11 which will let you create 16-bit DOS apps (mail me).

Share this post


Link to post
Share on other sites
quote:
Original post by lackluster
Like everyone says, you just can''t use interuppts. Let me know if you want MASM 5.11 which will let you create 16-bit DOS apps (mail me).


I have 6.11 but thanx

Share this post


Link to post
Share on other sites
You are able to make a 16bit DOS program using the lastest MASM if you have it.

You will also need a 16bit linker such as alink

Don't use inline assembly in MSVC since lastest microsoft C compilers are unable to generate DOS exe.


[edited by - __ALex_J_ on May 4, 2002 12:40:44 PM]

Share this post


Link to post
Share on other sites