[Coco] Cryptic BASIC program

Robert Gault robert.gault at att.net
Fri Sep 25 22:58:17 EDT 2015


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.
>

There are several things wrong with the listing.

1) Line 110 is suspicious given the test value of 1600. The main problem is that 
MEM will return a variety of values depending on whether you have Basic, 
Extended Basic, or Disk Basic. Regardless the value 1600 seems unlikely.

2) There are only 14 data values so the loop must stop with 1613. 1600 through 
1613 gives 14 bytes of memory.


3) This is the program POKEd into memory.
start	ldb #%10111111	0 marks the RAM size output
	stb $FF02	PIA
	ldb $FF22	PIA
	andb #%00000100	test the RAM size input bit
	clra		regD is now either 0 or 4
	jmp $B4F4	convert value in regD to an integer and return to Basic

This may or may not work depending on how the RAM size bits work. This method is 
not, in my opinion, a good test for functional RAM. Actually the test really 
should be dependent on whether the jumpers on the mother board were correctly 
switched from the 16K position.

Robert



More information about the Coco mailing list