Howdy, Stranger!

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

Categories

inline asm in C++

mr_biologymr_biology Member Posts: 44

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

  • APVAPV Member Posts: 6
    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.

  • mr_biologymr_biology Member Posts: 44
    : 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?



  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : : 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]
  • Shawn CarterShawn Carter Member Posts: 0

    ________ // http://forcoder.org // free video tutorials and ebooks about [ Visual Basic MATLAB C++ Scratch Python Perl Delphi Visual Basic .NET Assembly C# Go C Java Ruby R PHP Swift PL/SQL JavaScript Objective-C Apex Transact-SQL Lua D Crystal Scheme Rust ABAP F# Logo FoxPro Erlang Kotlin Prolog Clojure Bash Julia LabVIEW Scala Hack ML Lisp Ada Awk SAS Dart Fortran COBOL Alice VBScript ] ____________

Sign In or Register to comment.