[Coco] Cryptic BASIC program

Darren A mechacoco at gmail.com
Fri Sep 25 22:39:02 EDT 2015


On Fri, Sep 25, 2015 at 6:59 PM, Salvador Garcia wrote:

>
> Hi all, I am once again at the location where my Color Computer is located
> and was looking over the books that I have. I found a BASIC listing that a
> Radio Shack employee gave me back when I upgraded my CoCo I from 16 to 64K.
> I know it is related to the upgrade, but I do not know what it does
> exactly. Following is the listing. If anyone recognizes what it does it
> sure would be helpful. Thank you
>
> Salvador
>
> 100 CLS
> 110 IF MEM < 1600 THEN PRINT "32K"
> 120 FOR X = 1600 TO 16013
> 130 READ Y : POKE X, Y : NEXT X
> 140 DEF USR0 = 1600
> 150 A = USR0(0)
> 160 IF A THEN PRINT "32K" ELSE PRINT "64K"
> 170 END
> 180 DATA 198, 191, 247, 255, 2, 246, 255, 34, 196, 4, 79, 126, 180, 244
>
> PS: looking over the code it seems there is an anomaly with the upper
> range of the for loop. I believe it should be 1613. I typed it in exactly
> as the listing that I have shows.
>


The upper range of the loop in line 120 should definitely change to 1613
otherwise it will cause an ?OD ERROR.  The machine code being poked into
memory is:

   LDB   #$BF
   STB   $FF02
   LDB   $FF22
   ANDB  #$04
   CLRA
   JMP  GIVABF

What it does is test the state of the RAM Size jumper on the board by
setting the RAM Size output pin on PIA0 low, then reading the RAM Size
input pin on PIA1. It returns the value (0 or 4) to Basic as the result of
the USR() call.

- Darren


More information about the Coco mailing list