none
The Hello World program in assembly language

    Question

  • Now that I have downloaded Visual Studio C++ Express, I have discovered that there is the ml utility which identifies itself as Microsoft (R) Macro Assembler.

    I am interested in developing assembly language programs using Visual Studio C++ Express compiler, linker or assembler.

    On the great Internet I got hold of this small program but it doesn't assemble correctly in ml. It doesn't work. How do I modify the assembly language below to make it comply with the current version of ml? I just want it to output Hello World at the VS 2008 Command Prompt:

    .MODEL SMALL
    .STACK 256

    .DATA
    outstring DB 'Hello World',13,10,'$'

    .CODE
    _start:
     mov ax,@data
     mov ds,ax
     
     mov ax,OFFSET outstring
     mov ah,9
     int 21h
     
     mov ah,4ch
     int 21h
     
    END _start   

    Can you point me in the right direction regarding interfacing assembly language programs to the Win32 platform? I need some resources on the Internet that teach how to make an Windows Forms App in assembly.

    Why I use assembly language is just a matter of taste. It is a challenge and I have all the time in the world because this is an activity performed in my spare time.

    Wednesday, October 01, 2008 8:56 PM

Answers

  • S. Verma said:

    Gunnar Vestergaard said:

    . . . how to make an Windows Forms App in assembly . . .


    I don't think this is possible.  Assembly is very low level.  Windows Forms is an architecture of the .NET Framework on top of the Common Language Runtime on top of Win32.



    I think he meant Win32 GUI, not Windows Forms.  Win32 GUI is definitely possible with assembler, but you can get almost as small and just as efficient using C or C++ and not using anything from the C runtime library.
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:39 AM
    Thursday, October 02, 2008 7:20 PM
  • Gunnar Vestergaard said:

    Now that I have downloaded Visual Studio C++ Express, I have discovered that there is the ml utility which identifies itself as Microsoft (R) Macro Assembler.

    I am interested in developing assembly language programs using Visual Studio C++ Express compiler, linker or assembler.

    On the great Internet I got hold of this small program but it doesn't assemble correctly in ml. It doesn't work. How do I modify the assembly language below to make it comply with the current version of ml? I just want it to output Hello World at the VS 2008 Command Prompt:

    .MODEL SMALL
    .STACK 256

    .DATA
    outstring DB 'Hello World',13,10,'$'

    .CODE
    _start:
     mov ax,@data
     mov ds,ax
     
     mov ax,OFFSET outstring
     mov ah,9
     int 21h
     
     mov ah,4ch
     int 21h
     
    END _start   

    Can you point me in the right direction regarding interfacing assembly language programs to the Win32 platform? I need some resources on the Internet that teach how to make an Windows Forms App in assembly.

    Why I use assembly language is just a matter of taste. It is a challenge and I have all the time in the world because this is an activity performed in my spare time.



    That code uses DOS system calls (int 21h).  In Windows, if you want to output ASCII text, you should use GetStdHandle and WriteFileA.
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:36 AM
    Thursday, October 02, 2008 7:23 PM
  • That's ancient DOS era 16-bit assembly.  If ml.exe can actually still assembly that, link.exe would definitely be the show stopper.  You'll need to raid a museum to get the tools to get that going.  It's bound to be available somewhere.  But not in this forum.


    Hans Passant.
    Thursday, October 02, 2008 1:55 AM
    Moderator
  • Gunnar Vestergaard said:

    ... how to make an Windows Forms App in assembly. 

    ... I have all the time in the world because this is an activity performed in my spare time.



    Good thing. I think you will need all the time in the world. I wish you luck.
    • Edited by Brian MuthMVP Thursday, October 02, 2008 1:59 AM shorten quote
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:39 AM
    Thursday, October 02, 2008 1:58 AM

All replies

  • Gunnar Vestergaard said:

    . . . how to make an Windows Forms App in assembly . . .


    I don't think this is possible.  Assembly is very low level.  Windows Forms is an architecture of the .NET Framework on top of the Common Language Runtime on top of Win32.
    Wednesday, October 01, 2008 9:29 PM
  • That's ancient DOS era 16-bit assembly.  If ml.exe can actually still assembly that, link.exe would definitely be the show stopper.  You'll need to raid a museum to get the tools to get that going.  It's bound to be available somewhere.  But not in this forum.


    Hans Passant.
    Thursday, October 02, 2008 1:55 AM
    Moderator
  • Gunnar Vestergaard said:

    ... how to make an Windows Forms App in assembly. 

    ... I have all the time in the world because this is an activity performed in my spare time.



    Good thing. I think you will need all the time in the world. I wish you luck.
    • Edited by Brian MuthMVP Thursday, October 02, 2008 1:59 AM shorten quote
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:39 AM
    Thursday, October 02, 2008 1:58 AM
  • S. Verma said:

    Gunnar Vestergaard said:

    . . . how to make an Windows Forms App in assembly . . .


    I don't think this is possible.  Assembly is very low level.  Windows Forms is an architecture of the .NET Framework on top of the Common Language Runtime on top of Win32.



    I think he meant Win32 GUI, not Windows Forms.  Win32 GUI is definitely possible with assembler, but you can get almost as small and just as efficient using C or C++ and not using anything from the C runtime library.
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:39 AM
    Thursday, October 02, 2008 7:20 PM
  • Gunnar Vestergaard said:

    Now that I have downloaded Visual Studio C++ Express, I have discovered that there is the ml utility which identifies itself as Microsoft (R) Macro Assembler.

    I am interested in developing assembly language programs using Visual Studio C++ Express compiler, linker or assembler.

    On the great Internet I got hold of this small program but it doesn't assemble correctly in ml. It doesn't work. How do I modify the assembly language below to make it comply with the current version of ml? I just want it to output Hello World at the VS 2008 Command Prompt:

    .MODEL SMALL
    .STACK 256

    .DATA
    outstring DB 'Hello World',13,10,'$'

    .CODE
    _start:
     mov ax,@data
     mov ds,ax
     
     mov ax,OFFSET outstring
     mov ah,9
     int 21h
     
     mov ah,4ch
     int 21h
     
    END _start   

    Can you point me in the right direction regarding interfacing assembly language programs to the Win32 platform? I need some resources on the Internet that teach how to make an Windows Forms App in assembly.

    Why I use assembly language is just a matter of taste. It is a challenge and I have all the time in the world because this is an activity performed in my spare time.



    That code uses DOS system calls (int 21h).  In Windows, if you want to output ASCII text, you should use GetStdHandle and WriteFileA.
    • Marked as answer by Yan-Fei Wei Tuesday, October 07, 2008 9:36 AM
    Thursday, October 02, 2008 7:23 PM