[Coco] VARPTR not what expected.

coco at jechar.ca coco at jechar.ca
Sun Jul 3 15:54:37 EDT 2022


All

I Wrote the following program to try to understand how the VARPTR in 
Color Computer 3
Disk Extended Color Basic 2.1 works.

5  WIDTH 80
7  CLS 5
10 DIM XP$(10)
15 AD=0
20 XP$(1)="ABCDE"
30 XP$(2)="CAB"
40 AD=VARPTR(XP$(1))
50 PRINT "AT ADDRESS =";AD
55 FOR A=0 TO 10
56 :PA=AD+A
57 :PRINT PEEK(PA);
58 :PRINT " **";
59 NEXT A

so then I tested it.
RUN
AT ADDRESS = 9934
  0  **  0 ** 88  ** 208 **  0  ** 62  **  1  **  0  **  11 ** 0 ** 0 **
The second line is NOT what I expected.
I expected
  65  ** 66 ** 67 ** 68 **  69 ** 0 ** ???  maybe then 67 ** 65 ** 66 ** 
0 **

Since the ASCII codes for ABCDE  are 65,66,67,68 and 69 respectively.

Can you explain what I am doing wrong.
This happens on both my real coco3 and in the emulator.

Charlie


More information about the Coco mailing list