Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Inline assembly code in VC++ 6.0

tmlutmlu Member Posts: 15
Hello,
When I use inline assembly code in VC++ 6.0, (console application, win32 platform, win98SE), the following code is compiled but crashes at int 21h.

////////////////////////////////////////
char c;
_asm
{
mov ah,7;
int 21h;
mov c,al;
}
////////////////////////////////////////

Furthermore, I compile the code from MSDN, it also crashes at int 10h.


////////////////////////////////////////
Example
// Example of the __asm keyword
__asm // __asm block
{
mov eax, 01h
int 10h
}
////////////////////////////////////////

Is it not allowed to call interrupt in a win32 platform?
Or do I have to adjust any setting? Thanks.
-Lu.

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : Hello,
    : When I use inline assembly code in VC++ 6.0, (console application, win32 platform, win98SE), the following code is compiled but crashes at int 21h.
    :
    : ////////////////////////////////////////
    : char c;
    : _asm
    : {
    : mov ah,7;
    : int 21h;
    : mov c,al;
    : }
    : ////////////////////////////////////////
    :
    : Furthermore, I compile the code from MSDN, it also crashes at int 10h.
    :
    :
    : ////////////////////////////////////////
    : Example
    : // Example of the __asm keyword
    : __asm // __asm block
    : {
    : mov eax, 01h
    : int 10h
    : }
    : ////////////////////////////////////////
    :
    : Is it [red]not allowed[/red] to call interrupt in a win32 platform?
    : Or do I have to adjust any setting? Thanks.
    : -Lu.
    :

  • tmlutmlu Member Posts: 15
    : : Hello,
    : : When I use inline assembly code in VC++ 6.0, (console application, win32 platform, win98SE), the following code is compiled but crashes at int 21h.
    : :
    : : ////////////////////////////////////////
    : : char c;
    : : _asm
    : : {
    : : mov ah,7;
    : : int 21h;
    : : mov c,al;
    : : }
    : : ////////////////////////////////////////
    : :
    : : Furthermore, I compile the code from MSDN, it also crashes at int 10h.
    : :
    : :
    : : ////////////////////////////////////////
    : : Example
    : : // Example of the __asm keyword
    : : __asm // __asm block
    : : {
    : : mov eax, 01h
    : : int 10h
    : : }
    : : ////////////////////////////////////////
    : :
    : : Is it [red]not allowed[/red] to call interrupt in a win32 platform?
    : : Or do I have to adjust any setting? Thanks.
    : : -Lu.
    : :
    :
    :
    Thank you.
    If it is not allowed, how do people accomplish those tasks done by DOS interrupt?
    - Lu.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    Ok, what task are you trying to accomplish? If you planning to enter the graphics mode from console app - just write the full Windows app and Win32 has a pile of drawing functions - which are quite fast I can add...
  • tmlutmlu Member Posts: 15
    : Ok, what task are you trying to accomplish? If you planning to enter the graphics mode from console app - just write the full Windows app and Win32 has a pile of drawing functions - which are quite fast I can add...
    :
    Thanks for your advice. :)
    Well, its only out of curiosity, when I saw the subject of inline assembly code in MSDN. I'm trying to learn more about low level process. BTW, could you tell me where i can see the implementation of the standard library? --just out of curiosity :)
    -Lu.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : : Ok, what task are you trying to accomplish? If you planning to enter the graphics mode from console app - just write the full Windows app and Win32 has a pile of drawing functions - which are quite fast I can add...
    : :
    : Thanks for your advice. :)
    : Well, its only out of curiosity, when I saw the subject of inline assembly code in MSDN. I'm trying to learn more about low level process. BTW, could you tell me where i can see the implementation of the standard library? --just out of curiosity :)
    : -Lu.
    :
    [blue]
    I think if you have VC++ Professional Edition - the source code of run-time libraries are in some folder where you install VC++.

    On the other hand here is a little thing that happened to me: I was developing an object - like a table, which supposed to be used in financial applications which has a lot of information. When I was testing it I needed to check the sorting speed. 10,000 items were sorting suspiciosly slow (about 3 seconds). It looked sluggish, so I decided to replace 'strcmp()' with my own code (not ASM, just plain "C") - the result: same 10,000 items were sorted now in less than a second time - almost 4 times speed up! Since then I am trying to use the ASM when the speed needs most.
    [/blue]
Sign In or Register to comment.