- 2016/1/19 – Added reference to earlier article about more memory for BASIC (and an excerpt about why BASIC is that way). Also added reference to Juan’s comment on improving the program. Added link to Facebook CoCo group.
- 2016/9/2 – Removed a duplicate line in the 2nd listing. Maybe fixed a typo or two.
Recently, Richard Ivey became the latest person in the Facebook TRS-80 / Color Computer group to ask how to tell if an old Radio Shack Color Computer had 64K without opening the case. The problem has to do with backwards compatibility. When the original Radio Shack TRS-80 Color Computer was released in 1980, it was sold as either a 4K or 16K system. Later, a 32K model would be available, and the Microsoft COLOR BASIC would give about 24K of free memory (with the rest of the memory used by the video display, cassette buffers, BASIC input buffer, etc.).
Update: See this earlier article about getting more memory for BASIC. Here is an excerpt:
64K NOTE: The reason BASIC memory is the same for 32K and 64K is due to legacy designs. The 6809 processor can only address 16-bits of memory space (64K). The BASIC ROMs started in memory at $8000 (32768, the 32K halfway mark). This allowed the first 32K to be RAM for programs, and the upper 32K was for BASIC ROM, Extended BASIC ROM, Disk BASIC ROM and Program Pak ROMs. Early CoCo hackers figured out how to piggy-pack 32K RAM chips to get 64K RAM in a CoCo, but by default that RAM was “hidden” under the ROM address space. In assembly language, you could map out the ROMs and access the full 64K of RAM. But, since a BASIC program needed the BASIC ROMs, only the first 32K was available.
When 64K upgraded became available, the original BASIC would still only report about 24K free since it had never been modified to make use of the extra memory. Thus, typing “PRINT MEM” on a 32K CoCo 1 shows the same thing it does on a 512K (or greater) CoCo 3.
So how do you tell? One easy way is to just try to load a program or game that requires 64K and see if it works. But, if all you have is the CoCo, there is a short program you could type in to test. (NOTE: See a better listing later in this article.)
10 READ A$:IF A$="X" THEN END 20 POKE 20000+N,VAL("&H"+A$) 30 N=N+1:GOTO 10 40 DATA 34,01,1A,50,10,8E,80,00 50 DATA B7,FF,DE,EC,A4,AE,22,EE 60 DATA 24,B7,FF,DF,ED,A1,AF,A1 70 DATA EF,A1,10,8C,FE,FC,25,E8 80 DATA 10,8C,FF,00,24,0C,B7,FF 90 DATA DE,EC,A4,B7,FF,DF,ED,A1 100 DATA 20,EE,35,01,39 110 DATA X
Thanks to Juan Castro for passing this along. I reformatted it so no line would be longer than the 32 column screen, hoping it makes it a bit easier to type in (though it does make the program longer, needing more, shorter lines).
I believe this is the classic “ROM TO RAM” (or ROM2RAM) program that appeared somewhere in Rainbow magazine back probably around 1983. Basically, it places the system in to 64K mode (where memory addresses &H0000 to &HFFFF are all RAM) and copies the COLOR BASIC and, if installed, the EXTENDED and DISK BASIC ROMs in to that upper 64K so the system can still work.
If you type this in on a CoCo 1 or 2, then RUN it, it loads a small machine language program in starting ad memory address 20000. After this, you can type “EXEC 20000” to execute that machine language program. If you typed it in correctly, it should just return to BASIC and nothing should seem any different.
But, at this point (if it worked), the BASIC ROM is now in RAM, which means you can POKE to those memory locations and make changes.
Juan suggests an easy hack of changing where the prompt “OK” appears. He says:
Now try POKE &HABEF,89 — OK should become OY.
It worked for me in the Xroar emulator (configuration to emulated a 64K CoCo 2):
Thus, if you can run this program without it crashing, and that POKE works to change something formerly in ROM, your CoCo is operating in all-RAM mode and must have more than 32K.
In the future, I will have to track down a simpler way to test for 64K. Until then, happy typing…
Update: In the comments, Juan suggested making the following changes, so the program will execute the machine language program for you:
10 READ A$:IF A$=”X” THEN 35 20 POKE 20000+N,VAL("&H"+A$) 30 N=N+1:GOTO 10 35 EXEC 20000:POKE &HABEF,89:END 40 DATA 34,01,1A,50,10,8E,80,00 50 DATA B7,FF,DE,EC,A4,AE,22,EE 60 DATA 24,B7,FF,DF,ED,A1,AF,A1 70 DATA EF,A1,10,8C,FE,FC,25,E8 80 DATA 10,8C,FF,00,24,0C,B7,FF 90 DATA DE,EC,A4,B7,FF,DF,ED,A1 100 DATA 20,EE,35,01,39 110 DATA X
With those changes, now all you have to do is type RUN and it will load the machine language program, execute it (to copy ROM in to RAM), then poke the “OK” prompt to say “OY”. Thanks, Juan!
May I suggest the following changes to do everything in one fell swoop?
10 READ A$:IF A$=”X” THEN 35
35 EXEC 20000:POKE &HABEF,89:END
Yes you may :) I’ll try to make some revisions when I have a moment to clean up the article.
I needed to change line 110 to DATA “X” (adding double quotes) to prevent an ?OD ERROR on my 64K CoCo 2 with Extended Color BASIC 1.1.
Mine runs with just “130 DATA X”. I am using DISK EXTENDED COLOR BASIC 1.1.
I just tested this from a cassette file, under “EXTENDED COLOR BASIC 1.1” and it also worked with no quotes around the X. Are you on real hardware, or an emulator? I am using XROAR (emulator) to test. This is interesting.
Real hardware, ROM BASIC.
Oh yeah! It works on a real CoCo 2 (26-3127B) also!!! I was looking for the ROM2RAM program… And I changed the entire OK prompt to “JY” (don’t ask…)
But here’s how…
35 EXEC 20000:POKE &HABEE,74:POKE &HABEF,89:END
Thanks for this and CoCo forever!
I just got my CoCo 2 by UPS that I ordered from eBay and was curious how much RAM it has. Thank you for this program, it ran without a hitch and changed the prompt to “OY” so I’m assuming it’s 64k. I looked at it’s ram chips but I can’t tell buy looking at them.
Another test would be to try to load The Sailor Man from Tom Mix Software. It was the first CoCo game that required 64K to run. You can get a copy at Color Computer Archive, I think.
The program works just fine on my coco2, but if I type in the:”poke &habef,89″ command, it just says OK, instead of OY
Do you have 64K? The program tries to copy the upper 32K of ROM code over into the “hidden” RAM, then switches the CoCo to run out of that RAM. I’m mot sure, but I think I recall that RAM just mirrors if it is not present, so the POKE that would have been upper 32K ends up POKEing to real RAM below it, not where the OK is.
Pingback: 6809 request: smallest 64K test? | Sub-Etha Software
35 EXEC 20000:POKE &HABEE,&H0F:POKE &HABEF,&H0B:END
‘ It’ll still print “OK” but in reverse video
Nice! Makes more sense than OY
I lied, the 6847 will but BASIC the ROM strips if off