;This program accepts only numbers. Press enter to quit.
stak segment para stack 'stack'
db 100 dup (0)
stak ends
dta segment
msg1 db "Enter a number: $"
dta ends
kod segment
main proc
assume ss:stak, ds:dta, cs:kod
mov ax,dta
mov ds,ax
mov ah,09
mov dx,offset msg1
int 21h
start: mov ah,07
int 21h
cmp al,0dh
je exit
cmp al,30h
jb start
cmp al,39h
ja start
disp: mov ah,02
mov dl,al
int 21h
jmp start
exit: mov ax,4c00h
int 21h
main endp
kod ends
end main
Editor: Programmer's File Editor
Assembler: Turbo Assembler (TASM)
Linker: Turbo Link (TLINK)
Showing posts with label assembly language. Show all posts
Showing posts with label assembly language. Show all posts
Tuesday, August 17, 2010
Hello World! (Prints a string)
;prints a string
stak segment para stack 'stack'
db 50 dup(0)
stak ends
dta segment
msg db"Hello World!$"
dta ends
kod segment
prok proc
assume ss:stak, ds:dta, cs:kod
mov ax,dta
mov ds,ax
mov ah,09
mov dx, offset msg
int 21h
mov ah,07
int 21h
mov ax,4c00h
int 21h
prok endp
kod ends
end prok
stak segment para stack 'stack'
db 50 dup(0)
stak ends
dta segment
msg db"Hello World!$"
dta ends
kod segment
prok proc
assume ss:stak, ds:dta, cs:kod
mov ax,dta
mov ds,ax
mov ah,09
mov dx, offset msg
int 21h
mov ah,07
int 21h
mov ax,4c00h
int 21h
prok endp
kod ends
end prok
Subscribe to:
Posts (Atom)