G007 Memory

The information here may be useful to machine code programmers. The layout of the high-res display file and the variables used by the high-res graphics routines are described.

The entry points of some of the most useful routines are given, together with the addresses of areas of RAM that are available for storing machine code.

The G007 modifies the ZX81 memory map in several ways. Firstly, the decoding disables all the 'aliases' of the 8K BASIC ROM, so that it only appears once, in the bottom 8K. The 2K G007 ROM appears at 10K to 12K. The ZX81's on-board RAM is re-mapped to the 2K block at 8K to 10K. It appears twice if it is a 1K device, and the G007 only accesses the lower 1K. If it is a 2K device, you are free to use the upper 1K for your own purposes. The G007 uses the lower 1K for graphics variables, including the table of user definable characters.

The Display File

This is stored in a BASIC program line at the end of the program area. It is set up when needed, and moves around in memory as BASIC lines are added or deleted. The ZX81 ignores this line, because the line number is immediately followed by two "NEWLINE" characters.

The display file is laid out straightforwardly. Each row of pixels is mapped onto 34 consecutive bytes in the display file. In each byte, the most significant pixel is the leftmost pixel. Note the display is actually 272 pixels across, but the last two bytes (16 pixels) are normally kept blank. This keeps the display central, and the graphics routines simple. Rows follow straight on from one another, from top to bottom of the display. There are no "NEWLINE" characters at the end of each row.

RAM: 0x2000 to 0x23FF

ROM: 0x2800 to 0x2FFF