Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
documentations:devices:6846 [2014/03/26 21:05] – pulkomandy | documentations:devices:6846 [2015/02/28 18:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | The 6846 is the main PIA chip in all machines for the TO range. It handles the tape drive, memory banks communations, 50Hz interrupt (actually programmable, | + | The 6846 is the main PIA chip in all machines for the TO range. It handles the tape drive, memory banks commutations, 50Hz interrupt (actually programmable, |
====== Register map ====== | ====== Register map ====== | ||
Line 13: | Line 13: | ||
====== Ports ====== | ====== Ports ====== | ||
- | ===== P0: Video RAM mapping ===== | + | ===== Common ===== |
+ | ==== P0: Video RAM mapping ===== | ||
This bit allows switching the video RAM page for the CPU. | This bit allows switching the video RAM page for the CPU. | ||
when set to 0, the " | when set to 0, the " | ||
- | ===== P1: light pen button ===== | + | (on TO8/9+/8D, this is not actually wired, but the Gate Array emulates it). |
+ | |||
+ | ==== P1: light pen button ===== | ||
This bit is an input. It allows you to read the state of the light pen " | This bit is an input. It allows you to read the state of the light pen " | ||
+ | ==== P3: unused. ====== | ||
+ | |||
+ | ==== P7: Tape drive input ===== | ||
+ | The data from the tape drive can be read here. The tape drive use hardware demodulation, | ||
+ | |||
+ | ==== CP2: Sound output ===== | ||
+ | This is the 1-bit sound output. Setting it to 0 and 1 alternatively, | ||
+ | |||
+ | ==== CTO: Timer output to tape port ===== | ||
+ | The timer is used as a waveform generator, and the output is sent to the tape drive to save data to tape. | ||
+ | As the tape port also has an audio input pin, connecting the two would allow to use the waveform generator for low-CPU sound and music. This has not been done, yet. | ||
+ | |||
+ | The tape format for TO machines is: | ||
+ | * To code a 1, generate 5 periods of 4.5KHz squarewave | ||
+ | * To code a 0, generate 7 periods of 6.3KHz squarewave. | ||
+ | |||
+ | The decoding is done using analogue filters set on these frequencies. A comparator between the filters output decides if the bit is a 0 or a 1. | ||
+ | |||
+ | Note this is the same timer that generates the cursor blink interrupt (at a 10Hz frequency). | ||
- | ===== P2 and P6: " | + | ===== TO9 ===== |
+ | ==== P2 and P6: " | ||
These two bits allows mapping of the "RAM Disk" memory (external expansion on the TO9). | These two bits allows mapping of the "RAM Disk" memory (external expansion on the TO9). | ||
When no internal RAM is selected ([[documentations: | When no internal RAM is selected ([[documentations: | ||
Line 39: | Line 62: | ||
|1 |1 |1 |1 |1 |1 |1 |RAMdisk 4 | | |1 |1 |1 |1 |1 |1 |1 |RAMdisk 4 | | ||
- | Seriously, this system is a mess. Use the new banking from the gate array if you can. | + | ==== P4 and P5: Cartridge slot selection ===== |
- | + | ||
- | ===== P3: unused. ====== | + | |
- | + | ||
- | ===== P4 and P5: Cartridge slot selection ===== | + | |
On TO9 and later, these two bits are used to switch between different mappings for the cartridge area (0000-3FFF). It allows software (un)mapping of cartridges. | On TO9 and later, these two bits are used to switch between different mappings for the cartridge area (0000-3FFF). It allows software (un)mapping of cartridges. | ||
Line 61: | Line 80: | ||
Monitor entry [[documentations: | Monitor entry [[documentations: | ||
- | ===== P7: Tape drive input ===== | + | ===== TO8/ |
- | The data from the tape drive can be read here. The tape drive use hardware demodulation, | + | ==== PB2: Cartridge switch ==== |
- | ===== CP2: Sound output ===== | + | Only 2 banks are available. |
- | This is the 1-bit sound output. Setting it to 0 and 1 alternatively, | + | |
- | ===== CTO: Timer output to tape port ===== | + | ==== PB4: Monitor bank switch |
- | The timer is used as a waveform generator, and the output is sent to the tape drive to save data to tape. | + | |
- | As the tape port also has an audio input pin, connecting the two would allow to use the waveform generator for low-CPU sound and music. This has not been done, yet. | + | |
- | The tape format for TO machines is: | + | also switches the floppy ROM banks. |
- | * To code a 1, generate 5 periods of 4.5KHz squarewave | + | |
- | * To code a 0, generate 7 periods of 6.3KHz squarewave. | + | |
- | The decoding is done using analogue filters set on these frequencies. A comparator between | + | ==== PB5 and CP1: keyboard link ==== |
+ | === Reading keyboard state === | ||
+ | The keyboard link was implemented | ||
- | Note this is the same timer that generates | + | When the keyboard controller want to send a byte, it raises CP1 high. The computer acknowledges by setting PB5 low. |
+ | |||
+ | The serial frame is made of: | ||
+ | * CNT key state | ||
+ | * SHIFT key state | ||
+ | * 7-bit keycode of first pressed key (unlike on TO9, this is not the ASCII code). | ||
+ | |||
+ | The signalling is: | ||
+ | * 56µs high pulse for 1 bit | ||
+ | * 38µs high pulse for 0 bit | ||
+ | |||
+ | === Configuring | ||
+ | The computer can send commands by pulling PB5 low, waiting for CP1 to become low (acknowledge), then leave PB5 low for the right amount of time. | ||
+ | * 670µS: keyboard reset. The keyboard enter caps lock mode (led is on), and send the keymap bit (French or Export) to the computer. | ||
+ | * 1300µS: enable caps lock | ||
+ | * 1900µS: disable caps lock | ||
+ | ==== PB6: printer busy bit ==== |