Hello, I've been working on this code for a while and I can't get it to display A to a(Uppercase to lowercase) as well as lower to upper, a to A. I've looked around and found suggestions on here and googel from other similar threads that I've tried but none have helped. Help please. Commented out at line 51 is what I was trying before
EDIT: USING EMU 8086. Intel x86
org 100h
jmp start
string db 20, 22 dup('?')
revstring db 20, 22 dup('?')
size dw 4
new_line db 0Dh,0Ah, '$'
start:
lea dx, string
mov ah, 0ah
int 21h
mov bx, dx
mov ah, 0
mov al, ds:[bx+1]
add bx, ax
mov byte ptr [bx+2], '$'
lea dx, new_line
mov ah, 09h
int 21h
lea bx, string
mov ch, 0
mov cl, [bx+1]
mov size, cx
jcxz null
add bx, 2
upper_case:
cmp byte ptr [bx], 'a'- 'A'
;;OR cmp byte ptr [bx], 'A' + 32
jb ok
and byte ptr [bx], 11011111b ;
ok:
mov ah, byte ptr [bx]
push ax
inc bx
loop upper_case
mov cx, size
lea bx, revstring
reverse:
pop ax
mov byte ptr [bx], ah
inc bx
loop reverse
mov byte ptr [bx],'$'
lea dx, revstring
mov ah, 09h
int 21h
mov ah, 0
int 16h
null:
ret