N
N
Nikolai2021-05-08 00:15:12
assembler
Nikolai, 2021-05-08 00:15:12

How to invert a string in tasm?

you need to enter a string and invert it.
what I have is not working. What could be the problem?

Text    segment
        assume  CS:text,DS:data
Begin:  mov AX, data
        mov DS, AX
        mov BX, offset txt
        mov SI,0
inpt:   mov Ah, 01h
        int 21h
        cmp AL,0
        je ex_ascii
        mov [BX][SI],AL
        inc SI
        jmp inpt
ex_ascii: mov AH, 08h
        int 21h
        cmp AL, 10h
        je output
        jmp inpt
output: mov DX, offset message
        mov AH, 09h
        int 21h
        dec SI
next:   cmp SI,0
        jl exit
        mov DL, [BX][SI]
        mov AH, 02h
        int 21h
        dec SI
        jmp next
exit:   mov AX, 4c00h
        int 21h
text    ends
data    segment
message db 10, 13,'$'
txt     db 80 dup (?)
data    ends
end Begin


PS please, if possible, the code in the usual tasm. I don't understand small or tiny. Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-05-08
@freeExec

The question "what doesn't work for me" is answered by debugging your code step by step. And the search for the place where reality diverges from what was intended.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question