1

I want to compile simple program using assemblers such as MASM or FASM.

Ideal
model small
Stack 256

Dataseg

    str1 db 'hello','$'

Codeseg
Startupcode

   lea dx, [str1]
   mov ah, 09h
   int 21h

   lea dx, [ent]
   mov ah, 09h 
   int 21h

exitcode
END

This source is compiled on TASM in my college, but how to do it using MASM or FASM ?

Deck
  • 1,969
  • 4
  • 20
  • 41

1 Answers1

0

Interrupts can only be used in 16 bit versions of Windows. Those int 21h calls must be replaced by the equivalent Win32 Function calls. Also where is the variable ent defined? If you want to compile with Visual studio then set the custom build rules to MASM, go to linker settings and set the sub-system to windows and the entry point to main. Build and enjoy. See Setting Up Visual Studio 2010 For MASM32 Programming.

This is the relevant MASM code listing:

.386
.model small
.stack 256

.data
  str1 db 'hello','$'

.code
main:
  lea dx, [str1]
  mov ah, 09h
  int 21h

  lea dx, [ent]
  mov ah, 09h 
  int 21h
end main
Romaine Carter
  • 637
  • 11
  • 23