[Coco] CoCo BASIC

Robert Gault robert.gault at att.net
Wed Mar 24 11:31:07 EDT 2021


If you can find access to "TRS-80 Color Computer Assembly Language Programming" by 
William Barden, Jr.there is a chapter on the use of VARPTR. That will help with PEEKing or POKEing data into arrays and writing assembly programs to fill arrays with data.
Robert
Sent from AT&T Yahoo Mail on Android 
 
  On Wed, Mar 24, 2021 at 9:56 AM, Steve Ostrom<smostrom7 at comcast.net> wrote:   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





-- 
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
  


More information about the Coco mailing list