Color computer

Expand your color computer's memory without hardware

R. Wayne Day, Blue Mound, TX

One of the most frustrating things I saw upon unwrapping my brand-new Color computer, was the result when I asked it how much free space memory was available.

Free space 4is the amount of memory available for you to fill with . programming, not counting the "overhead" the computer needs to run.

"PRINT MEM", I innocently commanded.

Heck no, it's not OK! I bought a computer advertised as having 16K worth of RAM (Random Access Memory), and it tells me I only have 8487 bytes left...

Well, the people who designed the Color computer may have had a different idea in mind than I did, because they thoughfully decided they would "protect" 6.1 K of memory for graphics. They have broken it down to four pages of 1536 bytes for each page, which are unavailable for you to use without some operator override.

For those among us who are having their first computer experience with the Color computer, I'll digress a little bit to explain some facts of life about these monsters. For those geniuses amongst the rest - go have a drink, and we'll be back with you in a couple of moments.

Why would you want to protect something in RAM, and what's all this about overhead?

Well, first off, a couple of definitions - very basic, but very important.

RAM is the abbreviation for Random Access Memory. You can read from this memory, or more importantly, write new data into the RAM; such as a new program.

ROM, on the other hand, stands for Read Only Memory. The only thing that can be done with the data in this type of memory is to read it and act upon it. It cannot be changed or modified! In fact, the only way to change ROM is to program a new one entirely, from start to finish.

The BASIC and Extended BASIC language is stored in two ROM integrated circuits in the Color computer, but without some RAM, the chips would just be little pieces of plastic.

Because it is necessary for a computer to be able to keep track of itself, to keep track of where in the program it currently is, to remember what the current value of the variable "A" is (i.e., A=13), a computer must provide a certain amount of RAM for what is commonly called overhead.

Did you ever wonder how the computer remembers that line 10 in your BASIC program comes after line 9? Without some overhead RAM, it couldn't.

OK, the geniuses are back from their drink now. Let's continue.

In the case of the Color computer, high resolution graphics were believed to be a high drawing card for the product, and they very well may be for some people.

For a game programmer, the protection of four pages of video memory may not be enough if he wants to do some fancy animation.

For example, if a program continually erases, then re-writes a video display (a lunar lander program is the most common example, where you keep the "Height" label, but change the data that tells you how high off the ground you are), the result would be quite "jerky" and not smooth at all.

On the other hand, by protecting various pages of video memory, you could update a page that is not currently being displayed then turn around and call it up to the screen. Then, while you're watching that page, you could update the next page, call it up, and go on like that forever.

This method of displaying video information would result in a smooth picture to the person running (watching) the computer.

But, saving a lot of memory for video has its drawbacks if you use the computer like I do.

Personally, games are not the reason I bought the computer. I tend to use the machine for keeping subscription and mailing lists, running some amateur radio programs that keep my station log, keep count of how many countries I have worked and gotten confirm-tion cards from, finding out what direction it is from my house to any point on Earth (so I keep my antenna pointed in the right direction), etc.

I tend to use a large amount of DATA statements for file searching, and that eats up the memory very, very quickly.

But, there is hope.

The Extended Color BASIC manual very briefly explains how you can "PCLEAR", but it doesn't go into too much detail. Here's what you need to know.

Remember when we said you start out with four pages of memory that were protected? Well, the direct statement (i.e., you don't put it into a program, but rather type a one-liner directly into the computer - like CLOAD) of "PCLEAR 4" will also

38 80-U.S. Journal, January, 1982

reserve four pages for your display.

Get it? "PCLEAR" = Page Clear.

Now, suppose you don't want to save four pages worth of memory... you've got some serious number crunching to do and you'll be needing all of the RAM you can get?

Do like the manual says and enter:"PCLEARl".

This will protect only one page of video, or 1536 bytes, giving you a total of 13095 bytes to use for your programming.

By the same token, if you're going to need more than four pages, you can "PCLEAR 8" to protect eight pages of the RAM.

A PCLEAR8 will leave you with only 2343 bytes for your program (the same as a 4K machine).

"So what happens if I've got 14K worth of program, and only 13095 bytes when I "PCLEAR1"?, you ask, leading me up to the "Case of the Missing PCLEAR".

A little digression again. No, don't run off for something to drink, 'cause we'll be right back!

If you are like me, you didn't particularly like to take more math in high school than was absolutely necessary for graduation. And after that... forget it!

Well, it seems that I had forgotten one of the first things in math. That is that "Zero is a number, just like 1, 2 or 3!

For example, "2 minus 2 is the number 0", right? Not "2 minus 2 is nothing", although if we were talking about my checkbook, it very well may be.

Now, if we take a PCLEAR8 and subtract 1 from it, and do this seven times, we'll come up with a PCLEAR1.

If we do this subtraction again, we'll come up with a PCLEARO.

"Hey, that's what I've been wanting... I don't want to reserve anything for color graphics. All Power to the Program!!

OK, let's try it. Enter PCLEARO and see what happens.

"Awwww, it was a good idea, anyway."

Wait a minute, don't give up. Just because Microsoft didn't include PCLEARO into the vocabulary of the computer doesn't mean we can't do it. We'll just have to fool the computer a bit and sneak up on it.

To do this miraculous trick, we're going to have to get into the overhead of the computer and do some manipulations.

Remember PEEK and POKE? PEEK looks at a specific memory location and tells you what's there. POKE lets you write something directly into a memory location.

Turn the computer off for about 15 seconds. That will give it time for everything to reset and lose its memory.

Now, turn it back on and enter: "PRINT MEM". It should give you 8487, meaning you have 8487 bytes of free space memory.

Now let's investigate. Look at memory location 31, by entering "PRINT PEEK(31)". Does it say "30"? It should.

Enter a PCLEAR 1 statement, and check location 31 again.

"12"? Hmmmmmm.

There seems to be some correlation between the amount of memory available and the data in 31; with 8487 bytes available it was 30 and with 13095 bytes it was 12.

See COLOR, page 42


Give your computer a voice of its own ■ build speech into your BASIC programs This machine language program is a must for your library

Was this article helpful?

0 0

Post a comment