[Coco] CoCo BASIC

Steve Ostrom smostrom7 at comcast.net
Wed Mar 24 09:56:40 EDT 2021


Thank you, Art.  That’s amazing detective work !!!  And helps me a lot.  

--- Steve ---


Sent from Mail for Windows 10

From: Arthur Flexser
Sent: Wednesday, March 24, 2021 12:15 AM
To: CoCoList for Color Computer Enthusiasts
Subject: Re: [Coco] CoCo BASIC

Steve, I just ran the following Basic program in the Mocha online emulator.

10 DIM A(4,5)
20 PRINT HEX$(VARPTR(A(1,1)))
30 PRINT HEX$(VARPTR(A(2,1)))
40 PRINT HEX$(VARPTR(A(1,2)))

The output was:

1E76
1E7B
1E8F

This tells me that the array elements are stored consecutively (in the
array storage area following the end of the program) as 5-byte quantities,
with the first subscript varying fastest:

A(0,0), A(1,0), A(2,0), A(3,0), A(4,0),    A(0,1), A(1,1), A(2,1), A(3,1),
A(4,1),    A(0,2), A(1,2), A(2,2), A(3,2), A(4,2),    A(0,3), A(1,3) ....,
etc.

This follows from the fact that the output shows that A(1,1) and A(2,1) are
stored 5 bytes apart, while A(1,1) and A(1,2) are 25 bytes apart.

Further peeking showed that the array area pointer at $1D-1E points to
$1E4F, which, if you add 9 bytes for the header, agrees with the location
of A(0,0), which is stored at $1E58,

Art






More information about the Coco mailing list