COLECOVISION MEMORY MAP

0000H - BIOS ROM
.
1FFFH
2000H - Expansion port
.
3FFFH
4000H - Expansion port
.
5FFFH
6000H - Start of RAM (1K mapped into an 8K spot)
.
7FFFH
8000H - Cart ROM (broken into 4 sections, each enabled seperately)
.
FFFFH

 

COLECOVISION I/O MAP

00-1F - No Connection
20-3F - No Connection
40-5F - Video
60-7F - Video
80-9F - No Connection
A0-BF - No Connection
C0-DF - Sound
E0-FF - Controllers; E2 is special, as wellas E0 - E0 appears to be the readback, and E2 appears to be the scan - 39

 

BIOS DETAILS

The ColecoVision contains a ROM which essentially acts as a BIOS for the system. Upon startup, it begins to execute code at 0000H. The first step executed is a check to see if a cart is plugged in. This is performed by checking two locations in the cart's memory - if the two bytes read are 55H and AAH then the ColecoVision knows a cart is in the system. Otherwise, it displays the standard "Turn Power Off Before..." screen.

If a cart is in the system, the BIOS passes controlto the cart. The cart can then use some, all, or none the functions found in the BIOS. Some of the functions provided in the BIOS include the title screen and game select screen.

The famous twelve second delay is part of the titlescreen routine. - 8

The address range for cartridges is 8000H to FFFFH,a total of 32K. - 29, 31

 

COLECOVISION VIDEO RAM DETAILS

The video RAM is broken up into tables which are user movable. The tables which exist include:

The Name Table (this tells us what is in the background)
The Pattern Table (this tells us how each 8x8 character looks)
The Color Table (this tells us what colors to use for a given 8x8 pattern)
The Sprite Table (this tells us where sprites are, what they will look like, their color, and how many to display)
The Sprite Pattern Table (this defines the 8x8 or 16x16 pattern for a sprite)

Four video modes exist:

A text 40x24 mode.

A multi-color mode w/ sprites (multi-color breaks the backgroun into 4x4 squares of 1 color per square. Smurf Paint 'n Play uses this mode.)

Graphics 1 mode w/ sprites (32x24 8x8 character background. Each character is made up of 1 color only.)

Graphics 2 mode w/ sprites (same as Graphics 1 modeexcept each character can have different colors for each of it's 8 rows.)

The Video RAM is accessable _only_ through the I/O ports, which is why scrolling is difficult. - 8, 39

 

COLECOVISION PROGRAMMING TIPS

9918A Programming Information - Extracted from the TI Editor/Assembler manual by Tursi - tursi@vip.net (pages 326-340)

This applies to the TI-99/4A, but most should apply to the ColecoVision, too. I'm uncertain if it's the 9918 or the 9918A in there, but the only difference is that that 9918A has bitmap mode and the other doesn't. ;)


VDP Write-Only Registers


NOTE:

-bit 0 is MSB (ie: 0 1 2 3 4 5 6 7, 0=128 and 7=1)
-"enables" are active when set to 1
-">" represents a hexadecimal number (ie: >400 = 400 hex)

Register 0 - Bits 0-5 - Reserved, set to 000000
  Bit 6 - Mode bit 3 (M3) - sets bitmap mode
  Bit 7 - Enable external video source (replaces color 1 (transparent))
Register 1 - Bit 0 - 4/16k switch, if set, uses 16k
  Bit 1 - blank enable (blanks display)
  Bit 2 - Interrupt enable
  Bit 3 - Mode bit 1 (M1) - sets text mode
  Bit 4 - Mode bit 2 (M2) - sets multicolor mode
  Bit 5 - reserved - set to 0
  Bit 6 - sprite size - 0=normal (8x8), 1=large (16x16)
  Bit 7 - sprite magnification enable
Register 2 Base address of the Screen Image Table. Multiply this value by >400
Register 3 Base address of the Color Table. Multiply this value by >400
Register 4 Base address of the Pattern Descriptor Table. Multiply this value by >800
Register 5 Base address of the Sprite Attribute List. Multiply this value by >80
Register 6 Base address of the Sprite Descriptor Table. Multiply this value by >800
Register 7 - Bits 0-3 - Foreground color in Text mode only
  Bits 4-7 - Background color in all modes

The mode bits, M1, M2 and M3 determine the mode of the display. If they are all 0, the display is in Graphics mode. Else as listed above. Below the various modes are explained.

Graphics mode

 

Graphics mode uses an array of 32 columns by 24 lines. Each position may have one of the 256 patterns in the pattern table (usually including ASCII characters). Foreground and background colors may be set for the characters, and sprites are available.

PATTERN DESCRIPTOR TABLE

This table contains descriptions for each of the 256 patterns. Each takes 8 bytes, for a total size of 2048 bytes. Character 0 is located at the base address, character 1 at the base+8, and so forth.

To define a character, you must convert the pattern to hexadecimal bytes (at least, this is easiest). If you define the character in an 8x8 grid, simply treat dots as 1 and background as 0's, and convert the binary to hexadecimal. For instance, a man may look like this:

  ##   = 0001 1000 = 18 So the series of bytes to enter would be:
 ####  = 0011 1100 = 3C     >18, >3C, >3C, >18, >7E, >18, >24, >42
 ####  = 0011 1100 = 3C
  ##   = 0001 1000 = 18
###### = 0111 1110 = 7E
  ##   = 0001 1000 = 18
 #  #  = 0010 0100 = 24
#    # = 0100 0010 = 42

In case hexadecimal makes no sense, here's a quick conversion chart:

Binary  Hex   Decimal
0000 =  0  =  0
0001 =  1  =  1
0010 =  2  =  2
0011 =  3  =  3
0100 =  4  =  4
0101 =  5  =  5
0110 =  6  =  6
0111 =  7  =  7
1000 =  8  =  8
1001 =  9  =  9
1010 =  A  =  10
1011 =  B  =  11
1100 =  C  =  12
1101 =  D  =  13
1110 =  E  =  14
1111 =  F  =  15

To find the base address for a character description, multiple the character by 8 and add the table's base address (remember that you can do a faster multiply by 8 by shifting left by 3 (8=2^3))

COLOR TABLE

This table contains the foreground and background colors of all the characters. The high nibble is the foreground color, and the low nibble is the background color. Each byte represents a group of 8 characters (ie: the first entry is for characters 0-7, the second for characters 8-15, etc). The table is 32 bytes long.

The colors are: (in hex)

0 = Transparent
1 = Black
2 = Medium Green
3 = Light Green
4 = Dark Blue
5 = Light Blue
6 = Dark Red
7 = Cyan

8 = Medium Red
9 = Light Red
A = Dark Yellow
B = Light Yellow
C = Dark Green
D = Magenta
E = Gray
F = White

To determine which color group a character is in, divide it's number by 8 (or shift right by 3). Remember that you affect all 8 characters if you change the entry.

SCREEN IMAGE TABLE

This specifies which character occupies each position on the screen. It is 768 bytes long. Whatever byte is at each position is what appears at that location.

To calculate an address from X and Y, use (Y*32)+X (or (Y<<5)+x) and add the base address.

MULTICOLOR MODE

 

In multicolor mode, the screen is 48 rows, and 64 columns wide, with each 'box' being 4 pixels by 4 pixels. There are thus 3072 boxes, each of which can be a different color with no restrictions. Sprites are available.

The general way to set up is like so:

SCREEN IMAGE TABLE

Initialize the Screen Image Table so that the first >80 bytes contain >00 through >1F repeated 4 times, the next >80 bytes contain >20 through >3F repeated 4 times, and so on, so that the last >80 bytes contain >A0 through >BF repeated 4 times.

PATTERN DESCRIPTOR TABLE

The pattern descriptor table now contains colors, instead of patterns. They are still organized in 8-character blocks, with each byte describing the colors of two boxes. The high nibble is the first block, and the low nibble is the block to it's right.

The first byte defines the first two blocks in row 1. The second byte is the first two blocks in row 2. This continues until the eighth byte (the first two blocks in row 8), and then goes back to row one. This continues until the first 32 eight-byte segments have been defined, describing all the blocks in the first 8 rows.

It's very messy... but draw yourself a picture and it should make sense.

Essentially, each entry in the screen image table still points to an 8-byte 'definition', but the definition defines the colours, not the pixels, now, making each character a 2x8 colored group. :) Initializing the screen image table as above lets you change the screen by editing the pattern descriptor table, but it's not the only way. :)

TEXT MODE

 

Text mode is 40 columns by 24 lines, and sprites are not permitted.

The layout of the tables is the same as in graphics mode, however, each character is only 6x8, instead of 8x8. Also, the screen image table is now 960 bytes instead of 768. The last two bits of each definition are ignored to make the smaller characters.

Only two colors are allowed in text mode, as defined by VDP register 7.

 

BITMAP MODE

 

Bitmap mode allows independantly defining each of the 768 screen positions, and allows a bit more color freedom as well. Sprites are also allowed. As normal, the patterns for each position are in the Screen Image Table, the descriptions are in the Pattern Descriptor Table, and the colors are in the Color Table.

SCREEN IMAGE TABLE

As before, each entry is a single byte from >00 to >FF defining which pattern to place at each location. In bitmap mode, however, it is divided into 3 sections of 256 bytes each, each pointing essentially to a different character set. The first section uses the first 256 entries in the pattern and color table, the second section uses the next 256 entries, and the third uses the last 256 entries. Normally this table is set at >1800 (assuming 16k VDP ram) (VDP register 2 = >06)

PATTERN DESCRIPTOR TABLE

It works the same as in graphics mode, except that there are now 3 sections, each 256 patterns long, allowing 768 possible patterns. It's size is 6144 bytes.

The first section is for the first third of the screen, and so on.

It should normally be placed at either >0000 or >2000 (VDP register 4 = >00 or >04). The color table will sit at the other address.

COLOR TABLE

The color table works much like it did in graphics mode, except that each entry now defines a single character, and every row of that character has it's own color entry. It matches byte-for-byte the entries in the pattern descriptor table, with the high nibble being the foreground colour, and the low nibble being the background color for that row of the pattern.

It is also divided into three 256 character sections, and each entry is also 8 bytes long. It is 6144 bytes long, and should be placed at either >0000 or >2000, whichever the PDT is not at. (VDP register 3 = >00 or >04).

DISCUSSION of bitmap mode

For using bitmap mode, it is usually easiest (but not fastest!) to initialize the Screen Image Table with >00 through >FF three times, and then alter the entries in the Pattern Descriptor table and Color table.

Thus, to alter a pixel on the screen, you must calculate the byte and bit to be changed in the pattern descriptor table. The same offset will let you alter the color table.

I don't know what processor the Coleco uses, but here is a psuedo code for a weird and wacky formula that will calculate the byte offset and bit offset of a given coordinate, ready to be indexed into the appropriate table. :) Note this is all 16-bit math. Don't ask me why it works, but it does seem to. :)

XIn = X coordinate 0-255
YIn = Y coordinate 0-191
ByteOut = Byte Offset into tables
BitOut = Bit offset into byte in pattern descriptor table

1. Copy YIn to ByteOut
2. Shift ByteOut left 5 times (ie: multiply by 32)
3. OR YIn into ByteOut
4. AND ByteOut with >FF07
5. Copy XIn to BitOut
6. AND Bitout with >0007
7. Add XIn to ByteOut
8. Subtract BitOut from ByteOut

SPRITES

 

Sprites are independant of the screen and their patterns can be in addition to those in the pattern descriptor table (or the sprite descriptor table can be set up to overlap). There can be up to 32 sprites and there are 4 available sizes.

SPRITE ATTRIBUTE LIST

This list defines the position and color of each of the 32 sprites, 0-31. To move a sprite, you must update the entries in this table. Sprites may be located at any visible position (0- 255 and 0-191), or off the bottom of the screen (y> 191).

Each definition is 4 bytes long, thus the table is 128 bytes long. The first row on the screen is >FF, the next is >00 and so on to >BE. (so it says!) :)

Byte 1 - Y position of the sprite. >D0 means end ofthe sprite list, so be aware if allowing sprites off the bottom.
Byte 2 - X position of the sprite. >00 - >FF
Byte 3 - pattern of the sprite, from >00 to >FF, inthe SPRITE Descriptor Table
Byte 4 Bits 0-2 = apparently undefined
  Bit 3 = Early clock attribute - Normally, the coordinates indicate the top left corner of the sprite, and sprites can scroll smoothly off the right side of the screen. If this bit is set, the early clock is enabled, and the sprite is shifted 32 pixels to the left, and scrolls smoothly off the left of the screen.
  Bits 4-7 = Sprite color

SPRITE DESCRIPTOR TABLE

This table is defined exactly the same way as the pattern descriptor table in graphics mode. However, sprites can be double-sized or magnified. A magnified sprite simply has each pixel twice it's normal size. A double-size sprite uses four consecutive characters, laid out like this:

1 3
2 4

Sprites thus range from 8x8 pixels to 32x32 pixels, but only 16x16 pixels of detail.

 

CARTRIDGE SLOT PINOUT

Looking from the top of the unit:

 D2   D1   D0   A0   A1   A2   SHLD A3   A4   A13  A5   A6   A7  E000 GND
  1    3    5    7    9   11   13   15   17   19   21   23   25   27   29
  2    4    6    8   10   12   14   16   18   20   22   24   26   28   30
C000  D3   D4   D5   D6   D7   A11  A10 8000  A14 A000  A12  A9   A8   +5

Pin 13 is the shield ground. It is connected to a screw post, but not to a signal The four chip selects are active low. - 29

 

ADAM PRINTER/POWER PORT

(Colors of COLECO wires are indicated after voltageratings)

 1  2  3  4  5
  6  7  8  9
Pin 1 = 12V BROWN
Pin 2 = 12V RED
Pin 3 = 5V ORANGE
Pin 4 = -5V YELLOW
Pin 5 = Ground GREEN
Pins 6, 7, 8 = Serial Data Clock, Serial Data, Signal Ground?
Pin 9 = No connection - 13

 

ADAM PROGRAMMING TIPS

Computers and Electronics April 1984 issue includes a number of programming tips and ideas for the ADAM, including a number of projects.- 44