/* -------------------------------------------------------------------------- */
/*                                                                            */
/* (C) Copyright D.C.Devenport 1997. All right reserved.                      */
/*                                                                            */
/* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      */
/* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE        */
/* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR      */
/* PURPOSE.                                                                   */
/*                                                                            */
/* This code, and no part of this code, may not be used in any                */
/* commercial or for-profit venture without the express written               */
/* permission of D.C.Devenport. (DDevenp666@aol.com)                          */
/*                                                                            */
/* Credit must be given within any program that uses any of this code         */
/* OR in the accompanying documentation. (And mail me a copy :) )             */
/*                                                                            */
/*----------------------------------------------------------------------------*/

Modes 0 and 3 copy straight to video memory.
They are two colour modes, 80 bytes wide.
The other video modes screen memory requires re-ordering before it is sent
to the VGA card.

ͻ
          A description of the physical properties of the video modes.         
͹
    MODE 8         MODE 2         MODE 5         MODE 1        MODES 4/6   
͹
 10 chars       20 chars       20 chars       40 chars       40 chars      
 16 colours     16 colours     4  colours      4 colours      2 colours    
 40 bytes wide  80 bytes wide  40 bytes wide  80 bytes wide  40 bytes wide 
͹
             BBC Screen memory Source Bytes as stored in its 'RAM'             
͹
    76543210       76543210       76543210       76543210       76543210   
    ABABABAB       ABABABAB       ABCDABCD       ABCDABCD       ABCDEFGH   
͹
                  Reordered Dest Byte(s) as sent to VGA card                   
͹
    76543210       76543210       76543210       76543210       76543210   
    AAAAAAAA       AAAABBBB       AAAABBBB       AABBCCDD       AABBCCDD   
    BBBBBBBB                      CCCCDDDD                      EEFFGGHH   
ͼ

Tweaked 640x264 16 colours VGA mode 10H (640x350).
This allows 2 pages in screen memory. It is a 4 plane graphics mode.

VGA CARD VIDEO MEMORY ALLOCATION
--------------------------------
80*264=21120 (0x5280) thus:

A0000 page 1 \ for double buffering of video screens
A5280 page 2 /

A5300 is now page 2 (so screen swap can take place with just one OUT)

A5280-A52FF,
AA580-AA2FF,
AA600-AFFFF available for the lookup tables.

Typical lookup table appearance:

struct PaletteType
{
  const char * PaletteAddress;
  int Age;
  char CurrentPalette[16];
} PalTable[10]=
{
  { (char *) 0xaa600, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaa700, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaa800, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaa900, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaaa00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaab00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaac00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaad00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaae00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } },
  { (char *) 0xaaf00, 0, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }
};

256 byte range addresses for the look up tables (PaletteAddress above)
Note that the lookup uses all 4 planes so there are 256*4=1024 bytes
for each table. Note each table MUST begin on a xxx00 boundary.

Address,Modes used for - number of tables

AA600   0/3 - 10
AA700
AA800
AA900
AAA00
AAB00
AAC00
AAD00
AAE00
AAF00

AB000   1 - 10
AB100
AB200
AB300
AB400
AB500
AB600
AB700
AB800
AB900

ABA00   2 - 10
ABB00
ABC00
ABD00
ABE00
ABF00
AC000
AC100
AC200
AC300

AC400   4/6 - 10 pairs - 20
AC500
AC600
AC700
AC800
AC900
ACA00
ACB00
ACC00
ACD00
ACE00
ACF00
AD000
AD100
AD200
AD300
AD400
AD500
AD600
AD700

AD800   5 - 20
AD900
ADA00
ADB00
ADC00
ADD00
ADE00
ADF00
AE000
AE100
AE200
AE300
AE400
AE500
AE600
AE700
AE800
AE900
AEA00
AEB00

AEC00   8 - 20
AED00
AEE00
AEF00
AF000
AF100
AF200
AF300
AF400
AF500
AF600
AF700
AF800
AF900
AFA00
AFB00
AFC00
AFD00
AFE00
AFF00

A5280-A52FF,
AA580-AA2FF  SPARE! - Use for LED's = 32 chars at 8 pixels high
012345678901234567890123456789012
MOTOR-ON CAPS-LOCK SHIFT-LOCK *
- not got around to this yet.
