Assembly Language bug with space character
Posted
by
Bobby
on Stack Overflow
See other posts from Stack Overflow
or by Bobby
Published on 2012-12-02T20:52:37Z
Indexed on
2012/12/02
23:04 UTC
Read the original article
Hit count: 564
Having a bit of difficulty getting my input to print once a white space character is inputted. So far, i have it to display the uppercase/lowercase of the input but once i enter a string it doesnt read whats after the white space character. any suggestions?
EDIT: intel x86 processor and im using EMU8086
org 100h
include 'emu8086.inc'
printn "Enter string to convert"
mov dx,20
call get_string
printn
mov bx,di
mov ah,0eh
mov al,[ds+bx]
cmp al, 41h
cmp al, 5Ah
jle ToLower1
cmp al, 61h
cmp al, 7ah
jle ToUpper1
ToLower1:
add al, 20h
int 10h
jmp stop1
ToUpper1:
sub al, 20h
int 10h
stop1:
inc bx
mov al,[ds+bx]
cmp al, 41h
cmp al, 5Ah
jle ToLower2
cmp al, 61h
cmp al, 7ah
jle ToUpper2
ToLower2:
add al, 20h
int 10h
jmp stop2
ToUpper2:
sub al, 20h
int 10h
stop2:
inc bx
mov al,[ds+bx]
cmp al, 41h
cmp al, 5Ah
jle ToLower3
cmp al, 61h
cmp al, 7ah
jle ToUpper3
ToLower3:
add al, 20h
int 10h
jmp stop3
ToUpper3:
sub al, 20h
int 10h
stop3:
inc bx
mov al,[ds+bx]
cmp al, 41h
cmp al, 5Ah
jle ToLower4
cmp al, 61h
cmp al, 7ah
jle ToUpper4
ToLower4:
add al, 20h
int 10h
jmp stop4
ToUpper4:
sub al, 20h
int 10h
stop4:
inc bx
mov al,[ds+bx]
cmp al, 41h
cmp al, 5Ah
jle ToLower5
cmp al, 61h
cmp al, 7ah
jle ToUpper5
ToLower5:
add al, 20h
int 10h
jmp stop5
ToUpper5:
sub al, 20h
int 10h
stop5:
printn
hlt
define_get_string
define_print_string
end
© Stack Overflow or respective owner