0

i'm new to assembly language and i am trying to figure this code:

org 100h

.data
    string db "miracle si elcarim $"
    string2 db 13 dup(?)
    count dw 18

.code
start:  mov ax, @data
        mov ds, ax
        mov es, ax
        mov cx, count
        mov si, 0
        mov di, 0
        add di, count
        dec di

again:  mov al, string[si]

        mov string2[di], al
        inc si
        dec di


        lea dx,string2
        mov ah,9h
        int 21h

        jmp again

        mov ah, 4ch
        int 21h

ret

i am trying to reverse string into string2 by looping again and print out string2 at the end.

Please i need help!

Viqtoh
  • 192
  • 1
  • 2
  • 12
  • 5
    Don't forget to handle the terminating `$` properly. You still want that at the end. Also, learn to use a debugger and comment your code, especially if you want others to help. PS: trying to stuff 18 characters into a buffer of size 13 is not a good idea. – Jester Oct 08 '18 at 00:13
  • thanks... i changed it to 18 but i still get the error `INT 21h, AH=09h - address: 07116 byte 24h not found after 2000 bytes. ; correct example of INT 21h/9h: mov dx, offset msg mov ah, 9` – Viqtoh Oct 08 '18 at 00:18
  • "byte 24h" means the dollar sign. And as Jester said, you did not add it. Your loop seems wrong too (no terminating condition, and why is the printing done inside it?) – interjay Oct 08 '18 at 00:25

0 Answers0