x86 - Special Characters on program -
this first time here.
my friend told me forum if have questions programming.
so here program. problem there special characters printed too.
how remove this?
.model small .stack .data var db "welcome assembly language$" .code clear proc near mov ah, 6 mov bh, 2h mov cx, 0 mov dx, 184fh int 10h ret clear endp cursor proc near mov ah, 2 mov bh, 0 mov dh, 10 mov dl, 14 int 10h ret cursor endp start: body proc near call clear call cursor mov ah, 9 mov dx, offset var int 21h mov ah, 4ch int 21h body endp end start how can remove special characters?
thanks
you have segment problem: when use the .data directive, data placed in segment accessed via ds register while .code directive puts assembled code segment accessed via cs register.
with small memory model, data, code , stack memory merged single segment, programmer has responsability initialize segment registers himself.
you see weird characters because data accessed int 21h interruption via ds:dx has ds points wrong segment number see garbage before data. need fix ds avoid garbage output.
add @ begining of body proc:
mov ax, @data mov ds, ax we need use ax intermediate value because cannot mov ds:@data
this 16 bit asm reference can help.
Comments
Post a Comment