Difference between revisions of "Geneve CRU definitions"
m (Updated 1EF6 notes) |
|||
(9 intermediate revisions by 3 users not shown) | |||
Line 9: | Line 9: | ||
''/signal'' means negative logic. The first column is the base address for the respective bit if that bit is addressed without offset. You see that the base address is shifted one bit position to the left. Thus, setting R12 to >0004 and accessing bit 0 is the same as setting R12 to >0000 and accessing bit 2. | ''/signal'' means negative logic. The first column is the base address for the respective bit if that bit is addressed without offset. You see that the base address is shifted one bit position to the left. Thus, setting R12 to >0004 and accessing bit 0 is the same as setting R12 to >0000 and accessing bit 2. | ||
{| style="width: | {| style="width:80%; padding-top:3em" | ||
|- | |- | ||
| colspan=" | | colspan="6" style="background-color:lightgray; text-align:center" | TMS 9901 | ||
|- | |- | ||
| style="width: | | style="width:10%; font-weight:bold" | Address | ||
| style="width: | | style="width:10%; font-weight:bold" | Bit | ||
| style="width:15%" | Kind | | style="width:15%; font-weight:bold" | Kind | ||
| style="width:10%" | Default | | style="width:10%; font-weight:bold" | Default | ||
| Meaning | | style="width:20%: font-weight:bold" | Meaning | ||
| style="font-weight:bold" | Modification | |||
|- | |- | ||
| 0000 | | 0000 | ||
Line 24: | Line 25: | ||
| 0 | | 0 | ||
| Clock mode (/Interrupt mode) | | Clock mode (/Interrupt mode) | ||
| - | |||
|- | |- | ||
| 0002 | | 0002 | ||
Line 30: | Line 32: | ||
| 1 | | 1 | ||
| /INTA (P-Box, pin 17) | | /INTA (P-Box, pin 17) | ||
| - | |||
|- | |- | ||
| 0004 | | 0004 | ||
Line 36: | Line 39: | ||
| 1 | | 1 | ||
| /V9938 INT | | /V9938 INT | ||
| - | |||
|- | |- | ||
| 0006 | | 0006 | ||
Line 42: | Line 46: | ||
| 1 | | 1 | ||
| /Joystick button | | /Joystick button | ||
| - | |||
|- | |- | ||
| 0008 | | 0008 | ||
Line 48: | Line 53: | ||
| 1 | | 1 | ||
| /Joystick left | | /Joystick left | ||
| - | |||
|- | |- | ||
| 000A | | 000A | ||
Line 54: | Line 60: | ||
| 1 | | 1 | ||
| /Joystick right | | /Joystick right | ||
| - | |||
|- | |- | ||
| 000C | | 000C | ||
Line 60: | Line 67: | ||
| 1 | | 1 | ||
| /Joystick down | | /Joystick down | ||
| - | |||
|- | |- | ||
| 000E | | 000E | ||
Line 66: | Line 74: | ||
| 1 | | 1 | ||
| /Joystick up | | /Joystick up | ||
| - | |||
|- | |- | ||
| 0010 | | 0010 | ||
Line 71: | Line 80: | ||
| int | | int | ||
| 1 | | 1 | ||
| /Keyboard | | [[Geneve keyboard control|/Keyboard scancode available]] | ||
| - | |||
|- | |- | ||
| 0012 | | 0012 | ||
Line 78: | Line 88: | ||
| 0 | | 0 | ||
| (mirrors 003A) | | (mirrors 003A) | ||
| - | |||
|- | |- | ||
| 0014 | | 0014 | ||
Line 84: | Line 95: | ||
| 1 | | 1 | ||
| /Left Mouse button (mirrors 0038) | | /Left Mouse button (mirrors 0038) | ||
| - | |||
|- | |- | ||
| 0016 | | 0016 | ||
Line 90: | Line 102: | ||
| 1 | | 1 | ||
| /Real-time clock interrupt (mirrors 0036) | | /Real-time clock interrupt (mirrors 0036) | ||
| - | |||
|- | |- | ||
| 0018 | | 0018 | ||
Line 96: | Line 109: | ||
| 1 | | 1 | ||
| /INTB (mirrors 0034) | | /INTB (mirrors 0034) | ||
| - | |||
|- | |- | ||
| 001A | | 001A | ||
Line 102: | Line 116: | ||
| 1 | | 1 | ||
| (reflects output 0032) | | (reflects output 0032) | ||
| - | |||
|- | |- | ||
| 001C | | 001C | ||
Line 107: | Line 122: | ||
| in | | in | ||
| 0 | | 0 | ||
| - | |||
| - | | - | ||
|- | |- | ||
Line 114: | Line 130: | ||
| 1 | | 1 | ||
| (reflects output 002E) | | (reflects output 002E) | ||
| - | |||
|- | |- | ||
| 0020 | | 0020 | ||
Line 120: | Line 137: | ||
| 0 | | 0 | ||
| RESET (P-Box, pin 6 (inverted)) | | RESET (P-Box, pin 6 (inverted)) | ||
| - | |||
|- | |- | ||
| 0022 | | 0022 | ||
Line 126: | Line 144: | ||
| 1 | | 1 | ||
| /V9938 reset | | /V9938 reset | ||
| - | |||
|- | |- | ||
| 0024 | | 0024 | ||
Line 132: | Line 151: | ||
| 1 | | 1 | ||
| Joystick select | | Joystick select | ||
| - | |||
|- | |- | ||
| 0026 | | 0026 | ||
Line 137: | Line 157: | ||
| - | | - | ||
| 0 | | 0 | ||
| - | |||
| - | | - | ||
|- | |- | ||
| 0028 | | 0028 | ||
| 20 | | 20 | ||
| - | | - (out) | ||
| 0 | | 0 | ||
| - | | - | ||
| [[Programmble Flash Memory Expansion | PFM512]] bank-switch 1 of 2 | |||
|- | |- | ||
| 002A | | 002A | ||
Line 149: | Line 171: | ||
| - | | - | ||
| 0 | | 0 | ||
| - | |||
| - | | - | ||
|- | |- | ||
Line 156: | Line 179: | ||
| 1 | | 1 | ||
| /Keyboard reset | | /Keyboard reset | ||
| - | |||
|- | |- | ||
| 002E | | 002E | ||
Line 162: | Line 186: | ||
| 1 | | 1 | ||
| PAL pin 5 (System clock speed?) | | PAL pin 5 (System clock speed?) | ||
| - | |||
|- | |- | ||
| 0030 | | 0030 | ||
Line 167: | Line 192: | ||
| - | | - | ||
| 0 | | 0 | ||
| - | |||
| - | | - | ||
|- | |- | ||
Line 174: | Line 200: | ||
| 1 | | 1 | ||
| Video [[Geneve wait state generation | wait states]] (PAL pin 19) | | Video [[Geneve wait state generation | wait states]] (PAL pin 19) | ||
| - | |||
|- | |- | ||
| 0034 | | 0034 | ||
Line 180: | Line 207: | ||
| 1 | | 1 | ||
| /INTB (P-Box pin 18) | | /INTB (P-Box pin 18) | ||
| - | |||
|- | |- | ||
| 0036 | | 0036 | ||
Line 186: | Line 214: | ||
| 1 | | 1 | ||
| /Real-time clock interrupt | | /Real-time clock interrupt | ||
| - | |||
|- | |- | ||
| 0038 | | 0038 | ||
Line 192: | Line 221: | ||
| 1 | | 1 | ||
| /Left mouse button | | /Left mouse button | ||
| - | |||
|- | |- | ||
| 003A | | 003A | ||
| 29 | | 29 | ||
| in | | in (out) | ||
| 0 | | 0 | ||
| Connected to GND | | Connected to GND | ||
| [[Programmble Flash Memory Expansion | PFM512]] bank switch 2 of 2 | |||
|- | |- | ||
| 003C | | 003C | ||
Line 204: | Line 235: | ||
| 1 | | 1 | ||
| /Keyboard interrupt (mirrors 0010, no int) | | /Keyboard interrupt (mirrors 0010, no int) | ||
| - | |||
|- | |- | ||
| 003E | | 003E | ||
Line 210: | Line 242: | ||
| 1 | | 1 | ||
| /Joystick up (mirrors 000e) | | /Joystick up (mirrors 000e) | ||
| - | |||
|} | |} | ||
{| style="width: | {| style="width:80%; margin-top:3ex" | ||
|- | |- | ||
| colspan="2" style="background-color:lightgray; text-align:center" | Special | | colspan="2" style="background-color:lightgray; text-align:center" | Special | ||
Line 221: | Line 254: | ||
|} | |} | ||
{| style="width: | {| style="width:80%; margin-top:3ex" | ||
|- | |- | ||
| colspan=" | | colspan="4" style="background-color:lightgray; text-align:center" | TMS9995 | ||
|- | |- | ||
| style="width:15%" | | | style="width:15%; font-weight:bold" | Address | ||
| style="width:15%" | 0 | | style="width:15%; font-weight:bold" | Bit | ||
| style="width:15%; font-weight:bold" | Default | |||
| style="font-weight:bold" | Meaning | |||
|- | |||
| 1EE0 | |||
| 0 | |||
| 0 | |||
| Decrementer in event counter mode (0=in timer mode) | | Decrementer in event counter mode (0=in timer mode) | ||
|- | |- | ||
| 1EE2 | | 1EE2 | ||
| 1 | | 1 | ||
| 0 | |||
| Enable decrementer | | Enable decrementer | ||
|- | |- | ||
| 1EE4 | | 1EE4 | ||
| 2 | | 2 | ||
| 0 | |||
| Interrupt level 1 latch | | Interrupt level 1 latch | ||
|- | |- | ||
| 1EE6 | | 1EE6 | ||
| 3 | | 3 | ||
| 0 | |||
| Interrupt level 2 latch | | Interrupt level 2 latch | ||
|- | |- | ||
| 1EE8 | | 1EE8 | ||
| 4 | | 4 | ||
| 1 | |||
| Interrupt level 4 latch | | Interrupt level 4 latch | ||
|- | |- | ||
| 1EEA | | 1EEA | ||
| 5 | | 5 | ||
| 0 | |||
| not used | | not used | ||
|- | |- | ||
| 1EEC | | 1EEC | ||
| 6 | | 6 | ||
| 0 | |||
| not used | | not used | ||
|- | |- | ||
| 1EEE | | 1EEE | ||
| 7 | | 7 | ||
| | | 0 | ||
| CapsLock flag | |||
|- | |- | ||
| 1EF0 | | 1EF0 | ||
| 8 | | 8 | ||
| Keyboard | | 1 | ||
| [[Geneve keyboard control|Keyboard control]] | |||
|- | |- | ||
| 1EF2 | | 1EF2 | ||
| 9 | | 9 | ||
| | | 1 | ||
| [[Geneve keyboard control|Keyboard control]] | |||
|- | |- | ||
| 1EF4 | | 1EF4 | ||
| 10 | | 10 | ||
| 1 | |||
| Geneve mode (/TI mode) | | Geneve mode (/TI mode) | ||
|- | |- | ||
| 1EF6 | | 1EF6 | ||
| 11 | | 11 | ||
| Direct mode (/Mapper mode) | | 0 | ||
| Direct mode (/Mapper mode) (page F8 locked into >0000->1fff) | |||
|- | |- | ||
| 1EF8 | | 1EF8 | ||
| 12 | | 12 | ||
| 1 | |||
| Cartridge rom size (1=8 KiB, 0=16 Kib) | | Cartridge rom size (1=8 KiB, 0=16 Kib) | ||
|- | |- | ||
| 1EFA | | 1EFA | ||
| 13 | | 13 | ||
| 1 | |||
| /Protect 6xxx | | /Protect 6xxx | ||
|- | |- | ||
| 1EFC | | 1EFC | ||
| 14 | | 14 | ||
| 1 | |||
| /Protect 7xxx | | /Protect 7xxx | ||
|- | |- | ||
| 1EFE | | 1EFE | ||
| 15 | | 15 | ||
| 1 | |||
| /Add [[Geneve wait state generation|wait state]] per memory cycle | | /Add [[Geneve wait state generation|wait state]] per memory cycle | ||
|- | |- | ||
| 1FDA | | 1FDA | ||
| 125 | | 125 | ||
| 0 | |||
| Macro Instruction Detect | | Macro Instruction Detect | ||
|} | |} | ||
Line 357: | Line 412: | ||
This enables the keyboard clock, not clearing the input register, activating TI mode and mapping, cartridges have 8K, no write protection to 6xxx and 7xxx, and no wait states. | This enables the keyboard clock, not clearing the input register, activating TI mode and mapping, cartridges have 8K, no write protection to 6xxx and 7xxx, and no wait states. | ||
[[Category:Geneve]] |
Latest revision as of 23:00, 4 January 2021
Definitions
CRU bits may be tested with the TB command, with the base address in R12. The bit is copied to the EQ flag of the status register so that a JEQ will cause a branch whenever the bit is set.
The bits of the 9901 are tested in positive logic, which means that a low value on the pin will make a TB yield EQ=0, and a high value on the pin makes EQ=1. The signals on the pins may show negative logic themselves. That is, if the joystick button is pressed, a low value is put on the /INT3 input (bit 3), and a TB 3 will make EQ=0, while a not pressed button would be EQ=1.
TMS9901 lines may be configured as inputs (in), outputs (out), and the first 16 addresses may be configured as interrupt inputs (int), triggering an outgoing interrupt if the mask is set to 1 for the respective input. The interrupt mask configuration may be changed as desired; for instance, one could enable interrupts from the real-time clock by setting bit 11 to 1. The setting as shown here is the typical setting when working in MDOS.
/signal means negative logic. The first column is the base address for the respective bit if that bit is addressed without offset. You see that the base address is shifted one bit position to the left. Thus, setting R12 to >0004 and accessing bit 0 is the same as setting R12 to >0000 and accessing bit 2.
TMS 9901 | |||||
Address | Bit | Kind | Default | Meaning | Modification |
0000 | 0 | flag | 0 | Clock mode (/Interrupt mode) | - |
0002 | 1 | int | 1 | /INTA (P-Box, pin 17) | - |
0004 | 2 | int | 1 | /V9938 INT | - |
0006 | 3 | in | 1 | /Joystick button | - |
0008 | 4 | in | 1 | /Joystick left | - |
000A | 5 | in | 1 | /Joystick right | - |
000C | 6 | in | 1 | /Joystick down | - |
000E | 7 | in | 1 | /Joystick up | - |
0010 | 8 | int | 1 | /Keyboard scancode available | - |
0012 | 9 | in | 0 | (mirrors 003A) | - |
0014 | 10 | in | 1 | /Left Mouse button (mirrors 0038) | - |
0016 | 11 | in | 1 | /Real-time clock interrupt (mirrors 0036) | - |
0018 | 12 | in | 1 | /INTB (mirrors 0034) | - |
001A | 13 | in | 1 | (reflects output 0032) | - |
001C | 14 | in | 0 | - | - |
001E | 15 | in | 1 | (reflects output 002E) | - |
0020 | 16 | out | 0 | RESET (P-Box, pin 6 (inverted)) | - |
0022 | 17 | out | 1 | /V9938 reset | - |
0024 | 18 | out | 1 | Joystick select | - |
0026 | 19 | - | 0 | - | - |
0028 | 20 | - (out) | 0 | - | PFM512 bank-switch 1 of 2 |
002A | 21 | - | 0 | - | - |
002C | 22 | out | 1 | /Keyboard reset | - |
002E | 23 | out | 1 | PAL pin 5 (System clock speed?) | - |
0030 | 24 | - | 0 | - | - |
0032 | 25 | out | 1 | Video wait states (PAL pin 19) | - |
0034 | 26 | in | 1 | /INTB (P-Box pin 18) | - |
0036 | 27 | in | 1 | /Real-time clock interrupt | - |
0038 | 28 | in | 1 | /Left mouse button | - |
003A | 29 | in (out) | 0 | Connected to GND | PFM512 bank switch 2 of 2 |
003C | 30 | in | 1 | /Keyboard interrupt (mirrors 0010, no int) | - |
003E | 31 | in | 1 | /Joystick up (mirrors 000e) | - |
Special | |
13C0-13FE | Single step |
TMS9995 | |||
Address | Bit | Default | Meaning |
1EE0 | 0 | 0 | Decrementer in event counter mode (0=in timer mode) |
1EE2 | 1 | 0 | Enable decrementer |
1EE4 | 2 | 0 | Interrupt level 1 latch |
1EE6 | 3 | 0 | Interrupt level 2 latch |
1EE8 | 4 | 1 | Interrupt level 4 latch |
1EEA | 5 | 0 | not used |
1EEC | 6 | 0 | not used |
1EEE | 7 | 0 | CapsLock flag |
1EF0 | 8 | 1 | Keyboard control |
1EF2 | 9 | 1 | Keyboard control |
1EF4 | 10 | 1 | Geneve mode (/TI mode) |
1EF6 | 11 | 0 | Direct mode (/Mapper mode) (page F8 locked into >0000->1fff) |
1EF8 | 12 | 1 | Cartridge rom size (1=8 KiB, 0=16 Kib) |
1EFA | 13 | 1 | /Protect 6xxx |
1EFC | 14 | 1 | /Protect 7xxx |
1EFE | 15 | 1 | /Add wait state per memory cycle |
1FDA | 125 | 0 | Macro Instruction Detect |
The MID flag is set whenever the CPU encounters an unknown opcode. This (together with the interrupt) may be used to implement new "commands" on the application level.
The bits on addresses 1EEA to 1EFE are so-called user-defined internal CRU flags. As such, they are just latches that store the recent setting (0 or 1) and return it when reading the bit again. However, the TMS 9995 processor propagates the setting to the outside world, while ignoring input from there. That is, when we set bit 15 to 1 (here on address 1efe),
- the CPU stores the 1 on the corresponding flag
- it also outputs the 1 on CRUOUT, with the address bus set to 1EFE, where it may have some specific effect. Here, it turns off wait states.
When we test the bit using TB, the processor reads the flag value, but it ignores any incoming bit on CRUIN. This is reasonable, as the address is visible outside, and external devices may attempt to send some value to the CPU.
Obviously these flag bits only make sense when used as outputs. Storing bits for later reading can be done better within the CPU RAM.
Usage
As always, CRU bits are queried and set with special commands. Bits are addressed as offsets to a base address which is stored in Workspace Register 12 (R12). The base address is stored in bits 3-14, so the R12 value is twice as high as the absolute bit address. (Note that bit 15 cannot be used since A15 and CRUOUT share the same line.) Base addresses are commonly noted as register 12 values.
Turn on Geneve mode:
LI R12,>1EF4 SBO 0
or, equivalently
LI R12,>1EE0 SBO 10
since >1EE0 + 2·10 = >1EE0 + >14 = >1EF4
(bit numbers are often given in decimal notation)
The LDCR and STCR commands are used to write or read multiple CRU bits. The base address is automatically incremented for each bit transfer. Bit transfers begin at the least significant bit. Note that it is relevant whether less than 9 bits are transferred: If less, the memory location is treated as a byte address, if more, as a word address.
LI R12,>0006 STCR R0,5
reads the five joystick lines, storing the bits in the least significant five bits of the high byte of R0, with bit 3 at the right.
x | x | x | up | down | right | left | but | x | x | x | x | x | x | x | x |
If we had transferred 9 bits, all bits as shown above are shifted to the right by 8 positions (starting at the very right bit).
LI R12,>1EF0 LI R1,>F100 * binary: 11110001 LDCR R1,8
This enables the keyboard clock, not clearing the input register, activating TI mode and mapping, cartridges have 8K, no write protection to 6xxx and 7xxx, and no wait states.