Difference between revisions of "CRTC"

From BeebWiki
Jump to: navigation, search
(Added timing diagram.)
(First few registers.)
Line 60: Line 60:
 
===&FE01 - Register data===
 
===&FE01 - Register data===
 
Using the data register reads or writes to CRTC registers. Registers are normally
 
Using the data register reads or writes to CRTC registers. Registers are normally
written to with the VDU 23,0 API.
+
written to with VDU 23,0. the read/write registers have RAM copies in the VDU
 +
workspace which can be read with [[OSBYTE &A0]].
  
 
Write-only registers return &00. Reserved registers (18 to 31) return &00.
 
Write-only registers return &00. Reserved registers (18 to 31) return &00.
Line 67: Line 68:
 
<div style='text-align: center;'>'''CRTC Timing Diagram'''</div>
 
<div style='text-align: center;'>'''CRTC Timing Diagram'''</div>
  
===Register 0 - Horizontal total===
+
===Register 0 - Horizontal total (HTC)===
===Register 1 - Horizontal displayed===
+
This 8-bit register is the number of character bytes that represents the full
===Register 2 - Horizontal sync position===
+
horizontal line, covering the displayed and non-displayed area. The displayed
===Register 3 - Sync widths===
+
characters this represents is a combination of the HTC and the colour depth
 +
set with the video ULA. MODEs 0 to 3 are 128 characters wide, with HTC=127,
 +
MODEs 4 to 7 are 64 characters wide, with HTC=63.
 +
 
 +
===Register 1 - Horizontal displayed (HDC)===
 +
This 8-bit register is the number of displayed character bytes per display line.
 +
As with HTC, the number of visible characters is a combination of HDC and the
 +
colour depth set with the Video ULA. MODEs 0 to 3 are 80 characters wide, MODEs
 +
4 to 7 are 40 characters wide.
 +
 
 +
===Register 2 - Horizontal sync position (HSP)===
 +
Thsi 8-bit registers sets the position of the horizontal sync pulse measured
 +
in character bytes from the lefthand side. Increasing the HSP pushes the entire
 +
display to the left, decrementing it pushes the entire display to the right. The
 +
standard MODE 7 setting is 51, but 52 gives a more centred display.
 +
 
 +
===Register 3 - Sync widths (HSW, VSW)===
 +
 
 
===Register 4 - Vertical total===
 
===Register 4 - Vertical total===
 
===Register 5 - Vertical total adjust===
 
===Register 5 - Vertical total adjust===
Line 86: Line 104:
 
===Register 20 -===
 
===Register 20 -===
 
===Register 31 - Register 31===
 
===Register 31 - Register 31===
 +
 +
<pre>                            MODE
 +
Register    | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
 +
--------------+---+---+---+---+---+---+---+---+
 +
R0 HTC      |127|127|127|127|127|127|127|127|
 +
R1 HDC      | 80| 80| 80| 80| 40| 40| 40| 40|
 +
R2 HSP      | 98| 98| 98| 98| 49| 49| 49| 51|
 +
R3 HSW b3-b0 |  8|  8|  8|  8|  4|  4|  4|  4|
 +
    VSW b7-b4 |  2|  2|  2|  2|  2|  2|  2|  2|
 +
R4 VTC      | 38| 38| 38| 30| 38| 38| 30| 30|
 +
R5 VTA      |  0|  0|  0|  2|  0|  0|  2|  2| plus *TV setting
 +
R6 VDC      | 32| 32| 32| 25| 32| 32| 25| 25|
 +
R7 VSP      | 34| 34| 34| 27| 34| 34| 27| 27|
 +
R8 INT b1-b0 |  1|  1|  1|  1|  1|  1|  1|  1| plus *TV setting
 +
    UND b3-b2 |  |  |  |  |  |  |  |  |
 +
    DIS b5-b4 |  0|  0|  0|  0|  0|  0|  0|  1|
 +
    CUR b7-b6 |  0|  0|  0|  0|  0|  0|  0|  2|
 +
R9 NSL      |  7|  7|  7|  9|  7|  7|  9| 18|
 +
R10 b4-b0    |  7|  7|  7|  7|  7|  7|  7| 18|
 +
    b5        |  1|  1|  1|  1|  1|  1|  1|  1| changed for editing cursor
 +
    b6        |  1|  1|  1|  1|  1|  1|  1|  1| changed by VDU 23,1
 +
R11          |  8|  8|  8|  9|  8|  9|  9| 19|</pre>
 +
 +
 +
  
 
==Extensions==
 
==Extensions==
Line 100: Line 143:
 
[[User:Jgharston|Jgharston]] 14:47, 24 December 2007 (UTC)
 
[[User:Jgharston|Jgharston]] 14:47, 24 December 2007 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 22:43, 15 January 2023 (CET)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 22:43, 15 January 2023 (CET)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 22:24, 16 January 2023 (CET)

Revision as of 23:24, 16 January 2023

6845 CRTC

The 6845 CRTC (Cathode Ray Tube Controller) controls how the display is generated. It is written to with VDU 23,0 which also takes account of the current *TV and VDU 23,1 settings. The hardware is directly accessible at &FE00 and &FE01. The 6845 is used in the BBC, Master and System computers. Other display hardware is used on the Atom, Electron, and later computers

Most systems without a hardware 6845 CRTC implement setting the cursor state with registers 10 and 11 via VDU 23;10 and VDU 23;11.

Summary

  • &FE00 - Select register
  • &FE01 - Write to register
  • 0 - Horizontal total
  • 1 - Horizontal displayed
  • 2 - Horizontal sync position
  • 3 - Sync widths
  • 4 - Vertical total
  • 5 - Vertical total adjust
  • 6 - Vertical displayed
  • 7 - Vertical sync position
  • 8 - Interlace/Display delay/Cursor delay
  • 9 - Scan lines per character
  • 10 - Cursor start line and blink type
  • 11 - Cursor end line
  • &FE00 - Read from status
  • &FE01 - Read from register
  • 12 - Screen start address
  • 13 - Screen start address
  • 14 - Cursor position
  • 15 - Cursor position
  • 16 - Light pen position
  • 17 - Light pen position
  • 18 - Cursor width (extension)
  • 19
  • 20
  • 21
  • 22
  • 31 - Register 31

&FE00 - Register number

Writing to &FE00 sets the register that will be accessed through the data register. The register number is a 5-bit number 0-31, but registers 18 to 30 are reserved. Register 31 is implemented on some 6845s (but what does it do?).

Some 6845s have a status register that is read at &FE00. This returns the following information:

  • bit 7: always zero
  • bit 6: set if there is a strobe input to the ~LPEN signal. It is cleared when either R16 or R17 (Light pen position) is read.
  • bit 5: set during the vertical blanking period, when the VerticalCount >= VerticalDisplayed.
  • other bits: usually zero, but often random

&FE01 - Register data

Using the data register reads or writes to CRTC registers. Registers are normally written to with VDU 23,0. the read/write registers have RAM copies in the VDU workspace which can be read with OSBYTE &A0.

Write-only registers return &00. Reserved registers (18 to 31) return &00.

CRTC Timing Diagram

CRTC Timing Diagram

Register 0 - Horizontal total (HTC)

This 8-bit register is the number of character bytes that represents the full horizontal line, covering the displayed and non-displayed area. The displayed characters this represents is a combination of the HTC and the colour depth set with the video ULA. MODEs 0 to 3 are 128 characters wide, with HTC=127, MODEs 4 to 7 are 64 characters wide, with HTC=63.

Register 1 - Horizontal displayed (HDC)

This 8-bit register is the number of displayed character bytes per display line. As with HTC, the number of visible characters is a combination of HDC and the colour depth set with the Video ULA. MODEs 0 to 3 are 80 characters wide, MODEs 4 to 7 are 40 characters wide.

Register 2 - Horizontal sync position (HSP)

Thsi 8-bit registers sets the position of the horizontal sync pulse measured in character bytes from the lefthand side. Increasing the HSP pushes the entire display to the left, decrementing it pushes the entire display to the right. The standard MODE 7 setting is 51, but 52 gives a more centred display.

Register 3 - Sync widths (HSW, VSW)

Register 4 - Vertical total

Register 5 - Vertical total adjust

Register 6 - Vertical displayed

Register 7 - Vertical sync position

Register 8 - Interlace/Display delay/Cursor delay

Register 9 - Scan lines per character

Register 10 - Cursor start line and blink type

Register 11 - Cursor end line

Register 12/13 - Screen start address

Register 14/15 - Cursor position

Register 16/17 - Light pen position

Register 18 - Cursor width

Register 19 -

Register 20 -

Register 31 - Register 31

                             MODE
 Register     | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
--------------+---+---+---+---+---+---+---+---+
 R0 HTC       |127|127|127|127|127|127|127|127|
 R1 HDC       | 80| 80| 80| 80| 40| 40| 40| 40|
 R2 HSP       | 98| 98| 98| 98| 49| 49| 49| 51|
 R3 HSW b3-b0 |  8|  8|  8|  8|  4|  4|  4|  4|
    VSW b7-b4 |  2|  2|  2|  2|  2|  2|  2|  2|
 R4 VTC       | 38| 38| 38| 30| 38| 38| 30| 30|
 R5 VTA       |  0|  0|  0|  2|  0|  0|  2|  2| plus *TV setting
 R6 VDC       | 32| 32| 32| 25| 32| 32| 25| 25|
 R7 VSP       | 34| 34| 34| 27| 34| 34| 27| 27|
 R8 INT b1-b0 |  1|  1|  1|  1|  1|  1|  1|  1| plus *TV setting
    UND b3-b2 |   |   |   |   |   |   |   |   |
    DIS b5-b4 |  0|  0|  0|  0|  0|  0|  0|  1|
    CUR b7-b6 |  0|  0|  0|  0|  0|  0|  0|  2|
 R9 NSL       |  7|  7|  7|  9|  7|  7|  9| 18|
R10 b4-b0     |  7|  7|  7|  7|  7|  7|  7| 18|
    b5        |  1|  1|  1|  1|  1|  1|  1|  1| changed for editing cursor
    b6        |  1|  1|  1|  1|  1|  1|  1|  1| changed by VDU 23,1
R11           |  8|  8|  8|  9|  8|  9|  9| 19|



Extensions

Extensions to the VDU 23,0 interface, or extended hardware, should probably used register numbers 128 upwards.

Hardware differences

There are several slightly different versions of the 6845. The BBC series require a 6845S varient as the VDU drivers depend on certain functionality:

  • R3 Vertical Sync.
  • R6 Vertical Displayed any odd/even value, to set to 25 in MODE 3,6,7.
  • R8 Character Delay and Cursor Delay timing for MODE 7.

Jgharston 14:47, 24 December 2007 (UTC) Jgharston (talk) 22:43, 15 January 2023 (CET) Jgharston (talk) 22:24, 16 January 2023 (CET)