How do I find out the amount of RAM I have?
To find out how much RAM you have in your Jupiter Ace enter the following :
15384 @ u.
15384 is the system variable (see Ace system variables
) that stores the first address past the last address in the RAM. The @
Forth word take an address from the stack, in the case our 15384
. It reads the value and places a copy on the stack (2-bytes). The U.
outputs to the screen a value from the stack unsigned with one trailing space.
16384 value means 3K Jupiter Ace ( 1K user RAM for Forth or Z80 programs)
32768 value means 19K Jupiter Ace (17K user RAM for Forth or Z80 programs)
49152 value means 35K Jupiter Ace (33K user RAM for Forth or Z80 programs)
0 value means 51K Jupiter Ace (49K user RAM for Forth or Z80 programs)
Where has the other 2K of RAM gone? I thought I had a 3K Jupiter Ace when I enter 15384 @ .U it reports back 16384.
Well, 1K is used up the characters, the other 1K is used up with the display memory
and PAD memory
How do I set the RAMTOP.
What's a RAMTOP? Its a marker which points to the last RAM address available for the FORTH dictionary. As you create FORTH words and add then to the dictionary RAM is used up which stores these new FORTH words up to the value held at the RAMTOP. The RAMTOP can be move down in memory reserving space above it for Z80 machine code routines.
Why would I need to move the RAMTOP and reserve the RAM? If you loaded machine code below the RAMTOP there is the possibility that your Z80 machine code routine could become corrupted. As your FORTH dictionary grows towards the RAMTOP and the return stack grows down towards the dictionary any thing in between will get over written. So by moving the RAMTOP to reserve RAM ensures you data above the RAMTOP will remain intact.
If an Ace has 35K of extra RAM installed you could set the RAMTOP to reserve 16384 bytes by entering the following:
32768 15384 ! QUIT
Sets the RAMTOP to 32768 reserving 16384 bytes QUIT
is needed because it clears the return stack and starts it off again at the address stored in RAM below the new RAMTOP address.
ZX BASIC has a command called CLEAR
which has a similar effect, CLEAR 30000 in ZXBASIC would reserve RAM from address 30000 onwards. You could define a word in AceForth for clear as
: CLEAR 15384 ! QUIT ;
then all that is needed is the address of the RAM that's to be reserved from , 30000 CLEAR