From ad2623d8c4bc51638343ae9a628f8647ff558155 Mon Sep 17 00:00:00 2001 From: Thomas Albers Date: Mon, 14 Aug 2023 10:47:54 +0200 Subject: Initial commit --- template/template.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 template/template.c (limited to 'template/template.c') diff --git a/template/template.c b/template/template.c new file mode 100644 index 0000000..8237d68 --- /dev/null +++ b/template/template.c @@ -0,0 +1,30 @@ +#define CPU_FREQ 1843200 + +__sfr __at 0x30 sio_a_data; +__sfr __at 0x31 sio_b_data; +__sfr __at 0x32 sio_a_ctrl; +__sfr __at 0x33 sio_b_ctrl; + +void putchar(char c) +{ + unsigned char ctrl = 0; + + sio_a_data = c; + + while (!(ctrl & 0x04)) { + sio_a_ctrl = ctrl; + ctrl = sio_a_ctrl; + } +} + +void print(const char *str) +{ + for (; *str; str++) + putchar(*str); +} + +int main() +{ + print("Hello World from C"); + return 0; +} -- cgit v1.2.3