new version
authorTobias Girstmair <tobi@isticktoit.net>
Thu, 4 Mar 2021 12:44:52 +0000 (13:44 +0100)
committerTobias Girstmair <tobi@isticktoit.net>
Thu, 4 Mar 2021 12:44:52 +0000 (13:44 +0100)
bsv.c
fakeasm.h

diff --git a/bsv.c b/bsv.c
index 8bbde098019d84ea871c283435da22940106ee9b..d584e38eee165aa39e88f64ef9b4ade2094be26d 100644 (file)
--- a/bsv.c
+++ b/bsv.c
@@ -98,34 +98,20 @@ void main(void){
                MOV     (acc, i2)
                // shift-divide by ten
                // note: i2 is max 0x78; so acc will <= 12.
-                i2++;
-                acc >>= 1;
-                acc += i2;
-
-                acc >>= 1;
-                acc += 0;
-
-                acc >>= 1;
-                acc += 0;
-
-                acc >>= 1;
-                acc += i2;
-
-                acc >>= 1;
-                acc += i2;
-
-                acc >>= 1;
-                acc += 0;
-
-                acc >>= 1;
-                acc += 0;
-
-                acc >>= 1;
-                acc += 0;
-
-                acc >>= 1;
-                i2--;
-
+                INC    (i2)
+                SR     (acc)
+                ADD    (acc, i2)
+                SR     (acc)
+                SR     (acc)
+                SR     (acc)
+                ADD    (acc, i2)
+                SR     (acc)
+                ADD    (acc, i2)
+                SR     (acc)
+                SR     (acc)
+                SR     (acc)
+                SR     (acc)
+                DEC    (i2)
                // end divide by ten
                AND     (acc, tmp_1) // acc restored from tmp_1
                AND     (acc, 3)
index 5032674cc7f6880a8d4fcc902ae381c9349e2ec0..ff13be18762b80b621a14d0cf109cb9d7950854d 100644 (file)
--- a/fakeasm.h
+++ b/fakeasm.h
@@ -15,3 +15,4 @@ int flag_c = 0;
 #define XOR(dst, src)  dst ^= src; flag_z = (dst==0);
 #define SUB(dst, src)  flag_c = (src > dst); dst -= src; flag_z = (dst==0);
 #define XCH(dst)       acc ^= dst; dst ^= acc; acc ^= dst;
+#define DEC(dst)       dst -= 1; flag_c = flag_z = (dst==0);
Imprint / Impressum