TMS9927 CRT Controller

From Intellivision Wiki

Jump to: navigation, search

The TMS9927 CRT Controller (also known as the SMC CRT5027) is simple CRT controller capable of a wide range of operating modes. The TMS9927 and CRT5027 data sheets describes the full capability of the part. The Keyboard Component uses the CRT controller to provide white text on a 40x24 grid. The characters are formed from an character generator font stored in the Keyboard Component itself. This font differs from the font found in the Master Component's GROM.

Hardware Details

The CRT controller synchronizes with the STIC so that the two produce video that can be overlaid. The CRT controller's output gets fed into the "EXT VIDEO" (pin 8) input on the Master Component's Cartridge Port. (This input was removed on the Intellivision II.) A diode and resistor tie the CRT input to the STIC's output, giving the CRT controller the ability to pull the video image to "white." The result is white text overlaid on the STIC's current display output.

The Keyboard synchronizes the CRT with the STIC using (most likely) a Phase-Locked Loop (PLL) that locks to some combination of the CBLNK, SR1 and INTRM signals coming from the Master Component. These STIC signals indicate the STIC's current display timing and are sufficient for the Keyboard to synchronize with the STIC's output. The Master Component also outputs a 3.579545MHz clock (NTSC color burst), which most likely provides the video dot clock to the TMS 9927. One artifact of the PLL synchronization is that the Keyboard Component's title screen appears to "spin" momentarily after reset as the Keyboard locks onto the Master's signals.

One hardware oddity exists in the Master Component's circuitry for merging the Keyboard's external video. Close examination of the AY-3-8915 Color Processor's data sheet indicates an "ext. video" pin intended for "high resolution video input." It's unclear why the Master Component does not use this input for the Keyboard's video.

Programming Details

The 6502 programs the CRT controller through a series of memory mapped registers and a frame buffer stored in RAM. The Master Component cannot directly program the CRT controller.

The CRT controller implements the following registers:

$40C0Control Register 0
$40C1Control Register 1
$40C2Control Register 2
$40C3Control Register 3
$40C4Control Register 4
$40C5Control Register 5
$40C6Control Register 6
$40C7Processor Self Load command
$40C8Read Cursor Column
$40C9Read Cursor Row
$40CAReset: Halts and prepares timing chain for sync-up
$40CBUp Scroll: Causes all lines on screen to scroll up by 1, with the top line becoming the new bottom line.
$40CCLoad Cursor Column
$40CDLoad Cursor Row
$40CEStart Timing Chain
$40CFNon-processor Self Load

The following table describes Control Registers 0 through 6:

Control Register 0Horizontal character count (total scan line, not visible characters)
Control Register 1
Interlaced /
HSync WidthHSync Delay
Control Register 2
 Scans / Data RowCharacters / Data Row
Control Register 3
Skew bitsData Rows/Frame
Control Register 4Scan lines / Frame
Control Register 5Vertical Data Start
Control Register 6Last Displayed Row

In addition to the CRT controller's register set, bit 0 at location $4043 controls the visibility of the CRT controller's video. Writing 1 to this location makes the display visible. Writing 0 blanks out the CRT controller's display.

The CRT's text frame buffer resides at $B800 - $BFFF. The first 960 bytes of this memory hold the displayed text. After reset, Row 0 of the display resides at $B800 - $B827. Row 1 resides at $B828 - $B84F, and so on. Writes to either $40C6 or $40CB will rotate the mapping of rows to addresses. This allows for hardware scrolling.

Default Operating Mode

The Keyboard initializes the CRT controller with the following code:

;---  CRT controller initialization sequence
C956  LDA $40CA       ; Strobe screen scan location reset
C959  LDX #$07
C95B  LDA $C96A,X     ; \
C95E  STA $40BF,X     ;  |__ Copy video parameters to display from
C961  DEX             ;  |   table below.  9927 is at $40C0..$40CF
C962  BNE $C95B       ; /
C964  JSR $C917       ; Clear column position.
C967  LDA $40CE       ; Strobe 9927 timing chain start
C96A  RTS             ; Done!
;---  Data to load
C96B  .byte $38       ; $40C0: Horiz character count = 56
      .byte $25       ; $40C1: HSync Width = 4, HSync Delay = 5 
      .byte $3A       ; $40C2: Scans/Data Row = 7, Chars/Data Row = 4 
      .byte $97       ; $40C3: Skew = 2, Data Rows/Frame = 23
      .byte $03       ; $40C4: Scan lines/Frame = 3 
      .byte $44       ; $40C5: Vertical Data Start = 70
      .byte $17       ; $40C6: Last displayed data row = 23

See the CRT5027 Data Sheet for more information on the encodings for the various control register fields.

Personal tools