Atari 65xe Redefined Characters

Atari 65xe Redefined Characters

Atari 65xe Redefined Characters

I am convinced you are going to find this tutorial interesting. In this session, we will finally get down to creating our own Atari 65xe Redefined Characters. What does this mean? Well you can start making some interesting displays on your screen that could be used in a game later.

If you haven’t done it already, be sure to read the Atari Character Set tutorial to learn more about how to work with the Atari character set. Atari Redefined Characters

After you have read the tutorial on the Atari Character Set, I am hoping you understanding the concept of pixels now. We are going to change one of the Atari ASCII character set graphics into our own image.

I am using the book Compute!’s First Book of Atari Graphics to follow along with their example of of using Atari Redefined Characters on page 53.

In the example they provide in the book, a demonstration shows how a character would look when you zoom in on the pixels (dots). For example look at the picture below to see the pixels contained with the number “4” character.

Atari Character Set Bits

To build your own Atari 65xe Redefined Characters, you will need to learn a few things. First of all every space that is filled in is a “bit set in memory”. This is another one for the computer to read what is at that area. The white spaces are when the computer “unsets a bit in memory”. This is a way to tell the computer that area is empty, which means a zero is found there instead.

Atari Character Set Math

character set graphicsBefore we begin to explore the math behind the Atari Redefined Characters, let’s take another look at the number “4” as the Atari computer sees it in memory.  Also important to mention here is that these dots are referred to as binary bits. So when a bit is active a “1” is contained there. When it’s empty (white space), a “0” is placed there.

Redefining Atari Graphic Characters

After you calculate the row for the number 4, the result looks like this.

row 0 = 0
row 1 =12
row 2 =28
row 3 = 60
row 4 = 108
row 5 = 126
row 6 = 12
row 7 = 0

Redefining character ASCII graphics

Each area follows a specific calculation in order to recreate the number “4” on the screen display. If you fill a line completely across it will add up to 255.  Look at the example below.

128+64+32+16+8+4+2+1=255

So to appropriately calculate the math, locate all the dots that are filled in and add the up with the numbers at the top of the screen.

Atari Binary Bits

Each block (known as a “bit”) is represented by powers of 2.

2!7 = 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128
2!6 = 2 x 2 x 2 x 2 x 2 x 2 = 64 = 64
2!5 = 2 x 2 x 2 x 2 x 2 = 32
2!4 = 2 x 2 x 2 x 2 = 16
2!3 = 2 x 2 x 2 = 8
2!2 = 2 x 2 = 4
2!1 = 2
2!0 = 1
 

Finally at the lowest level (in binary) we can see each of the individual bits broken down to make up the calculations above:

Zero row of bits: 0 0 0 0 0 0 0 0
First row of bits: 0 0 0 0 8 4 0 0
Second row of bits: 0 0 0 16 8 4 0 0
Third row of bits: 0 0 32 16 8 4 0 0
Fourth row of bits: 0 64 32 0 8 4 0 0
Fifth row of bits: 0 64 32 16 8 4 2 0
Sixth row of bits: 0 0 0 0 8 4 0 0
Seventh row of bits: 0 0 0 0 0 0 0 0

The (x) represents the number raised to the power. An example is on line two where it shows 2(4) is multiplied as 2 x 2 = 4.

The calculations look like this:

0(7)   0(6)   0(5)   0(4)  0(3)   0(2)   0(1)   0(0) 

0(7)   0(6)   0(5)   0(4)  2(3)   2(2)   0(1)   0(0) 

0(7)   0(6)   0(5)   2(4)  2(3)   2(2)   0(1)   0(0) 

0(7)   0(6)   2(5)   0(4)  2(3)   2(2)   0(1)   0(0) 

0(7)   2(6)   2(5)   2(4)  0(3)   0(2)   0(1)   0(0) 

0(7)   2(6)   2(5)   2(4)  2(3)   2(2)   2(1)   0(0) 

0(7)   0(6)   0(5)   0(4)  2(3)   2(2)   0(1)   0(0) 

0(7)   0(6)   0(5)   0(4)  0(3)   0(2)   0(1)   0(0) 

 

Character Set Rows

We will add the top two parts of the number “4” to show you how this works. Starting with the numbers at the top 128,64,32,16,8,4,2,1, we begin the first calculation.

First of all note, that the top row all contains white spaces, so  you can add a “0” as the value for row 0.

Total of Atari Character Bits

Row 1 looks like this:

0+0+0+0+8+4+0+0 = 12

If you add up the total you will see the answer as 4.

Row 2 looks like this:

0+0+0+16+8+4+0+0 = 28

Your task is to see if you understand how to calculate the remaining rows. Sometimes even using a piece of graph paper may help you put this in perspective.

Transferring Character Set to RAM

Although the Atari character set contains up to 255 characters in the ASCII set, we cannot use them all here. So the Atari will utilize 128 characters that we can change to our own graphic images.

Next, in order to change these Atari 65xe Redefined Characters, since they are located in ROM memory, we cannot read them yet. The trick is to transfer the character set that exists in ROM and move it to RAM where we can easily modify all 128 characters. We are therefore interested in the first 1024 locations found in what is called Operating System ROM memory.

Now we need to be certain to place it in an area of memory that won’t allow us to accidentally erase it. In the program the variable RAMTOP points to the last memory address in Atari’s memory. We are going to make RAMTOP look at the end of user memory. This will actually restrict the computer from trying to place anything thing in that area of memory. So we will be free to use it then.

A memory address is a place in the Atari’s system memory that performs a specific task. In the book example, memory location 106 points to the value found in RAMTOP. Using this section will “trick the Atari” and make it stay away from our list. The +1 on line 20 will multiply 256 times RAMTOP. This is known as “paging”.

At times you may also see 4 pages of memory subtracted from RAMTOP to keep it preserved and safe.

On line 10 a GRAPHICS 0 command is needed to prevent the Atari from doing strange things in memory since the data we are using is normally accessed by the Atari as screen data.

Then on line 30 we print a simple message and begin to move that list from ROM to be assigned to our brand new list location. The PEEK(57344+MOVEME) is actually peering in memory at the ROM character set there, so it can be moved into our writable area. The *256 is used since we are accessing the memory as a page.

Pointing to our new Character Set

We are almost done. Now we need to tell the Atari where our new character set exists at in memory. This is accomplished on line 40. The memory location 756 is called the Character Base Register. The value being POKE’d here is using the MSB (Most Significant Byte) to point to our new character set. The /256 means to divide the MSB (high byte) by 256 to reach the correct area in memory. By default the value found here is 224.

Now RUN the program and wait for the READY prompt to appear. After the program stops, hold down the Control key and press the letter t. If all is well, you should see a musical note appearing on the screen. The default location would only show a circle character. We have just modified our first character!

The program is listed here:

10 POKE 106,PEEK(106)-5:GRAPHICS 0
20 STARTLIST=PEEK(106)+1)*256
30 ? “HOLD ON…”:FOR MOVEME=0 TO 1023:POKE STARTLIST+MOVEME,PEEK(57344+MOVEME):NEXT MOVEME
40 POKE 756,STARTLIST/256
50 FOR MOVEME=0 TO 7:READ VALUE:POKE 672+STARTLIST+MOVEME,VALUE:NEXT MOVEME
60 DATA 15,12,12,124,252,252,120,0

Line 50 reads in 7 characters (0-7) from the DATA list on line 60 and places it into the safe area of memory we designated for our new character set list.

To reiterate, the musical note’s new values are contained on line 60 of the program.

60 DATA 15,12,12,124,252,252,120,0

The New Music Note Character

Finally we get ready to present the new character. The values contained in line 60 are the new character for the music note. So since seeing is believing the new character set is seen in this screenshot.

As mentioned earlier, once you start to change a bunch of characters, you can begin to create interesting displays that are used in games, applications, and so on.

Eventually I hope to review some mini games to show how the character set works and how you can use this for entertainment purposes.

Stayed tuned to this website and bookmark it, as we are barely scratching the potential of what is possible with your Atari personal computer!