windows - TASM Print characters of string -
i'm trying print string character character, iterating through it. i've got:
.model small .stack 64 .data string db 'something',0 len equ $-string .code xor bx, bx mov si, offset string char: mov al, byte[si + bx] inc bx cmp bx, len je fin mov ah, 2 mov dl, al int 21h jmp char fin: mov ax, 4c00h int 21h end
i don't know if i'm getting right mem reference of string, because shows me weird symbols. tried adding 30 dl, thinking because of ascii representation.
how can print char char?
here working example tasm, not mangling begining of string.
it has 1 less jump due moving of increment later , replacement of je
jnz
.model small .stack 64 .data string db 'something' len equ $-string .code entry: mov ax, @data ;make ds point our data segment mov ds, ax xor bx, bx ;bx <-- 0 mov si, offset string ;address of string print mov ah, 2 ;we use repeatedly service #2 of int 21h char: mov dl, [si + bx] ;dl char print int 21h ;ask dos output single char inc bx ;point next char cmp bx, len jnz char ;loop if string not finished mov ax, 4c00h int 21h ;dos exit program al = exit code end entry
Comments
Post a Comment