From 2ae98f0b3db825606a7ecfdb4cf3e9ea6c6dbbce Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Thu, 4 Mar 2021 13:27:09 +0100 Subject: [PATCH] new version div6 was prototyped with this program: typedef unsigned char u8; int main(void) { for (int i = 0; i <= 0x78; i++) { u8 real = i/6; u8 test = i; test >>= 1; test += i; test >>= 1; test += 0; test >>= 1; test += i; test >>= 1; test += 0; test >>= 1; test += i; test >>= 1; test += 0; test >>= 1; test >>= 1; if (test != real) printf ("%hhd/6 == %hhd != %hhd\n", i, real, test); } return 0; } --- bsv.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/bsv.c b/bsv.c index 8109501..8ce4b42 100644 --- a/bsv.c +++ b/bsv.c @@ -70,31 +70,18 @@ void main(void){ MOV (tmp_1, acc) // acc saved in tmp_1; fresh acc MOV (acc, i2) // shift-divide by six - // note: i2 is max 0x78; so acc will <= 20. - + // note: i2 is max 0x78; so acc will <= 20. (breaks vor values >=128) SR (acc) ADD (acc, i2) - SR (acc) - //ADD acc, 0 - SR (acc) ADD (acc, i2) - SR (acc) - //ADD acc, 0 - SR (acc) ADD (acc, i2) - SR (acc) - //ADD acc, 0 - SR (acc) - //ADD acc, 0 SR (acc) - //ADD acc, 0 - // end divide by six AND (acc, tmp_1) // acc restored from tmp_1 AND (acc, 3) -- 2.39.3