possible bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

possible bug?

kostya3312
Hi
In my program from ch4 (R0*R1=R2) assembler sets strange address 17 instead label LOOP (address must be 6) ...

    @R1
    D=M
    @i
    M=D
    @R2
    M=0
(lOOP)    <--- label must refer to 6        
    @i
    D=M
    @END
    D;JEQ
    @R0
    D=M
    @R2
    M=M+D
    @i
    M=M-1
    @LOOP  <----- but in assembler i see here 0000000000010001, i.e. 17 (???)
    0;JMP
(END)
    @END
    0;JMP
Reply | Threaded
Open this post in threaded view
|

Re: possible bug?

cadet1620
Administrator
Symbols in Hack are case sensitive.

Your label (lOOP) starts with lowercase but @LOOP starts with upper case.
Since there is no (LOOP) in the program, the assembler allocates a new RAM variable for LOOP giving it RAM address 17.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: possible bug?

kostya3312
Oh, thanks a lot! I was inattentive.