
May 24th, 2007, 05:05 PM
|
|
Contributing User
|
|
Join Date: Jan 2006
Posts: 35
Time spent in forums: 17 h 16 m 54 sec
Reputation Power: 3
|
|
|
Copy string to string destination
Hello!
I was trying to copy the numbers in a string source(si) to a string destination(di),but I think I missed something...After copying the numbers to the screen and showing it correctly I get some 'garbage'...Can you help me solve this problem?Is there anything wrong with the code?
Thanks for the reply!
Code:
.8086
.model small
.stack 2048
dseg segment para public 'data'
vector1 db ' 2 value 1 value 3',0
vector2 db ?
dseg ends
cseg segment para public 'code'
assume cs:cseg, ds:dseg
compara:
mov al,[si]
cmp al,0
je sai
inc si
cmp al,'A'
jae comparag
jbe copiar
comparag:
cmp al,'Z'
jbe compara
jae comparap
comparap:
cmp al,'a'
jae comparap2
jbe copiar
comparap2:
cmp al,'z'
jbe compara
jae copiar
copiar:
mov [di],al
inc di
jmp compara
exit:
mov ah,09
mov dx,offset vector2
int 21h
ret
copia endp
main proc
mov ax, dseg
mov ds, ax
lea si,vector1
lea di,vector2
call copia
exitp:
mov ah,4ch
mov al,00
int 21h
main endp
cseg ends
end Main
|