Features
The list below describes ANTIC's inherent hardware capabilities meaning the intended functionality of the hardware by itself, not including results achieved by CPU-serviced interrupts or display kernels frequently driving register changes. ANTIC uses DMA to read a program called theVersions
''by part number'' * C012296 — NTSC: Used in Atari 400, 800, and 1200XL computers.Michael CurrentPinout
Registers
The Atari 8-bit computers and the Atari 5200 console map the ANTIC chip to the $D4xxhex page. ANTIC provides 15 Read/Write registers controlling Playfield display parameters, DMA for Player/Missile graphics, fine scrolling, light pen input, and interrupts. Hardware registers do not return the written values back when read. This problem is solved by Operating System Shadow registers implemented in regular RAM as places to store the last value written to registers. Operating System Shadow registers are copied from RAM to the hardware registers during the vertical blank. Therefore, any writes to hardware registers which have corresponding shadow registers will be overwritten by the value of the Shadow registers during the next vertical blank. Some Write hardware registers do not have corresponding Shadow registers. They can be safely written by an application without the value being overwritten during the vertical blank. If the application needs to know the last state of the register then it is the responsibility of the application to remember what it wrote. Operating System Shadow registers also exist for some Read registers where reading the value directly from hardware at an unknown stage in the display cycle may return inconsistent results. In the individual register listings below the following legend applies:DMACTL $D400 Write
SHADOW: SDMCTL $022F Direct Memory Access (DMA) Control DMACTL controls ANTIC's DMA behavior for the Playfield and Player-Missile ( sprite) graphics. Playfield Width bit values: Also see Display List DMA bit regarding Playfield display. Player/Missile DMA bits values: ANTIC's Player/Missile DMA feature reads bytes from memory and delivering data to update CTIA/GTIA's GRAFP0, GRAFP1, GRAFP2, GRAFP3, and GRAFM graphics pattern registers relieving the CPU from creating Player/Missile ( sprite) graphics. These bits turn on ANTIC's transmission of Player data and Missile data to CTIA/GTIA. CTIA/GTIA must also be configured to receive the data via its GRACTL register in order for Player/Missile DMA to function as expected. When Player DMA is enabled, Missile DMA automatically occurs to keep the DMA timing consistent, but the data is not delivered to the Missile's GRAFM register. When enabled, Player/Missile DMA occurs on every scan line in the visible display—from scan line 8 to 247. Therefore, the Player/Missile data in the memory map (see ANTIC's PMBASE) above and below those scan line counts is unused and undisplayed. Player/Missile Resolution bit values: * $00 - Double line resolution. ANTIC updates its DMA fetch address every other scan line and updates the CTIA/GTIA Player/Missile Graphics pattern registers every scan line, so that each Player/Missile byte pattern is two scan lines tall. When Double line resolution is enabled CTIA/GTIA register VDELAY ($D01Chex/53276dec) works by masking updates on even scan lines which results in shifting the bit pattern of individual Players and Missiles down one scan line. * $10 - Single line resolution. A DMA fetch and Player/Missile register update occurs on every scan line. CTIA/GTIA register VDELAY ($D01Chex/53276dec) which masks updates on even scan lines effectively reduces Single line resolution to Double line resolution. ANTIC DMA and Player/Missile pattern register updates occur on each scan line regardless of resolution. When Double line resolution is in effect the Player/Missile memory can be modified between the redundant DMA fetches thus changing the pattern sent to the GRAF* registers and producing apparent Single line resolution Player/Missiles. Display List DMA bit values: * $00 - Disable Display List. * $20 - Enable Display list. Playfield display requires that Display List DMA is enabled, and a Playfield width specified. If either value is zero, then no Playfield display is generated.CHACTL $D401 Write
SHADOW: CHART $02F3 Character Control CHACTL controls character display. Character control bit values do the following actions: The CHACTL Video Inverse and Video Blank bits affect the display of characters in ANTIC Text Modes 2 and 3 which have the high bit set (characters $80 through $FF). Toggling the values of the CHACTL bits allow blinking or blanking these characters globally for the entire display. Video Inverse and Video Blank enabled together result in reverse video characters displayed as an inverse blank space. Video Inverse and Video Blank bits work in ANTIC modes 2 and 3, and have no effect on the other text modes 4, 5, 6, and 7. The Video Reflect bit affects all Text Modes. Video Reflect is useful for situations requiring mirroring effects without defining a new character set. An ideal use is card games displaying accurate card faces showing upside down suits. As this vertically mirrors the glyph data before it is used, the effect appears inconsistent for ANTIC Mode 3 descenders with glyph bytes 6 and 7 appearing at the bottom of the descender area.DLISTL/DLISTH $D402/$D403 Write
SHADOW: SDLSTL/SDLSTH $0230/$0231 Display List Pointer ANTIC begins executing theHSCROL $D404 Write
Horizontal Fine Scroll This register specifies the distance of the Horizontal fine scrolling shift in color clocks. Only the lowest 4 bits are significant. The value range of 16 color clocks allows ANTIC to shift Mode 2 Text four characters, and Mode 6 text two characters before a coarse scroll is needed. When Horizontal scrolling is enabled for a mode line ANTIC fetches the next size increment greater than the current screen width to provide the buffer of data subject to the horizontal scrolling control. When displaying Narrow width ANTIC fetches the screen RAM needed for Normal width. Likewise, for Normal width ANTIC fetches the screen RAM needed for Wide. ANTIC buffers the first few bytes read from screen memory that are sufficient to cover the 16 color clock range of movement. (Two to four bytes depending on display mode.) The HSCROL value specifies how many color clocks should be output from the buffered data beginning from the last (right most) color clock of the last buffered byte and progressing to the left. When HSCROL is 0 no color clocks are output from the buffer, so the first screen byte displayed is the first byte after the buffered data. As HSCROL increases more color clocks from the end (right side) of the buffered data are added to the left edge of the display causing the fine scroll shift to move the screen contents to the right. ANTIC Mode F (high-resolution, 1/2 color clock pixels) can only be scrolled two pixels at a time, because HSCROL specifies color clocks. ANTIC Modes using the alternate GTIA color interpretations must be scrolled by an entire GTIA pixel (two color clocks). Only even values should be used to ensure correct scrolling. Odd values of HSCROL will shift the pixel stream into a different state that GTIA will interpret as different colors. Unlike many platforms Atari's horizontal scrolling is visually consistent and free from color "strobing" artifacts due to Atari's pixel size matching the color clock timing needed for accurate color.VSCROL $D405 Write
Vertical Fine Scroll This register specifies the distance of the Vertical fine scrolling in scan lines. The lowest 4 bits are significant, however the Vertical scroll value should range from 0 to the ANTIC Mode line's scan line height - 1. Scrolling farther than the ANTIC Mode's number of scan lines results in lines of repeated data upsetting the fine scrolling continuity (though, this can also be used as an exploitable behavior). The Vertical scrolling region is defined by setting the VS bit ($20) on a sequential series of ANTIC Mode Lines in thePMBASE $D407 Write
Player Missile Base Address This specifies the page of the base address for Player/Missile graphics. When double line resolution P/M graphics are operating the PMBASE value must begin on a 1K boundary. When single line resolution P/M graphics are operating the PMBASE value must begin on a 2K boundary.CHBASE $D409 Write
SHADOW: CHBAS $02F4 Character Base Address This specifies the page of the base address for the character set. ANTIC Modes 2, 3, 4, and 5 use 128 characters in the character set and require the CHBASE value begin on a 1K boundary. ANTIC Modes 6 and 7 use 64 characters, so the CHBASE value must begin on a 512 byte boundary. The usual default value is $E0hex/224dec for the character set in ROM at $E000hex/57344dec.WSYNC $D40A Write
Wait For Horizontal Sync This register allows programs to synchronize to the display. A write to this register halts the 6502 program through the end of the current scanline. This behavior is commonly used during Display List Interrupts to produce clean transitions/changes from one scanline to the next. The value written is unimportant.VCOUNT $D40B Read
Vertical Line Counter This register tracks the scan line currently being generated. The value returned is the actual scan line divided by 2. Blank lines generated at the start of the display are included. The value for NTSC will range from 0 to 130 for NTSC, and 0 to 155 for PAL. This value is useful during Display List Interrupts to identify the vertical screen position.PENH $D40C Read
SHADOW: LPENH $0234 Light Pen Horizontal Position This contains the horizontal color clock position when the light pen/light gun trigger is pressed. The shadow register is the recommended source for reading this information, since it will be updated during the vertical blank guaranteeing consistent and reliable results. Programs should avoid reading the hardware register directly unless the program is certain the register is read at a time insuring the value is valid. Light guns for the Atari function the same way as light pens with the addition of an optical magnifier allowing the screen to be read from a greater distance. The light pen/light gun input device requires a conventional CRT using a scanning electron beam. The light pen/light gun cannot work with modern LCD TVs and monitors.PENV $D40D Read
SHADOW: LPENV $0235 Light Pen Vertical Position This contains the VCOUNT value captured when the light pen/light gun trigger is pressed. The shadow register is the recommended source for reading this information, since it will be updated during the vertical blank guaranteeing consistent and reliable results. Programs should avoid reading the hardware register directly unless the program is certain the register is read at a time insuring the value is valid. Light guns for the Atari function the same way as light pens with the addition of an optical magnifier allowing the screen to be read from a greater distance. The light pen/light gun input device requires a conventional CRT using a scanning electron beam. The light pen/light gun cannot work with modern LCD TVs and monitors.NMIEN $D40E Write
Non-Maskable Interrupt (NMI) Enable NMIEN enables Non-Maskable Interrupts. The bit values: The Operation System sets NMIEN to the default $40hex/64dec during the power up routines. The NMI service routines first vector through $FFFAhex/65530dec which determines the cause and then transfers control to the interrupt service routine. DLI: If NMIEN's DLI bit is set when ANTIC encounters aNMIRES $D40F Write
Non-Maskable Interrupt (NMI) Reset Any value written to NMIRES resets the bits in NMIST which indicate the reason for the most recent Non-Maskable Interrupt. This is used by interrupt dispatch code in the Operating System and there would ordinarily not be a reason for a user program to write here.NMIST $D40F Read
Non-Maskable Interrupt (NMI) Status The Operating System's Non-Maskable Interrupt dispatch routine reads this register to determine the reason for the interrupt and so which service routine to execute. The bit values: * $20 - Reset key interrupt * $40 - Vertical Blank Interrupt * $80 - Display List InterruptDisplay list
TheDisplay list instruction overview
The Atari display is built as a series of ANTIC instructions each describing a line of text or graphics mode progressively from the top to the bottom of the screen until the desired display area is filled. In effect, the screen is a vertical stack of ANTIC mode instructions. Different modes occupy different numbers of scan lines and use different amounts of RAM. Designing a display requires counting the scan lines of each Mode instruction and tracking the memory for each Mode line to prevent overrunning ANTIC or video standard limitations. (See theInstruction Execution
ANTIC begins executing the Display List pointed to by the 16-bit address in registers DLISTL/DLISTH ($D402-$D403hex/54274-54275dec). The address registers are incremented by ANTIC automatically as each instruction is executed. ANTIC can only update the lowest 10 bits of the address during the automatic increment limiting the display list to begin and end within a 1K address range. The registers are also updated during Display List execution by ANTIC's JMP (Jump) and JVB (Jump and wait for Vertical Blank). These instructions load the full 16-bits of address, so can be used to circumvent the 1K Display List limitation. The address is also updated by the Operating System's Vertical Blank Interrupt (VBI) routine using the values from Operation System shadow registers SDLSTL/SDLSTH ($0230-$0231hex/560-561dec). When the OS VBI routine is enabled direct updates to the ANTIC DLIST registers by the CPU or the ANTIC Jump instructions will be overwritten by the OS during the next Vertical Blank. Since VBI processing is the usual state of the system, most programs rely on this and only update the OS shadow registers (SDLSTL/SDLSTH $0230-$0231hex/560-561dec) to set the Display List.Instruction Bytes
This legend applies to the instruction bit diagrams below: Instruction Bits: Bits 7:4 are modifiers for Playfield Mode instructions in bits 3:0. Bit value 1 Enables the modifier, and 0 disables the modifier. * Bit 3:Bit 0 - Playfield Mode Instruction. **Values , and are special instructions. ** Mode values through specify Playfield Character and Map modes. * Bit 4 - - Horizontal Scroll. * Bit 5 - - Vertical Scroll. * Bit 6 - - Load Memory Scan. * Bit 7 - - Display List Interrupt.Mode 0 Instruction - Blank Lines
When Mode bits are all zero ANTIC performs no playfield DMA and displays one or more blank scan line(s) of the background color. For normal color interpretation modes the "background" is color register COLBK (D01Ahex/53274dec) OS Shadow COLOR4 (02C8hex/712dec), though this differs for the GTIA color interpretation modes. See discussion of COLBK on the GTIA page for more information. The number of blank scan lines are specified by the value of Bits 4 through Bits 6 allowing a range from 0 through 7. ANTIC adds one to this value and displays the resulting number of scan lines. Instruction Values: Blank lines are useful for delaying the start of the screen display until the electron beam has left the vertical overscan area at the top of the display. The Atari Operating System creates all its graphics modes beginning with three 70hex/112dec instructions (or 24 blank scan lines) for this purpose. Blank lines are also useful for partitioning parts of a custom display with different purposes (i.e. a border between a status display and the main graphics.) Blank Mode lines cannot be contained within a scrolling region, because Blank Mode line instructions inherently do not have Fine Scrolling Modifier bits. However, a Blank Mode instruction can be used to end a vertical scrolling region and is still subject to the expected scan line height changes per the vertical scroll value. The DLI modifier bit is available for blank line instructions. When the DLI bit is enabled a Display List Interrupt will be triggered during the last blank scan line of the instruction. Since playfield DMA does not occur during blank lines (only Display list DMA and Player/Missile DMA (if enabled) occurs) the blank lines can be used where Playfield graphics will not be needed giving more time for Display List Interrupt routines changing color registers or Player/Missile positions.Mode 1 Instruction - Jump
When Mode value is 1 ANTIC executes a Jump in its program (the Display List). The next two bytes in the Display List are loaded into ANTIC registers DLISTL/DLISTH ($D402-$D403hex/54274-54275dec) changing the execution point of the next instruction. There are two kinds of Jumps: * 01hex/1dec JMP - Jump to address. This is used to load a new execution address in the middle of Display List execution, typically when the Display List must cross over a 1K boundary. * 41hex/65dec JVB - Jump to address and wait for Vertical Blank. (JMP + LMS bit set) This is used to end the Display List. The address used should be the starting address of the Display List. The DLIST registers are also updated by the Operating System's Vertical Blank Interrupt (VBI) routine using the values in shadow registers SDLSTL/SDLSTH (0230-0231hex/560-561dec). When the OS VBI routine is enabled direct updates to the ANTIC DLIST registers by the CPU or the ANTIC Jump instructions will be overwritten by the OS during the next Vertical Blank. This implies that an ANTIC JVB (Jump and wait for Vertical Blank) instruction that specifies an invalid address (or a valid address that differs from the shadow SDLST value) has no real effect on the display. The JVB's argument usually points to the beginning of the same Display List, but it can also point to another Display List, so that a chain of Display Lists is executed after consecutive vertical blanks. Of course, to give ANTIC control over the start of the next Display List the OS Vertical Blank interrupt must be disabled to prevent it overwriting ANTIC hardware registers with the shadow register values.Modes 2 to F Instructions - Playfield Character and Map Modes
The following is the list of ANTIC graphics mode instructions. For more detailed descriptions of each Mode see the Playfield Graphics Modes section. The memory requirement for a Mode Line is determined by two factors: * The width bits set in the DMACTL hardware register. * The presence of the Horizontal Fine Scroll Display List Instruction Modifier. The Horizontal Fine Scroll Modifier will change the memory requirement for the current Mode Line from the DMACTL-specified width to the next largest value.Instruction Modifiers
Bits 7:4 are modifiers for Playfield Mode instructions in bits 3:0. Playfield Mode Instruction values range from $02 to $0F. Modifier bit value 1 Enables the modifier, and 0 disables the modifier. * Bit 4 - $10hex/16dec Horizontal Scroll. * Bit 5 - $20hex/32dec Vertical Scroll. * Bit 6 - $40hex/64dec Load Memory Scan. * Bit 7 - $80hex/128dec Display List Interrupt.HS Modifer - Horizontal Fine Scroll
Bit4: position value $10, controls horizontal scrolling of the playfield mode. When horizontal scrolling is enabled ANTIC retrieves more screen memory bytes than displayed in order to show partially scrolled display bytes at the beginning and end of the line. If the display is in Narrow mode ANTIC retrieves the number of screen bytes necessary for Normal mode. If the display is in Normal mode ANTIC retrieves the number of bytes needed for Wide screen mode. In Wide screen mode ANTIC does not retrieve any additional screen bytes. Scrolling in Wide screen will cause blank data to be shifted into the scrolled area. This is not a problem, because it occurs in the overscan area which is not visible on a normal NTSC/PAL display.VS Modifer - Vertical Fine Scroll
Bit5: position value $20, controls vertical scrolling of the Playfield mode. The Vertical scrolling region in a display is defined by setting the VS bit ($20) on a sequential series of ANTIC Mode Lines in the Display List. The first Mode line without the VS bit set becomes the end of the scrolling region and is used as a buffer line to supply the new information to scroll up into the bottom of the scrolling region.LMS Modifer - Load Memory Scan
Bit6: position value $40, loads a new address for the start of screen memory for the current Playfield mode line. The LMS option loads ANTIC's screen memory scan address with the 16-bit value in the two bytes following the instruction. The Character or Map mode specified will begin displaying bytes from that address. The LMS option must appear in the first Playfield Mode Instruction line (not Blank Line) in the Display List to initialize ANTIC to begin reading at the start of screen memory. Most of the Operating System-generated full screen modes will have only that one occurrence of the LMS modifier present in theDLI Modifer - Display List Interrupt
Bit7: position value , directs ANTIC to invoke a CPU-serviced interrupt on the last scan line of thePlayfield Graphics Modes
The ANTIC chip allows a variety of different Playfield modes and widths. However, the original Atari Operating System included with the Atari 800/400 computers provides easy access to a limited subset of these graphics modes. ANTIC Playfield modes are exposed to users through Atari BASIC via the "GRAPHICS" command, and to some other languages, via similar system calls. Oddly, the modes not directly supported by the original OS and BASIC are modes most useful for games. The later version of the OS used in the Atari 8-bit XL/XE computers added support for most of these "missing" graphics modes. The ANTIC chip uses aCharacter Modes
Glyph Rendering
All character sets use 8 sequential bytes to represent the character. Four types of character/glyph rendering of those bytes are available. Each Character Mode is associated to a specific rendering method: * Standard: ANTIC Mode 2. Based on the high resolution graphics modes each bit in the character glyph represents one pixel on screen that is 1/2 color clock wide. The background color is rather than COLBK used in other Character and Map modes. COLBK appears as a border around all four sides of the Playfield. 0 value bits in the character glyph show the background color. 1 value bits show the luminance value from based on the background (COLPF2) color. The character set uses 128 characters and requires 1024 bytes of RAM. * Descenders: ANTIC Mode 3. A modification of the Standard method. The method of pixel color display is the same. Each mode line is 10 scanlines tall, though the character glyph is still 8 bytes. Characters hex/0dec to hex/95dec display in the top 8 scan lines with two blank scan lines added at the bottom. Characters hex/96dec to hex/127dec begin with two blank scan lines at the top, and then display the glyph bytes in the bottom 8 scan lines. The first two bytes in the glyph are moved to the bottom two scan lines. This allows a properly designed character set to display true descenders. The character set uses 128 characters and requires 1024 bytes of RAM. * Single Color: ANTIC Modes 6 and 7. In these modes each bit in the character glyph represents one pixel that is one color clock wide. The background color is COLBK. Characters may be displayed in a choice of one of four colors. The six low bits of the character value identifies the glyph and the two high bits identify a color. Since the character value is reduced to six bits the character set uses 64 characters and requires 512 bytes of RAM. 0 value bits in the character glyph show the background color. 1 value bits in the glyph data shows one of four possible color choices based on the two high bits of the character value. Character value bits 7 and 6: * Multi-Color: ANTIC Modes 4 and 5. In these character modes each pair of bits in the character glyph represents a pixel one color clock wide, thus a single byte of glyph information represents 4 pixels rather than the 8 pixels of other modes. The character set uses 128 characters and requires 1024 bytes of RAM. The background color is . This mode allows up to four colors (including the background) to be displayed in one character matrix. If the high bit of the character value is set (i.e. inverse video) then a fifth color, , is displayed in place of the pixel bit pattern "11" that ordinarily shows . The color choices based on the bit pairs of the character glyph:Map Modes
GTIA Modes
GTIA modes are Antic Mode F displays with an alternate color interpretation option enabled via GTIA registerScrolling
Before video displays became a common part of the user interface many computers used a teletype—a printer usually with continuously-fed paper. User input and the computer generated output were printed on the paper fed through the printer. This widely understood interface for user input and computer output continued with the introduction of video displays as computers presented a metaphor of the screen as a view port over an imagined, infinite roll of paper. Information is displayed on screen beginning at the top until it reaches the bottom of the screen and when the computer needs to introduce new information it shifts all the screen information up providing an empty space at the bottom for the new information and consequently erasing the topmost information. This kind of scrolling is called, "coarse scrolling". It is achieved by moving bytes of memory through a designated screen display area. Moving a kilobyte (or more) of memory is CPU intensive and slower computers may not be able to accomplish anything else while updating screen data. As a means of animating a display the results can be jerky when the CPU cannot update the screen memory faster than the display hardware reads the memory to generate the video output. Motion fluidity is impaired, since the minimum amount of shifting the display is the size of an entire character. Most computers including the Atari 8-bits accomplish coarse scrolling as described above — common examples are viewing a long BASIC program listing or directory of files. Coarse scrolling implemented by bulk movement of data is often the only method of scrolling possible on most computers. However, ANTIC provides direct hardware support for vertical and horizontal, coarse and fine scrolling taking the concept of a "view port moving over data" from a metaphorical illusion to literal implementation. These ANTIC features deliver rapid, smooth, full screen movement requiring negligible CPU time and so free the CPU for other work. All ANTIC display modes, Text and Map modes, can exercise the hardware scrolling features.Vertical Coarse Scrolling
Vertical coarse scrolling is the easiest feature to exercise. The first Text or Map Mode instruction in everyVertical Fine Scrolling
Vertical Fine Scrolling allows single scan line movement of the scrolling region for Text and Map modes which are greater than one scan line tall. Vertical Fine Scrolling for Map modes only one scan line tall is logically not practical. The effect of vertical "fine" scrolling for single scan line Map modes can be performed using the easier coarse scrolling method. Fine scrolling requires setup to define the scrolling region. This is done by setting the Vertical Scroll (VS) modifier bit in sequentialHorizontal Coarse Scrolling
Horizontal coarse scrolling requires a little more effort than vertical scrolling. While horizontal scrolling is expected to present the illusion of a view port moving left and right across a wide panoramic scene made of screen memory, ANTIC's automatic memory scan increment conflicts with this idea that the rows of screen data is wider than the display. Presenting screen memory as long horizontal lines requires an LMS modifier for everyHorizontal Fine Scrolling
Horizontal Fine Scrolling allows single color clock movement of the scrolling region for Text and Map modes. For all normal color interpretations this is by color clock, not pixel even when pixels are larger (or smaller) than the color clocks. ANTIC Modes using the alternate GTIA color interpretations must be scrolled by an entire GTIA pixel (two color clocks). Only even values should be used to ensure correct GTIA pixel scrolling. Odd values of HSCROL will shift the GTIA pixel stream into a different state that will be interpreted as different colors. Fine scrolling requires setup to define the horizontal scrolling region. The first step is to start with aAlternate Scrolling Methods
An interesting use of ANTIC's DMA memory scan behavior permits a strategy for apparently long horizontal scrolling distances, but uses a fraction of the real memory required. As discussed in Horizontal Coarse Scrolling ANTIC's automatic memory scan increment from Mode line to Mode line conflicts with the idea that the rows of screen data are wider than the display. Using memory actually organized as a long, horizontal, contiguous series of bytes requires an LMS modifier for every Display List Text or Map Mode instruction in the scrolling region. Instead of using an LMS modifier for every line this method uses a more "normal" display list that only requires one LMS modifier at the start of the scrolling region. An increment (+1) to the LMS modifier address makes the scrolling region appear to move toward the left. However, the "new" information that has moved into the right side of the scrolling region was previously the first byte on the following line (except for the last byte of the last line — that information had been completely off screen). The second half of this strategy requires the last byte/character of every line in the scrolling region to be updated to show the desired, new information. For a typical scrolling display this would mean updating the last byte of one or two dozen lines which takes a trivial amount of time in assembly. So, if this scrolling process involves a full screen Mode 2 or Mode 4 text display (rather worst case) and uses the entire 4K capability of ANTIC's automatic screen memory addressing, then the horizontal scrolling can continue in this manner for about 3,000 steps; equivalent to 75 full screens. However, even the 4K memory use is not required. After all the data from the first full screen has been shifted off the display the scrolling application can rebuild the first screen to contain a known transition point so that the scrolling action can jump back to the first address in the block with no apparent stutter or obvious interruption in the scrolling. Fine scrolling this arrangement requires a little more planning. When fine scrolling is enabled in the Display List ANTIC retrieves more information than the Mode line requires for display. As each mode line now uses more memory, the new information scrolled into the side of the display is not the byte/character that was displayed at the start of the next line. However, this does not impair the scrolling process and merely changes the value of addition and subtraction used to locate the start and end of each display line.Display List Interrupts (DLI)
ANTIC includes a feature to trigger a CPU-serviced interrupt at specific vertical positions on the screen. This is built into the ANTIC Display List which directs ANTIC to launch the interrupt during the last scan line of the current Mode instruction, and so is called "Display List Interrupt". Other platforms call this activity, "Overview
Properly launching the interrupt requires the following conditions: * A Display List with a Mode instruction that includes the Display List Interrupt (DLI) modifier bit set. (Bit 7 - $80hex/128dec) * ANTIC's NMIEN register has the DLI bit set. (Bit 7 - $80hex/128dec) * The Operating System vector for the Display List Interrupt (VDSLST, $0200hex/512dec) points to the starting address of the interrupt routine.Proper Setup
When updating display control values care must be taken to ensure ANTIC is not currently using them. If ANTIC is processing the Display List containing an Instruction with the DLI modifier, then an interrupt could be dispatched while changing the VDSLST address, potentially crashing the system. If a Display List uses multiple interrupts, and interrupts are enabled in NMIEN after ANTIC has already passed Mode Instructions with DLI modifiers, then the Display List Interrupts will be started out of order, causing unexpected results. A ''reasonable'' sequence of events to install a Display List using Display List Interrupts: * Turn off ANTIC Display List Interrupts by clearing bit 7 () of NMIEN by setting the register to value which allows the Vertical Blank Interrupt to continue running. * Turn off ANTIC Display List DMA. Turn off the DMA in the Shadow register first ( SDMCTL), and then if desired the same can be done to the hardware register ( DMACTL). Bit 5 (value ) must be cleared, but most implementations would choose to zero all bits and then when the time comes to restart the screen restore the correct value of all bits. * Set the Display List pointer Shadow address DLISTL/DLISTH to the starting address of the new Display List. * Set the Display List Interrupt address VDSLST (hex/512dec) to the starting address of the interrupt routine. * Wait for the next Vertical Blank Interrupt (VBI) to apply the Shadow register changes. Possible methods: ** Monitor RTCLOCK (//hex/18/19/20dec) for an increment indicating the VBI occurred. ** Monitor ANTIC's VCOUNT for changes indicating the next frame has started. * Turn on ANTIC Display List Interrupts by setting bit 7 () of NMIEN. The usual value for NMIEN is which enables DLI and VBI. * Turn on ANTIC Display List DMA by updating the Shadow register ( SDMCTL). Bit 5 (value ) must be set, as should the bits for Playfield width, and if needed, the bits related to Player/Missile graphics. A program tightly integrated with the display cycle and aware of the electron beam position relative to the current display can bypass turning off Display List DMA. Likewise, turning off the display is not needed if the setup occurs during the vertical blank.Code Considerations
The 6502 Accumulator, X and Y register contents are not preserved before entry to the DLI routine. It is the responsibility of the DLI routine to save the state of the registers that will be used during the DLI routine, and then the last action is to restore the original values of the registers before exiting with an RTI instruction. Routines typically push the register values to the 6502 stack. If multiple DLIs are used the first interrupt updates VDSLST to point to the address of the next interrupt, and so on for subsequent interrupts. The last Display List Interrupt routine on the screen points VDSLST back to the address of the first Display List Interrupt. If a value changed by a DLI has an Operating System Shadow register and the Vertical Blank Interrupts are enabled, then the value in effect before (above) the screen position of the Display List Interrupt is the value of the Shadow, and the value after (below) the screen position is the value from the DLI (and any other DLI that later changes it.) If the value does not have an Operating System Shadow then there should be an initial DLI (or VBI) routine which sets a starting value. If a graphics object is being displayed while the DLI changes its value the results may be inconsistent. The most common example is changing the background color. Since the DLI begins executing while the electron beam is in a visible portion of the screen, the transition from the previous background color to the new color written by the DLI will be visible somewhere on the current scan line. (The exact location varies based on DMA requirements for the display mode and Player/Missile graphics.) To produce a clean transition from scan line to scan line the code should first write to WSYNC which halts the DLI execution until the end of the scan line, and then write to the desired registers. While the usual operation of the DLI is to change a few display-oriented values, and then return to the main code, this is not a requirement. It is safe for a DLI to run for several, or many scan lines as long as it exits before the next DLI or the Vertical Blank Interrupt.Examples
A trivial example of a Display List Interrupt that changes the background color:Player/Missile Graphics
Most Player/Missile graphics functionality is in the domain of the CTIA/GTIA chip. CTIA/GTIA controls position, size, color, priority, and collision detection for Player/Missile graphics objects, but its actual shape rendering implementation goes no farther than a single byte pattern per object presented uniformly on all scan lines. (The patterns are set in CTIA/GTIA's GRAF* graphics pattern registers.) In the end, by itself CTIA/GTIA generates Player/Missile objects as only vertical stripe patterns on the screen. ANTIC's design includes DMA capability so that it may read its Display List and Playfield graphics data. This direct memory access capability is leveraged to read data on behalf of CTIA/GTIA and update the GRAF* graphics pattern registers as each display scan line is generated. In this way ANTIC provides Player/Missile objects with patterns that vary over the height of the screen and so appear as traditional "sprite" graphics. Bits 2 and 3 of ANTIC's DMACTL register (shadowed by SDMCTL) control ANTIC's retrieval of Player/Missile data to update CTIA/GTIA graphics pattern registers. DMACTL Player/Missile DMA control bits values (bits :2: * - Disable Player and Missile DMA * - Enable Missile DMA * - Enable Player DMA * - Enable Player and Missile DMA Missile DMA can be enabled without player DMA. However, when Player DMA is enabled, Missile DMA automatically occurs to keep the DMA timing consistent, but the data is not delivered to the Missile's GRAFM register. Bit 4 (value hex/16dec) of the DMACTL register controls the frequency of new data retrieval. ANTIC retrieves data and updates CTIA/GTIA every scan line. The DMACTL resolution settings affect how often ANTIC increments its internal DMA pointer for fetching new data. Single Line resolution Player/Missile graphics increments the DMA address every scan line, and Double Line resolution increments the DMA address with every even scan line. The DMACTL bit values for Player/Missile resolution: * - Double line resolution. New data is fetched by DMA on even scan lines, but an update to CTIA/GTIA Player/Missile Graphics pattern registers still occurs on every scan line. Consequently, each Player/Missile byte pattern is two scan lines tall. When Double line resolution is enabled CTIA/GTIA register VDELAY (D01Chex/53276dec) can be used to mask ANTIC's updates on even scan lines shifting the bit pattern of individual Players and Missiles down one scan line. * - Single line resolution. A new DMA fetch and Player/Missile register update occurs on every scan line. CTIA/GTIA register VDELAY (D01Chex/53276dec) masking the updates on even scan lines reduces Single line Player/Missile resolution to appear to be Double line resolution, though the data is shifted one scan line lower. CTIA/GTIA must also be specifically enabled to receive the Player/Missile graphics data via DMA to correctly present the objects on screen. See CTIA/GTIA's GRACTL register for more information. The location of memory read by ANTIC for Player/Missile graphics is controlled by register PMBASE. This value of PMBASE provides the starting page of the base address for Player/Missile graphics. When double line resolution P/M graphics are operating the PMBASE value must begin on a 1K boundary. When single line resolution P/M graphics are operating the PMBASE value must begin on a 2K boundary. The memory maps for the Player/Missile graphics modes: Double line resolution (1 byte per 2 scanlines, 128 bytes each object) relative to PMBASE x hex/256dec: Single line resolution (1 byte per scanline, 256 bytes each object) relative to PMBASE x hex/256dec: Missiles share the same bytes of the memory maps above, two bits per Missile: ANTIC does not use the first and last 8 scan lines worth of data of Player/Missile memory in the memory map. In double line resolution the first and last four bytes are ignored, in single line resolution the first and last eight bytes. Since the Player/Missiles are an overlay independent from Playfield graphics and are rendered in the overscan area the vertical coordinates for Player/Missile data must be offset to align objects with the Playfield. In the Operating System's 192-scan line default graphics modes the Player/Missile vertical data coordinates are offset from the Player/Missile's start in memory as shown below. Overscan entries show the first and last used offsets of Player/Missile data:Limitations
The vertical extent of the entire Playfield display varies between 0 and 240 scanlines - this depends on the number of lines ANTIC is programmed to display according to theBugs and Border Conditions
Certain combinations of values in theExploitable Behaviors
Graphics 9++
One method of using the enhanced GTIA color modes without the large memory requirements of ANTIC mode F is to direct ANTIC to repeat each line of data one or more times by using Mode line instructions with the LMS modifier to redisplay the same screen data on multiple scan lines. This produces a lower vertical resolution where each pixel is 2 or more scan lines tall, but has higher DMA overhead due to ANTIC needing to re-read the same bytes from screen memory. Rather than using repeated LMS modifiers, a quirk of vertical scrolling can be exploited to create a four scan-line mode that displays pixels using the hi-res or GTIA color interpretation modes. Vertical Scrolling would ordinarily not be considered useful for ANTIC Mode F which is one scan line tall. However, if Vertical Scrolling is enabled for the Mode FUnexploitable Behaviors
Mode 8/Mode 9 Horizontal Scroll Corruption
ANTIC Map Modes 8 and 9 will be corrupted when immediately following a horizontally scrolled line of a different mode using normal or wide playfield width. This occurs if the Mode 8 or 9 line is horizontally scrolled or not, but the corruption results are different in each case. The problem appears for certain HSCROL values causing ANTIC to output pixels incorrectly and misalign the Mode 8-9 line. The bug is absent when narrow width playfield is used. *If Mode 8 or 9 is NOT using Horizontal scrolling and follows: **Mode 2, 3, 4, 5, D, E, or F and HSCROL is , or : then corruption continues through the mode line. **Mode 2, 3, 4, 5, D, E, or F and HSCROL is or : then corruption resolves itself within two scan lines. **Mode 6, 7, A, B, or C and HSCROL is or : then corruption continues through the mode line. *If Mode 8 or 9 is using Horizontal scrolling and follows: **Mode 2, 3, 4, 5, D, E, or F: then corruption resolves itself within three scan lines. **Mode 6, 7, A, B, or C: then corruption resolves itself within two scan lines. Since the HSCROL values causing the problem are greater than 7, the problem can be averted when Mode 8 or 9 is NOT using Horizontal scrolling by limiting HSCROL shifts to 0 through 7 color clocks and updating theHi-Res Last Line Bug
A display list should not be built with a hi-res (Mode F) instruction in scan line 247—the last displayable scan line. If the DMACTL Playfield Width bits are not 00 then ANTIC will not generate the vertical sync properly potentially causing display distortion. In any case, this is easy to avoid, since this is not a practical Display List arrangement as this places the Mode line in the overscan area where it is not ordinarily visible.Wide Playfield Horizontal Fine Scrolling
The Horizontal Fine Scrolling display list modifier causes ANTIC to fetch extra screen memory corresponding to the next larger Playfield width which provides the data needed to scroll into the display. Since there is no Playfield width larger than the Wide Playfield, ANTIC has no extra data for fine scrolling. ANTIC presents fake data for the area emptied by the shifted screen—on the left side of the display the background color will be shifted in and on the right side a few color clocks of random data will appear at the end of the scrolling range. This pixel data is not usually noticeable, since this occurs in the overscan area where it is not ordinarily visible. However, if these false Playfield pixels intersect Player/Missile pixels a collision will be flagged. The solution for Players/Missiles that have moved into the overscan area is to reset their positions to zero to remove them from the display and so prevent false collisions.See also
* CTIA/GTIA *References
{{reflistExternal links