Thursday, September 11, 2008

String Manipulation (Assembly in A86)

As I was going through with my old emails, I have found some A86 assignments. And I want to share it with you. This "String Manipulation" source code is working. ("/)

I am not that good in assembly programming, thus any comment or suggestion will positively entertained. Thank you!

mov ah,0ah
lea dx,strng
int 21h

mov ah,02
mov dl,0dh
int 21h
mov dl,0ah
int 21h

lea di,string
lea si,actlen

mov cl,[si]

here:

mov al,[di]
cmp al,'e'
je change
inc di,1
dec cl,1
cmp cl,0
je exit
jmp here

change:
mov al,'i'
mov [di],al
inc di,1
dec cl,1
cmp cl,0
je exit
jmp here

exit:
lea dx,string
mov ah,09
int 21h
int 20h

strng label byte
maxlen db 255
actlen db ?
string db 255 dup('$')

I forgot all the syntax. hehe

0 comments: