I have a homework question to get from user up to 8 char in the string in a new line and print it on reverse
I wrote a code that should take every bit from string and put it in the stack and then take it back to the string so it's will be in reversing and print it in the new line. But when I run the file it's just stuck on input and does't give me to do something
I'm new to assembly, we use tasm1~1.4.
there is my code:
STA SEGMENT STACK
DB 100H DUP (0)
STA ENDS
DATA SEGMENT
MSG1 DB 'ENTER STRING (Maximum is 8) : $'
MSG2 DB 'REVERS IS : $'
ISTR DB 10 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STA
MAIN:
MOV AX, DATA
MOV DS, AX
LEA DX, MSG1
MOV AH, 09H
INT 21H
MOV DX, 0
;INPUT
MOV DX, OFFSET ISTR
MOV AH, 0AH
INT 21H
MOV SI, DX
MOV CL, [SI+1]
ADD SI, 2
MOV DX, 0
MOV BL, CL
TOSTACK:
MOV DX, [SI]
PUSH DX
INC SI
LOOP TOSTACK
MOV DL, 10
MOV AH, 02H
INT 21H
LEA DX, MSG2
MOV AH, 09H
INT 21H
MOV DX, 0
MOV CL, BL
MOV SI, 2
FROMSTACK:
POP DX
MOV AH, 02H
INT 21H
INC SI
LOOP FROMSTACK
MOV AX, 4C00H
INT 21H
CODE ENDS
END MAIN