so I am working on an assignment in class, and I've hit a road block. the assignment is to replace certain letters (b, c) with others, (x, y). Right now, my program is not recognizing 'b' in ebx, and the second letter in the array, 'b', (stored in eax) as being the same, so it is not changing them. I know im doing something wrong, but I can't figure out what. Any hints would be much appreciated, meanwhile i will keep plugging away at it. Also, I cannot get the new array in edx to show up without subtracting sixteen, and im not sure how to fix that so that is not necessary. Thanks so much.
INCLUDE Irvine32.inc
.data
array byte 'a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'c',
'd', 'e', 'f', 'a', 'b', 'c'
letter byte ?
newArray byte 15 dup (?)
.code
main PROC
mov ecx, lengthof array ;moves ecx to beginning of array as a counter
mov esi, offset array ;moves esi to the beginning of array to obtain letters
mov eax, [esi] ;moves first position of array into eax
doLoop: ;starts a loop
mov ebx, 'b' ;moves first letter comparison (b) into ebx
cmp ebx, eax ;compares letters
je check4C ;if it is b, then jump to check for c
add edx, eax ;if not b, store first letter of newArray in edx
add esi, type array ; increment esi to next letter in array
loop doLoop ;loop back to the beginning
mov edx, offset newArray
sub edx, 16
call writestring ;print newArray string with new letters
call crlf ;enters a blank line
call waitmsg ;waits til user closes screen
exit ;exit
check4C: ;check for c
add edx, 'x' ;adds x for b into new array
add esi, type array ;move esi down the array
mov eax, [esi] ;move esi into eax for next comparison
mov ebx, 'c' ;move c into ebx for comparison
cmp ebx, eax ;compare registers
je replace ;if the letter is matches c go to replace
add edx, eax ;store next letter of newArray in edx
add esi, type array ;move esi down the array
jmp doLoop ;go to the top of the loop
replace: ;replaces y for c
add edx, 'y' ;moves y into array instead of c
add esi, type array ;move esi down the array
jmp doLoop ;go to the top of the loop
main ENDP
END main