heuristic
June 7th, 2006, 01:12 PM
Hi!
I am very new to assembly programming. I wrote this piece of code to display a string using dos int21h.
data_seg segment
mystr db 32, 'hello, world!$'
data_seg ends
code_seg segment
assume cs:code_seg, ds:data_seg
MAIN:
; init data segment
mov ax, data_seg
mov ds, ax
xor ax,ax
mov ah, 02h ; dos function to print
mov bx, 0 ; bx is the index
PRINTLOOP:
mov dl,[mystr+bx]
inc bx
int 21h ; output the char
cmp dl, '$' ; $ marks the end of the string
jnz PRINTLOOP
code_seg ends
END MAIN
I am printing the string character by character. I know about dos function 09h which prints the string.
But whats wrong with the above code??
I use TASM 4.1 on windows xp.
Any help will be appriciated.
thanks in advance
heuristic
I am very new to assembly programming. I wrote this piece of code to display a string using dos int21h.
data_seg segment
mystr db 32, 'hello, world!$'
data_seg ends
code_seg segment
assume cs:code_seg, ds:data_seg
MAIN:
; init data segment
mov ax, data_seg
mov ds, ax
xor ax,ax
mov ah, 02h ; dos function to print
mov bx, 0 ; bx is the index
PRINTLOOP:
mov dl,[mystr+bx]
inc bx
int 21h ; output the char
cmp dl, '$' ; $ marks the end of the string
jnz PRINTLOOP
code_seg ends
END MAIN
I am printing the string character by character. I know about dos function 09h which prints the string.
But whats wrong with the above code??
I use TASM 4.1 on windows xp.
Any help will be appriciated.
thanks in advance
heuristic