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 ?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.