ANTIC Opcodes...

io-cableAs you (hopefully ;) ) know Atari has designed some very nice custom chips in this small machine which make life easier.

Your Atari has beside the main-cpu 65c02 another custom chip with own instruction-set. "ANTIC" is maybe the shortage for "Alphanumeric Television Interface Controller". Antic is a cool sub-processor and can "steal" cpu-cycles from the 65c02 when he accesses RAM by his DMA- possibility.

Because of own instrucion-set, so called "display-list or Dlist", it is possible to mix all graphic-modes as you want (text+hires-modes).

(the following informations are based on PAL-versions)

Antic displays 50 frames per second. The cpu was designed to work with 1,77 mhz so that in 1 machine-cycle the Antic can display 2 color-clocks.

There are 3 display-line-width possible:
  • small line-width with 128 color-clocks. the display-area on screen is defined by 32 bytes in screen-ram.
  • normal line-width with 160 color-clocks. display-area is defined by 40 bytes (see esp. gr.0).
  • overscan line-width with 192 color-clocks. A line is here defined by 48 bytes.
  • So the maximum resolution is for the most used graphic-modes:
    graphic-mode in "basic"-notation (esp. gr.0):
    
    text-modes
     
    
    
                      Antic-modes      "2"  "3"  "4"  "5"  "6"  "7"
                      Basic-modes      "0"  ---  12   13   "1"  "2"
    
                      chars per line   40   40   40   40   20   20
                      pixel per char   8    8    4    4    8    8
          color-clocks per pixel (x)   1/2  1/2  1    1    1    1
                  Pixel per char (y)   8    8    8    8    8    8
                  scanlines per char   8    10   8    16   8    16
                          max. color   1    1    5    5    5    5
           defineable chars per font   128  128  128  128  64   64
             length of font in bytes   1kb  1kb  1kb  1kb  512  512
        bytes in screen-ram per line
                               small   32   32   32   32   16   16             
                              normal   40   40   40   40   20   20
                            overscan   48   48   48   48   24   24
        how many bits define 1 pixel   1    1    2    2    1    1
    
    and now the same for
    
    hires-modes:
    
                      Antic-modes      "8"  "9"  "A"  "B"  "C"  "D"  "E"  "F"
                      Basic-modes      "3"  "4"  "5"  "6"  ---  "7"  "F"  "8" 
    
                  Pixel per Scanline
                               small   32   64   64   128  128  128  128  256                      
                              normal   40   80   80   160  160  160  160  320      
                            overscan   48   96   96   192  192  192  192  384
        bytes in screen-ram per line   
                               small   8    8    16   16   16   32   32   32
                              normal   10   10   20   20   20   40   40   40
                            overscan   12   12   24   24   24   48   48   48
        How many bits define 1 pixel   2    1    2    1    1    2    2    1
          possible colors per screen   4    2    4    2    2    4    4    2
                 scanlines per pixel   8    4    4    2    1    2    1    1
              color-clocks per pixel   4    2    2    1    1    1    1    1
    This tables are useful for coding when you have to know how many bytes/pixel are are used in a special grafic/text-mode... This informations were taken from the book "Atari intern" but rewritten and most bugs are deleted and changed.

    Let me now show you the complete list of the ANTIC-Opcodes:

    There are 3 groups of display-list-commands:
    1. commands which make "empty" scanlines
    2. jump-commands
    3. commands which produce special scanlines (text/grafic)

    I will not write down which bits in a command-byte define what... The following table should give you all possibilities to code your own display-lists... ;)

    1. Blank-scanlines:

    empty scanlines:    "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"
    dl-byte:            $00  $10  $20  $30  $40  $50  $60  $70
    e.g. if you want 8 empty-scanlines then you must add the $70-command to your display-list, or if you want just 4 then $30.

    2. Jump-Instructions:

    The Antic "decodes" his display-list every vbi but he doesn`t know where is the end of the display-list... he does not count the amount of scanlines he is displaing. So if e.g. your display-list causes the Antic to display more then 240 scanlines (for PAL-machines) then he will do this... But your TV-Set or Monitor doesn`t like this and the picture will be "rolling"... So if you are writing your own display-list you must take care about the amount of scanlines it produces... if you are not sure... just add the values of the 2 above shown tables...

    At the end of each Display-list there must be a JMP-command which shows the ANTIC, "aha, I am finished" or "oh, there is another Display-List".

    There are 2 possible JMP-comnands:

  • 1. JMP-Code: $01 lo hi-Adress of Display-list
  • 2. JMP but wait till VBI Code: $41 lo hi-Adress of display-list
  • Each JMP-instruction produces 1 empty scanline and loads the adress-counter with the followed adress.

    Every DL should contain a $41+Adress of the DL at the end... But you may ask yourself "for what is the $01 usefull???". Well, I have often used the $01-command when I used several Display-lists with a basic-frame but different containings.

    Here is a example... (in ascii-format, not the listing):

    1. here is a area on screen with a gr.15-logo
    2. then the "action-area follows containing several different modes.
    3. another "Credits" area in text-mode
    
    -----------------
    | Logo in Gr.15 | the logo is not changing in the demo.
    -----------------
    |               |
    | action-screen | This area is changing several times in a demo.
    |               |
    -----------------
    | Credits-Text  | this one stays constant on screen.
    -----------------
    To save memory you can make several display-lists for each effect in your demo... but you have not include in each display-list the same "logo"-display- list and the "credits"-text-display-list...

    Why not make the following:

    1. gr.15-logo-display-list with $01+Adress of the effect-DL
    2. the different-DLs with $01+Adress of the 3rd part of the "main"-DL
    3. the "Credits"-DL with a $41-JMP to the 1st logo-DL
    But you must take care that all "including" DLs contain the same amount of scanlines because if there are differences then the following DL (e.g. the "Credits"-DL) will "jumping" on the screen...

    So back to the most used commands, the "action"-commands:

    The following table shows all possible commands without "Display-List-Interrupts":

    Horizontal Softscrolling enabled --   xx   --   xx   --   xx   --   xx
    Vertical Softscrolling   enabled --   --   xx   xx   --   --   xx   xx
    Load new Screen-Adress (LMS)     --   --   --   --   xx   xx   xx   xx
    
                          Antic Mode
                             "2"     02   12   22   32   42   52   62   72
                             "3"     03   13   23   33   43   53   63   73
                             "4"     04   14   24   34   44   54   64   74
                             "5"     05   15   25   35   45   55   65   75
                             "6"     06   16   26   36   46   56   66   76
                             "7"     07   17   27   37   47   57   67   77
                             "8"     08   18   27   37   47   57   67   77
                             "9"     09   19   29   39   49   59   69   79
                             "A"     0a   1a   2a   3a   4a   5a   6a   7a
                             "B"     0b   1b   2b   3b   4b   5b   6b   7b
                             "C"     0c   1c   2c   3c   4c   5c   6c   7c
                             "D"     0d   1d   2d   3d   4d   5d   6d   7d
                             "E"     0e   1e   2e   3e   4e   5e   6e   7e
                             "F"     0f   1f   2f   3f   4f   5f   6f   7f
    
    for DLI add +$80...
    A huge table, isn`t it? But it`s easy to understand. the Bits 0-3 in the command-byte define the graphic-mode which you want the Antic to display. The other bits select several modes, e.g. horizontal softscrolling or loading the adress-register of the Antic for new screen-ram. The "XX" above this table hows which modes are enabled.

    What about an example of a display-list which you know very well? ;)

    The following display-list shows the standard Graphics 0-screen:

    $70  3*8 empty scanlines (the "black" border above the text-screen)
    $70
    $70
    $42  load the screen-ram into the adress-counter 
    $40  $bc40 is our screen-ram, its the same adress which is normaly
    $bc  set by the OS to 88,89 (in basic type "?peek(88)+peek(89)*256"
    $02  
    $02  23*Graphics 0 (Antic-Mode 2)
    $02
    ..
    $02
    $41 
    $lo adress of the display-list (look into 560,561 ;) "?peek(560)+peek(561)*256")
    $hi
    Why are there just 23 $02-commands??? the standard Gr.0-screen has 24 lines. Hmmm. Look to the LMS-Command (the one which tells the Antic where are the screen- data, $4x). The $42 tells the Antic "load the following adress to your memory- counter and after that display this data in that adress in Antic-Mode "2" which is Gr.0. So the LMS-Byte is our 1st line which will be displayed!

    Here is another example, the Gr.8-Display-List:

    $70 as usual set by Atari (but you don`t need that!)
    $70
    $70
    $4f now Antic-Mode "F" instead of "2"
    $lo the starting adress of our hires-screen-ram
    $hi
    $0f
    $0f
    $0f about 100 times...
    $0f
    ...
    $0f
    $4f
    $lo
    $hi
    $0f
    $0f
    $0f
    ...
    $0f
    $41
    $dl
    $dh
    There is one difficulty by adressing RAM via Antic...Antic can not display more than 4k in a continous block, to avoid shit on the screen we have to load the adress-counter with the new "4k"-block. A Gr.8-screen contains 192 scanlines which are 40 bytes long, so the whole screen needs about 7680 bytes, more than the 4096 bytes-boundary.

    back to main-index


    Last changes: 19 Jun 1997

    Amiga_logo

    Feel free to contact me for any legal reason!
    email_icon HeAvEn, Member of TaquarT