I don't know if I am just going a bit potty, but...
I have noticed a problem in SMSQ/E with ALCHP, where LOAD will corrupt the allocated space.
Start SMSQ/E (I'm using QPC2 as an example)
type x=ALCHP(12000), then PRINT HEX$(x,32) and make a note of the address.
In my case it returned $00140404
type PRINT PEEK_L($140404), returns 0 as expected. PRINT PEEK_L($140408) also returns 0 as expected.
LOAD a BASIC program, I don't know if size is important, but I used one about 8K long.
Now do the two PEEK's again. The allocated space has been corrupted!
ALCHP and LOAD problem
Re: ALCHP and LOAD problem
That is actually intentional.
I think ALLOCATION from Turbo toolkit provides memory that survives NEW and LOAD.
Tobias
As LOAD clears all variables, it would be hard to free any ALCHPed space after a LOAD (without at least pen and paper to take note) and you would end up with possibly severe memory leaks after a while.SBasic Reference Manual wrote: NOTE 2
Memory reserved by ALCHP is indirectly cleared by NEW, CLEAR, LOAD and LRUN (this does not apply to the Btool extended variant - see above).
I think ALLOCATION from Turbo toolkit provides memory that survives NEW and LOAD.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- mk79
- QL Wafer Drive
- Posts: 1349
- Joined: Sun Feb 02, 2014 10:54 am
- Location: Esslingen/Germany
- Contact:
Re: ALCHP and LOAD problem
You can also use RESPR if you want the memory to survive a NEW (it will try to use the resident procedure area but fall back to the common heap if that isn't possible).
-
- Aurora
- Posts: 852
- Joined: Tue Dec 17, 2013 1:17 pm
Re: ALCHP and LOAD problem
Hi Martin,
To retain basic variables, I use MERGE in lieu of LOAD as I test various M/C against different basic test units.
Tomas
To retain basic variables, I use MERGE in lieu of LOAD as I test various M/C against different basic test units.
Code: Select all
DLINE TO: REMark deletes old prog, but vars
MERGE prog_bas: REMark loads new prog
CLEAR: REMark optional smashes var area
-
- Aurora
- Posts: 852
- Joined: Tue Dec 17, 2013 1:17 pm
Re: ALCHP and LOAD problem
What I had done, is write a small boot loader program to LBYTES and CALL some SuperBASIC extensions. Then LOAD a test program for the SuperBASIC extensions, which I was going to trace through with QMON/JMON.
Only I mistakenly used ALCHP instead of RESPR. And when I tried the extensions, Crash...
With all the extension code getting corrupted after the LOAD. And I thought, what the hell's going on?
Only I mistakenly used ALCHP instead of RESPR. And when I tried the extensions, Crash...
With all the extension code getting corrupted after the LOAD. And I thought, what the hell's going on?