m820241125005RS232Transmit.asm

Image Screenshot_20241125_034831

Image Screenshot_20241125_034838


; 2024-11-25
; RS232 - Transmit

.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

again:
ldi r16, 'd'
rcall rs232_transmit
ldi r16, 'a'
rcall rs232_transmit
ldi r16, 'v'
rcall rs232_transmit
ldi r16, 'i'
rcall rs232_transmit
ldi r16, 'd'
rcall rs232_transmit
ldi r16, '@'
rcall rs232_transmit
ldi r16, 'h'
rcall rs232_transmit
ldi r16, 't'
rcall rs232_transmit
ldi r16, 't'
rcall rs232_transmit
ldi r16, 'p'
rcall rs232_transmit
ldi r16, 's'
rcall rs232_transmit
ldi r16, ':'
rcall rs232_transmit
ldi r16, '/'
rcall rs232_transmit
ldi r16, '/'
rcall rs232_transmit
ldi r16, 'w'
rcall rs232_transmit
ldi r16, 'w'
rcall rs232_transmit
ldi r16, 'w'
rcall rs232_transmit
ldi r16, '.'
rcall rs232_transmit
ldi r16, 'i'
rcall rs232_transmit
ldi r16, 't'
rcall rs232_transmit
ldi r16, 'u'
rcall rs232_transmit
ldi r16, 'e'
rcall rs232_transmit
ldi r16, 'n'
rcall rs232_transmit
ldi r16, 'i'
rcall rs232_transmit
ldi r16, 'x'
rcall rs232_transmit
ldi r16, '.'
rcall rs232_transmit
ldi r16, 'd'
rcall rs232_transmit
ldi r16, 'e'
rcall rs232_transmit
ldi r16, 10
rcall rs232_transmit
ldi r16, 13
rcall rs232_transmit
rjmp again

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