INCLUDE Irvine32.inc
.data
fullName BYTE "Bob Johnson",0
nameSize = ($ - fullName) - 2
.code
main PROC
mov ECX,nameSize
mov ESI,OFFSET fullName
Sum:
mov EBX,[ESI+ECX]
add EAX,EBX
loop Sum
exit
main ENDP
END main
So I am having an issue I just want to read one character from the string at a time and store it in EBX register then take the value of that character and keep a running sum in EAX.
Add together all of the ASCII codes of the characters of the string, using 8-bit unsigned arithmetic. Overflow is ignored. The final value is the checksum. For example, if the string is "Joe", then the ASCII values are 4A, 6F, 65. The sum is 11E.
INCLUDE Irvine32.inc
.data
fullName BYTE "Bob Johnson",0 ; String storing name
nameSize = ($ - fullName) ; Variable storing length of name
.code
main PROC
mov ECX,nameSize ; Set counter for loop
mov ESI,OFFSET fullName ; Set pointer at fullName variable
mov EAX,0 ; Clear the EAX register
mov EBX,0 ; Clear the EBX register
Sum: ; Loop
mov bl,[ESI + ECX - 1] ; Use the bl (8 bit register) to point at characters in the string.
add EAX,EBX ; Add the two registers together
loop Sum ; Loop
call DumpRegs ; Display results
exit
main ENDP
END main
SOLVED WOOT!!