Graphics 8 Text

John Hulme, London

 

Issue 8

Mar/Apr 84

Next Article >>

<< Prev Article

 

 

 

When I used to look at pictures of the display from some micros which allow free mixing of text and graphics I often used to feel a twinge of envy as this did not seem possible on my Atari. I could have used a modified display list but the text and graphics would still have been on separate lines. Phil Griffin's article on Memory Mapped Screens (issues 4 and 5) gave me an idea of how to do it and, to my great surprise, the program which emerged proved to be both simple and short.

The graph program with this article gives a practical example of mixed graphics and text in Graphics Mode 8. The graph is meant to represent a gravity 'well' with the Earth at its centre but the interest to most programmers will be the labelling of the axes.

What the program does is to copy the character data stored in ROM starting at address 57344 and POKE it directly onto the screen. Each character is stored as eight numbers between 0 and 255 and the number is converted to binary and displayed with a 1 indicating a pixel illuminated and a 0 indicating a pixel extinguished. The character is made up of eight such rows. Phil Griffin's article in issue 5 demonstrated that screen data is stored in the same way in Graphics 4, 6 and 8.

 

 

GRAPHICS MODE

COLUMNS

ROWS
 (Split
screen)

ROWS (Full screen)

4

10

40

48

6

20

80

96

8

40

160

192

 

Figure 1


In order to find the character you want look at table 9.6 of the ATARI BASIC REFERENCE MANUAL. For example, character number 2 is the quotation mark and this character starts at 57344+2*8 - *8 because of the eight items of data per character. The placement of the character is done by adding the appropriate position to the start of screen memory which is found by PEEK (88)+ PEEK(89)*256. The number to be added is the row which you require multiplied by the number of columns supported by your Graphics mode (figure 1). To translate this to English, or rather Basic, see listing 1 which POKEs character number 2 onto a graphics screen in mode 8.

 

1 REM SIMPLE EXAMPLE TO POKE QUOTE
      QUOTATION MARKS ON SCREEN
10 GRAPHICS 8+16:M=57344:S=PEEK(88)+256*PEEK(89):R=16:C=10:COLOR 1
20 FOR I=0 TO 7
30 POKE S+(I*40)+(R*40)+C,PEEK(M+I+(2*8))
40 NEXT I
50 GOTO 50

In line 10 R is the required row and C is the required column.

In line 30 I*40 places each item of character data beneath the previous one and the multiplier should be varied according to the graphics mode (see figure 1).

A similar technique can be used for Graphics 3, 5 and 7 to produce multi-coloured text but you will have to design your own character set because of the different way in which screen data is stored. I presume that data is stored in the same way as for ANTIC modes 4 and 5 but I have to leave that for you to discover as I only have a black and white set.

 

AtariLister - requires Java

top