First Steps

Mark Hutchinson's regular column for beginners

 

Issue 26

Mar/Apr 87

Next Article >>

<< Prev Article

 

 

GETTING TO GRIPS WITH GRAPHICS

For this issue I thought that I would look at graphics. I have been putting this off for some time, not because it is hard to write about, but because it would take up far more room than I am allowed by the Editor. I will tell you about the basic modes but I may not go into as much detail as you would like.

Graphic modes are divided into two types, text and graphics. The basic screens range from the three text modes of GRAPHICS 0, 1 and 2 and from the low resolution (chunky graphics) of GRAPHICS 3 to the high resolution screen of GRAPHICS 8. Believe it or not, all these screens are the same. They are made up of tiny dots (pixels) and are 320 pixels wide by 192 pixels high. The only difference is how the computer handles the screen. For instance, GRAPHICS 0 uses characters that are 8 by 8 pixels square. Thus 320 divided by 8 gives 40 characters per line and 192 divided by 8 gives 24 lines. You can work out mode 1 (16 by 8) and mode 2 (16 by 16).

THE TEXT MODES

GRAPHICS 0

This, though you may not think it, is a specialised screen. It is designed for the input of command lines and will display the full character set. The default colour of blue is not mandatory. It can be changed, along with the border colour, but the characters will only take a lighter or darker shade of the screen colour. You can make characters invisible by setting their colour to that of the background. The characters can be placed anywhere on the screen by using the editing characters. These characters, e.g. TAB, ARROWS, INSERT, can only be utilised in mode 0. I have included a small program (Listing 1) to illustrate their uses.

GRAPHICS 1 & 2.

These differ from mode 0, not only by the fact that the characters are bigger, but that they have a text window (the four lines at the bottom of the screen) which is actually mode 0. The main part is termed the text screen. The normal PRINT command will place characters in the window, but you will needs to use a special device specifier to print to the screen. This is done with PRINT #6;. There are four types of printable characters, normal lower and upper case and inverted lower and upper case but in these two modes upper case only appears on screen and the type of character defines the colour of that character. Listing 2 should demonstrate this clearly and show you how to change the colours of the text.

Now look closely at Listing 3. You will see that the original screen is GRAPHICS 1 with a text window but, for the next example, I needed to extend the screen by getting rid of the text window. To do this I set up a GRAPHICS 1 + 16, but to keep the text I added 32 (making a total of 49). Using a GRAPHICS 49 command I was able to get rid of the window and keep my text. For some reason this is very seldom, if ever, used.

POKING AROUND.

In both modes, the cursor can be made to disappear by a simple POKE (POKE 752, 1). Other POKEs of interest are 82 and 83 which set the left and right hand margins respectively. The text screen can be extended by adding 16 to the graphic mode, eg GRAPHICS 1 - 16 or GRAPHICS 17, again shown in the listings.

Probably by now you will know that if you leave the computer for several minutes without using the keyboard the screen colours will begin to change. This is done automatically to stop an image being burnt into the phosphor on the screen. This can be a nuisance when you use joysticks only, but it can be stopped by POKE 77,0 during the running of your program.

The two text modes can be used for graphics by redefining the character set. This is done by making up your own data and storing it in a safe area of RAM then telling the computer where to look for this data each time a key is pressed. Normally location 756 holds a number which, when multiplied by 256 will point to the start of the character data. Just pick a part of RAM evenly divisible by 256 then POKE 765, RAM/256. Just to see this in action. POKE 765 with any random number and list one of the programs. The garbage you will see is because of any random bits of data stored in the location you picked.

Next issue I will have a quick look at the graphic modes 3-7, nothing spectacular, just the basics.

A USEFUL TIP

Before I go, I must pass on a good tip from Len Lawson. If you need only DOS.SYS on a disk (when you wish to only boot up, not use the DUP.SYS) you can use the following without going into DOS to use option H.

OPEN #1, 8, 0, "D:DOS.SYS":CLOSE #1

IN CLOSING

Recently, I have been receiving several letters asking questions about Atari computing. I can only reply to those that have enclosed a SAE, otherwise the answer will appear in this column ... sometime! So, if you are in a hurry for an answer. Write to me, as always, at P.O.BOX 123, BELFAST, BT10 OTB.

I hope to be going to the next ATARI show in April, mainly wandering around the exhibition stands, so perhaps I will meet you there (large hint, Stan!).

Listing 1

AtariLister - requires Java

Listing 2

AtariLister - requires Java

Listing 3

AtariLister - requires Java

top