Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Assembly code problem

$
0
0
I'm writing assembly code and I'm a bit out of my element. I'm having some difficulty getting this code to print the Uppercase characters to lowercase. Any suggestions? Here's what I have so far. Can anyone help me? I'm doing this using the EMU8086 which is designed for an Intelx86. Thanks in advance



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'
jb ok
cmp byte ptr [bx], 'z'
ja 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 

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>