Relay Power Pi Machine

A late addendum, prompted by a nearby conversation: for this pi calculation we need two bignums, but it turns out that one gets bigger (longer) and the other one gets shorter, so by arranging them carefully, and having one big-endian and the other little-endian, we can cram them into pretty much the same memory. By this means we doubled the capacity, or the memory efficiency. And, by placing this workspace in video memory, we could visualise the sharing. Here’s the short video, and here’s a still:

You need the movement from the video to see the left and right ends of the two active bignums. With this 40 character wide screen, a single character row is 320 bytes, and as you see, the bignums in this case are 309 bytes long (max).

(On the BBC Micro, one can place data in screen RAM, as here, but it’s also possible to tweak the video chip config to place screen memory at the bottom of RAM instead of the top, and see zero page and stack activity. See this demo.)

2 Likes