SNIPPET TO DISPLAY VARIABLE LOCATIONS
SNIPPET TO DISPLAY VARIABLE LOCATIONS
Does anyone have a bit of BBC BASIC code handy to map out the locations and names etc of all known INTEGERS, REAL's and String Variables.
So Ii' thinking something like this.
Variable Name Value or Excerpt &Start &End
A% &FFFFFFFF &NNNN &NNNN
A &FFFFFFFFFF .. ..
A$ or ?? &AAAAAAAAA... .. ..
I could probably do it myself, but why re-invent the wheel ?
Cheers
So Ii' thinking something like this.
Variable Name Value or Excerpt &Start &End
A% &FFFFFFFF &NNNN &NNNN
A &FFFFFFFFFF .. ..
A$ or ?? &AAAAAAAAA... .. ..
I could probably do it myself, but why re-invent the wheel ?
Cheers
Software Engineer, Acorn BBC/Retro & Electronics Hobbyist
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Try the program in chapter three of this book (BASIC ROM User Guide, by Mark Plumbley)
viewtopic.php?t=13861
It's probably at least half-way there, anyhow. The book's well worth a read even if not!
viewtopic.php?t=13861
It's probably at least half-way there, anyhow. The book's well worth a read even if not!
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
If you're looking to access these from assembler then the CALL function allows you to pass variables which BASIC builds a table of the locations of. E.g.
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... %20'%22%7D
If you just need a list *XREF from the toolkit+ ROM lists them. Remember that variables won't be assigned until the program is run.
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... %20'%22%7D
If you just need a list *XREF from the toolkit+ ROM lists them. Remember that variables won't be assigned until the program is run.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
If you just need a list of variables and their values, then *VLIST on BASIC Utilities:
https://mdfs.net/Mirror/Archive/JGH/
https://mdfs.net/Mirror/Archive/JGH/
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
- BeebMaster
- Posts: 7379
- Joined: Sun Aug 02, 2009 5:59 pm
- Location: Lost in the BeebVault!
- Contact:
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Also in ARM BASIC, which should run any BBC BASIC program as long as it doesn't use any 6502 assembler (and even then there is a build which replaces the ARM assembler with a 6502 assembler) there is the LVAR keyword which lists the integer variables and their current values, and all declared variables and their values, plus it lists all defined procedures and functions.
The only thing it doesn't do is give the actual memory location of variables, unless they have been declared with DIM.
The only thing it doesn't do is give the actual memory location of variables, unless they have been declared with DIM.
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Yeah, thanks guys.
I did try it out on an emulator and it works for the beeb. But I was hoping it would work on the Agon Light, but it looks like they moved the inbuilt Integers @%-Z% so the addresses didnt work. But will have a look at later this week when I get time.
I Appreciate ALL your post related to it.
I did try it out on an emulator and it works for the beeb. But I was hoping it would work on the Agon Light, but it looks like they moved the inbuilt Integers @%-Z% so the addresses didnt work. But will have a look at later this week when I get time.
I Appreciate ALL your post related to it.
Software Engineer, Acorn BBC/Retro & Electronics Hobbyist
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Isn't the Agon Light a Z80, so anything that looks for the internal structure of 6502 BASIC is not going to work with the internal structure of Z80 BASIC.
On Z80 BASIC the integer variables are either at PAGE-&100 or at HIMEM+&200 if PAGE/HIMEM haven't been moved. The simplest check to find out which immediately after a program starts is IF !(PAGE-&100)=@% THEN intvars are at PAGE-&100 ELSE IF !(HIMEM+&200)=@% THEN intvars are at HIMEM+&200.
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Yes you are right. The Statics are not & their original position.
I have gotten around the issue now. But thank you for the reply
Software Engineer, Acorn BBC/Retro & Electronics Hobbyist
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
They *are* in their original postsion - for a Z80.
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
Re: SNIPPET TO DISPLAY VARIABLE LOCATIONS
Correct they are for the z80, when I said original, I mean the old 'Original' location for the BEEB.
I'm fine with this now, so no more dialogue needed.
Software Engineer, Acorn BBC/Retro & Electronics Hobbyist