;bug (?) in avra assembler reports word address of label, ; rather than byte address... that's why you'll see low(menu*2) rather ; than low(menu). if the bug gets fixed, the code will have to change .include "tn2313def.inc" .org 0 rjmp cold ; 0x0x2 ;board initialization stuff (cold start) cold: ldi r19, 0xDF out spl, r19 ;set stack pointer low byte ldi r19, 0 out spl + 1, r19 ;stack pointer high byte ; sbi ucsrb, rxcie ;enable interrupt on RX complete ; sei ;enable interrupts ldi r19, 0xFF ;set PORTB to all outputs out ddrb, r19 cold2: sbi ucsrb, txen sbi ucsrb, rxen ldi r19, 51 ;9600 baud out ubrrl, r19 warm: rcall chrin ;get selection rcall chrout ;echo it back cpi r21, '0' breq off cpi r21, '1' breq on rjmp warm chrout: sbis ucsra, udre ;wait for port ready (data register empty) rjmp chrout out udr, r21 ;send character out port 12 (RS232) ret chrin: sbis ucsra, rxc ;wait for port ready (receive complete) rjmp chrin in r21, udr ret on: sbi portb, portb0 rjmp warm off: cbi portb, portb0 rjmp warm