diff options
author | Thomas Albers <thomas@thomaslabs.org> | 2023-08-14 10:47:54 +0200 |
---|---|---|
committer | Thomas Albers <thomas@thomaslabs.org> | 2023-08-14 10:47:54 +0200 |
commit | ad2623d8c4bc51638343ae9a628f8647ff558155 (patch) | |
tree | d41e8390824e6fee4c02eb044c7f5acb94b478bf /template/template.c |
Diffstat (limited to 'template/template.c')
-rw-r--r-- | template/template.c | 30 |
1 files changed, 30 insertions, 0 deletions
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; +} |