Atari XL Character-flip software text mode documentation by Bobby Clark The following is an attempt to document a number of software-driven text display modes accessible on the Atari 8-bit computer. These are (or will be) supported under my ICE Font editor. This document assumes that you already have some knowledge of the Atari's basic text modes (specifically Graphics 0 and Graphics 12/13) and how to design and use custom character sets in these modes. If you need to refresh your memory, there are many such resources available on the internet. A familiarity with Display Lists will also prove helpful. This document also assumes a knowledge of the GTIA text modes (that is, Graphics 0 or 12 with the GTIA set for modes 9, 10, or 11). I have a seperate documentation file for these modes, which might also prove helpful to keep handy when reading this. The modes are accessed by modifying either the Vertical Blank Interrupt routine, or through a cycling Display List Interrupt, so familiarity with these concepts might prove helpful. The following naming conventions will be used when referring to the memory locations required for the use of these modes. Name: Hardware location (decimal): Shadow register (decimal): ----- ---------------------------- -------------------------- CHBAS 54281 756 GTPRIOR 53275 623 COLP0-COLP3 53266-53269 704-707 COLPF0-COLPF3 53270-53273 708-711 COLBK 53274 712 CHACT 54273 755 DLIST 560,561 (pointer) RAMTOP 106 (pointer) In addition, the software routine which accesses these modes (through VBI or DLI) also references a table of values which get interchanged each screen redraw. Each register that gets flipped will receive a value from two memory locations. The naming convention for these will change, according to which registers get flipped: CHBV1 - CHBV2: Character set (CHBAS) GTV1 - GTV2: GTIA mode (GTI Prior) CPxV1 - CPxV2: Color table for COLPx (COLp0-COLP3) CPFxV1 - CPFxV2: Color table for COLPFc (COLPF0-COLPF3) CBKV1 - CBKV2: Color table for background or GTIA 10 color 8 (COLBK) CHCV1 - CHCv2: Character attribute (CHACT) There are up to 8 registers which can be flipped per VBI in these modes. VBTAB0-VBTAB7 will refer to the locations used by the VBI (or DLI) routine to access these registers. The locations are POKEd with the register value using LO+256*HI format (or DPOKE with the value itself if using TurboBASIC). Also note, if you are using a DLI to enable the character flip, you must use the hardware locations, while a VBI requires the shadow registers to be flipped. Display list flipping (see DISPLAY LIST FLIP modes), as far as I know, will not work on a DLI, only on a VBI. The idea: --------- The basis for all these modes, is a normal Graphics 0 (or 12) screen, with 2 character sets below RAMTOP. CHBAS gets flipped every VBI (or screen redraw) between these two sets. Other registers can also be flipped, depending on the text mode setup. The most famous example of this is the Super IRG mode which was used in Bill Kendrick's Gem Drop game, which allowed for the display of 14 colors at normal Graphics 12 (Antic 4) character resolution. There are basically 4 categories of software text modes: simple character-flip, gtia-flip, CIN/MIN/PCIN (normal-gtia flip), and display list flip. A. Simple Character Flip: ========================= The only register which gets flipped every VBLANK is the character set, plus (optionally) color registers. These are usually the simplest to set up, and take up less processing time. 1. Super 0 ----------- Base mode: Graphics 0 Required flip: CHBAS Optional flips: COLPF1 (luminance only) and COLPF2 (hue only) Resolution: 8x8 pixels, 2-4 colors per character. 4x8 pixels, 10-16 colors per character, if using Graphics 0 artifacting. Notes: An interesting monochrome effect can be had if you flip COLPF1 each vblank. You will want to set CPF1V1 and CPF1V2 to be between 0-14. The letters will change in luminance only, the chroma value (hue) remains the same as the background color (COLPF2). If you choose to flip COLPF2, make sure you have the values of CPF2V1 and CPF2V2 set so that the luminance is zero. it will improve the contrast of your display. 2. Super 12/13 (aka Super IRG) ---------------------------- Base mode: Graphics 12/13 Required flip: CHBAS Optional flips: COLPF0-COLPF3 Resolution: 4x8 pixels, 10-16 colors per character, 14-23 colors total displayable onscreen This is the famous software mode used in Bill Kendrick's "Gem Drop". The normal 4 color display per Antic 4 character is increased to 10 colors (4+3+2+1) per character grid. Also, for ATASCII 128-255 (Inverse) COLPF3 is used for bit-pair 11 instead of COLPF2, enabling the "fifth color". This allows for 4 different colors to be displayed in these characters, thereby bringing the total colors displayable in this mode (character flip only) to 14. The flicker which is encountered in many software modes such as this one, can be reduced by usage of character dithering. When you have adjacent pixels of the same color, you can design your character so that the component hues are on different character flips. This leads to an interlocking "checkerboard" design which can help stabilize the display. You cannot use dithering if you are flipping the playfield registers, however. By flipping the playfield registers each VBI, you can increase your color display total to 16 per character, with 23 colors displayable, however the flicker may be more noticeable. 3. Super 10 ------------ Base mode: Graphics 0.10 GTIPRIOR: 128 (mode 10) Required flip: CHBAS Optional flips: COLP1-COLP3 and COLPF0-COLPF3 Resolution: 2x8 pixels, 45-81 colors per character This is basically two graphics 0 character sets under GTIA 10 resolution. As above, character dithering will improve the display if you are not flipping playfield registers. Flipping the player and playfield registers will increase the colors displayable, but at a cost of more flicker. 4. Super 9 ----------- Base mode: Graphics 0.9 GTIPRIOR: 64 (mode 9) Required flip: CHBAS Optional flip: COLBK Resolution: 2x8 pixels, 136 monochrome shades displayable 256 dichromatic shades displayable if using COLBK flip Two graphics 0 sets under GTIA 9 monochrome resolution. You get 136 shades using only CHBAS flip. Flipping COLBK increases this to 256, but you must make sure CBKV1 and CBKV2 are set to an exact multiple of 16 (luminance of 0). Dithering can be used if you are not using the COLBK flip. This mode can produce some very subtle gradients! 5. Super 11 ------------ Base mode: Graphics 0.11 GTIPRIOR: 192 (mode 11) Required flip: CHBAS Optional flip: COLBK (luminance only) Resolution: 2x8 pixels, 136 colors (black+15 hues + 120 hues at double luminance) displayable 256 colors (3 level luminance + black) displayable with COLBK luminance flip. Two graphics 0 character sets under GTIA 11 resolution. You get the normal 15 hues, plus black, plus an additional 120 colors at double luminance. Character dithering can be used to stabilize the display. If flipping COLBK, use only values 0-14 (even numbered) for CBKV1 and CBKV2. This gets you black, 15 hues at one luminance, 15 hues at a brighter luminance, and an additional blended 225 hues at a third level luminance. This mode is more suited for subtle color gradients than contrasted luminance. B. GTIA FLIP ============ In these modes, a GTIA flip occurs on top of the CHBAS flip, to change the screen between any 2 of the three GTIA states (modes 9, 10, and 11). This concept was first used in bitmap mode, by Thomas Tanida, inventor of the APAC display mode, which interchanged a Graphics 9 and Graphics 11 screen to allow display of the full 256 colors in the Atari's hardware pallette. In addition, these modes may require a flip of COLBK in order to sharpen the display. 1. APAC 0 ---------- base mode: Graphics 0 Required flips: CHBAS, GTIPROR (modes 9-11), COLBK (0, 4-8 recommended) Optional flip: CHACT (0,2) Resolution: 2x8 pixels, 256 colors (16 hues * 16 luminance) This is the text mode version of the APAC/PRYZM mode. Like these bitmap modes, the screen is flipped between GTIA 64 (mode 9) and 192 (mode 11). Along with the CHBAS flip it enables any of the full Atari hardware pallette of 256 colors to be displayed per 2x8 character grid. A flip of COLBK is required to sharpen the display, setting CBKV1 to 0 and CBKV2 to 4-8 is recommended. An optional flip of CHACT by setting CHCV1 to 0 and CHCV2 to 2 will allow for two-color text display when using inverse characters. The luminance value is unchanged, but the bits on the mode 11 side are inversed. 2. HIP 0 -------- Base mode: Graphics 0 Required flips: CHBAS, GTIPROR (modes 9-10) Optional flips: CHACT (0,2), COLBK (0,1-255) Resolution: 5x8 pixels (illusory) 2x8 pixels actual, 128-144 colors (16 hues * 8 luminance or 16*9 colors) This mode is inspired by the HIP/RIP modes invented by Polish demo coders. It takes advantage of a bug in the GTIA chip which causes Graphics 10 pixels to be shifted one color clock (1/2 a GTIA pixel) right. The flicker causes the screen to display an apparent 160 pixels across. In this mode, GTIA is changed between 64 (mode 9) and 128 (mode 10). When designing characters, you are using two overlapping 2x8 character grids. The mode 10 character grid is positioned 1/2 pixel to the right of the mode 9 grid, giving an apparent 5x8 grid at double normal GTIA resolution. However, the first row is made up of only mode 9 pixels, while the last row is only mode 10 pixels. Care must be taken when desiging characters, as the rows on each side of the character grid can influence the pixels of any neighbouring characters, introducing artifacts. A HIP pixel is a combination of a mode 9 and mode 10 pixel in the same position. Plotting a mode 9 pixel and mode 10 pixel at the same spot in the character grid will show a combined color, with a hangoff to either side of the pixel (mode 9 to the right, mode 10 to the left) as below: *#* (mode 9 - both - mode 10) Plotting the mode 9 pixel one space over from the mode 10 pixel, has the effect of shifting the combined color pixel 1/2 space to the right, as shown: *#* (mode 9 - both - mode 10) *#* (blank - mode 10 - both - mode 9) A familiarity with the HIP mode and its variants (RIP, TIP) will prove helpful in using this character mode. The character can display any of 128-144 characters. It is common practice to set COLP1-COLP3 and COLPF0-COLPF3 to the same luminance to reduce flickering, though not required. When not flipping COLBK, keep COLBK and COLP0 (the background register for mode 10) set to 0 for best display. You can flip COLBK by setting CBKV1 to 0 and CBKV2 to any other value, to increase your color resolution from 128 to 144 colors. Again as in the APAC mode, a flip of CHACT between 0 (on the mode 9 side) and 2 (on the mode 10 side) enables two-color inverse text capability. When desiging text for this mode, it is required for you to use 2 characters to display one letter to ensure the text will be readable. It is also advisable to restict yourself to a 6x8 character resolution over those two grids, and avoid using the edges, so as to avoid any artifacting or bleedover onto other letters or characters on the screen. 3. CHIP 0 -------- Base mode: Graphics 0 Required flips: CHBAS, GTIPROR (modes 11-10) Optional flips: CHACT (2,0), COLBK (4-80,1-255) Resolution: 5x8 pixels (illusory) 2x8 pixels actual, 128-144 colors (8 hues * 16 luminance or 16*9 colors) This mode is similar to HIP 0 except this time, mode 10 provides the luminance while mode 11 provides the chroma information. Although not required, it is common practice to set COLP0-COLp3 and COLPF0-COLpF3 to the 8 grey shades (0-14 even numbers). When not flipping COLBK, set it to between 4-8 in order to stabilize the display on the mode 11 side. When flipping COLBK, set CBKV1 to 4-8 and CBKV2 to any other color you want. You can also set the playfield and player registers to non-monochrome colors to get subtle color gradients as well. A flip of CHACT between 2 and 0 (mode 11 and 10) again enables two-color inverse display. C. CIN-MIN (normal-gtia flip) ============================= These modes are inspired by the CIN bitmap mode concept. These modes involve a CHBAS flip, a GTIPRIOR flip between normal (0) and either 64 or 192 (mode 9 or mode 11). This results in an ANTIC mode character grid (4x8 or 8x8) overlaid onto a GTIA mode grid (2x8) thereby increasing the number of colors displayable. Also, a background flip (either COLBK or COLPF2) may be required to stabilize the display, as well as a CHACT flip if using mode 0 as the base mode. A warning: There is a known issue with the Atari800Win 4.1 emulator which causes the CIN 12/13 and MIN 12/13 modes to display incorrectly. The problem stems from the fact that the emulator doesn't handle correctly the display of Graphics 12/13 with the GTIA settings. Instead of displaying all the ATASCII characters, only ATASCII 32-95 get displayed. Other emulators such as Atari800 and Atari++ handle this display correctly. 1. CIN 12/13 ------------ base mode: GRAPHICS 12/13 Required flips: CHBAS, GTIPRIOR (modes 0-11), COLBK (0,4-8) Resolution: 4x8 pixels, 4-5 shades, overlaid onto a 2x8 9-14 hue grid, 60 colors total. This is the text equivalent of the CIN mode, first documented on atariage.com by Gary Ryan, an Australian coder. In this mode it is common practice to set COLPF0-COLPF3 to grey shades. The character grid is 2x8, however each pixel on the grid has two sub-pixels which can be set to any luminance, giving an overall resolution of 4x8 but with enhanced color resolution. There are two pallettes in use, as in normal ANTIC 4/5. The normal pallette (ATASCII 0-127) enables a display of 9 hues on the mode 11 side, and 4 luminances on the ANTIC 4/5 side. The inverse pallette (ATASCII 128-255) enables bit 11 to be the "fifth color", and also enables 5 extra luminances on the mode 11 side, available only in this pallette. The result is 36 colors per pallette (9 hue * 4 luminance), and 60 colors displayable overall. This mode is very useful for tetris-style blocks, and other block style graphics. 2. MIN 12/13 --------- base mode: GRAPHICS 12/13 Required flips: CHBAS, GTIPRIOR (modes 0-9) Resolution: 4x8 pixels, 4-5 colors, overlaid onto a 2x8 9-14 luminance grid, 60 colors total. This is similar to CIN 12/13, except this time it is the ANTIC 4/5 4x8 which provides the colors, overlaid on top of the GRAPHICS 12.9 grid, which allows for 14 shades displayable in a similar manner as described in the CIN 12 mode. No flipping of COLBK is required. 3. CIN 0 --------- base mode: GRAPHICS 0 Required flips: CHBAS, GTIPRIOR (modes 0-11), CHACT (0,2), COLBK (0,4-8) Resolution: 8x8 pixels, 2 colors, overlaid onto a 2x8 16 hue grid, 32 colors total. 4x8 pixels, 4 colors, overlaid onto a 2x8 16 hue grid, 64 colors total (artifacting). In this mode, each GTIA character pixel (2x8 grid) contains 4 normal GRAPHICS 0 character pixels whcih can be turned on or off, allowing for normal Graphics 0 text to be displayed in 32 colors (16 colors x 2 luminance). When using Graphics 0 artifacting, the grid becomes a CIN 12 grid, except that you get the 4 artifacted colors mixed on top of the GTIA luminances. For best results, COLBK should be flipped between 0 (mode 0) and 4-8 (mode 11) and COLPF2 should remain set at 0. A CHACT flip is also required between 0 and 2 if you wish to use inverse video. 4. MIN 0 --------- base mode: GRAPHICS 0 Required flips: CHBAS, GTIPRIOR (modes 0-9), CHACT (0,2) Resolution: 8x8 pixels, 2 colors, overlaid onto a 2x8 16 luminance grid, 32 shades total. 4x8 pixels, 4 colors, overlaid onto a 2x8 16 luminance grid, 64 colors (4x16 shades) total (artifacting). Similar to CIN 0, except overlaid onto mode 9. As above, COLPF2 should remain at the same value as COLBK0, and at luminance of 0. This mode allows for GRAPHICS 0 text to have 16 shades. When using artifacting in mode 0, you get 4x16 colors using CIN 12 character resolution. 5. PCIN 0 --------- base mode: GRAPHICS 0 Required flips: CHBAS, GTIPRIOR (modes 0-10), CHACT (0,2), COLPF2 (0,1-255) Resolution: 8x8 pixels, 2 colors, overlaid onto a 2x8 9 color grid, 18 colors total. 4x8 pixels, 4 colors, overlaid onto a 2x8 9 color grid, 36 colors total (artifacting). Similar to CIN 0, except overlaid onto mode 10. a COLPF2 flip between 0 and any other value on the mode 10 side is required to stabilize the display. In addition, this mode suffers from the GTIA pixel shift (HIP shift) for mode 10, so there is some pixel overhang when using the sides of the character grid, plus some bleeding may occur onto other character cells. This mode allows for mode 0 text at 18 colors per character cell, or 36 if using graphics 0 artifacting. D. DISPLAY LIST FLIP ==================== In these modes, in addition to a CHBAS flip, a display list flip between ANTIC 2 and ANTIC 4 is required to cycle the display. This is best accomplished by storing an ANTIC 2 and ANTIC 4 display list on the same page in memory (page 6, or the cassette buffer on page 4 are good places), doing a POKE to 560 of the page number, and cycling 561 between the two display lists every vblank. Because the display list has no shadow register, these modes can only be accessed through a VBI. The Display list flipping also means these modes cannot be used with GRAPHICS 13. 1. DIN ------ base mode: Graphics 0/12 (antic 2/4) Required flips: CHBAS, DLIST (561), COLPF2 (0,1-255), CHACT (0,2) Resolution: 4x8 pixels, 4-5 colors, overlaid onto a graphics 0 8x8 2 luminance grid. 4x8 16-20 color character grid when using Graphics 0 artifacting. This is the basic ANTIC 2/4 flip mode, giving a 4x8 antic 4 grid, with each pixel in the grid containing 2 GRAPHICS 0 pixels. This enables GRAPHICS 0 resolution text with 8 displayable colors. Enabling inverse video gives access to an additional 2 colors when using bit-pair 11 on the ANTIC 4 side ("fifth color") When using artifacting, the grid becomes a straight 4x4 grid (Super IRG) enabling 16 colors to be displayed. 4 additional colors can be displayed when using inverse video and using bit pair 11 on the ANTIC 4 side. A flip of COLPF2 between 0, and any other color on the antic 4 side is required to stabilize the display, and a CHACT flip is required to stabilize the inverse video characters. 2. Super CIN ------------ base mode: Graphics 0.11/12.0 (antic 2/4 flip) Required flips: CHBAS, DLIST (561), COLPF0 (4-8,0), GTIPRIOR (192,0) optional flip: CHACT (0,2) Resolution: 4x8 pixels, 4-5 shades, overlaid onto a 2x8 16 hue grid, 80 colors total. Similar to CIN 12 except the full range of 16 hues is accessible on the mode 0.11 side thanks to the display list flip. As in CIN 12, it is necessary to flip COLPF0 to stabilize the display. An optional flip of CHACT between 0 (on the mode 0 side) and 2 (on the mode 12 side) rearranges the inverse pallette and allows for variation when using 2-color inverse text. The normal pallette (ATASCII 0-127) allows for 64 colors (16*4), while the fifth color in the inverse ANTIC 4 pallette (ATASCII 128-255) adds an additional 16 colors. 3. Super MIN ------------- base mode: Graphics 0.9/12.0 (antic 2/4 flip) Required flips: CHBAS, DLIST (561), GTIPRIOR (64,0) optional flip: CHACT (0,2) Resolution: 4x8 pixels, 4-5 colors, overlaid onto a 2x8 16 luminance grid, 80 colors total. Similar to Super CIN, except that Antic 4 provides the colors, while the full range of 16 monochrome shades is accessible on the mode 0.9 side. COLPF0 should remain set at an even multiple of 16 to stabilize the display (luminance 0). The optional CHACT flip works here, in a similar fashion as in Super CIN. As in Super CIN, the normal pallette (ATASCII 0-127) allows for 64 colors (16*4), while the fifth color in the inverse ANTIC 4 pallette (ATASCII 128-255) adds an additional 16 colors.