BASIC high memory limit?
-
- Posts: 17
- Joined: Tue Mar 12, 2024 3:12 am
BASIC high memory limit?
Is it possible to tell the BASIC interpreter to use a maximum high address for variable storage? (like the Applesoft HIMEM:) I'd like to unit test some assembly modules that use this same area of memory for its own storage and not clash
Re: BASIC high memory limit?
Yes, there's a way to set MEMTOP... I just don't remember how to do it. Let me check with @MooingLemur, who would know the answer to that one.
Re: BASIC high memory limit?
10 POKE$30F,1:SYS$FF99
20 Y=$8C:X=$00
30 POKE$30D,X:POKE$30E,Y:POKE$30F,0:SYS$FF99
40 CLR
So the way this works: the MEMTOP function in KERNAL serves to both read and set the top of BASIC, as well as to set the number of available RAM banks. (64 or 256, depending on whether you have 512K or 2MB of extended RAM.)
Calling MEMTOP with the Carry flag set reads the values. Calling MEMTOP with the Carry flag clear sets the values.
So the process is to:
0 PRINT FRE(0) 50 PRINT FRE(0)
So the way this works: the MEMTOP function in KERNAL serves to both read and set the top of BASIC, as well as to set the number of available RAM banks. (64 or 256, depending on whether you have 512K or 2MB of extended RAM.)
Calling MEMTOP with the Carry flag set reads the values. Calling MEMTOP with the Carry flag clear sets the values.
So the process is to:
- Read the values
- Alter the top of BASIC (X and Y)
- Write them back
0 PRINT FRE(0) 50 PRINT FRE(0)
Re: BASIC high memory limit?
Also... lay out your memory the way you want to... but you should know, if you don't already, that the area from $0400 to $07FF is unused by the system (and is not needed for the memory map of the text screen like it was on the C64, because that's stored in VERA's own screen RAM), so could be used for up to 1KB of assembly code, binary variables, etc.
-
- Posts: 17
- Joined: Tue Mar 12, 2024 3:12 am
Re: BASIC high memory limit?
Thanks, in the time since I posted I found MEMTOP, but found creating a new variable and querying POINTER on it still shows an address above, yet fre(0) does reflect the new memtop setting. Even if I new NEW or CLR first.
Setting memtop=$7fff, if that matters.
Setting memtop=$7fff, if that matters.
-
- Posts: 17
- Joined: Tue Mar 12, 2024 3:12 am
Re: BASIC high memory limit?
Found my issue: using load "file",8,1 to an address above memtop leaves things in a very strange state. If I load my binaries and then set memtop, I appear OK
-
- Posts: 17
- Joined: Tue Mar 12, 2024 3:12 am
Re: BASIC high memory limit?
..and of course it would! I was stupidly unaware using ,1 still messes with BASICs internal pointers. So the variable space is left above the end of the loading, thus loading above memtop would do strange things.
- ahenry3068
- Posts: 1145
- Joined: Tue Apr 04, 2023 9:57 pm
Re: BASIC high memory limit?
It's ok to use BLOAD above memtop. I usually use BLOAD if I'm loading binary assets.PaulForgey wrote: ↑Tue Mar 12, 2024 8:56 pm ..and of course it would! I was stupidly unaware using ,1 still messes with BASICs internal pointers. So the variable space is left above the end of the loading, thus loading above memtop would do strange things.
Re: BASIC high memory limit?
Yeah, you want to use BLOAD to load your ML routines. When you assemble them, assemble them as .BIN files without the 2 byte address pointer.