new version
authorTobias Girstmair <t@thi3nkpad.lan>
Mon, 12 Nov 2018 23:39:21 +0000 (00:39 +0100)
committerTobias Girstmair <t@thi3nkpad.lan>
Mon, 12 Nov 2018 23:39:21 +0000 (00:39 +0100)
foo.c

diff --git a/foo.c b/foo.c
index 3acf09c246b9558d25d23319123ddad2d62bba8c..6d2d885648ed25c5b00c02e20bef055482af7f64 100644 (file)
--- a/foo.c
+++ b/foo.c
@@ -35,6 +35,7 @@ int main(void) {
        unsigned short n;
        unsigned short s;
        u8 acc;
+       //TODO: clear all vars/registers
        for (;;) {
                acc = 0;
                n = i >> 14;
@@ -70,9 +71,11 @@ int main(void) {
 
                putchar(acc<<4);
                i++;
-               i0 = i;
-               i1 = i>>8;
-               i2 = i>>16;
-               i3 = i>>24;
+               #define tmp acc
+               LDI     (tmp, 0)
+               SUBI    (i0, -1)
+               ADC     (i1, tmp, !i0)
+               ADC     (i2, tmp, !i0&&!i1)
+               ADC     (i3, tmp, !i0&&!i1&&!i2)
        }
 }
Imprint / Impressum