Advertisement
MHSS

reverse of string

Oct 24th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //reverse
  2. data segment
  3. string db "hello world$"
  4. reverse db ?
  5. data ends
  6.  
  7. code segment
  8. assume ds:data,cs:code
  9. start: mov ax,ds
  10.        mov ds,ax
  11.        mov cl,00h
  12.        lea si,string
  13.  
  14.    up: mov bl,[si]
  15.        cmp bl,'$'
  16.        jz down
  17.        inc cl
  18.        inc si
  19.        jmp up
  20.  
  21.  down: dec si
  22.        lea di,reverse
  23.  
  24.   up1: mov al,[si]
  25.        mov [di],al
  26.        dec si
  27.        inc di
  28.        dec cl
  29.        jnz up1
  30.        int 03h
  31. code ends
  32. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement