Author |
Topic: Help - Problem using two lists of data (Read 719 times) |
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: Help - Problem using two lists of data
« Reply #4 on: Aug 8th, 2011, 09:09am » |
|
Hi Richard,
Yes, I worked out what must be going on, but I was astonished to see that you could make what looks like a direct memory address private!
Presumably !376 addresses a memory location deep in the innards of BB4W, which contains the data pointer. I can see that you can use it like any other integer variable, but I am amazed that you can make it private. When it meets a PRIVATE statement, does BB4W go to see if it has already created a version of the variable, and if so, restore the version it has hidden away somewhere, while storing the higher-level version on the stack, restoring it when the procedure ends?
I don't NEED this information, but I am intrigued about how direct memory addressing can be used in this way!
Best wishes,
David
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Help - Problem using two lists of data
« Reply #5 on: Aug 8th, 2011, 1:56pm » |
|
on Aug 8th, 2011, 09:09am, DDRM wrote:| Yes, I worked out what must be going on, but I was astonished to see that you could make what looks like a direct memory address private! |
|
You shouldn't be, and if I may say so it betrays a serious misunderstanding about the way indirection works. It is a fundamental property of the indirection operators ? and ! that they create L-values; if you don't know what an L-value is, check out this Wikipedia article:
http://en.wikipedia.org/wiki/Value_%28computer_science%29
So, since indirection operators create L-values, they may be used whenever an L-value is syntactically valid in BBC BASIC, and of course this includes the parameters of LOCAL and PRIVATE.
The BB4W manual alludes to this in the section 'Query as a byte variable':
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin2.html#bytequery
There it explains that (even before the introduction of 'true' byte-variables using the & suffix) 8-bit unsigned L-values have always been available in BBC BASIC using the ? indirection operator.
Quote:| I am amazed that you can make it private. |
|
You were astonished, now you are amazed! Nevertheless, it has been true of BBC BASIC since the very beginning on the BBC Micro (there was no PRIVATE then, of course, but it had LOCAL). Perhaps a little boning up on basic Computer Science principles would not go amiss. 
Richard.
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: Help - Problem using two lists of data
« Reply #6 on: Aug 10th, 2011, 08:29am » |
|
Hi Richard,
Thanks for the pointers about how it works... I don't think I can have a "serious misunderstanding" about something I have no understanding of, but a bit of reading may remedy that situation! 
I'm sure a bit of boning up on computer science would be very good for me. I don't remember L-values being an important part of computer science A level in 1980, but if it was it has escaped from my mind since - as with so many things...
Best wishes,
D
|
|
Logged
|
|
|
|
|