m820241127004RS232TxD.asm


; (C) David Vajda
; RS232, 2400 Bd, Transmit, USART, Atmega8
; 2024-11-27

.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16

ldi r16, HIGH (25)
out UBRRH, r16
ldi r16, LOW (25)
out UBRRL, r16

ldi r16, (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0)
out UCSRC, r16

ldi r16, (1 << TXEN)
out UCSRB, r16

loop1:
ldi r16, 'c'
rcall rs232transmit
ldi r16, 'd'
rcall rs232transmit
ldi r16, 'e'
rcall rs232transmit
ldi r16, 'f'
rcall rs232transmit
ldi r16, 'g'
rcall rs232transmit
ldi r16, 'a'
rcall rs232transmit
ldi r16, 'h'
rcall rs232transmit
ldi r16, 'c'
rcall rs232transmit
ldi r16, '@'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, 'w'
rcall rs232transmit
ldi r16, '.'
rcall rs232transmit
ldi r16, 'i'
rcall rs232transmit
ldi r16, 't'
rcall rs232transmit
ldi r16, 'u'
rcall rs232transmit
ldi r16, 'e'
rcall rs232transmit
ldi r16, 'n'
rcall rs232transmit
ldi r16, 'i'
rcall rs232transmit
ldi r16, 'x'
rcall rs232transmit
ldi r16, '.'
rcall rs232transmit
ldi r16, 'd'
rcall rs232transmit
ldi r16, 'e'
rcall rs232transmit
ldi r16, 10
rcall rs232transmit
ldi r16, 13
rcall rs232transmit
rjmp loop1

rs232transmit:
sbis UCSRA, UDRE
rjmp rs232transmit
out UDR, r16
ret