trunk/src/mess/drivers/pdp11.c
| r24058 | r24059 | |
| 64 | 64 | |
| 65 | 65 | 23/02/2009 Skeleton driver. |
| 66 | 66 | |
| 67 | Memory Map (converted from the annoying octal format from the manuals): |
| 68 | 0x0000 - 0x00ff: irq vectors |
| 69 | 0xe000: ROM |
| 70 | 0xff68: "high speed reader and punch device status and buffer register" |
| 71 | 0xff70 - 0xff7e: "teletype keyboard and punch device status and buffer register" |
| 72 | PDP-11 internal registers: |
| 73 | 0xff80 - 0xffbf: "reserved for expansion of processor registers" |
| 74 | 0xffc0: R0 |
| 75 | 0xffc2: R1 |
| 76 | 0xffc4: R2 |
| 77 | 0xffc6: R3 |
| 78 | 0xffc8: R4 |
| 79 | 0xffca: R5 |
| 80 | 0xffcc: R6 / SP |
| 81 | 0xffce: R7 / PC |
| 82 | 0xfffe: PSW |
| 83 | |
| 67 | 84 | ****************************************************************************/ |
| 68 | 85 | |
| 69 | 86 | #include "emu.h" |
| r24058 | r24059 | |
| 82 | 99 | |
| 83 | 100 | required_device<cpu_device> m_maincpu; |
| 84 | 101 | required_device<generic_terminal_device> m_terminal; |
| 85 | | DECLARE_READ16_MEMBER( term_r ); |
| 86 | | DECLARE_READ16_MEMBER( term_tx_status_r ); |
| 87 | | DECLARE_READ16_MEMBER( term_rx_status_r ); |
| 88 | | DECLARE_WRITE16_MEMBER( term_w ); |
| 102 | DECLARE_READ16_MEMBER( teletype_ctrl_r ); |
| 103 | DECLARE_WRITE16_MEMBER( teletype_ctrl_w ); |
| 89 | 104 | DECLARE_WRITE8_MEMBER( kbd_put ); |
| 90 | | UINT8 m_term_data; |
| 91 | | UINT16 m_term_status; |
| 105 | UINT8 m_teletype_data; |
| 106 | UINT16 m_teletype_status; |
| 92 | 107 | virtual void machine_reset(); |
| 93 | 108 | DECLARE_MACHINE_RESET(pdp11ub2); |
| 94 | 109 | DECLARE_MACHINE_RESET(pdp11qb); |
| 95 | 110 | void load9312prom(UINT8 *desc, UINT8 *src, int size); |
| 96 | 111 | }; |
| 97 | 112 | |
| 98 | | WRITE16_MEMBER(pdp11_state::term_w) |
| 113 | READ16_MEMBER(pdp11_state::teletype_ctrl_r) |
| 99 | 114 | { |
| 100 | | m_terminal->write(space, 0, data); |
| 101 | | } |
| 115 | UINT16 res = 0; |
| 102 | 116 | |
| 103 | | READ16_MEMBER(pdp11_state::term_r) |
| 104 | | { |
| 105 | | m_term_status = 0x0000; |
| 106 | | return m_term_data; |
| 107 | | } |
| 117 | switch(offset) |
| 118 | { |
| 119 | /* |
| 120 | keyboard |
| 121 | ---- x--- ---- ---- busy bit |
| 122 | ---- ---- x--- ---- ready bit (set on character receive, clear on buffer read) |
| 123 | ---- ---- -x-- ---- irq enable |
| 124 | ---- ---- ---- ---x reader enable (?) |
| 125 | */ |
| 126 | case 0: res = m_teletype_status; break; // reader status register (tks) |
| 127 | case 1: m_teletype_status &= ~0x80; res = m_teletype_data; break;// reader buffer register (tkb) |
| 128 | /* |
| 129 | printer |
| 130 | ---- ---- x--- ---- ready bit |
| 131 | ---- ---- -x-- ---- irq enable |
| 132 | ---- ---- ---- -x-- maintenance |
| 133 | */ |
| 134 | case 2: res = 0x80; break; // punch status register (tps) |
| 135 | case 3: res = 0; break; // punch buffer register (tpb) |
| 136 | } |
| 108 | 137 | |
| 109 | | READ16_MEMBER(pdp11_state::term_tx_status_r) |
| 110 | | { // always ready |
| 111 | | return 0xffff; |
| 138 | return res; |
| 112 | 139 | } |
| 113 | 140 | |
| 114 | | READ16_MEMBER(pdp11_state::term_rx_status_r) |
| 141 | WRITE16_MEMBER(pdp11_state::teletype_ctrl_w) |
| 115 | 142 | { |
| 116 | | return m_term_status; |
| 143 | switch(offset) |
| 144 | { |
| 145 | case 3: |
| 146 | m_terminal->write(space, 0, data); |
| 147 | break; |
| 148 | } |
| 117 | 149 | } |
| 118 | 150 | |
| 119 | 151 | static ADDRESS_MAP_START(pdp11_mem, AS_PROGRAM, 16, pdp11_state) |
| 120 | 152 | ADDRESS_MAP_UNMAP_HIGH |
| 121 | 153 | AM_RANGE( 0x0000, 0xdfff ) AM_RAM // RAM |
| 122 | 154 | AM_RANGE( 0xea00, 0xfeff ) AM_ROM |
| 123 | | AM_RANGE( 0xff70, 0xff71 ) AM_READ(term_rx_status_r) |
| 124 | | AM_RANGE( 0xff72, 0xff73 ) AM_READ(term_r) |
| 125 | | AM_RANGE( 0xff74, 0xff75 ) AM_READ(term_tx_status_r) |
| 126 | | AM_RANGE( 0xff76, 0xff77 ) AM_WRITE(term_w) |
| 155 | AM_RANGE( 0xff70, 0xff77 ) AM_READWRITE(teletype_ctrl_r,teletype_ctrl_w) |
| 127 | 156 | |
| 128 | 157 | AM_RANGE( 0xfe78, 0xfe7b ) AM_DEVREADWRITE("rx01", rx01_device, read, write) |
| 129 | 158 | ADDRESS_MAP_END |
| r24058 | r24059 | |
| 314 | 343 | |
| 315 | 344 | WRITE8_MEMBER( pdp11_state::kbd_put ) |
| 316 | 345 | { |
| 317 | | m_term_data = data; |
| 318 | | m_term_status = 0xffff; |
| 346 | m_teletype_data = data; |
| 347 | m_teletype_status |= 0x80; |
| 319 | 348 | } |
| 320 | 349 | |
| 321 | 350 | static GENERIC_TERMINAL_INTERFACE( terminal_intf ) |