o2doc
o2doc
1
By Daniel Boris 11/98
Disclaimer: All the information in the original document come from studying the actual
Odyssey 2 hardware. The only technical documentI had that the time was the Intel 8-bit
Embedded Controller Handbook. Starting with version 1.1, I had access to various
official O2 tech docs. I have made every attempt to assure the accuracy of this
information, but there are bound to be errors and omissions in this document. Use this
information at your own risk.
1.0 Processor
The Odyssey 2 (O2) is based on the Intel 8048 microcontroller. The 8048 is clocked
at approximately 1.79 MHz which is divided by 5 to produce a .36Mhz (2.5us) instruction
cycle clock. (Note: This is not as slow as it seems since each 8048 instruction takes only
1 or 2 cycles) The 8048 has 64 bytes of internal RAM, and 1K of internal ROM that
contains the system BIOS (see section 6.0). The 8048 has 2, 8-bit I/O ports, an internal
timer/counter, an interrupt input, and 2 single bit testable inputs.
The second I/O port is used to read the keyboard. Since P20-P23 are also used as the
upper 4 bits of the address bus, I believe that it is only possible to read the keyboard
correctly through the BIOS.
P23: Unused.
2.0 Cartridge
The O2 cartridge connector has 2 row of 15 contacts each. The contacts are on 0.15
inch centers. The cartridge port also serves as an expansion port, for example for the
Voice Module. The pins are labeled as follows:
Top Row: A B C D E F G H J K L M N P R
----------------------------------------------------------------------
Bottom Row: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(Note that letters I, O, and Q are not used as labels on the top row)
A: ~WR – Active low cart write enable, disabled when P16 is high.
B,C: GND
D: +5V
E: Active high external RAM enable
F: ~PSEN (Chip Enable to the cartridge)
G: A0
H: A1
J: A2
K: A3
L: A4
M: A5
P: A6
N: A7
R: A8
1: T0 from processor
2..9: DB0..DB7 from the processor
10: A10
11: P14
12: P11, High bank select bit
13: P10, Low bank select bit
14: A11
15: A9
~PSEN (Program Store Enable): This signal comes from the processor and goes low to
indicate a read from program memory. This is used to enable the cartridge.
A0...A9,A11: Address bus. Notice that A10 is not used by the cartridge. The reason for
this is that the internal ROM in the processor occupies address $0-$3FF. The first byte in
the cartridge is accessed at address $400 so leaving off A10 will map this address to the
first byte in the cartridge.
P10, P11: Bank select bits. For cartridges over 2K these lines are used to select banks. For
4K carts P10 is used to select between the 2 banks. For 8K carts P10 and P11 are used to
select between the 4 banks.
4.0 VDC
The Video Display Controller (VDC) chip is a custom Intel IC that generates all the
O2’s video and audio. The VDC is accessed by setting P13 low and P14 high, then using
the MOVX instruction. The VDC occupies and address range from $00 - $FF. It is
important to note that the VDC registers that control the graphic object cannot be changed
while the VDC is enabled by the VDC control register.
4.1 Graphic Objects
The VDC can generate 4 different types of graphics ‘objects’, a background grid,
single characters, quad characters, and sprites. Under normal circumstances, these objects
should only be changed during the vertical blank period.
The color of the background and grid are controlled by the color register $A3 (see section
4.9).
If bit 7 of the VDC control register ($A0) is set to 1 then the box to the right of each
vertical line segment that is turned on will be filled solid with the grid color.
4.3 Sprites
The VDC can draw 4 independent sprites. Each sprite is 8x8 pixels in one color and
can be positioned freely anywhere on the screen. The sprite control registers are at $00 -
$0F and the sprite shape memory is at $80-$9F.
Byte 2: Lower 8 bits of position in character set to begin getting character shape from.
NOTE: The interaction between Byte 0 and Byte 2 in determining how and where the
character is displayed is very confusing and hard to explain in words. The best way to
learn it is to write some code and play around with it.
Bit 0: Sprite 0
Bit 1: Sprite 1
Bit 2: Sprite 2
Bit 3: Sprite 3
Bit 4: Vertical grid
Bit 5: Horizontal grid and dots grid
Bit 6: External collision input, not used on O2.
Bit 7: Characters
To check for collisions with a given object(s) set the appropriate bits to 1. When you
read back this location any collision between objects will be indicated by a 1 in the
corresponding location. For example to check for collisions between sprite 0 and other
objects, set $A0 to $01, then when you read back $A0 it will return a 1 for each object
sprite 0 collided with. This register is only valid during VBLANK.
4.10 Sound
The sound is controlled by registers $A7 to $AA. The sound system consists of a 24
bit shift register that is clocked out at one of two frequencies to form the output audio
signal.
5.0 Joysticks
To read the joysticks you must first disable both the VDC and the external RAM by
setting P13 and P14 high. You then enable the keyboard scanner by setting P12 low. To
read the right joystick set P20...P22 to 0 and to read the left joystick set P20, P21 to 0 and
P22 to 1. Once this is setup the stick can be read using the INS A,BUS command. The
bits read are as follows:
Bit 0: Up
Bit 1: Right
Bit 2: Down
Bit 3: Left
Bit 4: Fire button
NOTE: Since the joystick is enabled onto the data bus it is only possible to read the sticks
from the BIOS ROM.
6.0 BIOS
The O2 has a 1K BIOS ROM that is stored inside the 8048 processor. The BIOS
takes locations $0-$3FF in the program area.
$400 – The BIOS jumps to this address when the systems is powered up or reset.
$402 – Jumped to on an external IRQ.
$404 – Jumped to on a timer IRQ.
$406 – Vblank service routine
$408 – The BIOS jumps to this location after the “Select Game” routine has executed.
$40A – Continuation of Vblank
6.2 BIOS Routines: (This section is far from complete)
Alters: Indicates any registers that are altered by the routine and not restored
Ends: Ending address of routine
Inputs: Indicates any values that should be passed to the routine
Returns: Indicates any values that the routine returns
READ
0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 8 9 SPC ? L P
2 + W E R T U I O
3 Q S D F G H J K
4 A Z X C V B M .
Byte 0
Y position
Byte 1
X position
Byte 2
7 6 5 4 3 2 1 0
Color Size Even Full
Shift Shift
Byte 0
Y position to start displaying character
Byte 1
X position
Byte 2
Character set pointer (0..7)
Byte 3
7 6 5 4 3 2 1 0
Color Cset pointer (8)
7 6 5 4 3 2 1 0
Fill Dot Display Enable Ext. Grid Sound Latch Pos Horz
Mode Grid Enable Overlap on/off Interrupt Registers Interrupt
Enable Enble
7 6 5 4 3 2 1 0
Major External VBLANK Sound Position HBLANK
System Overlap Needs Strobe
Overlap Service Status
7 6 5 4 3 2 1 0
Characters Grid Sprite 3 Sprite 2 Sprite 1 Sprite 0
7 6 5 4 3 2 1 0
Grid Lum Background Color Grid Color
Bank: $E8
˝
80 "AMAZING" 89 "AAAAH"
˝ ˝
81 "THANK YOU" 8A "GOOD"
˝ ˝
82 "YUCK" 8B "HI"
˝ ˝
83 "ARG" 8C "HARD"
˝ ˝
84 "THAT'S EASY" 8D "RIGHT"
˝ ˝
85 "ATTENTION" 8E "WRONG"
˝ 8F "ATTACK!"
86 "DANGER" 90 "GREAT!"
˝ 91 "CLIMB"
87 "TURKEY" 92 "DIVE"
˝ 93 "FIRE"
88 "ACTION" 94 "HELP"
˝ 95 "HURRY"
Bank: $E9
80 "JUMP" 81 "RUN"
˝ ˝
82 "SQUASH!" 8A "OUTCH"
˝ ˝
83 "NOW" 8B "OH NO"
˝ ˝
84 "NO" 8C "GO FOR IT"
˝ ˝
85 "NO!" 8D "DO IT"
˝ 8E "LOOK OUT"
86 "YES" 8F "COME ON!"
˝ 90 WHIP SOUND
87 "SORRY" 91 TONE E991
˝ 92 MEDIUM EXPLOSION
88 "OH DEAR" 93 BEE SOUND
˝ 94 SMALL EXPLOSION E994
89 "GOT'CHA" 95 SMALL EXPLOSION E995
˝ 96 SMALL EXPLOSION E996
Bank $EA
˝
80 "UP" 86 PYEW-THUMP
˝ 87 PYEW-PYEW
81 "DOWN" 88 MISSILE
˝ 89 LARGE EXPLOSION
82 "ALAS" 8A "HA HA HA HA HA"
˝ 8B BRRRREEP
83 "GO" 8C GUNSHOT
˝ 8D TONE EA8D
84 "FIGHT" 8E TONE EA8E
˝ 8F RANDOM COMPUTER
85 "DODGE" 90-A7 TONES EA90-EAA7