Created
April 15, 2019 14:16
-
-
Save Karl-Han/e0e14156afd01739118ea252fd2af91d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; string lower case to higer case | |
data segment | |
capacity equ 100 | |
buffer db capacity | |
db 0 ; return length | |
db capacity dup(0) | |
data ends | |
stack1 segment para stack | |
dw 10h dup(0) | |
stack1 ends | |
codeseg segment | |
start: | |
assume cs:codeseg, ds:data, ss:stack1 | |
mov ax, data | |
mov ds, ax | |
; get the input string | |
mov dx, offset buffer | |
mov ah, 0ah | |
int 21h | |
mov dl, 0ah | |
mov ah, 02h | |
int 21h | |
mov bx, offset buffer+1 | |
mov cl, [bx] ; Get the length of the string | |
xor ch, ch | |
testchar: | |
inc bx | |
mov al, [bx] ; Get the character | |
cmp al, 'a' | |
jb display | |
cmp al, 'z' | |
ja display | |
; It is a lower case character, change it into higer case | |
sub al, 20h | |
display: | |
; ascii of the character is in ax | |
mov dl, al | |
mov ah, 2 | |
int 21h | |
loop testchar | |
; Done | |
mov ah, 4ch | |
int 21h | |
codeseg ends | |
end start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment