So What Techncial Notes

Call Box
Allocating Direct Pages

Written by: William Stephens - February 9,1990

This technical note describes how to allocate direct pages needed by some tools and for your own applications use.

Direct pages are 256 bytes long and reside in bank zero of your IIgs. These pages are page aligned (starting on page boundaries ie: 0,256,512,768. .. ). Some tools require a direct page for their own use and some require more than one yet others require none ... refer to the Tool Box Reference Manuals for the exact information on the tool you wish to use. Usually in Call Box BASIC you will not need to worry about this but when you wish to use tools not directly supported by the BASIC driver then you must take matters into your own hands and allocate your own memory.

Allocating direct pages under Call Box is quite simple but requires a machine code patch to call ProDOS 8 for some space. This patch can be installed by using the BigPOKE command.

As an example let's put the patch in a rarely used area of the input buffer at $2CO (704).

20 CALL PO,4,704,$F52001A9 : CALL PO,2,708,$60BE

The first call installs 4 bytes and the second call installs another 2 bytes for a total of 6 bytes. The 01 part of the hexidecimal number in the first call is the number of pages you wish to allocate ... if this is changed to 03 for example then 3 direct pages will be allocated. To actually do the allocation you need to call this patch.

CALL 704

The next thing you need to do is inform Call Box about this allocation by incrementing the direct page size by the amount of direct pages you have allocated.

A = PEEK(PO+244) : A = A + 1 : POKE PO+244,A

The last thing you need to do is pass the address of your global page back to your program so you have a record of where it is. This is accomplished by multiplying the current page count by 256 and subtracting it from the Call Box BASIC global page address:

A = PO - (A*256)

Direct page de-allocation should be performed by Call QF and should not be attempted on your own. You really have to know what you are doing to make this type of thing happen.

Further Reference
Call Box BASIC Manual V2.0

Call Box - So What Software 10221 Slater Ave. Suite 103 Fountain Valley, CA. 92708