anyone has a sample program that prints out 'hello world' using masm? thanks :)
anyone has a sample program that prints out 'hello world' using masm? thanks :)
.model small
.data
msg db 'hello$'
.code
mov ax,@data ;the ds is set to datasegment
mov ds,ax
mov dx,offset msg ;ofset of buffer is stored in dx
mov ah,09h ;write string terminated with $
int21h
mov ah,4ch ;exit to dos
int 21h
end
http://www.csi.ucd.ie/staff/jcarthy/home/alp/alp-05.pdf
for windows
; requires /coff switch on 6.15 and earlier versions
.386
.model small,c
.stack 100h
.data
msg db "Hello World!",0
.code
includelib MSVCRT
extrn printf:near
extrn exit:near
public main
main proc
push offset msg
call printf
push 0
call exit
main endp
end main
for dos:
.model small
.stack 100h
.data
msg db 'Hello, world!$'
.code
start:
mov ah, 09h ; Display the message
lea dx, msg
int 21h
mov ax, 4C00h ; Terminate the executable
int 21h
end start
" It is so simple to be happy,
but it is so difficult to be simple"
thanks.. i will try that :)