; 99 bottles of beer on the wall for Atmel AVR 8-bit MCU with USART, LPM-Command ; ; written by Michael Strosche ; http://www.roboter-projekte.de ; ; tested on ATMega32 @ 16 MHz .include("m32def.inc") ; 9600 Baud @ 16 MHz .equ BAUD = 0x0067 .org 0x0000 rjmp init .org 0x002A init: ; init stackpointer ldi r16, LOW (RAMEND) out SPL, r16 ldi r16, HIGH(RAMEND) out SPH, r16 ; init usart ldi r16, HIGH(BAUD) out UBRRH,r16 ldi r16, LOW (BAUD) out UBRRL,r16 ; enable transmitter ldi r16, (1< 's', else => '' cpi r17, 1 breq plural__only_one ldi r16, 's' rcall put_char plural__only_one: ret txt0: .db " bottle", 0x00 txt1: .db " of beer on the wall, ", 0x00 txt2: .db " of beer.", 0x0a, "Take one down and pass it around, ", 0x00 txt3: .db " of beer on the wall.", 0x0a, 0x0a, 0x00 nomore: .db "no more", 0x00 nomore_txt0: .db "No more bottles of beer on the wall, ", 0x00 nomore_txt1: .db " of beer. ", 0x0a, "Go to the store and buy some more, ", 0x00