With this program I am supposed to use ASCII operations to do addition and subtraction on positive integers of any length represented in characters. I have no idea how to fix this program could anyone help me fix it?
Thanks!

include irvine32.inc

.data
msg1 byte 0dh, 0ah, "Enter a number:", 0
msg2 byte 0dh, 0ah, "Enter a second number:", 0

x byte 50 dup (?)
y byte 50 dup(?)
z byte 50 dup ('?')

.code
begin:
mov edx, offset msg1
call writeString

mov edx, offset x
mov ecx, sizeof x
call readString

mov edx, offset x
add edx,eax
mov byte ptr [edx],0

L1:
mov esi,offset X
mov ecx, 0
jz done
inc esi
inc ecx
loop L1

done:
distance = sizeof x
shr x, distance

mov ecx, distance
mov esi, offset x

zero:
mov byte ptr [esi],0
inc esi
loop zero

mov edx, offset msg2
call writeString

mov edx, offset y
mov ecx, sizeof y
call readString

mov edx, offset y
add edx,eax
mov byte ptr [edx],0

L2:
mov esi,offset y
mov ecx, 0
jz done2
inc esi
inc ecx
loop L2

done2:
distance = sizeof y
shr y, distance

zero2:
mov byte ptr [esi],0
inc esi
loop zero2

distance = sizeof x

mov esi,(offset x) + distance - 1               
mov ecx,distance                                
mov edi,(offset z) + sizeof z - 1               
clc                                             
next:
mov al,[esi]                                    
adc al,[esi+distance]                           
aaa                                             
pushf                                           
add al,30h                                      
mov [edi],al                                    
dec esi                                         
dec edi
popf
loop next
jc  carryOut                                    
jmp fin
carryOut:
mov byte ptr [edi], '1'

fin:
invoke exitProcess, 0
end begin

Someone help him please, I'll be using this myself and can't find what's wrong with it either. As I am not that of a pro coder. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.