How to Change RAMTOP, Part 1

See all articles from The Plotter v2 n3
Author(s): Dick Wagner
Publication: The Plotter
Pub Details: The Plotter v2 n3 (Volume 2, Issue 3)
Date: March 1984
Pages: 5

(NOTE: Part two will be printed next month)

Part one is the blind faith part of this article, part two will be a discusson on the background used for part one.

certain programs call for RAMTOP to be lowered, sometimes by a certain number of bytes. I recently ran into this problem, so I decided that it was something that I had to know more about.

With 16K of memory, our computers have a RAMTOP address of 32767. Computers with 2K of memory have an address of 18432 for RAMTOP. The 1K RAM in the ZX81 has a RAMTOP address of 17408.

The following direct command will ask the computer for the RAMTOP address in your computer:

PRINT PEEK 16388+256*PEEK 16389

The easiest method to lower RAMTOP is based on using increments of 256 to determine the amount of memory to leave above RAMTOP. Consider that 4*256=1024=1K and 256=1/4K. With this method 2 numbers must be POKEd as in:

POKE 16388,0 (0=increments of
              256)
POKE 16389,N (N=128 for an add-
              ress of 32767)

Where N is number based on this table:

  K     N     DIFF. FROM 128
 1/4   127         1
 1/2   126         2
  1    124         4
  2    120         8
  4    112        16
  8     96        32
 16     64        64

Select the number N determined by this table of values, where K is the amount to lower RAMTOP.

I suggest that you copy this table on a card along with the following example on a card for future reference, or put a copy in your computer notebook.

EXAMPLE:

   Lower RAMTOP 2500 or 2 1/2K

     2K = 8
   1/2K= 2
   ------
       10

     N=128-10=118
 or  N=120(2K)-2(1/2K)=118

Now: POKE 16388,0
     ENTER
     POKE 16389,118
     ENTER
     NEW
     ENTER

Blind faith now says that RAMTOP= 32768-2 1/2*1024=30208. If you question faith then check your work with:

PRINT PEEK 16388+256*PEEK 16389

NOTE: While POKE will accept either the 16388,0 first, or the 16389,118 first, the PEEKs MUST be in the order shown.

TILL NEXT TIME–
KEEP ON
PEEKing and POKEing>>>*