Table of Contents

PCLEAR 0

At boot, Extended Color BASIC reserves 4 x 1.5KB “graphics pages” totalling 6KB.

The PCLEAR command lets you reserve more graphics pages for BASIC if needed.

But if you are not using graphics pages, you may want to reclaim that memory for more code and data.

Unfortuantely, the PCLEAR 0 command historically has a bug that prevented you from freeing all of the reserved graphics pages.

If you need to free everything possible here's how to manually “PCLEAR 0”.

The procedure is different for a Tape-only Extended Color BASIC system than a Disk Extended Color BASIC system.

The Disk system requires more lower BASIC memory for disk buffers which you should not free if your intend for the disk to work correctly.

DON'T CLEAR 0

In the examples, I also show CLEAR 0 commands to free up the usual 200 bytes of reserved temporary string space.

This is just to show how high you can go and the CLEAR 0 should not be used for normal programming.

COLOR BASIC / EXTENDED COLOR BASIC

This frees up RAM starting at address $0600 (1536).

PRINT MEM
 24871
OK
POKE25,6:POKE26,1:POKE1536,0:NEW
OK
PRINT MEM
 31015
OK
CLEAR 0
OK
PRINT MEM
 31215
OK

How this works:
Memory Locations 25 and 26 are used by BASIC together to form the 16-bit address for TXTTAB - the start of the BASIC program “text” or code.
The address poked into location 25 is multipled by 256 and then the content of location 26 is added to become the start address of where your BASIC programs are loaded or stored in memory.
So, 256 * 6 + 1 = 1537.
Color BASIC starts how it stores BASIC lines in memory using a zero, so we poke a 0 into location 1536 to simulate BASIC's setup.

DISK EXTENDED COLOR BASIC

The procedure is the same for a Disk system, we just move the start address from $0600 (1536) up to $0E00 (3584) to leave room for the Disk BASIC buffers.

PRINT MEM
 22823
OK
POKE 25,14:POKE26,1:POKE3584,0:NEW
OK
PRINTMEM
 28967
OK
CLEAR 0
OK
PRINT MEM
 29167
OK

RTS

Return to Tandy Color Computer