-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAAAA.ASM
57 lines (56 loc) · 1.44 KB
/
AAAA.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
STRING MACRO MSG
MOV AH,09H
MOV DX,OFFSET MSG
INT 21H
ENDM
DATA SEGMENT
CR EQU 0DH
LF EQU 0AH
BUFF DB 20 DUP(0)
REVBUFF DB 20 DUP(0)
MSG1 DB 'ENTER THE STRING:','$'
MSG2 DB CR,LF,'THE REVERSE OF THE STRING IS:','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX,DATA
MOV DS,AX
STRING MSG1
MOV SI,OFFSET BUFF
RDCHART:
MOV AH,01H
INT 21H
MOV [SI],AL
INC SI
CMP AL,CR
JNE RDCHART
MOV SI,OFFSET BUFF
MOV BX,00
LABEL3:
MOV AL,[SI]
CMP AL,CR
JE LABEL2
MOV [SI],AL
INC SI
INC BX
JMP LABEL3
LABEL2:
MOV SI,OFFSET BUFF
ADD SI,BX
MOV DI,OFFSET REVBUFF
MOV CX,BX
LABEL4:
DEC SI
MOV AL,[SI]
MOV [DI],AL
INC DI
LOOP LABEL4
MOV AL,'$'
MOV [DI],AL
STRING MSG2
STRING REVBUFF
MOV AX,4C00H
INT 21H
CODE ENDS
END START