| Originally published in the ASCII magazine "C= Hacking" issue 12 (March 1996): 
 
 @(#)gfx: Talking to TED: The MOS 7360/8360 Text Display ICsby Harsfalvi Levente (TLC@MSZI.PMMF.HU)
 
 @(A): Introduction
 
 This information file is based on my old books, descriptions, and especially
 my experiences while I was coding.  That's no mistake.  The Plus/4 series
 was not very famous in the world, but they were very poular in mideast
 Europe.  In fact, there were even demo groups for the machine.  I learned
 some of this information while writing demos for the machine in demo groups,
 while other things were gleaned from personal work on the machine.  These
 computers did indeed play an important part in Commodore computer history.
 
 I started my first code development on a Plus/4 in late 1986.  After I saw a
 HomeLab 3 (made in Hungary, U880 - GDR made Z80 compatible proc, B/W, 16K),
 I started writing demos and other software for the Plus/4 machine I owned.
 It actually wasn't that strange to see demo groups sprout up for all
 kinds of machines, including the Plus/4.  All over, there were groups
 and individuals, writing software while trying to keep the flame lit for
 each machine.  In fact, I know people currently working in groups writing
 for the Plus/4 in Hungary, Germany, and as far away as Alaska.
 
 @(A): Overview
 
 Let's discuss the TExt Editor (TED) IC and its environment. This DIL-48 IC
 was designed specifically for the 264 series of machines, which initially
 included the CV364 and the 264, evolving into the Plus/4, C16, and C116
 machines.  Unlike the CIA or ACIA or other machines, this IC isn't well
 suited to any other system.
 
 The TED contains all functions done by several chips in former Commodore
 computers. The TED is a complete video-interface and composite video
 signal generator, sound generator, keyboard input latch, timer,
 clock generator, memory manager and DRAM refresher in a single IC.  It can
 address the full memory map of the 264 series machines, and it generates
 the RAS', CAS', and MUX signals for the DRAM memory used in that series.
 For ROM, it generates the chip select (CS) lines, depending on the state
 of the internal registers.  So, in addition to all the above duties, the
 TED IC is a simplistic MMU as well.
 
 @(A): Video Information
 
 We see the TED chip shine as it does its primary job, displaying graphics.
 Its abilities mostly parallel those of the uniquitous VIC-II video IC in the
 C64.  It has the following modes:
 
 *  40x25 screen (characters)
 *  enhanced color mode
 *  multicolor mode
 *  320x200 Hi-Res Graphics
 *  160x200 Multicolor Graphics
 
 Of course, there are differences.  TED does not contain sprite support.
 
 To offset this omission, the TED chip can select 8 intensities for each of
 the 16 supported colors, giving 121 colors (the 8 shades of black are all
 black).  Other features include a hardware cursor, hardware text blinking,
 and hardware inverse character support.  Character sets, screen and color
 memory, and graphics bitplanes can be addressed directly, without additional
 logic as found on the C64.  In fact, even RAM/ROM selection requires change
 of a single bit.
 
 Character modes need $800 bytes of RAM for screen and color memory. The
 first $400 bytes act as color memory (the memory permanently located at
 $d800 on the C64), with the lower 4 bits containing color codes, exactly
 as found on the 64.  Bits 4-6 denote the intensity level of the color, while
 the high bit select flashing/no-flashing attributes. The other $400 bytes
 contain the screen codes for the displayed characters.  If hardware
 character inversion is selected, the lower 7 bits hold the screen code and
 the high bit selects inversion for the character.  If character inversion
 is not selected, all 8 bits denote the screen code. Extended Color Mode (ECM)
 and Multi Color Mode (MCM) modes work exactly as described on the 64.  While
 these two modes are in effect, inversion and blinking are disabled.
 
 Things get a bit more complex in graphics mode (pun unintentional).  In
 graphcis mode, the bitplane occupies $2000 bytes and is handled just like a
 VIC-II biplane.  The colors are handled differently.  $800 bytes are needed
 for color memory, which is laid out in $400 bytes of intensity memory
 and $400 bytes of color memory.  An "off" bit in the bitplane uses the
 lowest nybble of the appropriate color memory location as the color and
 retreieves the intensity from bits 4-6 of the appropriate intensity memory
 location.  For an "on" bit, the color is taken from the high nybble of the
 appropriate color memory location, while the intensity is taken from bits
 0-2 of the intensity memory location.  Bits 3 and 7 in intensity memory are
 unused.
 
 In multicolor mode, differences abound.  The 64's VIC-II enabled one to
 utilize 3 different colors in each 8x8 cell and a single background.  The
 TED simply cannot accomplish this due to the lack of adequate color memory.
 So, TED allows only 2 varying colors per 8x8 cell. Those colors are chosen
 from  the palette of 121.  The remaining 2 colors are chosen for the
 entire screen, again from the 121 color palette.  The mapping is as
 follows:
 
 00   background color
 01   same as "off" color in hires mode
 10   same as "on" color in hires mode
 11   another "background" color
 
 The TED IC is able to generate both PAL and NTSC compatible signals from
 a single IC.  Only the crystal need be changed to go from one standard to
 the other.  In PAL mode, there are 312 lines hown, while NTSC only has 262
 lines of display.  The line synchronization is the same in either PAL or
 NTSC mode.  It's always 57 clock cycles per rasterline.  The TED divides
 the supplied crystal frequency by 20 for PAL display and by 16 for NTSC.
 
 For the serious video programmer, raster interrupts are implemented as on the
 VIC-II.  However, the 0 line of the register corresponds to the first line
 of the character screen area, not the top of the border.  In addition, the
 current raster line can be read from TED registers.  you can modify the
 counter as well.  Doing so will most likely affect the screen display.  As
 a bonus, the horizontal location of the raster can be read and modified in
 the same way.  Unfortunately, these registers provide the basis for most
 effects, as the TED can't handle sprites.
 
 @(A): Running The Show
 
 As earlier mentioned, the TED IC does more than produce graphics.  One of
 its tasks involves generating the clock signal for the 7501/8501
 microprocessor.  The clock is not constant, as it switches from from
 885 kHz and twice that speed, 1.773 Mhz.  The speed depends on TED's current
 task.  It generates the slower clock signal when refreshing DRAM or fetching
 data for the video screen.  Otherwise, the high clock signal is generated.
 The user can disable fast clock generation via a register.  The end result
 is a machine that operates at approximately 1 MHz, as the CPU runs in slow
 mode while the screen is displayed, and operates in fast mode when the
 TED starts drawing the top and bottom borders.
 
 @(A): Sound Advice
 
 As far as a sound device is concerned, the TED doesn't stack up to the
 SID in the 64.  Just 2 squarewave generators, of which the second can be
 switched to generate white-noise, are available for sound generation.
 Volume control is available in 8 levels.
 
 To play samples, the TED can switch the sound generators to constant level
 outputs.  D/A is then done by changing the volume register setting.  Each
 generator can generate frequencies from 100Hz to 23kHz.
 
 @(A): Other features
 
 The timers available in the TED appear to be nothing more than 16
 bit decrementing timers.  They are always clocked with the slow clock.
 The first timer reloads its starting value when it reaches 0, the other 2
 are free-running.
 
 Since it already does almost everything else, it's not unusual to notice
 the TED handles the keyboard matrix.  A simple 8-bit imput latch handles
 keyboard interfacing.
 
 As noted above, a single bit in the register space will page ROM or
 RAM into the upper 32kB of the address map.  Since the TED knows what is
 paged in at all times, it knows what to output to access the memory
 locations in this area.
 
 @(A): Conclusion
 
 Well, that about wraps up the TED IC.  All that is left is a map of the
 registers.  Assume all registers are read/write unless noted otherwise.
 If you have questions, I cna be reached at the Internet address listed above
 or at:
 
 Harsfalvi Levente
 7200 Dombovar
 Gorkij 33.
 Hungary
 
 By the way, catch FLI ED. V1.0; Its info file may contain some more about
 TED's screen-handling. It may be retrieved as
 ftp://ftp.funet.fi/pub/cbm/plus4/tlc/cns.lzh
 
 @(A): Register Map
 
 Register      Description
 --------      -----------
 $ff00- $ff01: Counter #01. It always starts to decrement from the last
 written value into it.
 $ff02- $ff03: Counter #02. It runs freely from $ffff.
 $ff04- $ff05: Counter #03. Same as above.
 $ff06       : Mostly the same as VIC's $d011.
 Bit 0,1,2 : Vertical smooth-scrolling
 Bit 3     : 24/25 rows screen
 Bit 4     : Blank screen
 Bit 5     : Bitplane mode
 Bit 6     : Enhanced color mode
 Bit 7     : TED's internal test, it should be 0.
 $ff07       : Most similar VIC-reg is $d016.
 Bit 0,1,2 : Horizontal smooth-scrolling
 Bit 3     : 40/38 columns screen
 Bit 4     : Multicolor mode
 Bit 5     : TED stop. If set, the TED stops it's counters and
 screen-generating, only single clock and refresh
 cycles remain.
 Bit 6     : PAL/NTSC. 0:PAL, 1:NTSC
 Bit 7     : Disable reverse mode. If 0, we got 128 characters
 and higmost bit tells if the character should
 appear in inverse. If set, no inverse mode but
 256 characters.
 $ff08       : Keyboard input latch. Giving a strobe - writing to the register,
 the latch stores the values of the input-lines. Then, we
 can read them from this register.
 $ff09       : Interrupt request register. When a counter sends want to send
 an IRQ, it's bit will appear as a 0; then, if the IRQ was
 caused then highmost bit is set.
 Bit 0     : Unused
 Bit 1     : Raster-counter
 Bit 2     : Lightpen. Not implemented.
 Bit 3     : Counter #1
 Bit 4     : Counter #2
 Bit 5     : Unused
 Bit 6     : Counter #3
 Bit 7     : Interrupt occured. This bit is set when an IRQ
 was enabled and therefore, the IRQ was sent to the
 processor. Physically, this is the negated level of
 the TED's IRQ output. The IRQ should be deleted
 with writing the register-value back after
 accepting an interrupt.
 $ff0a       : Interrupt mask register. These bits could be used to disable and
 enable interrupt-sources. When a place is set to 1, that will
 be able to cause an interrupt to the processor. If not, the sign
 of the interrupt request will only be appear in the above
 register.
 Bit 0     : 9th bit of $ff0b (see there)
 Bit 1     : Raster-counter
 Bit 2     : Lightpen. Not implemented.
 Bit 3     : Counter #1
 Bit 4     : Counter #2
 Bit 5     : Unused
 Bit 6     : Counter #3
 Bit 7     : Unused
 $ff0b       : Raster interrupt register. Same as $d012 when writing; it stores
 the position of occuring raster interrupt. Higmost bit is in
 $ff0a's 0. bit.
 $ff0c,$ff0d : Hardware-cursor position (10 bits). Lower bits: $ff0d, higher
 2 bits in $ff0c's 0. and 1. places. Beyond 1000 the cursor is
 not seeable.
 $ff0e       : This reg is the first sound-source's frq-value's lowmost 8 bit.
 More 2 bits are in $ff10's 0. and 1. places.
 $ff0f       : 2nd. source, lowmost 8 bits. More 2 bits in $ff12, 0. and 1.
 places.
 The soundregister-value can be calculated as
 reg=1024-(111860.781/frq[Hz]) (NTSC)
 reg=1024-(111840.45 /frq[Hz]) (PAL)
 $ff10       : 1st. sound-source, higmost 2 bits. 2-7 bits are unused.
 $ff11       : Sound control register.
 Bit 0-3   : Volume. Maximum value is 8.
 Bit 4     : Sound #1 on/off.
 Bit 5     : Sound #2 squarewave on/off.
 Bit 6     : Sound #2 noise on/off. If You set both, the square
 will sound.
 Bit 7     : D/A mode. See above for more.
 $ff12       : Bit 0,1   : 2nd sound-source, highmost bits.
 Bit 2     : Character generator in ROM or RAM. When set, TED
 will enable ROM when trying to get data from the
 charactergenerator to build screen. Else, it will
 give out control-signals to the DRAM's.
 Bit 3,4,5 : These bits tell, where to find bitplane in the
 memory when using bitplane-mode. TED assumes them
 as A15,A14 and A13 bits. So, the bitplanes can be
 switched as 8K pages, anywhere in the 64K.
 Bit 6-7   : Unused.
 $ff13         Bit 0     : A sign to having control about memory paging. This
 bit always sets to 1 when ROM is active over $8000.
 Else, it will be 0. READ ONLY.
 Bit 1     : Force single clock mode. Then, TED will disable to
 generate twiee clock.
 Bit 2-7   : Charactergenerator. Bit 7 corresponds to A15, 6 to
 A14 and so on. This value shows and sets the start
 of the charactergenerator. It can be paged as $400
 bytes. Use with addition of $ff12-2.bit.
 $ff14         Bit 0-2   : Unused
 Bit 3-7   : Start of the video-ram. Bit 7 also corresponds to
 the A15 line as above. So, video-ram is mappable
 as $800 bytes - 2K. The above $ff12-2.bit doesn't
 affect this, but the actual RAM/ROM mapping (see at
 $ff3e/$ff3f and $ff13/0) does.
 $ff15       : Background. Lower bits contain color-code, higher 3 luminance
 and higmost is ignored.
 $ff16       : Color-reg 1
 $ff17       : Color-reg 2
 $ff18       : Color reg 3. This and the above are used in ECM and MCM modes.
 $ff19       : Border. All color registers use codes as described in $ff15.
 $ff1a       : Bit 0-1   : Higmost bits of the next $ff1b
 Bit 2-7   : Unused
 $ff1b       : Actual character-position. Higmost bits in the above register.
 TED counts the characters that it had fetched and put out to
 the screen. The number is increasing by 40 after every
 characterline (8 rasterline).
 $ff1c       : Bit 0     : Higmost bit of $ff1d
 Bit 1-7   : Unused
 $ff1d       : Actual position of vertical scanning. Higmost
 bit is in $ff1c. Read/Writeable!
 $ff1e       : Actual position of horizontal scanning. R/W!. Lowmost bit is
 unused. It contains the TED's internal counter's highmost 8
 bits. So, it increases 4 with every character. When writing,
 it seems to put the value to a functionally different register
 (writing back a reading value in right time affects the screen).
 $ff1f       : Bit 0,1,2 : Actual vertical scanning-line in a character-row.
 R/W!.
 Bit 3-6   : Flashing counter. It's value increases with every
 frame, and TED fits it's flashing feature to this
 register's reaching to 15.
 Bit 7     : Unused
 $ff3e       : Switching to ROM. A writing statement to this address will
 cause to turn on the ROM between $8000-$ffff. It's an other
 matter, which one; this time, only sure thing that it'll give
 CS signals instead of RAS', CAS' and MUX.
 See $ff13/0 and $ff14
 $ff3f       : Switching to RAM. The opposite of the above.
 |