Two Steps Forward, One Step Back
Finally, I have video working on PikaPC, my PowerPC homebrew computer. I've adjusted my Forth Mandelbrot program to draw on screen instead of over the terminal. But surely I can do better, right?
One of the original goals of this project was to get the proper tools and development environment set up for writing PowerPC code, but I've spent all my time writing Forth code for it. It's time I set up a C compiler.
This would have been so much easier if I were running anything other than Windows on my main computer. Cygwin and MinGW never given me anything but trouble, and something is wrong with my WSL installation. So I was left to the mercy of whatever precompiled tool chain I could find.
The first result that came up for a PowerPC C compiler for Windows, a gcc build, was very broken. The preprocessor & compiler worked, but the assembler output was always empty. Not much use. Eventually I did find another that did work. It is missing some common libraries, but at least it will properly compile useable code.
With that sorted, I tried porting my integer Mandelbrot program from Forth to C. It did not work. I have no real debugging environment set up, and at this point couldn't even print to the terminal from C code, so it was really hard to have any idea what was going wrong.
I was however able to get it to work using the GCC built-in software floating point library. This worked great! It only took … 13 minutes to render. That is double the time the Forth program took to run. I know this machine can do better than that. Time to give fixed-point authentic another shot.
I tried. I really did. First I tried the easy decimal fixed point I used in Forth, where numbers are multiplied by 1000. I never could get it to work right. I don't think it's the best approach anyway; better to use binary fixed point.
For binary fixed point, a certain number of bits will be the integer component, and the rest will be the fractional component. Unlike floating point, there is no exponent. It's much simpler in that regard. I tried to figure it out myself, but ultimately pulled the code I needed from libfixmath.
Finally, success!
This new fixed-point C code is much faster than my Forth program. I knew this machine could do better.
But there is a problem. It was here last week and I missed it. The Trio64V+ video chip is supposed to be configured for 256 color mode (or 256 shades of grey, as that's how I've set up the color palette), so each byte written to the video buffer should be one pixel. What's actually being displayed is only 4 colors, and each byte affects two pixels. I'm going to have to dig back into the Trio64V+ manual to figure out what registers I've missed to get this into the correct color graphics mode.










