Visualize the Heap + CRON X16 + BASIC 4.0 Strings

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

Visualize the Heap + CRON X16 + BASIC 4.0 Strings

Post by rje »


I watched a video by 8 Bit Show and Tell (Robin's show) where he fixes the old PET Dungeon! game to run with BASIC 4.0.  I learned that a difference between 2.0 and 4.0 is that strings are later augmented by a pointer back to their owner, so 4.0 strings are two bytes longer than 2.0 strings.  This space cost vastly improves garbage collection speeds, something hinted at by a Butterfield article 35+ years ago.


  • Makes me think the X16 "ought" to have the BASIC 4.0 strings and garbage collection.


ANYWAY, he reset high RAM to coincide with screen RAM.  The result?  When he allocated a string, it magically shows up at the "end" of the screen!  He used that visualization trick to show how memory is allocated off the heap in Commodore 2.0 versus 4.0, and it was COOL.


  • I'd love to have a Heap Visualizer for the X16.


One incarnation would be a small interrupt-driven program to copy the top chunk of high BASIC RAM to VERA, for example to SPRITE data or screen memory or something.  Not sure.  It would probably have to be non-intrusive and therefore not directly written to screen memory.  Whatever.  But it wouldn't have to run every jiffy or however fast interrupts run.  This one would need to update every second or three or ten.


  • It's almost like that solution would need a CRON-X16 to manage interrupt jobs...  But I digress.


 

BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

Visualize the Heap + CRON X16 + BASIC 4.0 Strings

Post by BruceMcF »


For demo purposes, it really can overwrite the bottom line(s) ... in his demo, if you got down to those lines, you would literally trash the heap, and you would also trash the heap by printing a clear string character.. Copying the heap to the screen wouldn't cause any problems, except you'd have to clear screen when you get too close to where the heap display shows up.

 

Post Reply