dataseg segment
strbuf db 100
db ?
string db 100 dup(?)
message db 'please input a string',0Dh,0Ah,'$'
enter db 0Dh,0Ah,'$'
dataseg ends
stackseg segment para stack 'stack'
db 256 dup('o')
stackseg ends
codeseg segment
assume ds:dataseg,cs:codeseg,ss:stackseg
start:
mov ax,dataseg
mov ds,ax
mov dx,offset strbuf
input:
mov ah,0Ah
int 21h
mov ah,0
mov al,[strbuf+1]
cmp al,100
jae change
mov bx,offset string
add bx,ax
mov [bx],'$'
change:
mov cx,ax
mov bx,offset string
mov si,0
next:
mov al,[bx+si]
cmp al,61h
jb continue
cmp al,7Ah
ja continue
sub al,20h
mov [bx+si],al
continue:
inc si
loop next
display:
mov dx,offset message
mov ah,09h
int 21h
mov dx,offset string
mov ah,09h
int 21h
mov dx,offset enter
mov ah,09h
int 21h
mov ah,4ch
int 21h
codeseg ends
strbuf db 100
db ?
string db 100 dup(?)
message db 'please input a string',0Dh,0Ah,'$'
enter db 0Dh,0Ah,'$'
dataseg ends
stackseg segment para stack 'stack'
db 256 dup('o')
stackseg ends
codeseg segment
assume ds:dataseg,cs:codeseg,ss:stackseg
start:
mov ax,dataseg
mov ds,ax
mov dx,offset strbuf
input:
mov ah,0Ah
int 21h
mov ah,0
mov al,[strbuf+1]
cmp al,100
jae change
mov bx,offset string
add bx,ax
mov [bx],'$'
change:
mov cx,ax
mov bx,offset string
mov si,0
next:
mov al,[bx+si]
cmp al,61h
jb continue
cmp al,7Ah
ja continue
sub al,20h
mov [bx+si],al
continue:
inc si
loop next
display:
mov dx,offset message
mov ah,09h
int 21h
mov dx,offset string
mov ah,09h
int 21h
mov dx,offset enter
mov ah,09h
int 21h
mov ah,4ch
int 21h
codeseg ends
end start