Frank Steinberg - 2012-11-11

It's me again :D

… found a little bug when using the 0bxxxxxxxx notation for constants. It seems that it happens, when a variable- or a register name ends with "0b".

A simple workaround is to use the b'xxxxxxxx' notation instead.

This ist the (simpified) code:

#chip tiny2313, 1
Var0 = 0b00001111
Var0B = 0b00001111
TCCR0A = 0b00000111
TCCR0B = 0b00000111

And this is the generated asm:

;Set aside memory locations for variables
.EQU    0B00000111=96            <- recocnized as variable
.EQU    0B00001111=97            <- not as binary constant
.EQU    VAR0=98
.EQU    VAR0B=99
...
;Var0 = 0b00001111             <- GCB Source
    ldi SysValueCopy,15          <- 15 = o.k.
    sts VAR0,SysValueCopy
;Var0B = 0b00001111            <- variable-name ends with 0b
    lds SysValueCopy,0B00001111  <- oops
    sts VAR0B,SysValueCopy
;TCCR0A = 0b00000111
    ldi SysValueCopy,7           <- 7 = o.k.
    out TCCR0A,SysValueCopy
;TCCR0B = 0b00000111           <- register-name (AVR) ends with 0b
    lds SysValueCopy,0B00000111  <- oops
    out TCCR0B,SysValueCopy
...

Maybe it's helpful for someone or (better) can be fixed in the future.
_________________________
Steini