Atari Hires Sprites
- Type
- Graphics
- Category
- Player/missile colour-under-text demonstration
- Author
- Cyprian
- Published in
- AtariOnline.pl forum, 2022
- Year
- 2022
- Language
- Atari BASIC
- Requirements
- Any 8-bit Atari with Atari BASIC
- Tags
- player-missile, gtia, graphics-0, colour, priority, fifth-player, demo, cyprian, atarionline, atari-basic
About the program
GRAPHICS 0 is a hi-res mode with only one hue: the text is just a lighter or darker shade of the background. This short program, posted by Cyprian on the Polish AtariOnline.pl forum in 2022, shows how players and missiles get round that. It covers the entire text screen with a checkerboard of player graphics, each square exactly one character in size, in eight different colours. Wherever a square lies under the text, the hi-res pixels show in that colour. The same principle lets you put colour under a hi-res shape and get a "hi-res sprite" with a resolution of 320 pixels.
What you need
Any 8-bit Atari with Atari BASIC. RUN it from the normal text screen. The effect stays in place afterwards, so LIST the program or type something to see the text change colour as it crosses the squares.
Typing it in
Ten short lines of plain ASCII. Line 0 is legal: Atari BASIC accepts line number 0.
How it works
- Lines 0–3:
P$is DIMensioned at 2K so that a 1K-aligned area inside it can hold player/missile memory.POKE 54279(PMBASE) points to it,53277,3(GRACTL) turns players and missiles on, and559,46gives double-line resolution.POKE 623,1+16sets GPRIOR to put players in front of the playfield (1) and to combine the four missiles into a fifth player coloured by register 711 (16). - Line 4: puts eight colours, hues 0, 2, 4 … 14, into registers 704–711. That includes the playfield registers. Line 10 then puts 709 and 710 back to colours for the text and its background.
- Line 5: places the four players 32 colour clocks apart (positions 48, 80, 112, 144) and the four missiles 8 apart (176–200). Line 7 sets every size register to 255 (quadruple width), so each player is 32 colour clocks wide and the five "players" together cover all 160 colour clocks of the text screen.
- Lines 6–10: fill each player with bytes 170 and 85 (10101010 and 01010101), four of each in turn. One bit of a quad-width player is 4 colour clocks, the width of one GRAPHICS 0 character. Four bytes at double-line resolution are 8 scanlines, one character row. The checkerboard therefore lines up exactly with the character grid, for all 24 rows.
The colouring works because of how GTIA draws the hi-res modes. Where a player is in front, its hue is used for the cell, but the hi-res pixels still take their brightness from register 709, so the text stays readable in the new colour.
Variations to try
- Fill the player bytes with 255 instead of 170/85 to give whole 8-character-wide columns a single colour.
- Change line 4 to
POKE 704+K,K*32+10for brighter colours, or draw your own coloured shapes by putting other bit patterns into the player memory.
Listing
0 Z=1024
1 DIM P$(Z*2)
2 X=(INT(ADR(P$)/Z)+1)*Z
3 POKE 54279,X/256:POKE 53277,3:POKE 559,46:POKE 623,1+16
4 FOR K=0 TO 7:POKE 704+K,K*32+4:NEXT K
5 FOR K=0 TO 3:POKE 53248+K,48+K*32:POKE 53252+K,176+K*8:NEXT K
6 FOR K=0 TO 4
7 POKE 53256+K,255:L=X+K*128+16+384
8 FOR N=L TO L+88 STEP 8:FOR M=0 TO 3:POKE N+M,170:POKE N+M+4,85:NEXT M:NEXT N
10 NEXT K: POKE 709,202: POKE 710,148
Credits
- Program listing: Atari Hires Sprites — program listing (AtariOnline.pl forum, 2022) — Cyprian
- Picture: After RUN, the whole GRAPHICS 0 screen is coloured character by character, and the text picks up each square's colour. — Cyprian (program); screenshot by the site
- Gury's Atari 8-bit Forever — Atari Hires Sprites (listing) — Cyprian
- AtariOnline.pl forum discussion 6509 (linked from the Gury entry; not available locally) — atarionline.pl
