sta segment stack
s1 dw 100 dup(?)
sta ends
data segment
buf db 20
db ?
db 20 dup('$')
db '$'
data ends
code segment
assume cs:code,ds:data,ss:sta
start:
mov ax,data
mov ds,ax
mov dx,offset buf
mov ah,0ah
int 21h ;DS:DX -> buf
xor cx,cx
mov cl,[buf+1]
mov si,offset buf+2
;---------------------------------
next:
cmp byte ptr [si],'a'
jb skip
cmp byte ptr [si],'z'
ja skip
sub byte ptr [si],'a'-'A'
skip:
inc si
loop next
;---------------------------------
mov dl,0ah
mov ah,02h
int 21h
mov ah,9
mov dx,offset buf+2
int 21h
mov ax,4c00h
int 21h
code ends
end start
s1 dw 100 dup(?)
sta ends
data segment
buf db 20
db ?
db 20 dup('$')
db '$'
data ends
code segment
assume cs:code,ds:data,ss:sta
start:
mov ax,data
mov ds,ax
mov dx,offset buf
mov ah,0ah
int 21h ;DS:DX -> buf
xor cx,cx
mov cl,[buf+1]
mov si,offset buf+2
;---------------------------------
next:
cmp byte ptr [si],'a'
jb skip
cmp byte ptr [si],'z'
ja skip
sub byte ptr [si],'a'-'A'
skip:
inc si
loop next
;---------------------------------
mov dl,0ah
mov ah,02h
int 21h
mov ah,9
mov dx,offset buf+2
int 21h
mov ax,4c00h
int 21h
code ends
end start