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

diff --git a/bsv.c b/bsv.c
index 6cd20ac359934f0573153bb87b3feaa7a250c9bd..dd971ab70b5cc5f3291498ffcd1532ee300c5012 100644 (file)
--- a/bsv.c
+++ b/bsv.c
@@ -13,6 +13,11 @@ u8 notes[] = {
        0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58
 };
 
+u8 mod3hi, mod3lo;
+void mod3(void) {
+       acc = (mod3hi<<8|mod3lo) % 3;
+}
+
 void g(void){
        u8 notes_ix = acc & 0x7;
        if(3&i2)
@@ -60,11 +65,11 @@ void main(void){
                AND     (acc, 3)
                ADD     (sample, acc)
 
-               { u8 tmp2 = (i2<<5|i1>>3)%3;//TODO
-               MOV     (acc, tmp2)
+               mod3hi = i2>>3;
+               mod3lo = i2<<5|i1>>3;
+               mod3();
                ADD     (acc, n)
                CALL    (g)
-               } //tmp2
                SR      (acc)
                SR      (acc)
                MOV     (tmp_1, acc) // acc saved in tmp_1; fresh acc
@@ -89,7 +94,7 @@ void main(void){
 
                MOV     (acc, n)
                ADD     (acc, 8)
-               { u8 tmp3 = (i2<<6|i1>>2)%3;
+               { u8 tmp3 = ((i2<<6|i1>>2)&0x1fff)%3;
                  SUB   (acc, tmp3)
                } // tmp3
                CALL    (g)
Imprint / Impressum