ZX-81 Hi-Res

Date: 30 Jan 1996 04:33:21 -0800 T.Swenson
Tanita Plaskow <[e-mail address omitted]> wrote:
Matt Barber ([e-mail address omitted]) wrote:
: >From the ZX81 FAQ (Frequently Asked Questions):

I just downloaded this from your home page – many thanks:)

Q: Could you get Hi-Res graphics on a ZX81?

A: Yes. There were a number of ways.

1. The Z80’s i register pointed to a font table.

Q: I must confess my ignorance of Z80 and ask how the pointer was limited to 16k? Was it an 8-bit value that was multiplied by decimal 64, or a sixteen bit value with the two highest bits ignored?

A: It is the later.

Use the following example program to see exactly how it works:

10  REM HIRES DEMO
20 POKE 25000,58
30 POKE 25001,12
40 POKE 25002,98
50 POKE 25003,237
60 POKE 25004,71
70 POKE 25005,201
80 FOR G=0 TO 63
90 PRINT CHR$ G;
100 NEXT G
110 FOR F=0 TO 31
120 POKE 25100,F
130 LET A=USR 25000
140 PAUSE 4E4
150 NEXT F
160 POKE 25100,30
170 LET A=USR 25000

This cycles the i register through all possible values in the 8K ROM. Leave out line 140 for a nice swirly effect. Great for crashes and explosions in games. 🙂

2. CRL released a HI-Res graphics toolkit. This contained an extremely hairy interrupt routine that replaced the ZX81’s usual display update routine. Basically, it pointed the I register to a strategic ROM location, and tried to ‘best fit’ the HRG display to what it could find in those locations. It also used a feature of the ZX81’s hardware that allowed you to have 1 pixel height characters to improve its chances.

Q: So the screen is still viewed as a character map here with eight times as many lines/bytes as normal?

A: Yes. Just to unnecessarily complicate things, you could get more than 192 lines, if you overscanned the display into the bottom border. 🙂

Q: This would mean you needed 32*24*8 bytes = 6K of memory for the actual screen, assuming it is read from contiguous locations.

A: Yes. That’s exactly the same as what be ZX Spectrum uses, (plus 768 byes for the attributes, of course).

Q: I wonder if there was also a separate 6k map of the *intended* screen, with values from here being compared to the font table to find the best fit that was available? Somehow I doubt it, as that’s 12K of memory gone, so the real thing must be even more fiendish –

A: You could do it that way, but I think that programs usually generate the display a character square at a time, and then look-up the best fit. There’s no point in wasting all that RAM, when there’s so little to play with, anyway.

The memory requirements of a Hi-Res program on a ZX81 are similar to those of Spectrum game. The Hi-Res routine and the 6K display file leaves you with about as much free RAM to play around with as there is an a 16K Spectrum so, excepting the difference in speed, similar results are possible.

I will take a couple of headache tablets quickly before someone replies;)

Matt Barber
University Of Greenwich

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.