ROM Computer Magazine Archive ROM MAGAZINE ISSUE 3 — DECEMBER 1983/JANUARY 1984 / PAGE 3

Starting Page
Character Graphics - Part II
by Geoff Corry

    Here we are again. In the last issue we copied the ATARI character set down into a safe area of memory. We plan to modify some of the characters to make up the elements of a picture we want to display.

The program so far is:-

10 RAMTOP=106:CHBAS=756:CHORG=57344
20 GRAPHICS 0
30 RAMNEW=PEEK(RAMTOP)-8
40 START=RAMNEW*256
50 FOR CH=0 TO 1023
60 POKE START+CH,PEEK(CHORG+CH)
70 NEXT CH
80 POKE CHBAS,RAMNEW

    Those of you who typed in the program and ran it probably thought "so what nothing happened". This issue will correct one typo that got into the listing and will generate a little magic to show that, indeed, something DID happen.

    First the BOO BOO. Line 80 had a letter 'R' creep into CHBAS. So the computer, being a very literal fellow, looked at CHRBAS and said hmm - a new variable, no value given. So I will call it location 0 in memory and I will put the value of 'RAMNEW' there. Well we wanted the value of 'RAMNEW' to go into location 756, where it becomes a signpost to tell the computer where to get the relocated character set. See how careful we all have to be!

    This column is called STARTING PAGE and is intended to help those of you who want to know something about how the machine operates and maybe develop something you can call your own. The series on character graphics is written with this view in mind. Looking at the last issue, I felt that some of the terms we have used may need some explanation, so here goes:

    PEEK(address) -Get the computer to find out what is stored in a certain memory location (or address). In this program we asked it to 'peek' into memory location 106, which we called RAMTOP (the TOP of Random Access Memory). We also asked it to peek into 1024 memory locations, from 57344 to 58377, to find the coding required for the ORiGinal CHaracter set (CHORE to CHORE+1023).

    POKE address,value -Get the computer to put a specified value into a specified memory address. Try this:- type POKE 82,5 and press return. You will see that the cursor and 'READY' have moved over to the right. Normally memory location 82 has a value of 2 in it, so all text starts two columns in from the left. In this program, we asked the computer to copy the values it 'peeked' into memory locations 57344 to 58377 down into our new area starting at page 'RAMNEW'.

    PAGE -To simplify addressing the memory field in the computer we use a similar idea as postal addressing. Our favorite computer store may be in the 23 hundred block Jackson Ave., which is O.K. for us to tell someone where to find it. But if we want to mail a letter to the store, we should use the correct address, say 2023 Jackson Ave. Blocks in the computer are called PAGES and each consist of 256 individual memory locations. A fully equipped ATARI has a total of 256 pages of memory, each page having again 256 memory locations, giving a grand total of 65536 memory cells. About 18 thousand of these are Read Only Memory or ROM, which cannot be altered, leaving less than 46 thousand for house-keeping and program development. To turn a PAGE number into an actual memory location, we have to multiply by 256, as we did in line 40.

    Meanwhile, back at the program. Type in lines 10 to 80, or fix up line 80 (remember, old CHBAS ). Now we are going to do some magic. Type in the following.'

12 Y=(PEEK(RAMTOP)-8)*256
14 FOR X=Y TO Y+1023:POKE X,255:NEXT X

    Now move the cursor up to line 80, (what again!), and type '42' and return.Type 'L.' (the quick way to type LIST). Lo and behold, line 80 has been repeated as line 42, Check that lines 12 and 14 are O.K. This copying of lines is a good trick to use when you get to a lot of similar lines when typing in a program. Type the first line of the bunch, hit RETURN, and move back up, change the line number,and then make any small changes and hit RETURN. Repeat this process until all the similar lines are done.

    Back to our program to set up the magic act. Type in!

    44 PRINT " THE CHARACTER SET IS NOW BEING MOVED (7 CTRL ,) (9 CTRL P) (9 CTRL .) (8 CTRL ;)"

    Hey, what's going on here? Well, after you type 'MOVED', hit the space bar twice, then hold down the 'CTRL' key and hit the comma key seven times. Another space and then 'CTRL P' nine times, space again, 'CTRL .' nine times, another space, 'CTRL ;',and finally the closing quotes. Whew! If this came out right, after the text. you should have two spaces, seven hearts, space, nine clubs, space, nine diamonds, space, eight spades. Rummy anyone? With a hand like that, you could clean up.

    Now line 44 can be introduced on the poor person, (you), trying to type it in, ANTIC has 'Listing Conventions', A.N.A.L.O.G. COMPUTING has 'Control Characters', COMPUTE! has 'How to Type COMPUTE!'s Programs', and SOFTSIDE has a section called 'Line Listings' in the back of the small Printed Game Software booklet included in each magazine issue, The CODE WORKS produced a program back in the early years of ATARI, (almost 3 years ago), called 'IRIDIS 2' which deals with altered character sets or fonts. This is an excellent program because the authors took time to fully document the program, and also it is liberally sprinkled with helpful programming tips. The last page of the IRIDIS 2 booklet deals with listing conventions, and are often accepted as the standard.

    O.K. before you run this magic addition to our program, you had better save it. Wrong POKES may send the computer to never never land, and I would hate to see you go through all this again, especially line 44.

    Here we go, Your full program is on the screen, if not, type 'L.' and RETURN. Now finally type 'RUN' and RETURN. Wait for about 12 seconds for the magic to generate. Hey! Your listing has been wiped out and white blocks have appeared at the top of the screen (lines 12 and 14 did this). Keep looking. The white blocks are being replaced in alphabetical order by the text you wrote in line 44. Here come the hearts, clubs, diamonds, and finally the spades. This is a visual demonstration that the character set has been copied down into your new memory area. If you look at Table 9.6 on page 55 of the ATARI Basic Reference Manual you will see the order follows the code listing, capital letters from numbers 33 to 58, the heart symbol is 64, club is 80, diamond 96, and the spade symbol near the end at 123.

    Now for more magic. List the program again. Now type 'RUN' and RETURN. Wow, the screen turned white and all your characters are changing into white blocks (That's lines 12 and 14 again). Now the rest of the program will go through the same process as before. Call in the folks, they will be impressed with the magic you can get out of your ATARI.

    See if you can figure out everything that went on here. If you are having problems let us know. We want to make this magazine as useful as possible. If you feel confident with all this, then you can hardly wait to get onto the next installment of the continuing saga of Character Graphics.

    P.S. By the way, the Spring and Summer Issues of the ATARI CONNECTION have been carrying a series of articles called Cartoon Computer Animation that gets into the same stuff as we are doing here.