Re: D3/Linux compile question
- From: Dale <dale_benedict@xxxxxxxxxxxxxx>
- Date: Tue, 19 Feb 2008 08:37:14 -0800 (PST)
On Feb 18, 5:38 pm, "Peter McMurray" <excalibu...@xxxxxxxxxxx> wrote:
Hi Dale
Mine was the first response and I specifically answered your question.
Trying to address array(0) generates a runtime error in D3 using the default
options.
Well... No you haven't answered the question. I'm not wanting to
sound rude here or turn anyone off Here is my program and subsequent
output:
01 dim x(5)
02 equ a to x(0)
03 equ b to x(1)
04 for i = 1 to 5
05 x(i) = i
06 next i
07
08 crt a
09 crt b
dlb.bp 'tteesstt' size = 101 filed
tteesstt
.
[820] Creating FlashBASIC Object ( Level 0 ) ...
[241] Successful compile! 2 frame(s) used.
[B10] in program "tteesstt", Line 8:
Variable has not been assigned a value; zero used.
0
1
Like I said in the original post:
Does the compiler ignore the equate?
Based on the actual compile I'm not sure. Here is the output from the
compile with the 'A' option:
0001 EE DIMENSION x 5 1
0001 01 EOL
0002 F3 ? a x(0,1)
0002 01 EOL
0003 F3 ? b x(1,1)
0003 01 EOL
0004 03 LOADA i
0004 08 LOAD 0
0004 5F STORE
0004 *1001
0004 05 LOADN 5
0004 03 LOADA i
0004 DB FORNEXT *2001
0004 01 EOL
0005 ED LOAD DV x
0005 16 LOAD i
0005 56 VECTOR
0005 16 LOAD i
0005 5F STORE
0005 01 EOL
0006 06 BRANCH *1001
0006 *2001
0006 01 EOL
0007 01 EOL
0008 C7 DCD EXT
0008 5D FORCECRT
0008 16 LOAD a
0008 5D CRTCRLF
0008 01 EOL
0009 C7 DCD EXT
0009 5D FORCECRT
0009 16 LOAD b
0009 5D CRTCRLF
0009 01 EOL
0010 01 EOL
0011 45 EXIT
This is where things get fuzzy for me.
Note in the first 5 lines I believe the compiler is looking at the
equates by using the question mark (?)
But execution seems to ignore the assignment.
As for where to start the indexing of an array, whether 1 or 0, I find
that 1 make sense to my mind, but in recent coding I would have found
0 to be more convenient (sp?) as I have to keep adding 1 to the math
done to create the subscipt that I need.
Regards
Dale
Peter McMurray>
"Dale" <dale_bened...@xxxxxxxxxxxxxx> wrote in message
news:03d36479-69f2-47d8-bfd1-c4244e16ff09@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Whoa..!!!
What a discussion I opened up.
Hmmm... No one has really answered my question:
Does the D3 Basic compiler ignore the statement:
equate stuff to var(0)
Aside from that I guess I could wade into the fray of where to start
numbering your indices. But first I'll start with a small recap of a
story from the show "60 Minutes" I believe:
A person was teaching grade school children (about age 10-12 I think)
how to do arithmetic quickly without calculators or pen and paper. He
had them adding 6 - 4 digit figures in their head about as quicky as
he could rattle off the numbers. Very impressive!!!
His secret was he started counting at zero (0). Which sort of make
sense, as the first decade of his numbers (0 to 9) would have only a
single digit.
Take that story as you like.
As for inside the computer, it can make sense to start numbering the
indices of arrays at zero. Zero times anything is zero and would then
allow the start of the data at the first calculated byte, which would
be zero.
That same logic prevails in the grouping of items in D3. Hash out the
key, divide by the modulo of the file, take the remainder (0 to modulo
-1) and add that to the base frame of the file to determine what frame
to store/find the data. So the data would start getting stored in the
base frame not 1 past the base frame.
As for your personal ways of counting, I'll leave that to you.
Regards,
Dale
On Feb 13, 4:01 pm, Dale <dale_bened...@xxxxxxxxxxxxxx> wrote:
I just can passed some old code:
DIM ARRAY(5)
EQU VAR TO ARRAY(0)
EQU STUFF TO ARRAY(1)
It appears that the compiler ignores the equate to ARRAY(0).
In testing it certainly looks like the compiler ignores the
assignment.
Can anybody confirm or deny this?
Regards,
Dale- Hide quoted text -
- Show quoted text -
.
- Follow-Ups:
- Re: D3/Linux compile question
- From: Tony Gravagno
- Re: D3/Linux compile question
- From: frosty
- Re: D3/Linux compile question
- References:
- D3/Linux compile question
- From: Dale
- Re: D3/Linux compile question
- From: Dale
- Re: D3/Linux compile question
- From: Peter McMurray
- D3/Linux compile question
- Prev by Date: Re: D3/Linux compile question
- Next by Date: Re: D3/Linux compile question
- Previous by thread: Re: D3/Linux compile question
- Next by thread: Re: D3/Linux compile question
- Index(es):
Relevant Pages
|
Loading