z80: uart echo test program (SDCC)
[z80.git] / z80 / uart / main.c
1
2 #include <stdio.h>
3
4 __sfr __at 0x10 uart_data;
5 __sfr __at 0x11 uart_rxfill;
6
7 void putchar(char c) {
8         uart_data = c;
9 }
10
11 void main(void)
12 {
13         char rx;
14
15         char hello[] = "Hallo, Welt!\n";
16
17         printf("%s", hello);
18
19         while(1) {
20                 if(uart_rxfill) {
21                         rx = uart_data;
22                         printf("%c", rx);
23                 }
24         }
25
26         while(1);
27 }