
                        P R O G R A M M I N G   T H E

                       A 1 2 0 0   A A   C H I P S E T


                          By Junkie/PMC Fr, Yragael
                             and Spencer Shanson.


Junkie bought an A1200 some days ago and started quickly to dasm the
copperlist of the workbench.  Thanx to his work of prime importance and his
impressive speed which leads me to dasm the copperlist too, I (Yragael)
bring you the following information.

More should follow as long as we will not get the hardware reference manual.

We are waiting for your works on 1200 and your cooperation to the trip into
the hardware of the A1200.


                               O V E R V I E W

Now that AA (AGA) has been finally released and to quash any future
questions as to what AA can and cannot do, here is a list of display modes
that I compiled when I first started working on the AA project.

This is the definitive guide!  There is no more and no less information to
be had with regards AA.

All AA features can be used through the appropriate calls provided by the
operating sysyem (AmigaDOS Release 3, kickstart V39).  All other methods of
enabling features (such as writing directly to the hardware, poking
copper lists etc.) will NOT be supported in future machines.

                            YOU HAVE BEEN WARNED!

- 1 colour clock = 280ns
- 1 Lores pixel = 140ns (2 per colour clock)
- 1 Hires pixel = 70ns (4 per colour clock)
- 1 SuperHires pixel = 35ns (8 per colour clock)
- 1 VGA pixel = 35ns (8 per colour clock)


                             NEW AA DISPLAY MODES

We now have a palette of 2^24 colours. Each colour has 8 bits each of Red,
Green and Blue (hence 24 bits of colour) and 1 genlock bit.


                                    LORES

- 6 Bitplane (non HAM, non EHB) 64 colours!
- 7 Bitplane128 colours!
- 8 Bitplane256 colours!
- 8 Bitplane HAMAny of 2^24 colours!

Dual Playfield, Max 4 Bitplanes per playfield!  16 colours per playfield.
The bank of 16 colours in the 256 colour palette is selectable per
playfield.


                                    HIRES

- 5 Bitplanes32 colours
- 6 Bitplanes64 colours
- 7 Bitplanes128 colours
- 8 Bitplanes256 colours
- 6 Bitplanes EHB32 * 2 colours
- 6 Bitplanes HAM4096 colours
- 8 Bitplanes HAMany of 2^24 colours

Dual Playfield, Max 4 Bitplanes per playfield! or 16 colours per
playfield.  The bank of 16 colours in the 256 colour palette is selectable
per playfield.


                                  SUPERHIRES

- 1 or 2 bitplanes, as ECS, bit with no colour fudging!
- 3 Bitplanes8 colours
- 4 Bitplanes16 colours
- 5 Bitplanes32 colours
- 6 Bitplanes64 colours
- 7 Bitplanes128 colours
- 8 Bitplanes256 colours
- 6 Bitplanes EHB32 * 2 colours
- 6 Bitplanes HAM4096 colours
- 8 Bitplanes HAMany of 2^24 colours

Dual Playfield, Max 4 Bitplanes per playfield or 16 colours per playfield.
The bank of 16 colours in the 256 colour palette is selectable per
playfield.

All playfield scrolling is now in 35ns increments, range 0-63.  Pre AA
scrolling was in 140ns increments, range 0-15.


                                     VGA

- 1 or 2 bitplanes, as ECS, bit with no colour fudging!
- 3 Bitplanes8 colours
- 4 Bitplanes16 colours
- 5 Bitplanes32 colours
- 6 Bitplanes64 colours
- 7 Bitplanes128 colours
- 8 Bitplanes256 colours
- 6 Bitplanes EHB32 * 2 colours
- 6 Bitplanes HAM4096 colours
- 8 Bitplanes HAMany of 2^24 colours

Dual Playfield, Max 4 Bitplanes per playfield or 16 colours per playfield.
The bank of 16 colours in the 256 colour palette is selectable per
playfield.

The Euro72 and Super72 modes are variations of the VGA modes (just
different resolutions and refresh rates).

There is also a "Scan Doubling" feature.  This allows each scan line
to be shown twice.  The purpose of this is to enable a software work-
around to replace the display enhancer found on the A3000.  With the
"promotion" feature enabled, NTSC and PAL displays are "promoted" to a
flicker-free version defined in the DblNTSC/DblPAL monitors.  These two
monitors are also variations of the VGA monitor, but designed to resemble
as closely as possible the NTSC and PAL dimensions, but at twice the
refresh rate.  In other words, the DblNTSC monitor will provide 640x400
dimension, non-laced, at 60Hz refresh, the DblPAL will provide 640x512 non
laced at 50Hz.  Non-laced NTSC/PAL screens (such as 640x200) will also be
promoted, but will take up as much space on the screen as the 640x400
will through scan-doubling.

Of course, all the ECS genlocking features have been carried through to AA.


                                   SPRITES

Prior to AA, sprites were always displayed with 140ns pixels, except on
SuperHires or VGA screens, where sprite pixels were 70ns long.

With AA, all sprites can now be displayed in either:

1) ECS mode!
2) 140ns (this is not the same as ECS mode - see above!)!
3) 70ns@
4) 35ns$

on any display resolution. eg 35ns sprites on a lores screen, or 140ns
sprites on a superhires screen.

Sprites can be positioned to 35ns resolution.

Sprites are either 16, 32, or 64 bits wide.

Sprites can be attached in any mode (could not attach sprites in the new
ECS modes).

Sprite resolution affects all the sprites, in other words you cannot
have sprite 3 64 bits wide with 70ns pixels and sprite 4 32 bits wide with
35ns pixels.

Even numbered and odd numbered sprites can select any bank of 16 colours from
the 256 colour palette for the sprite colours.

Sprites can also be scandoubled (to maintain aspect ratio).


                          USING THE SUPERHIRES MODE

To use the SuperHires mode (1280 pixels wide), just use the bit 6 of
register $0100

                           bit 6 | Mode SuperHires
                           -----------------------
                             0   | Non selectionne
                           -----------------------
                             1   | Selectionne
                           -----------------------


                              USING 8 BITPLANES

The number of bitplanes available used to be no more than 7 and was coded
using the bits 14 to 12 of register $0100.  To use 8 bitplanes, just use
bit 4 of register $0100.  The value of bits 14 to 12 will then not be
considered anymore.

                           bit 4 | 8 bitplanes mode
                           ------------------------
                             0   | Not selected
                           ------------------------
                             1   | Selected
                           ------------------------


                           ACCEDING 24 BITS COLORS

The 24 bits color is coded using 2 words:

- the first receives the 4 low bits of each R, G and B componants
- the second receives the 4 high bits of each R, G and B componants

To modify a color using 24 bits coding, you must use 2 coppers-moves
on the same color register.  The first move must ABSOLUTELY be the move of
the word of the 3*4 high bits, the second move is the move of the word of
the 3*4 low bits.

The copper knowns when the move regards the 3*4 low bits or the 3*4
high bits by checking the bit 9 of register $0106

                    bit 9 | Componants access
                    --------------------------------------
                      0   | Access to the 4 low bits of
                            componants R, G and B
                    --------------------------------------
                      1   | Access to the 4 high bits of
                            componants R, G and B
                    --------------------------------------

ex: change $0180 to $00123456 in the copperlist

$01060000
$01800135
$01060200
$01800246

When you want to work using the 12 bits color coding mode, the 3*4 bits
value you move to the color register is considered by the copper as the 3*4
high bits.  You don't have to care about $0106.  It seems bit 9 of
register $0106 is initialized to 0 at each copjmp.


                       ACCEDING THE 256 COLORS PALETTE

The Amiga won't work with 256 separate
color registers.  A same color
register is used several times to code
several colors.

--------------------------------------------------------------------------------
The Amiga just works with 8 differents  palettes of 32 colors each, using
color registers from $0180 to $01BE.  You can choose the palette you want to
access via the bits 11 to 14 of register $0106

           bit 14 | bit 13 | bit 12 | Selected palette
           --------------------------------------------------------
              0   |    0   |    0   | Palette 0 (color 0 to 31)
           --------------------------------------------------------
              0   |    0   |    1   | Palette 1 (color 32 to 63)
           --------------------------------------------------------
              0   |    1   |    0   | Palette 2 (color 64 to 95)
           --------------------------------------------------------
              0   |    1   |    1   | Palette 3 (color 96 to 125)
           --------------------------------------------------------
              1   |    0   |    0   | Palette 4 (color 128 to 159)
           --------------------------------------------------------
              1   |    0   |    1   | Palette 5 (color 160 to 191)
           --------------------------------------------------------
              1   |    1   |    0   | Palette 6 (color 192 to 223)
           --------------------------------------------------------
              1   |    1   |    1   | Palette 7 (color 224 to 255)
           --------------------------------------------------------

ex: You want to change color 177 to
$00123456

Color 177 is color $01A2 of palette 5

$01065000
$01800246
$01065200
$01800135


                            SWITCHING THE PALETTE

You can switch colors.  The definition of switching color A and color B is:

- Color registers of colors A and B are NOT modified by the switching
- Color A is displayed using the content of register of color B and
  vice-versa

The switching of the palette can't be used on just n colors of the palette.
Once you choose a switching value, ALL the palette's colors will be
switched.  The switching value is the value separing the colors to be
switched and is coded with bits 15 to 8 of register $010C.

ex: You want all the colors separated by one color in the colorlist to be
switched

$0180 <--
$0182 <--|--
$0184 <--   |
$0186 <-----
$0188 <--------
.              |
.
Value 2 will be stocked in bits 15 to 8.
The switching works with the palette as if it was a circular palette.  I
mean if the copper consider color 255 and must switch by 1 the colors, color
$0180 will be assiocated to color 255.


                           USING SPRITES IN LOWRES,
                             HIRES AND SUPERHIRES

To change the reolution of the sprite,
just use bit 7 and 6 of register $0106

      bit 7 | bit 6 | Resolution
      --------------------------
        0   |   0   | Lowres
      --------------------------
        1   |   0   | Hires
      --------------------------
        0   |   1   | Lowres
      --------------------------
        1   |   1   | SuperHires

                             USING 16, 32 AND 64
                             PIXELS WIDE SPRITES

I still have a bug with sprites in 32 or 64 pixels.  Sorry, but the
following informations may have to be corrected.

Use bit 3 and 2 of register $01FC

      bit 3 | bit 2 | Wide
      -------------------------
        0   |   0   | 16 pixels
      -------------------------
        1   |   0   | 32 pixels
      -------------------------
        0   |   1   | 32 pixels
      -------------------------
        1   |   1   | 64 pixels
      -------------------------

The copper doesn't read the spritelist in the same way regarding the wide
you choose for your sprite

16 pixels wide reading:

word C1, word C2
word A1, word B1
.
.
word An, word Bn
$0000 0000

C1=first control word
C2=second control word

Ai and Bi are combined via OR to form the sprite

32 pixels wide reading:

long C1, long C2
long A1, long B1
.
.
.
long An, long Bn
$0000 0000 0000 00000

C1=first control long the first control word is the high word of C1.
The low word of C1 must contain the second control word.
C2=second control long the second control word is the high word of C2.
Low word of C2 is $0000

Ai and Bi are combined via OR to form the sprite

64 pixels wide reading:

double C1, double C2
double A1, double B1
.
.
double An, double Bn
$0000 0000 0000 00000
$0000 0000 0000 00000

C1=first control double
   C1=W3:W2:W1:W0 (Wi=words)
   W3 is first control word
   W2 and W1 are second control word
C2=second control double
   C2=W3:W2:W1:W0 (Wi=words)
   W3 is second control word

Ai and Bi are combined via OR to form the sprite.


                          CHANGING THE SPRITE PALETTE

It is possible to choose the color palette of the sprite.  This is done by
the bits 7 and 4 of register $010C.

    bit 7 | bit 6 | bit 5 | bit 4 | Starting color of the sprite's palette
   -------------------------------------------------------------------------
      0   |   0   |   0   |   0   | $0180/palette 0 (coulor 0)
   -------------------------------------------------------------------------
      0   |   0   |   0   |   1   | $01A0/palette 0 (color 15)
   -------------------------------------------------------------------------
      0   |   0   |   1   |   0   | $0180/palette 1 (color 31)
   -------------------------------------------------------------------------
      0   |   0   |   1   |   1   | $01A0/palette 1 (color 47)
   -------------------------------------------------------------------------
      0   |   1   |   0   |   0   | $0180/palette 2 (color 63)
   -------------------------------------------------------------------------
      0   |   1   |   0   |   1   | $01A0/palette 2 (color 79)
   -------------------------------------------------------------------------
      0   |   1   |   1   |   0   | $0180/palette 3 (color 95)
   -------------------------------------------------------------------------
      0   |   1   |   1   |   1   | $01A0/palette 3 (color 111)
   -------------------------------------------------------------------------
      1   |   0   |   0   |   0   | $0180/palette 4 (color 127)
   -------------------------------------------------------------------------
      1   |   0   |   0   |   1   | $01A0/palette 4 (color 143)
   -------------------------------------------------------------------------
      1   |   0   |   1   |   0   | $0180/palette 5 (color 159)
   -------------------------------------------------------------------------
      1   |   0   |   1   |   1   | $01A0/palette 5 (color 175)
   -------------------------------------------------------------------------
      1   |   1   |   0   |   0   | $0180/palette 6 (color 191)
   -------------------------------------------------------------------------
      1   |   1   |   0   |   1   | $01A0/palette 6 (color 207)
   -------------------------------------------------------------------------
      1   |   1   |   1   |   0   | $0180/palette 7 (color 223)
   -------------------------------------------------------------------------
      1   |   1   |   1   |   1   | $01A0/palette 7 (color 239)
   -------------------------------------------------------------------------

