Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:09 12 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : List variables

Author Message
Mark
Regular Member

Joined: 26/11/2022
Location: United States
Posts: 85
Posted: 03:34pm 27 Dec 2024
Copy link to clipboard 
Print this post

The memory commands may show variables in memory. I assume those are variables created from the command prompt as well as global variables created in a program. Is it possible to list those variables?
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 10:29am 28 Dec 2024
Copy link to clipboard 
Print this post

I am not up-to-date with any changes to the MEMORY or INFO commands that might provide vairable name lists but I did a bit of work on this a year or two back.

Take a look at this  artcle for discussion on the structure of the vairable headers and how to get at them. It should be quite straightforward to adapt the process in that code to simply list out the variables.

A couple of words of caution:
*** there is no mechanism exposed to MMBasic to determine where is the end of the varable descriptors so you have to choose a figure and go with it. Each descriptor is 64 bytes long so your number needs to be a multiple of that e.g. 2048/64 will list 32 "variable name" but there is no guarantee that some of thse won't be garbage
*** locals and statics can have the same names as globals but are differentiated by having a "level" value... I don't know where this is in the descriptor or how to use it
Edited 2024-12-28 20:35 by CaptainBoing
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10244
Posted: 10:33am 28 Dec 2024
Copy link to clipboard 
Print this post

The article is out-of-date as the PicoMite variants use a hash table for variables. It isn't possible to list them - you created them so you should know what you created
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 10:36am 28 Dec 2024
Copy link to clipboard 
Print this post

I suspected as much - the micromite is the target platform for that code
Edited 2024-12-28 20:38 by CaptainBoing
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025