ARM Assembly, register not being set to 0?
<pre><code>start

read

    BL  getkey              ; read key from console
    CMP R0, #0x0D           ; while (key != CR)
    BEQ endRead             ; {
    BL  sendchar            ;   echo key back to console    

    CMP R0, #' '            ; if (ro = ' ')
    BNE nocount             ;{                          
    ADD R7, R7, #1          ; r7 += 1
    LDR R4, =0              ; r4 = 0
nocount                     ;}

    MOV R6, R0              ; Store input in R6
    SUB R6, R6, #'0'        ; Convert from decimal to hex
    MULS R4, R5, R4         ; If there is another input, multiply total by 10
    ADDS R4, R4, R6         ; Add the input to the total

    ADD R8, R4, R8          ;sum

    B   read    

endRead                 

end                     

stop    B   stop

    END 
</code></pre>

<p>Hi,
I'm trying to have my code so when there is a space entered into the console, 1 will be added to R7 and R4 will be set to 0.</p>

<p>When a space is added, R4 is set to 0xFFFFFFF0, but when I add '5' to this, I get 0xFFFFFFF65. I expect to just get 0x00000005. This is weird, because when I put the same command outside the compare, it works. Any help is appreciated, thanks.</p>

<p>Also I want r8 to be the sum of numbers entered, it doesn't seem to be working properly, can anyone tell me why?</p>