8086 ALP : Reverse String

.model small
.stack
.code
main proc
    mov ax,@data
    mov ds,ax
    mov si,offset string
    mov bx,0000h
    check:cmp [si],'$'
    je start
    inc si
    inc bx
    jmp check
    start:mov di,offset reverse
    mov cx,bx
    dec si
    L:mov al,[si]
    mov [di],al
    inc di
    dec si
    loop L
    mov [di],'$'
    mov dx,offset reverse
    mov ah,9
    int 21h
    mov ah,4ch
    int 21h
main endp
.data
string db "moicroprocessor$"
reverse db 1 dup(?)
end

No comments:

Post a Comment