(NOTE: Part one was in last month’s newsletter)
The general procedure for lowering RAMTOP in increments of 1/4k (256) was given in Part 1. Here is the reasoning for those who like more than blind faith.
The Sinclair memery system includes a variable upper limit called RAMTOP. When the computer first powers up, the microprocessor, mp, inputs a binary number 2 into each memory cell, or address, in the RAM. Then the mp interrogates each address. When it finds an address without a binary 2, mp calls this the top limit of memory. This information is stored in dedicated memory addresses 16388 and 16389. This information can only be changed by actually changing the address of RAMTOP.
Part 1 gave this direct command to determine the present RAMTOP address:
PRINT PEEK 16389*256+PEEK 16388
This command will cause the address to be printed at 0,0 and will be applicable to your computer memory capacity. If the numbers are smaller than those given in Part 1 either there is a defective memory cell or RAMTOP has already been lowered. To return RAMTOP to standard 32767 address:
POKE 16388,0
POKE 16389,128
change 128 to 72 for 2k of memory. To confirm the address PEEK again.
The address 16388 is filled with 8 zeros in binary. If there are 8 then something is left over for address 16389. If there is only one bit over then it must be 256 as 2 to the 8 power equals 256, and the number to input into 16389 would be 1.
You may notice a RAMTOP address variation such as 32767 or 32768. 32767 is the actual address but to be above by 1 we use 32768. The following formula takes this into account:
POKE 16389, INT ((32768-mk)/256)
POKE 16388,(32768-mk)-256*INT ((32768-mk)/256)
where mk is the amount of memory we wish to store above RAMTOP and is not abreviated as 2 1/2k (use 2500), etc. This formula will work only for 16k of memory so substitute if necessary. As mentioned at first 16389 & 16388 do not vary, only the record in them varies.
The computer is not particular about the two addressed locations being POKED in special order as either 16388 or 16389 can be first.