Kits
QRP Labs |
Other Radio Topics
Frequency Counters
Electronics
Guest Project Gallery
ZX81 Mandelbrot |
Written by Hans Summers |
Friday, 31 December 2010 10:21 |
Around the time of my Acorn Electron ownership, my Grandfather gave me his ZX81, having upgraded to a Sinclair ZX Spectrum. The ZX81 is a tiny home computer that came out in 1981 or thereabouts. It has a Z80 processor, a membrane keyboard, 1K of RAM and runs BASIC from its ROM. The screen is a text-only display, with 32 horizontal characters in 24 lines, the bottom two lines are used for error messages and so on. The character set also includes graphics characters, each character can be a 2 x 2 pixel grid such that the display can also display primitive black and white graphics, on a 64 x 48 pixel grid. The Mandelbrot set to the right here was produced on a java ZX81 emulator by Jeff Vavasour. It is a BASIC program using the ZX81 graphics characters to draw a 64 x 44 pixel Mandelbrot set (leaving the lower two rows for BASIC messages). It takes 22 minutes to produce this picture. You can run this program yourself (as long as you are running a java-enabled browser) by visiting this page in Jeff's ZX81 software library. The basic ZX81 machine could be upgraded by addition of a 16K RAM pack, and a small thermal printer could also be connected. I upgraded my own ZX81 with 32K of RAM, which was on an old computer board. I obtained a real keyboard, and interfaced it to the ZX81. I had a 2'nd hand Alphacom 32 thermal printer purchased from a computer shop in Brighton. The printout paper is only 4 inches wide (12cm or so) if I recall correctly. It printed quite quickly with a rattling noise as the print heads oscillated back and forth. So all in all I had quite an enhanced ZX81. This was the first time I had a computer with a printer, so I would be able to obtain hard copies of Mandelbrot sets, to put on my bedroom wall. But the ZX81 didn't do graphics (at least, it did but only in a 64 x 48 pixel resolution). This problem was somewhat solved when I happened to come across a magasine article describing a short machine code program which got the ZX81 to pretend to the printer that it could display graphics. The program sent the right data to the printer to draw a block of black and white pixels corresponding to one row of the ZX81 display. This block had 256 x 8 pixels. By repeatedly writing the pixels to the right area of memory and calling this machine code, it was possible to build up a mandelbrot image on the Alphacom printer. The ZX81 has a FAST mode, which is some 3 or 4 times quicker than the normal mode. In FAST more, the ZX81 doesn't attempt to maintain the screen display, which was fine in this case since there's no screen display anyway. So I wrote a Mandelbrot program in ZX81 basic, which sent its output to the printer. The resulting image was 256 x 256 pixels square, printed out it was sized about 12 cm square. Wanting more, I decided to create a huge image of the mandelbrot set by producing 16 of these printouts and sticking them together in a large 48 cm square image, containing 1024 x 1024 pixels. In fact, each vertical section of the 4 x 4 screens could be printed in one continuous strip, 256 pixels wide and 1024 high. The program was modified accordingly to produce these enlargements. Eventually I had 4 of these strips and glued them to a piece of card, which graced my bedroom wall until several years later. To produce this giant (relatively "giant"!) Mandelbrot picture, containing a total of 1,048,576 pixels took the ZX81 one week, running 24 hours a day in the FAST mode. Every 30 minutes or so, one "line" was printed (256 x 8 pixels). So for that whole week every waking moment of my life (while not at school) as well as every sleeping moment was punctuated by the rattle of the printer, lasting a few seconds every 30 minutes. Yes, somehow I even learnt to sleep through that racket. Below see photos of my modifiied ZX81, and an original.
|
Last Updated on Friday, 31 December 2010 10:30 |