A
A
Alexey Mairin2018-02-27 23:46:28
assembler
Alexey Mairin, 2018-02-27 23:46:28

How to reverse a string and not letters in words?

Here is the code that reverses the string and the words in it, but how do you reverse the string?

.model tiny      
.code 
org 100h
start: 
         
     MOV CH,0
   MOV CL,0
   
   INPUT: 
   MOV AH,1
   INT 21H   
   CMP AL,13D;compare with enter
   JE LINE ; comare if = jump to revers function                               
   AND DX,0 ;zanulaem dla zapisi v stek(pobitovae i)
   MOV DL,AL;zanosim simvol
   PUSH DX;pushim v stek
   INC CL;
   JMP INPUT   
   
   LINE:;pixaem \n
   MOV AH,2
   MOV DL,0AH
   INT 21H
   MOV DL,0DH
   INT 21H
   
   
   PRINT:
   POP DX
   MOV AH,2 
   INT 21H  
   LOOP PRINT

end start

Actually I understand that it is necessary to read not a character, but a line (command 9, interrupt 21). But something doesn't work

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question