Translating while Statements to AVR


while (condition) {
    statements
}

Translates to this AVR:


start:
    # code for condition ->  R2
    AND R2,R2  ; set Z bit of status register
    BRBC 1, end
    # code for while loop body
    LDI    r31, hi8(pm(start))  
    LDI    r30, lo8(pm(start))
    IJMP
end:

Index