Monday, 11 January 2016

Testing the arithmetic routines ....

Of course, we all love maths tests…..

I tested the arithmetic  - primarily multiply and divide a bit bluntly – putting sums in and comparing answers.

I thought this wasn’t good enough, so I wrote a program that resides in the machine’s RAM at $C40 that repeatedly tested multiply or divide against a set of inputs and outputs (including remainder for division).

I then created a little python script which generated the result. With a little bit of tweaking it worked ; there are issues with –ve numbers.

What I do is remove the signs, do integer division, and then put the sign back if the input signs are different. Python does it slightly differently ; it seems to depend whether you round the result down (on the number line) or round it back to zero. But I’m quite happy with my algorithm, and it passed several hundred tests with flying colours.

So the last two monitor bits are going to be ASCII to decimal conversion, and a Galois LFSR to generate some nice random numbers. This should fit (if necessary there are bytes that can be chopped).

No comments:

Post a Comment