-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathString_Reversal_Using_Array(lab 1.b).asm
More file actions
90 lines (65 loc) · 1.14 KB
/
String_Reversal_Using_Array(lab 1.b).asm
File metadata and controls
90 lines (65 loc) · 1.14 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
; University of Rajshahi
; Name : Nakul Deb Nath
; Dept : CSE
; Date : 18-10-2018
.model small
.stack 100h
.data
str db 100 dup('$')
msg1 db 'Enter a String(use any char) : $'
msg2 db 'Reversing the given String : $'
.code
main proc
mov ax,@data
mov ds,ax
lea dx,msg1
mov ah,9
int 21h
mov si,offset str
input:
mov ah,1
int 21h
cmp al,0dh
je input_ended
cmp al,24h ;In input chack $ sign
je get_$
mov [si],al
inc si
jmp input
get_$: ;Changing $ sign into other un enterable character
mov [si],01h
inc si
jmp input
input_ended:
mov ah,2
mov dl,0ah
int 21h
mov dl,0dh
int 21h
lea dx,msg2
mov ah,9
int 21h
mov ah,2
output:
dec si
cmp [si],01h
je recover_$
mov dl,[si]
int 21h
cmp si,0
je exit
jmp output
recover_$:
mov dl,'$'
int 21h
cmp si,0
je exit
jmp output
;mov dx,offset str
;mov ah,9
;int 21h
exit:
mov ah,4ch
int 21h
main endp
end main