inline asm in C++


Hi!

I wrote a program with inline assembler in C++.
The program should clear the screen with blue color. It works ok in TASM but when I try to run the same code in C++ inline ASM it doesn't work correctly. There are no warnings or errors though. So could anyone tell me what's wrong? Here's the code:

void main()
{
asm
{
mov ax, 13h
int 10h

cld

mov dx, 0
mov ax, 0a000h
mov es, ax
mov ax, 0
mov cx, 4000
mov bx, 4000
shl cx, 3
shl bx, 3
add cx, bx
mov di, ax
mov al, 1
rep stosb

mov al, 0
int 16h

mov ax, 03h
int 10h
}
}

Thanks.

Comments

  • Your program working fine and have no errors (tested with BC5.02), but you must compile it for 16-bit platform, like DOS. Real-mode interrupts and addresses can't be used in console applications for Win32.

  • : Your program working fine and have no errors (tested with BC5.02), but you must compile it for 16-bit platform, like DOS. Real-mode interrupts and addresses can't be used in console applications for Win32.

    Ok.. How about writing similar code for 32-bit platform? What should I do to make the program work in Windows? Could you give an example?



  • : : Your program working fine and have no errors (tested with BC5.02), but you must compile it for 16-bit platform, like DOS. Real-mode interrupts and addresses can't be used in console applications for Win32.
    :
    : Ok.. How about writing similar code for 32-bit platform? What should I do to make the program work in Windows? Could you give an example?
    :
    :
    :
    :
    [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/functions_by_category.asp

    Click on [b]Console[/b]... - you have all the functions for Win32.[/blue]
Sign In or Register to comment.

Howdy, Stranger!

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

Categories