-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLowToHigh.asm
More file actions
62 lines (50 loc) · 929 Bytes
/
LowToHigh.asm
File metadata and controls
62 lines (50 loc) · 929 Bytes
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
.model small
.stack 100h
.data
msg db 'Enter a lowercase string: $'
str db 20 dup(?)
result db 20 dup('$')
newline db 13, 10, '$'
.code
main:
mov ax, @data
mov ds, ax
mov es, ax
lea dx, msg
mov ah, 09h
int 21h
lea dx, str
mov ah, 0Ah
mov dx, offset buffer_struct
int 21h
lea si, buffer+2
lea di, result
convert_loop:
mov al, [si]
cmp al, 13
je done
cmp al, 'a'
jb skip_convert
cmp al, 'z'
ja skip_convert
sub al, 32
skip_convert:
mov [di], al
inc si
inc di
jmp convert_loop
done:
lea dx, newline
mov ah, 09h
int 21h
lea dx, result
mov ah, 09h
int 21h
mov ah, 4Ch
int 21h
buffer_struct:
db 20
db ?
buffer:
db 20 dup(?)
end main