m820241130005rs232transmit.asm

; (C) David Vajda
; 2024-11-30
; RS232/v.24/recieve - Atmega8

.include "m8def.inc"

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

ldi r16, 0xff
out DDRB, 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 << RXEN)
out UCSRB, r16

rcall v24recieve

v24recieve:
sbis UCSRA, RXC
rjmp v24recieve
in r16, UDR
out PORTB, r16
rjmp v24recieve