src/emu/machine/ins8250.c
| r14535 | r14536 | |
| 73 | 73 | |
| 74 | 74 | **********************************************************************/ |
| 75 | 75 | |
| 76 | | #include "emu.h" |
| 77 | 76 | #include "machine/ins8250.h" |
| 78 | 77 | |
| 78 | const device_type INS8250 = &device_creator<ins8250_device>; |
| 79 | const device_type NS16450 = &device_creator<ns16450_device>; |
| 80 | const device_type NS16550 = &device_creator<ns16550_device>; |
| 79 | 81 | |
| 80 | | #define LOG(LEVEL,N,M,A) \ |
| 81 | | do { \ |
| 82 | | if(LEVEL>=N) \ |
| 83 | | { \ |
| 84 | | if( M ) \ |
| 85 | | logerror("%-24s",(char*)M ); \ |
| 86 | | logerror A; \ |
| 87 | | } \ |
| 88 | | } while (0) |
| 82 | ins8250_uart_device::ins8250_uart_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock) |
| 83 | : device_t(mconfig, type, name, tag, owner, clock), |
| 84 | device_serial_interface(mconfig, *this) |
| 85 | { |
| 86 | } |
| 89 | 87 | |
| 88 | ins8250_device::ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 89 | : ins8250_uart_device(mconfig, INS8250, "ins8250", tag, owner, clock) |
| 90 | { |
| 91 | m_device_type = TYPE_INS8250; |
| 92 | } |
| 90 | 93 | |
| 91 | | /* device types */ |
| 92 | | enum { |
| 93 | | TYPE_INS8250 = 0, |
| 94 | | TYPE_INS8250A, |
| 95 | | TYPE_NS16450, |
| 96 | | TYPE_NS16550, |
| 97 | | TYPE_NS16550A, |
| 98 | | TYPE_PC16550D, |
| 94 | ns16450_device::ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 95 | : ins8250_uart_device(mconfig, NS16450, "ns16450", tag, owner, clock) |
| 96 | { |
| 97 | m_device_type = TYPE_NS16450; |
| 98 | } |
| 99 | 99 | |
| 100 | | NUM_TYPES |
| 101 | | }; |
| 100 | ns16550_device::ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 101 | : ins8250_uart_device(mconfig, NS16550, "ns16550", tag, owner, clock) |
| 102 | { |
| 103 | m_device_type = TYPE_NS16550; |
| 104 | } |
| 102 | 105 | |
| 103 | | |
| 104 | | /* device tags */ |
| 105 | | static const char * const device_tags[NUM_TYPES] = { "ins8250", "ins8250a", "ns16450", "ns16550", "ns16550a", "pc16550d" }; |
| 106 | | |
| 107 | | |
| 108 | | #define VERBOSE_COM 0 |
| 109 | | #define COM_LOG(n,m,a) LOG(VERBOSE_COM,n,m,a) |
| 110 | | |
| 111 | | typedef struct { |
| 112 | | devcb_resolved_write_line out_intr_func; |
| 113 | | const ins8250_interface *interface; |
| 114 | | int device_type; |
| 115 | | |
| 116 | | UINT8 thr; /* 0 -W transmitter holding register */ |
| 117 | | UINT8 rbr; /* 0 R- receiver buffer register */ |
| 118 | | UINT8 ier; /* 1 RW interrupt enable register */ |
| 119 | | UINT8 dll; /* 0 RW divisor latch lsb (if DLAB = 1) */ |
| 120 | | UINT8 dlm; /* 1 RW divisor latch msb (if DLAB = 1) */ |
| 121 | | UINT8 iir; /* 2 R- interrupt identification register */ |
| 122 | | UINT8 lcr; /* 3 RW line control register (bit 7: DLAB) */ |
| 123 | | UINT8 mcr; /* 4 RW modem control register */ |
| 124 | | UINT8 lsr; /* 5 R- line status register */ |
| 125 | | UINT8 msr; /* 6 R- modem status register */ |
| 126 | | UINT8 scr; /* 7 RW scratch register */ |
| 127 | | |
| 128 | | /* holds int pending state for com */ |
| 129 | | UINT8 int_pending; |
| 130 | | |
| 131 | | // sending circuit |
| 132 | | struct { |
| 133 | | int active; |
| 134 | | UINT8 data; |
| 135 | | double time; |
| 136 | | } send; |
| 137 | | } ins8250_t; |
| 138 | | |
| 139 | 106 | /* int's pending */ |
| 140 | 107 | #define COM_INT_PENDING_RECEIVED_DATA_AVAILABLE 0x0001 |
| 141 | 108 | #define COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY 0x0002 |
| 142 | 109 | #define COM_INT_PENDING_RECEIVER_LINE_STATUS 0x0004 |
| 143 | 110 | #define COM_INT_PENDING_MODEM_STATUS_REGISTER 0x0008 |
| 144 | 111 | |
| 145 | | |
| 146 | | INLINE ins8250_t *get_safe_token(device_t *device) |
| 147 | | { |
| 148 | | assert( device != NULL ); |
| 149 | | assert( ( device->type() == INS8250 ) || |
| 150 | | ( device->type() == INS8250A ) || |
| 151 | | ( device->type() == NS16450 ) || |
| 152 | | ( device->type() == NS16550 ) || |
| 153 | | ( device->type() == NS16550A ) || |
| 154 | | ( device->type() == PC16550D ) ); |
| 155 | | return (ins8250_t *)downcast<legacy_device_base *>(device)->token(); |
| 156 | | } |
| 157 | | |
| 158 | | |
| 159 | | /* setup iir with the priority id */ |
| 160 | | static void ins8250_setup_iir(device_t *device) |
| 161 | | { |
| 162 | | ins8250_t *ins8250 = get_safe_token(device); |
| 163 | | |
| 164 | | ins8250->iir &= ~(0x04|0x02); |
| 165 | | |
| 166 | | /* highest to lowest */ |
| 167 | | if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_RECEIVER_LINE_STATUS) |
| 168 | | { |
| 169 | | ins8250->iir |=0x04|0x02; |
| 170 | | return; |
| 171 | | } |
| 172 | | |
| 173 | | if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_RECEIVED_DATA_AVAILABLE) |
| 174 | | { |
| 175 | | ins8250->iir |=0x04; |
| 176 | | return; |
| 177 | | } |
| 178 | | |
| 179 | | if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY) |
| 180 | | { |
| 181 | | ins8250->iir |=0x02; |
| 182 | | return; |
| 183 | | } |
| 184 | | |
| 185 | | /* modem status has both bits clear */ |
| 186 | | } |
| 187 | | |
| 188 | | |
| 189 | 112 | /* ints will continue to be set for as long as there are ints pending */ |
| 190 | | static void ins8250_update_interrupt(device_t *device) |
| 113 | void ins8250_uart_device::update_interrupt() |
| 191 | 114 | { |
| 192 | | ins8250_t *ins8250 = get_safe_token(device); |
| 193 | 115 | int state; |
| 194 | 116 | |
| 195 | 117 | /* if any bits are set and are enabled */ |
| 196 | | if (((ins8250->int_pending&ins8250->ier) & 0x0f) != 0) |
| 118 | if (((m_int_pending & m_regs.ier) & 0x0f) != 0) |
| 197 | 119 | { |
| 198 | 120 | /* trigger next highest priority int */ |
| 199 | 121 | |
| 200 | 122 | /* set int */ |
| 201 | 123 | state = 1; |
| 202 | | ins8250_setup_iir(device); |
| 124 | m_regs.iir &= ~(0x04|0x02); |
| 203 | 125 | |
| 126 | /* highest to lowest */ |
| 127 | if (m_regs.ier & m_int_pending & COM_INT_PENDING_RECEIVER_LINE_STATUS) |
| 128 | m_regs.iir |=0x04|0x02; |
| 129 | else if (m_regs.ier & m_int_pending & COM_INT_PENDING_RECEIVED_DATA_AVAILABLE) |
| 130 | m_regs.iir |=0x04; |
| 131 | else if (m_regs.ier & m_int_pending & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY) |
| 132 | m_regs.iir |=0x02; |
| 133 | |
| 204 | 134 | /* int pending */ |
| 205 | | ins8250->iir &= ~0x01; |
| 135 | m_regs.iir &= ~0x01; |
| 206 | 136 | } |
| 207 | 137 | else |
| 208 | 138 | { |
| r14535 | r14536 | |
| 210 | 140 | state = 0; |
| 211 | 141 | |
| 212 | 142 | /* no ints pending */ |
| 213 | | ins8250->iir |= 0x01; |
| 143 | m_regs.iir |= 0x01; |
| 214 | 144 | /* priority level */ |
| 215 | | ins8250->iir &= ~(0x04|0x02); |
| 145 | m_regs.iir &= ~(0x04|0x02); |
| 216 | 146 | } |
| 217 | 147 | |
| 218 | 148 | /* set or clear the int */ |
| 219 | | ins8250->out_intr_func(state); |
| 149 | m_out_int_func(state); |
| 220 | 150 | } |
| 221 | 151 | |
| 222 | | |
| 223 | | |
| 224 | 152 | /* set pending bit and trigger int */ |
| 225 | | static void ins8250_trigger_int(device_t *device, int flag) |
| 153 | void ins8250_uart_device::trigger_int(int flag) |
| 226 | 154 | { |
| 227 | | ins8250_t *ins8250 = get_safe_token(device); |
| 228 | | |
| 229 | | ins8250->int_pending |= flag; |
| 230 | | ins8250_update_interrupt(device); |
| 155 | m_int_pending |= flag; |
| 156 | update_interrupt(); |
| 231 | 157 | } |
| 232 | 158 | |
| 233 | | |
| 234 | | |
| 235 | 159 | /* clear pending bit, if any ints are pending, then int will be triggered, otherwise it |
| 236 | 160 | will be cleared */ |
| 237 | | static void ins8250_clear_int(device_t *device, int flag) |
| 161 | void ins8250_uart_device::clear_int(int flag) |
| 238 | 162 | { |
| 239 | | ins8250_t *ins8250 = get_safe_token(device); |
| 163 | m_int_pending &= ~flag; |
| 164 | update_interrupt(); |
| 165 | } |
| 240 | 166 | |
| 241 | | ins8250->int_pending &= ~flag; |
| 242 | | ins8250_update_interrupt(device); |
| 167 | void ins8250_uart_device::update_clock() |
| 168 | { |
| 169 | int baud; |
| 170 | if(m_regs.dl == 0) |
| 171 | { |
| 172 | m_timer->adjust(attotime::never); |
| 173 | return; |
| 174 | } |
| 175 | baud = clock()/(m_regs.dl*16); |
| 176 | m_timer->adjust(attotime::zero, 0, attotime::from_hz(baud)); |
| 243 | 177 | } |
| 244 | 178 | |
| 245 | | |
| 246 | | WRITE8_DEVICE_HANDLER( ins8250_w ) |
| 179 | WRITE8_MEMBER( ins8250_uart_device::ins8250_w ) |
| 247 | 180 | { |
| 248 | | static const char P[] = "NONENHNL"; /* names for parity select */ |
| 249 | | ins8250_t *ins8250 = get_safe_token(device); |
| 250 | | int tmp; |
| 181 | int tmp; |
| 251 | 182 | |
| 252 | 183 | switch (offset) |
| 253 | 184 | { |
| 254 | 185 | case 0: |
| 255 | | if (ins8250->lcr & 0x80) |
| 186 | if (m_regs.lcr & 0x80) |
| 256 | 187 | { |
| 257 | | ins8250->dll = data; |
| 258 | | tmp = ins8250->dlm * 256 + ins8250->dll; |
| 259 | | COM_LOG(1,"COM_dll_w",("COM \"%s\" $%02x: [$%04x = %d baud]\n", device->tag(), |
| 260 | | data, tmp, (tmp)?(int)(ins8250->interface->clockin/16/tmp):0)); |
| 188 | m_regs.dl = (m_regs.dl & 0xff00) | data; |
| 189 | update_clock(); |
| 261 | 190 | } |
| 262 | 191 | else |
| 263 | 192 | { |
| 264 | | ins8250->thr = data; |
| 265 | | COM_LOG(2,"COM_thr_w",("COM $%02x\n", data)); |
| 266 | | |
| 267 | | if ( ins8250->mcr & 0x10 ) |
| 193 | m_regs.thr = data; |
| 194 | m_regs.lsr &= ~0x60; |
| 195 | if ( m_regs.mcr & 0x10 ) |
| 268 | 196 | { |
| 269 | | ins8250->lsr |= 1; |
| 270 | | ins8250->rbr = data; |
| 271 | | ins8250_trigger_int( device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE ); |
| 197 | m_regs.lsr |= 1; |
| 198 | m_regs.rbr = data; |
| 199 | trigger_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 272 | 200 | } |
| 273 | | |
| 274 | | if ( ins8250->interface->transmit ) |
| 275 | | ins8250->interface->transmit(device, ins8250->thr); |
| 276 | | |
| 277 | | /* writing to thr will clear the int */ |
| 278 | | ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY); |
| 279 | 201 | } |
| 280 | 202 | break; |
| 281 | 203 | case 1: |
| 282 | | if (ins8250->lcr & 0x80) |
| 204 | if (m_regs.lcr & 0x80) |
| 283 | 205 | { |
| 284 | | ins8250->dlm = data; |
| 285 | | tmp = ins8250->dlm * 256 + ins8250->dll; |
| 286 | | COM_LOG(1,"COM_dlm_w",("COM \"%s\" $%02x: [$%04x = %d baud]\n", device->tag(), |
| 287 | | data, tmp, (tmp)?(int)(ins8250->interface->clockin/16/tmp):0)); |
| 206 | m_regs.dl = (m_regs.dl & 0xff) | (data << 8); |
| 207 | update_clock(); |
| 288 | 208 | } |
| 289 | 209 | else |
| 290 | 210 | { |
| 291 | | ins8250->ier = data; |
| 292 | | COM_LOG(2,"COM_ier_w",("COM \"%s\" $%02x: enable int on RX %d, THRE %d, RLS %d, MS %d\n", device->tag(), |
| 293 | | data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1)); |
| 294 | | COM_LOG(2,"COM_ier_w",("COM \"%s\" lsr = $%02x, int_pending = $%02x\n", device->tag(), ins8250->lsr, ins8250->int_pending )); |
| 295 | | ins8250_update_interrupt(device); |
| 211 | m_regs.ier = data; |
| 212 | update_interrupt(); |
| 296 | 213 | } |
| 297 | 214 | break; |
| 298 | 215 | case 2: |
| 299 | | COM_LOG(1,"COM_fcr_w",("COM \"%s\" $%02x (16550 only)\n", device->tag(), data)); |
| 300 | 216 | break; |
| 301 | 217 | case 3: |
| 302 | | ins8250->lcr = data; |
| 303 | | COM_LOG(1,"COM_lcr_w",("COM \"%s\" $%02x word length %d, stop bits %d, parity %c, break %d, DLAB %d\n", device->tag(), |
| 304 | | data, 5+(data&3), 1+((data>>2)&1), P[(data>>3)&7], (data>>6)&1, (data>>7)&1)); |
| 305 | | break; |
| 218 | m_regs.lcr = data; |
| 219 | switch ((m_regs.lcr>>3) & 7) |
| 220 | { |
| 221 | case 1: |
| 222 | tmp = SERIAL_PARITY_ODD; |
| 223 | break; |
| 224 | case 3: |
| 225 | tmp = SERIAL_PARITY_EVEN; |
| 226 | break; |
| 227 | case 5: |
| 228 | tmp = SERIAL_PARITY_MARK; |
| 229 | break; |
| 230 | case 7: |
| 231 | tmp = SERIAL_PARITY_SPACE; |
| 232 | break; |
| 233 | default: |
| 234 | tmp = SERIAL_PARITY_NONE; |
| 235 | break; |
| 236 | } |
| 237 | // if 5 data bits and stb = 1, stop bits is supposed to be 1.5 |
| 238 | set_data_frame((m_regs.lcr & 3) + 5, (m_regs.lcr & 4)?2:1, tmp); |
| 239 | break; |
| 306 | 240 | case 4: |
| 307 | | if ( ( ins8250->mcr & 0x1f ) != ( data & 0x1f ) ) |
| 241 | if ( ( m_regs.mcr & 0x1f ) != ( data & 0x1f ) ) |
| 308 | 242 | { |
| 309 | | ins8250->mcr = data & 0x1f; |
| 310 | | COM_LOG(1,"COM_mcr_w",("COM \"%s\" $%02x DTR %d, RTS %d, OUT1 %d, OUT2 %d, loopback %d\n", device->tag(), |
| 311 | | data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1, (data>>4)&1)); |
| 312 | | if (ins8250->interface->handshake_out) |
| 313 | | ins8250->interface->handshake_out(device,data); |
| 243 | m_regs.mcr = data & 0x1f; |
| 314 | 244 | |
| 315 | | if ( ins8250->mcr & 0x10 ) /* loopback test */ |
| 245 | if ( m_regs.mcr & 0x10 ) /* loopback test */ |
| 316 | 246 | { |
| 317 | | data = ( ( ins8250->mcr & 0x0c ) << 4 ) | ( ( ins8250->mcr & 0x01 ) << 5 ) | ( ( ins8250->mcr & 0x02 ) << 3 ); |
| 318 | | if ( ( ins8250->msr & 0x20 ) != ( data & 0x20 ) ) |
| 319 | | { |
| 247 | data = ( ( m_regs.mcr & 0x0c ) << 4 ) | ( ( m_regs.mcr & 0x01 ) << 5 ) | ( ( m_regs.mcr & 0x02 ) << 3 ); |
| 248 | if ( ( m_regs.msr & 0x20 ) != ( data & 0x20 ) ) |
| 320 | 249 | data |= 0x02; |
| 321 | | } |
| 322 | | if ( ( ins8250->msr & 0x10 ) != ( data & 0x10 ) ) |
| 323 | | { |
| 250 | if ( ( m_regs.msr & 0x10 ) != ( data & 0x10 ) ) |
| 324 | 251 | data |= 0x01; |
| 325 | | } |
| 326 | | if ( ( ins8250->msr & 0x40 ) && ! ( data & 0x40 ) ) |
| 327 | | { |
| 252 | if ( ( m_regs.msr & 0x40 ) && ! ( data & 0x40 ) ) |
| 328 | 253 | data |= 0x04; |
| 329 | | } |
| 330 | | if ( ( ins8250->msr & 0x80 ) != ( data & 0x80 ) ) |
| 331 | | { |
| 254 | if ( ( m_regs.msr & 0x80 ) != ( data & 0x80 ) ) |
| 332 | 255 | data |= 0x08; |
| 333 | | } |
| 334 | | ins8250->msr = data; |
| 256 | m_regs.msr = data; |
| 335 | 257 | } |
| 258 | else |
| 259 | { |
| 260 | m_out_dtr_func(m_regs.mcr & 1); |
| 261 | m_out_rts_func((m_regs.mcr & 2) && 1); |
| 262 | m_out_out1_func((m_regs.mcr & 4) && 1); |
| 263 | m_out_out2_func((m_regs.mcr & 8) && 1); |
| 264 | } |
| 336 | 265 | } |
| 337 | 266 | break; |
| 338 | 267 | case 5: |
| r14535 | r14536 | |
| 341 | 270 | bits 5 - 0, you could cause an interrupt if the appropriate IER bit |
| 342 | 271 | is set. |
| 343 | 272 | */ |
| 344 | | COM_LOG(1,"COM_lsr_w",("COM \"%s\" $%02x\n", device->tag(), data )); |
| 273 | m_regs.lsr = data; |
| 345 | 274 | |
| 346 | | ins8250->lsr = data; |
| 347 | | |
| 348 | 275 | tmp = 0; |
| 349 | | tmp |= ( ins8250->lsr & 0x01 ) ? COM_INT_PENDING_RECEIVED_DATA_AVAILABLE : 0; |
| 350 | | tmp |= ( ins8250->lsr & 0x1e ) ? COM_INT_PENDING_RECEIVER_LINE_STATUS : 0; |
| 351 | | tmp |= ( ins8250->lsr & 0x20 ) ? COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY : 0; |
| 352 | | ins8250_trigger_int( device, tmp ); |
| 276 | tmp |= ( m_regs.lsr & 0x01 ) ? COM_INT_PENDING_RECEIVED_DATA_AVAILABLE : 0; |
| 277 | tmp |= ( m_regs.lsr & 0x1e ) ? COM_INT_PENDING_RECEIVER_LINE_STATUS : 0; |
| 278 | tmp |= ( m_regs.lsr & 0x20 ) ? COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY : 0; |
| 279 | trigger_int(tmp); |
| 353 | 280 | |
| 354 | 281 | break; |
| 355 | 282 | case 6: |
| r14535 | r14536 | |
| 358 | 285 | bits 3 - 0, you could cause an interrupt if the appropriate IER bit |
| 359 | 286 | is set. |
| 360 | 287 | */ |
| 361 | | COM_LOG(1,"COM_msr_w",("COM \"%s\" $%02x\n", device->tag(), data )); |
| 288 | m_regs.msr = data; |
| 362 | 289 | |
| 363 | | ins8250->msr = data; |
| 364 | | |
| 365 | | if ( ins8250->msr & 0x0f ) |
| 366 | | { |
| 367 | | ins8250_trigger_int( device, COM_INT_PENDING_MODEM_STATUS_REGISTER ); |
| 368 | | } |
| 290 | if ( m_regs.msr & 0x0f ) |
| 291 | trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 369 | 292 | break; |
| 370 | 293 | case 7: |
| 371 | | ins8250->scr = data; |
| 372 | | COM_LOG(2,"COM_scr_w",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 294 | m_regs.scr = data; |
| 373 | 295 | break; |
| 374 | 296 | } |
| 375 | | |
| 376 | | if (ins8250->interface->refresh_connected) |
| 377 | | ins8250->interface->refresh_connected(device); |
| 378 | 297 | } |
| 379 | 298 | |
| 380 | | |
| 381 | | |
| 382 | | READ8_DEVICE_HANDLER( ins8250_r ) |
| 299 | READ8_MEMBER( ins8250_uart_device::ins8250_r ) |
| 383 | 300 | { |
| 384 | | ins8250_t *ins8250 = get_safe_token(device); |
| 385 | 301 | int data = 0x0ff; |
| 386 | 302 | |
| 387 | 303 | switch (offset) |
| 388 | 304 | { |
| 389 | 305 | case 0: |
| 390 | | if (ins8250->lcr & 0x80) |
| 391 | | { |
| 392 | | data = ins8250->dll; |
| 393 | | COM_LOG(1,"COM_dll_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 394 | | } |
| 306 | if (m_regs.lcr & 0x80) |
| 307 | data = (m_regs.dl & 0xff); |
| 395 | 308 | else |
| 396 | 309 | { |
| 397 | | data = ins8250->rbr; |
| 398 | | if( ins8250->lsr & 0x01 ) |
| 399 | | { |
| 400 | | ins8250->lsr &= ~0x01; /* clear data ready status */ |
| 401 | | COM_LOG(2,"COM_rbr_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 402 | | } |
| 310 | data = m_regs.rbr; |
| 311 | if( m_regs.lsr & 0x01 ) |
| 312 | m_regs.lsr &= ~0x01; /* clear data ready status */ |
| 403 | 313 | |
| 404 | | ins8250_clear_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 314 | clear_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 405 | 315 | } |
| 406 | 316 | break; |
| 407 | 317 | case 1: |
| 408 | | if (ins8250->lcr & 0x80) |
| 409 | | { |
| 410 | | data = ins8250->dlm; |
| 411 | | COM_LOG(1,"COM_dlm_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 412 | | } |
| 318 | if (m_regs.lcr & 0x80) |
| 319 | data = (m_regs.dl >> 8); |
| 413 | 320 | else |
| 414 | | { |
| 415 | | data = ins8250->ier & 0x0f; |
| 416 | | COM_LOG(2,"COM_ier_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 417 | | } |
| 321 | data = m_regs.ier & 0x0f; |
| 418 | 322 | break; |
| 419 | 323 | case 2: |
| 420 | | data = ins8250->iir; |
| 421 | | COM_LOG(2,"COM_iir_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 324 | data = m_regs.iir; |
| 422 | 325 | /* The documentation says that reading this register will |
| 423 | 326 | clear the int if this is the source of the int */ |
| 424 | | if ( ins8250->ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY ) |
| 425 | | { |
| 426 | | ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY); |
| 427 | | } |
| 327 | if ( m_regs.ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY ) |
| 328 | clear_int(COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY); |
| 428 | 329 | break; |
| 429 | 330 | case 3: |
| 430 | | data = ins8250->lcr; |
| 431 | | COM_LOG(2,"COM_lcr_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 331 | data = m_regs.lcr; |
| 432 | 332 | break; |
| 433 | 333 | case 4: |
| 434 | | data = ins8250->mcr; |
| 435 | | COM_LOG(2,"COM_mcr_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 334 | data = m_regs.mcr; |
| 436 | 335 | break; |
| 437 | 336 | case 5: |
| 337 | data = m_regs.lsr; |
| 338 | if( m_regs.lsr & 0x1f ) |
| 339 | m_regs.lsr &= 0xe1; /* clear FE, PE and OE and BREAK bits */ |
| 438 | 340 | |
| 439 | | #if 0 |
| 440 | | if (ins8250->send.active && (machine.time()-ins8250->send.time>uart_byte_time(n))) |
| 441 | | { |
| 442 | | // currently polling is enough for pc1512 |
| 443 | | ins8250->lsr |= 0x40; /* set TSRE */ |
| 444 | | ins8250->send.active = 0; |
| 445 | | if ( ins8250->mcr & 0x10 ) |
| 446 | | { |
| 447 | | ins8250->lsr |= 1; |
| 448 | | ins8250->rbr = ins8250->send.data; |
| 449 | | } |
| 450 | | } |
| 451 | | #endif |
| 452 | | ins8250->lsr |= 0x60; /* set THRE */ |
| 453 | | data = ins8250->lsr; |
| 454 | | if( ins8250->lsr & 0x1f ) |
| 455 | | { |
| 456 | | ins8250->lsr &= 0xe1; /* clear FE, PE and OE and BREAK bits */ |
| 457 | | COM_LOG(2,"COM_lsr_r",("COM \"%s\" $%02x, DR %d, OE %d, PE %d, FE %d, BREAK %d, THRE %d, TSRE %d\n", device->tag(), |
| 458 | | data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1, (data>>4)&1, (data>>5)&1, (data>>6)&1)); |
| 459 | | } |
| 460 | | |
| 461 | 341 | /* reading line status register clears int */ |
| 462 | | ins8250_clear_int(device, COM_INT_PENDING_RECEIVER_LINE_STATUS); |
| 342 | clear_int(COM_INT_PENDING_RECEIVER_LINE_STATUS); |
| 463 | 343 | break; |
| 464 | 344 | case 6: |
| 465 | | data = ins8250->msr; |
| 466 | | ins8250->msr &= 0xf0; /* reset delta values */ |
| 467 | | COM_LOG(2,"COM_msr_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 345 | data = m_regs.msr; |
| 346 | m_regs.msr &= 0xf0; /* reset delta values */ |
| 468 | 347 | |
| 469 | 348 | /* reading msr clears int */ |
| 470 | | ins8250_clear_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 349 | clear_int(COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 471 | 350 | |
| 472 | 351 | break; |
| 473 | 352 | case 7: |
| 474 | | data = ins8250->scr; |
| 475 | | COM_LOG(2,"COM_scr_r",("COM \"%s\" $%02x\n", device->tag(), data)); |
| 353 | data = m_regs.scr; |
| 476 | 354 | break; |
| 477 | 355 | } |
| 478 | | |
| 479 | | if (ins8250->interface->refresh_connected) |
| 480 | | ins8250->interface->refresh_connected(device); |
| 481 | | |
| 482 | 356 | return data; |
| 483 | 357 | } |
| 484 | 358 | |
| 485 | | |
| 486 | | |
| 487 | | void ins8250_receive(device_t *device, int data) |
| 359 | void ins8250_uart_device::update_msr(int bit, UINT8 state) |
| 488 | 360 | { |
| 489 | | ins8250_t *ins8250 = get_safe_token(device); |
| 490 | | |
| 491 | | /* check if data rate 1200 baud is set */ |
| 492 | | if( ins8250->dlm != 0x00 || ins8250->dll != 0x60 ) |
| 493 | | ins8250->lsr |= 0x08; /* set framing error */ |
| 494 | | |
| 495 | | /* if data not yet serviced */ |
| 496 | | if( ins8250->lsr & 0x01 ) |
| 497 | | ins8250->lsr |= 0x02; /* set overrun error */ |
| 498 | | |
| 499 | | /* put data into receiver buffer register */ |
| 500 | | ins8250->rbr = data; |
| 501 | | |
| 502 | | /* set data ready status */ |
| 503 | | ins8250->lsr |= 0x01; |
| 504 | | |
| 505 | | /* set pending state for this interrupt. */ |
| 506 | | ins8250_trigger_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 507 | | |
| 508 | | |
| 509 | | // /* OUT2 + received line data avail interrupt enabled? */ |
| 510 | | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x01) ) |
| 511 | | // { |
| 512 | | // if (com_interface.interrupt) |
| 513 | | // com_interface.interrupt(4-(n&1), 1); |
| 514 | | // |
| 515 | | // } |
| 516 | | } |
| 517 | | |
| 518 | | /************************************************************************** |
| 519 | | * change the modem status register |
| 520 | | **************************************************************************/ |
| 521 | | void ins8250_handshake_in(device_t *device, int new_msr) |
| 522 | | { |
| 523 | | ins8250_t *ins8250 = get_safe_token(device); |
| 524 | | |
| 525 | | /* no change in modem status bits? */ |
| 526 | | if( ((ins8250->msr ^ new_msr) & 0xf0) == 0 ) |
| 361 | UINT8 mask = (1<<bit); |
| 362 | if((m_regs.msr & mask) == (state<<bit)) |
| 527 | 363 | return; |
| 528 | | |
| 529 | | /* set delta status bits 0..3 and new modem status bits 4..7 */ |
| 530 | | ins8250->msr = (((ins8250->msr ^ new_msr) >> 4) & 0x0f) | (new_msr & 0xf0); |
| 531 | | |
| 532 | | ins8250_trigger_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 533 | | |
| 534 | | // /* set up interrupt information register */ |
| 535 | | // COM_iir[n] &= ~(0x06 | 0x01); |
| 536 | | |
| 537 | | // /* OUT2 + modem status interrupt enabled? */ |
| 538 | | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x08) ) |
| 539 | | // { |
| 540 | | // if (com_interface.interrupt) |
| 541 | | // com_interface.interrupt(4-(n&1), 1); |
| 542 | | // } |
| 364 | m_regs.msr = (m_regs.msr & ~mask) | (mask & (state<<bit)); |
| 365 | m_regs.msr = (m_regs.msr & ~(mask << 4)) | (1<<(bit+4)); |
| 366 | trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 543 | 367 | } |
| 544 | 368 | |
| 545 | | |
| 546 | | static void common_start( device_t *device, int device_type ) |
| 369 | WRITE_LINE_MEMBER(ins8250_uart_device::dcd_w) |
| 547 | 370 | { |
| 548 | | ins8250_t *ins8250 = get_safe_token(device); |
| 549 | | |
| 550 | | ins8250->interface = (const ins8250_interface*)device->static_config(); |
| 551 | | ins8250->device_type = device_type; |
| 552 | | |
| 553 | | ins8250->out_intr_func.resolve(ins8250->interface->out_intr_cb, *device); |
| 371 | update_msr(3, (state&&1)); |
| 554 | 372 | } |
| 555 | 373 | |
| 556 | | |
| 557 | | static DEVICE_START( ins8250 ) |
| 374 | WRITE_LINE_MEMBER(ins8250_uart_device::dsr_w) |
| 558 | 375 | { |
| 559 | | common_start( device, TYPE_INS8250 ); |
| 376 | update_msr(1, (state&&1)); |
| 560 | 377 | } |
| 561 | 378 | |
| 562 | | |
| 563 | | static DEVICE_START( ins8250a ) |
| 379 | WRITE_LINE_MEMBER(ins8250_uart_device::ri_w) |
| 564 | 380 | { |
| 565 | | common_start( device, TYPE_INS8250A ); |
| 381 | update_msr(2, (state&&1)); |
| 566 | 382 | } |
| 567 | 383 | |
| 568 | | |
| 569 | | static DEVICE_START( ns16450 ) |
| 384 | WRITE_LINE_MEMBER(ins8250_uart_device::cts_w) |
| 570 | 385 | { |
| 571 | | common_start( device, TYPE_NS16450 ); |
| 386 | update_msr(0, (state&&1)); |
| 572 | 387 | } |
| 573 | 388 | |
| 574 | | |
| 575 | | static DEVICE_START( ns16550 ) |
| 389 | void ins8250_uart_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 576 | 390 | { |
| 577 | | common_start( device, TYPE_NS16550 ); |
| 578 | | } |
| 579 | | |
| 580 | | |
| 581 | | static DEVICE_START( ns16550a ) |
| 582 | | { |
| 583 | | common_start( device, TYPE_NS16550A ); |
| 584 | | } |
| 585 | | |
| 586 | | |
| 587 | | static DEVICE_START( pc16550d ) |
| 588 | | { |
| 589 | | common_start( device, TYPE_PC16550D ); |
| 590 | | } |
| 591 | | |
| 592 | | |
| 593 | | static DEVICE_RESET( ins8250 ) |
| 594 | | { |
| 595 | | ins8250_t *ins8250 = get_safe_token(device); |
| 596 | | |
| 597 | | ins8250->ier = 0; |
| 598 | | ins8250->iir = 1; |
| 599 | | ins8250->lcr = 0; |
| 600 | | ins8250->mcr = 0; |
| 601 | | ins8250->lsr = (1<<5) | (1<<6); |
| 602 | | |
| 603 | | ins8250->send.active=0; |
| 604 | | |
| 605 | | /* refresh with reset state of register */ |
| 606 | | if (ins8250->interface->refresh_connected) |
| 607 | | ins8250->interface->refresh_connected(device); |
| 608 | | } |
| 609 | | |
| 610 | | |
| 611 | | DEVICE_GET_INFO( ins8250 ) |
| 612 | | { |
| 613 | | switch ( state ) |
| 391 | receive_register_update_bit(m_rx_line); |
| 392 | if(is_receive_register_full()) |
| 614 | 393 | { |
| 615 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 616 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ins8250_t); break; |
| 617 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 618 | | |
| 619 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 620 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ins8250); break; |
| 621 | | case DEVINFO_FCT_STOP: /* nothing */ break; |
| 622 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(ins8250); break; |
| 623 | | |
| 624 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 625 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor INS8250/INS8250B"); break; |
| 626 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "INS8250"); break; |
| 627 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.00"); break; |
| 628 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 629 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 394 | if(m_regs.lsr & 0x01) |
| 395 | { |
| 396 | m_regs.lsr |= 0x02; //overrun |
| 397 | trigger_int(COM_INT_PENDING_RECEIVER_LINE_STATUS); |
| 398 | } |
| 399 | else |
| 400 | { |
| 401 | m_regs.lsr |= 0x01; |
| 402 | receive_register_extract(); |
| 403 | m_regs.rbr = get_received_char(); |
| 404 | trigger_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 405 | } |
| 406 | receive_register_reset(); |
| 630 | 407 | } |
| 631 | | } |
| 632 | 408 | |
| 633 | | |
| 634 | | DEVICE_GET_INFO( ins8250a ) |
| 635 | | { |
| 636 | | switch ( state ) |
| 409 | if(is_transmit_register_empty()) |
| 637 | 410 | { |
| 638 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 639 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor INS8250A/INS82C50A"); break; |
| 640 | | |
| 641 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 642 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ins8250a); break; |
| 643 | | |
| 644 | | default: DEVICE_GET_INFO_CALL(ins8250); break; |
| 411 | if(!(m_regs.lsr & 0x20)) |
| 412 | { |
| 413 | transmit_register_setup(m_regs.thr); |
| 414 | m_regs.lsr &= ~0x40; |
| 415 | m_regs.lsr |= 0x20; |
| 416 | trigger_int(COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY); |
| 417 | } |
| 418 | else |
| 419 | m_regs.lsr |= 0x40; |
| 645 | 420 | } |
| 421 | else |
| 422 | m_out_tx_func(transmit_register_get_data_bit()); |
| 646 | 423 | } |
| 647 | 424 | |
| 648 | | |
| 649 | | DEVICE_GET_INFO( ns16450 ) |
| 425 | void ins8250_uart_device::device_start() |
| 650 | 426 | { |
| 651 | | switch ( state ) |
| 652 | | { |
| 653 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 654 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor NS16450/PC16450"); break; |
| 427 | m_out_tx_func.resolve(m_out_tx_cb, *this); |
| 428 | m_out_dtr_func.resolve(m_out_dtr_cb, *this); |
| 429 | m_out_rts_func.resolve(m_out_rts_cb, *this); |
| 430 | m_out_int_func.resolve(m_out_int_cb, *this); |
| 431 | m_out_out1_func.resolve(m_out_out1_cb, *this); |
| 432 | m_out_out2_func.resolve(m_out_out2_cb, *this); |
| 655 | 433 | |
| 656 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 657 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ns16450); break; |
| 658 | | |
| 659 | | default: DEVICE_GET_INFO_CALL(ins8250); break; |
| 660 | | } |
| 434 | m_timer = timer_alloc(); |
| 661 | 435 | } |
| 662 | 436 | |
| 663 | | |
| 664 | | DEVICE_GET_INFO( ns16550 ) |
| 437 | void ins8250_uart_device::device_reset() |
| 665 | 438 | { |
| 666 | | switch ( state ) |
| 667 | | { |
| 668 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 669 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor NS16550/PC16550"); break; |
| 670 | | |
| 671 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 672 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ns16550); break; |
| 673 | | |
| 674 | | default: DEVICE_GET_INFO_CALL(ins8250); break; |
| 675 | | } |
| 439 | memset(&m_regs, '\0', sizeof(m_regs)); |
| 440 | m_regs.ier = 0; |
| 441 | m_regs.iir = 1; |
| 442 | m_regs.lcr = 0; |
| 443 | m_regs.mcr = 0; |
| 444 | m_regs.lsr = (1<<5) | (1<<6); |
| 445 | m_int_pending = 0; |
| 446 | m_rx_line = 0; |
| 447 | m_timer->adjust(attotime::never); |
| 448 | receive_register_reset(); |
| 449 | transmit_register_reset(); |
| 450 | m_out_rts_func(0); |
| 451 | m_out_dtr_func(0); |
| 452 | m_out_out1_func(0); |
| 453 | m_out_out2_func(0); |
| 676 | 454 | } |
| 677 | 455 | |
| 678 | | |
| 679 | | DEVICE_GET_INFO( ns16550a ) |
| 456 | void ins8250_uart_device::device_config_complete() |
| 680 | 457 | { |
| 681 | | switch ( state ) |
| 458 | const ins8250_interface *intf = reinterpret_cast<const ins8250_interface *>(static_config()); |
| 459 | if(intf != NULL) |
| 682 | 460 | { |
| 683 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 684 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor NS16550A/PC16550A"); break; |
| 685 | | |
| 686 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 687 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(ns16550a); break; |
| 688 | | |
| 689 | | default: DEVICE_GET_INFO_CALL(ins8250); break; |
| 461 | *static_cast<ins8250_interface *>(this) = *intf; |
| 690 | 462 | } |
| 691 | | } |
| 692 | | |
| 693 | | |
| 694 | | DEVICE_GET_INFO( pc16550d ) |
| 695 | | { |
| 696 | | switch ( state ) |
| 463 | else |
| 697 | 464 | { |
| 698 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 699 | | case DEVINFO_STR_NAME: strcpy(info->s, "National Semiconductor PC16550D"); break; |
| 700 | | |
| 701 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 702 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(pc16550d); break; |
| 703 | | |
| 704 | | default: DEVICE_GET_INFO_CALL(ins8250); break; |
| 465 | memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb)); |
| 466 | memset(&m_out_dtr_cb, 0, sizeof(m_out_dtr_cb)); |
| 467 | memset(&m_out_rts_cb, 0, sizeof(m_out_rts_cb)); |
| 468 | memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); |
| 469 | memset(&m_out_out1_cb, 0, sizeof(m_out_out1_cb)); |
| 470 | memset(&m_out_out2_cb, 0, sizeof(m_out_out2_cb)); |
| 705 | 471 | } |
| 706 | 472 | } |
| 707 | | |
| 708 | | |
| 709 | | |
| 710 | | DEFINE_LEGACY_DEVICE(INS8250, ins8250); |
| 711 | | DEFINE_LEGACY_DEVICE(INS8250A, ins8250a); |
| 712 | | DEFINE_LEGACY_DEVICE(NS16450, ns16450); |
| 713 | | DEFINE_LEGACY_DEVICE(NS16550, ns16550); |
| 714 | | DEFINE_LEGACY_DEVICE(NS16550A, ns16550a); |
| 715 | | DEFINE_LEGACY_DEVICE(PC16550D, pc16550d); |
src/emu/machine/microtch.c
| r14535 | r14536 | |
| 9 | 9 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | | #include "emu.h" |
| 13 | 12 | #include "microtch.h" |
| 14 | 13 | |
| 15 | 14 | #define LOG 0 |
| 16 | 15 | |
| 17 | | enum MICROTOUCH_FORMAT |
| 18 | | { |
| 19 | | FORMAT_UNKNOWN, |
| 20 | | FORMAT_TABLET, |
| 21 | | FORMAT_DECIMAL |
| 22 | | }; |
| 16 | const device_type MICROTOUCH = &device_creator<microtouch_device>; |
| 23 | 17 | |
| 24 | | ALLOW_SAVE_TYPE(MICROTOUCH_FORMAT); |
| 25 | | |
| 26 | | enum MICROTOUCH_MODE |
| 18 | microtouch_device::microtouch_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock) |
| 19 | : device_t(mconfig, type, name, tag, owner, clock) |
| 27 | 20 | { |
| 28 | | MODE_INACTIVE, |
| 29 | | MODE_STREAM, |
| 30 | | MODE_POINT |
| 31 | | }; |
| 21 | } |
| 32 | 22 | |
| 33 | | ALLOW_SAVE_TYPE(MICROTOUCH_MODE); |
| 34 | | |
| 35 | | static struct |
| 23 | microtouch_device::microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 24 | : device_t(mconfig, MICROTOUCH, "Microtouch Touchscreen", tag, owner, clock) |
| 36 | 25 | { |
| 37 | | UINT8 rx_buffer[16]; |
| 38 | | int rx_buffer_ptr; |
| 39 | | emu_timer* timer; |
| 40 | | UINT8 tx_buffer[16]; |
| 41 | | UINT8 tx_buffer_num; |
| 42 | | UINT8 tx_buffer_ptr; |
| 43 | | int reset_done; |
| 44 | | MICROTOUCH_FORMAT format; |
| 45 | | MICROTOUCH_MODE mode; |
| 46 | | int last_touch_state; |
| 47 | | int last_x; |
| 48 | | int last_y; |
| 49 | | microtouch_tx_func tx_callback; |
| 50 | | microtouch_touch_func touch_callback; |
| 51 | | } microtouch; |
| 26 | } |
| 52 | 27 | |
| 53 | | |
| 54 | | static int microtouch_check_command( const char* commandtocheck, int command_len, UINT8* command_data ) |
| 28 | int microtouch_device::check_command( const char* commandtocheck, int command_len, UINT8* command_data ) |
| 55 | 29 | { |
| 56 | 30 | if ( (command_len == (strlen(commandtocheck) + 2)) && |
| 57 | 31 | (command_data[0] == 0x01) && |
| r14535 | r14536 | |
| 66 | 40 | } |
| 67 | 41 | } |
| 68 | 42 | |
| 69 | | static void microtouch_send_format_table_packet(UINT8 flag, int x, int y) |
| 43 | void microtouch_device::send_format_table_packet(UINT8 flag, int x, int y) |
| 70 | 44 | { |
| 71 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = flag; |
| 45 | m_tx_buffer[m_tx_buffer_num++] = flag; |
| 72 | 46 | // lower byte (7bits) of x coordinate |
| 73 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = x & 0x7f; |
| 47 | m_tx_buffer[m_tx_buffer_num++] = x & 0x7f; |
| 74 | 48 | // higher byte (7bits) of x coordinate |
| 75 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (x >> 7) & 0x7f; |
| 49 | m_tx_buffer[m_tx_buffer_num++] = (x >> 7) & 0x7f; |
| 76 | 50 | // lower byte (7bits) of y coordinate |
| 77 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = y & 0x7f; |
| 51 | m_tx_buffer[m_tx_buffer_num++] = y & 0x7f; |
| 78 | 52 | // higher byte (7bits) of y coordinate |
| 79 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (y >> 7) & 0x7f; |
| 80 | | }; |
| 53 | m_tx_buffer[m_tx_buffer_num++] = (y >> 7) & 0x7f; |
| 54 | } |
| 81 | 55 | |
| 82 | | static void microtouch_send_format_decimal_packet(int x, int y) |
| 56 | void microtouch_device::send_format_decimal_packet(int x, int y) |
| 83 | 57 | { |
| 84 | 58 | int decx, decy; |
| 85 | 59 | |
| r14535 | r14536 | |
| 91 | 65 | decy = 999; |
| 92 | 66 | |
| 93 | 67 | // header byte |
| 94 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01; |
| 68 | m_tx_buffer[m_tx_buffer_num++] = 0x01; |
| 95 | 69 | // x coordinate in decimal mode |
| 96 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decx / 100) + '0'; |
| 97 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = ((decx / 10) % 10) + '0'; |
| 98 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decx % 10) + '0'; |
| 70 | m_tx_buffer[m_tx_buffer_num++] = (decx / 100) + '0'; |
| 71 | m_tx_buffer[m_tx_buffer_num++] = ((decx / 10) % 10) + '0'; |
| 72 | m_tx_buffer[m_tx_buffer_num++] = (decx % 10) + '0'; |
| 99 | 73 | // comma (separator) |
| 100 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = ','; |
| 74 | m_tx_buffer[m_tx_buffer_num++] = ','; |
| 101 | 75 | // y coordinate in decimal mode |
| 102 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decy / 100) + '0'; |
| 103 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = ((decy / 10) % 10) + '0'; |
| 104 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decy % 10) + '0'; |
| 76 | m_tx_buffer[m_tx_buffer_num++] = (decy / 100) + '0'; |
| 77 | m_tx_buffer[m_tx_buffer_num++] = ((decy / 10) % 10) + '0'; |
| 78 | m_tx_buffer[m_tx_buffer_num++] = (decy % 10) + '0'; |
| 105 | 79 | // terminator |
| 106 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d; |
| 80 | m_tx_buffer[m_tx_buffer_num++] = 0x0d; |
| 107 | 81 | } |
| 108 | 82 | |
| 109 | | static void microtouch_send_touch_packet(running_machine &machine) |
| 83 | void microtouch_device::send_touch_packet() |
| 110 | 84 | { |
| 111 | | int tx = input_port_read(machine, "TOUCH_X"); |
| 112 | | int ty = input_port_read(machine, "TOUCH_Y"); |
| 85 | int tx = input_port_read(*this, "TOUCH_X"); |
| 86 | int ty = input_port_read(*this, "TOUCH_Y"); |
| 113 | 87 | |
| 114 | | if ( microtouch.touch_callback == NULL || |
| 115 | | microtouch.touch_callback( machine, &tx, &ty ) != 0 ) |
| 88 | if ( m_out_touch_cb == NULL || |
| 89 | m_out_touch_cb( &tx, &ty ) != 0 ) |
| 116 | 90 | { |
| 117 | 91 | ty = 0x4000 - ty; |
| 118 | 92 | |
| 119 | | switch( microtouch.format ) |
| 93 | switch( m_format ) |
| 120 | 94 | { |
| 121 | 95 | case FORMAT_TABLET: |
| 122 | | microtouch_send_format_table_packet(0xc8, tx, ty); |
| 96 | send_format_table_packet(0xc8, tx, ty); |
| 123 | 97 | break; |
| 124 | 98 | case FORMAT_DECIMAL: |
| 125 | | microtouch_send_format_decimal_packet(tx, ty); |
| 99 | send_format_decimal_packet(tx, ty); |
| 126 | 100 | break; |
| 127 | 101 | case FORMAT_UNKNOWN: |
| 128 | 102 | break; |
| 129 | 103 | } |
| 130 | | microtouch.last_touch_state = 1; |
| 131 | | microtouch.last_x = tx; |
| 132 | | microtouch.last_y = ty; |
| 104 | m_last_touch_state = 1; |
| 105 | m_last_x = tx; |
| 106 | m_last_y = ty; |
| 133 | 107 | } |
| 134 | 108 | } |
| 135 | 109 | |
| 136 | | static TIMER_CALLBACK(microtouch_timer_callback) |
| 110 | void microtouch_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 137 | 111 | { |
| 138 | | if ( microtouch.tx_buffer_ptr < microtouch.tx_buffer_num ) |
| 112 | if ( m_tx_buffer_ptr < m_tx_buffer_num ) |
| 139 | 113 | { |
| 140 | | microtouch.tx_callback( machine, microtouch.tx_buffer[microtouch.tx_buffer_ptr++] ); |
| 141 | | if ( microtouch.tx_buffer_ptr == microtouch.tx_buffer_num ) |
| 114 | tx( m_tx_buffer[m_tx_buffer_ptr++] ); |
| 115 | if ( m_tx_buffer_ptr == m_tx_buffer_num ) |
| 142 | 116 | { |
| 143 | | microtouch.tx_buffer_ptr = microtouch.tx_buffer_num = 0; |
| 117 | m_tx_buffer_ptr = m_tx_buffer_num = 0; |
| 144 | 118 | } |
| 145 | 119 | return; |
| 146 | 120 | } |
| 147 | 121 | |
| 148 | | if ( (microtouch.reset_done == 0) || |
| 149 | | (microtouch.format == FORMAT_UNKNOWN) || |
| 150 | | (microtouch.mode != MODE_STREAM)) |
| 122 | if ( (m_reset_done == 0) || |
| 123 | (m_format == FORMAT_UNKNOWN) || |
| 124 | (m_mode != MODE_STREAM)) |
| 151 | 125 | { |
| 152 | 126 | return; |
| 153 | 127 | } |
| 154 | 128 | |
| 155 | 129 | // send format tablet packet |
| 156 | | if ( input_port_read(machine, "TOUCH") & 0x01 ) |
| 130 | if ( input_port_read(*this, "TOUCH") & 0x01 ) |
| 157 | 131 | { |
| 158 | | microtouch_send_touch_packet(machine); |
| 132 | send_touch_packet(); |
| 159 | 133 | } |
| 160 | 134 | else |
| 161 | 135 | { |
| 162 | | if ( microtouch.last_touch_state == 1 ) |
| 136 | if ( m_last_touch_state == 1 ) |
| 163 | 137 | { |
| 164 | | microtouch.last_touch_state = 0; |
| 165 | | switch( microtouch.format ) |
| 138 | m_last_touch_state = 0; |
| 139 | switch( m_format ) |
| 166 | 140 | { |
| 167 | 141 | case FORMAT_TABLET: |
| 168 | | microtouch_send_format_table_packet(0x88, microtouch.last_x, microtouch.last_y); |
| 142 | send_format_table_packet(0x88, m_last_x, m_last_y); |
| 169 | 143 | break; |
| 170 | 144 | case FORMAT_DECIMAL: |
| 171 | | microtouch_send_format_decimal_packet(microtouch.last_x, microtouch.last_y); |
| 145 | send_format_decimal_packet(m_last_x, m_last_y); |
| 172 | 146 | break; |
| 173 | 147 | case FORMAT_UNKNOWN: |
| 174 | 148 | break; |
| 175 | 149 | } |
| 176 | 150 | } |
| 177 | 151 | } |
| 178 | | }; |
| 152 | } |
| 179 | 153 | |
| 180 | | void microtouch_init(running_machine &machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb) |
| 154 | void microtouch_device::device_config_complete() |
| 181 | 155 | { |
| 182 | | memset(µtouch, 0, sizeof(microtouch)); |
| 156 | const microtouch_interface *intf = reinterpret_cast<const microtouch_interface *>(static_config()); |
| 157 | if(intf != NULL) |
| 158 | *static_cast<microtouch_interface *>(this) = *intf; |
| 159 | else |
| 160 | { |
| 161 | memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb)); |
| 162 | memset(&m_out_touch_cb, 0, sizeof(m_out_touch_cb)); |
| 163 | } |
| 164 | } |
| 183 | 165 | |
| 184 | | microtouch.last_touch_state = -1; |
| 185 | | microtouch.tx_callback = tx_cb; |
| 186 | | microtouch.touch_callback = touch_cb; |
| 166 | void microtouch_device::device_start() |
| 167 | { |
| 168 | memset(m_rx_buffer, 0, sizeof(m_rx_buffer)); |
| 169 | memset(m_tx_buffer, 0, sizeof(m_tx_buffer)); |
| 170 | m_rx_buffer_ptr = 0; |
| 171 | m_tx_buffer_ptr = 0; |
| 172 | m_tx_buffer_num = 0; |
| 173 | m_reset_done = 0; |
| 174 | m_format = 0; |
| 175 | m_mode = 0; |
| 176 | m_last_x = 0; |
| 177 | m_last_y = 0; |
| 178 | m_last_touch_state = -1; |
| 187 | 179 | |
| 188 | | microtouch.timer = machine.scheduler().timer_alloc(FUNC(microtouch_timer_callback)); |
| 189 | | microtouch.timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5)); |
| 180 | m_timer = timer_alloc(); |
| 181 | m_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5)); |
| 190 | 182 | |
| 191 | | microtouch.format = FORMAT_UNKNOWN; |
| 192 | | microtouch.mode = MODE_INACTIVE; |
| 183 | m_format = FORMAT_UNKNOWN; |
| 184 | m_mode = MODE_INACTIVE; |
| 193 | 185 | |
| 194 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done); |
| 195 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_touch_state); |
| 196 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_x); |
| 197 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_y); |
| 198 | | state_save_register_item_array(machine, "microtouch", NULL, 0, microtouch.rx_buffer); |
| 199 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.rx_buffer_ptr); |
| 200 | | state_save_register_item_array(machine, "microtouch", NULL, 0, microtouch.tx_buffer); |
| 201 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.tx_buffer_num); |
| 202 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.tx_buffer_ptr); |
| 203 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.format); |
| 204 | | state_save_register_item(machine, "microtouch", NULL, 0, microtouch.mode); |
| 205 | | }; |
| 186 | save_item(NAME(m_reset_done)); |
| 187 | save_item(NAME(m_last_touch_state)); |
| 188 | save_item(NAME(m_last_x)); |
| 189 | save_item(NAME(m_last_y)); |
| 190 | save_item(NAME(m_rx_buffer)); |
| 191 | save_item(NAME(m_rx_buffer_ptr)); |
| 192 | save_item(NAME(m_tx_buffer)); |
| 193 | save_item(NAME(m_tx_buffer_num)); |
| 194 | save_item(NAME(m_tx_buffer_ptr)); |
| 195 | save_item(NAME(m_format)); |
| 196 | save_item(NAME(m_mode)); |
| 197 | m_out_tx_func.resolve(m_out_tx_cb, *this); |
| 198 | } |
| 206 | 199 | |
| 207 | 200 | |
| 208 | | void microtouch_rx(int count, UINT8* data) |
| 201 | WRITE8_MEMBER(microtouch_device::rx) |
| 209 | 202 | { |
| 210 | | int i; |
| 203 | m_rx_buffer[m_rx_buffer_ptr] = data; |
| 204 | m_rx_buffer_ptr++; |
| 205 | if(m_rx_buffer_ptr == 16) |
| 206 | return; |
| 211 | 207 | |
| 212 | | for ( i = 0; (i < count) && ((microtouch.rx_buffer_ptr + i) < 16); i++ ) |
| 208 | if (m_rx_buffer_ptr > 0 && (m_rx_buffer[m_rx_buffer_ptr-1] == 0x0d)) |
| 213 | 209 | { |
| 214 | | microtouch.rx_buffer[i+microtouch.rx_buffer_ptr] = data[i]; |
| 215 | | microtouch.rx_buffer_ptr++; |
| 216 | | } |
| 217 | | |
| 218 | | if (microtouch.rx_buffer_ptr > 0 && (microtouch.rx_buffer[microtouch.rx_buffer_ptr-1] == 0x0d)) |
| 219 | | { |
| 220 | 210 | if (LOG) |
| 221 | 211 | { |
| 222 | 212 | char command[16]; |
| 223 | 213 | memset(command, 0, sizeof(command)); |
| 224 | | strncpy( command, (const char*)microtouch.rx_buffer + 1, microtouch.rx_buffer_ptr - 2 ); |
| 214 | strncpy( command, (const char*)m_rx_buffer + 1, m_rx_buffer_ptr - 2 ); |
| 225 | 215 | logerror("Microtouch: received command %s\n", command); |
| 226 | 216 | } |
| 227 | 217 | // check command |
| 228 | | if ( microtouch_check_command( "MS", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 218 | if ( check_command( "MS", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 229 | 219 | { |
| 230 | | microtouch.mode = MODE_STREAM; |
| 220 | m_mode = MODE_STREAM; |
| 231 | 221 | } |
| 232 | | else if ( microtouch_check_command( "MI", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 222 | else if ( check_command( "MI", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 233 | 223 | { |
| 234 | | microtouch.mode = MODE_INACTIVE; |
| 224 | m_mode = MODE_INACTIVE; |
| 235 | 225 | } |
| 236 | | else if ( microtouch_check_command( "MP", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 226 | else if ( check_command( "MP", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 237 | 227 | { |
| 238 | | microtouch.mode = MODE_POINT; |
| 228 | m_mode = MODE_POINT; |
| 239 | 229 | } |
| 240 | | else if ( microtouch_check_command( "R", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 230 | else if ( check_command( "R", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 241 | 231 | { |
| 242 | | microtouch.tx_buffer_num = 0; |
| 243 | | microtouch.reset_done = 1; |
| 232 | m_tx_buffer_num = 0; |
| 233 | m_reset_done = 1; |
| 244 | 234 | } |
| 245 | | else if ( microtouch_check_command( "FT", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 235 | else if ( check_command( "FT", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 246 | 236 | { |
| 247 | | microtouch.format = FORMAT_TABLET; |
| 237 | m_format = FORMAT_TABLET; |
| 248 | 238 | } |
| 249 | | else if ( microtouch_check_command( "FD", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 239 | else if ( check_command( "FD", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 250 | 240 | { |
| 251 | | microtouch.format = FORMAT_DECIMAL; |
| 241 | m_format = FORMAT_DECIMAL; |
| 252 | 242 | } |
| 253 | | else if ( microtouch_check_command("OI", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) ) |
| 243 | else if ( check_command("OI", m_rx_buffer_ptr, m_rx_buffer ) ) |
| 254 | 244 | { |
| 255 | 245 | // output identity - SMT3, ver 01.00 |
| 256 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01; |
| 257 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 'Q'; |
| 258 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = '1'; |
| 259 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0'; |
| 260 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = '1'; |
| 261 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0'; |
| 262 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0'; |
| 263 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d; |
| 264 | | microtouch.rx_buffer_ptr = 0; |
| 246 | m_tx_buffer[m_tx_buffer_num++] = 0x01; |
| 247 | m_tx_buffer[m_tx_buffer_num++] = 'Q'; |
| 248 | m_tx_buffer[m_tx_buffer_num++] = '1'; |
| 249 | m_tx_buffer[m_tx_buffer_num++] = '0'; |
| 250 | m_tx_buffer[m_tx_buffer_num++] = '1'; |
| 251 | m_tx_buffer[m_tx_buffer_num++] = '0'; |
| 252 | m_tx_buffer[m_tx_buffer_num++] = '0'; |
| 253 | m_tx_buffer[m_tx_buffer_num++] = 0x0d; |
| 254 | m_rx_buffer_ptr = 0; |
| 265 | 255 | return; |
| 266 | 256 | } |
| 267 | 257 | // send response |
| 268 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01; |
| 269 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x30; |
| 270 | | microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d; |
| 271 | | microtouch.rx_buffer_ptr = 0; |
| 258 | m_tx_buffer[m_tx_buffer_num++] = 0x01; |
| 259 | m_tx_buffer[m_tx_buffer_num++] = 0x30; |
| 260 | m_tx_buffer[m_tx_buffer_num++] = 0x0d; |
| 261 | m_rx_buffer_ptr = 0; |
| 272 | 262 | } |
| 273 | 263 | }; |
| 274 | 264 | |
| 275 | | static INPUT_CHANGED( microtouch_touch ) |
| 265 | INPUT_CHANGED_MEMBER( microtouch_device::touch ) |
| 276 | 266 | { |
| 277 | | if ( newval && ( microtouch.mode == MODE_POINT ) ) |
| 267 | if ( newval && ( m_mode == MODE_POINT ) ) |
| 278 | 268 | { |
| 279 | | microtouch_send_touch_packet( field.machine() ); |
| 269 | send_touch_packet(); |
| 280 | 270 | } |
| 281 | 271 | } |
| 282 | 272 | |
| 283 | | INPUT_PORTS_START(microtouch) |
| 273 | static INPUT_PORTS_START(microtouch) |
| 284 | 274 | PORT_START("TOUCH") |
| 285 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME( "Touch screen" ) PORT_CHANGED( microtouch_touch, 0 ) |
| 275 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME( "Touch screen" ) PORT_CHANGED_MEMBER( DEVICE_SELF,microtouch_device, touch, 0 ) |
| 286 | 276 | PORT_START("TOUCH_X") |
| 287 | 277 | PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15) |
| 288 | 278 | PORT_START("TOUCH_Y") |
| 289 | 279 | PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15) |
| 290 | 280 | INPUT_PORTS_END |
| 291 | 281 | |
| 282 | ioport_constructor microtouch_device::device_input_ports() const |
| 283 | { |
| 284 | return INPUT_PORTS_NAME(microtouch); |
| 285 | } |
| 286 | |
| 287 | const device_type MICROTOUCH_SERIAL = &device_creator<microtouch_serial_device>; |
| 288 | |
| 289 | microtouch_serial_device::microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 290 | : microtouch_device(mconfig, MICROTOUCH_SERIAL, "Microtouch Serial Touchscreen", tag, owner, clock), |
| 291 | device_serial_interface(mconfig, *this) |
| 292 | { |
| 293 | } |
| 294 | |
| 295 | void microtouch_serial_device::device_config_complete() |
| 296 | { |
| 297 | const microtouch_serial_interface *intf = reinterpret_cast<const microtouch_serial_interface *>(static_config()); |
| 298 | if(intf != NULL) |
| 299 | *static_cast<microtouch_serial_interface *>(this) = *intf; |
| 300 | else |
| 301 | { |
| 302 | memset(&m_out_stx_cb, 0, sizeof(m_out_stx_cb)); |
| 303 | } |
| 304 | memset(&(microtouch_interface::m_out_tx_cb), 0, sizeof(microtouch_interface::m_out_tx_cb)); |
| 305 | memset(&m_out_touch_cb, 0, sizeof(m_out_touch_cb)); |
| 306 | } |
| 307 | |
| 308 | void microtouch_serial_device::device_start() |
| 309 | { |
| 310 | microtouch_device::device_start(); |
| 311 | m_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); |
| 312 | set_data_frame(8, 1, SERIAL_PARITY_NONE); //8N1? |
| 313 | m_out_stx_func.resolve(m_out_stx_cb, *this); |
| 314 | m_count = 0; |
| 315 | m_output_valid = false; |
| 316 | |
| 317 | save_item(NAME(m_count)); |
| 318 | save_item(NAME(m_output_valid)); |
| 319 | save_item(NAME(m_output)); |
| 320 | save_item(NAME(m_rx_line)); |
| 321 | } |
| 322 | |
| 323 | void microtouch_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 324 | { |
| 325 | if(is_transmit_register_empty()) |
| 326 | { |
| 327 | if(m_output_valid) |
| 328 | { |
| 329 | transmit_register_setup(m_output); |
| 330 | m_output_valid = false; |
| 331 | } |
| 332 | } |
| 333 | else |
| 334 | m_out_stx_func(transmit_register_get_data_bit()); |
| 335 | |
| 336 | receive_register_update_bit(m_rx_line); |
| 337 | if(is_receive_register_full()) |
| 338 | { |
| 339 | receive_register_extract(); |
| 340 | microtouch_device::rx(*memory_nonspecific_space(machine()), 0, get_received_char()); |
| 341 | receive_register_reset(); |
| 342 | } |
| 343 | |
| 344 | if((m_count == 0) && (m_output_valid == false)) |
| 345 | microtouch_device::device_timer(timer, id, param, ptr); |
| 346 | |
| 347 | ++m_count %= 8; |
| 348 | } |
src/mess/machine/pc_mouse.c
| r14535 | r14536 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | machine/pc_mouse.c |
| 4 | | |
| 5 | | Code for emulating PC-style serial mouses |
| 6 | | |
| 7 | | ***************************************************************************/ |
| 8 | | |
| 9 | | #include "emu.h" |
| 10 | | #include "machine/ins8250.h" |
| 11 | | #include "machine/pc_mouse.h" |
| 12 | | |
| 13 | | |
| 14 | | static struct { |
| 15 | | |
| 16 | | PC_MOUSE_PROTOCOL protocol; |
| 17 | | |
| 18 | | device_t *ins8250; |
| 19 | | int inputs; |
| 20 | | |
| 21 | | UINT8 queue[256]; |
| 22 | | UINT8 head, tail, mb; |
| 23 | | |
| 24 | | emu_timer *timer; |
| 25 | | |
| 26 | | } pc_mouse; |
| 27 | | |
| 28 | | static TIMER_CALLBACK(pc_mouse_scan); |
| 29 | | |
| 30 | | void pc_mouse_initialise(running_machine &machine) |
| 31 | | { |
| 32 | | pc_mouse.head = pc_mouse.tail = 0; |
| 33 | | pc_mouse.timer = machine.scheduler().timer_alloc(FUNC(pc_mouse_scan)); |
| 34 | | pc_mouse.inputs = 0; |
| 35 | | pc_mouse.ins8250 = NULL; |
| 36 | | } |
| 37 | | |
| 38 | | void pc_mouse_set_serial_port(device_t *ins8250) |
| 39 | | { |
| 40 | | if ( pc_mouse.ins8250 != ins8250 ) { |
| 41 | | pc_mouse.ins8250 = ins8250; |
| 42 | | ins8250_handshake_in(pc_mouse.ins8250, pc_mouse.inputs); |
| 43 | | } |
| 44 | | } |
| 45 | | |
| 46 | | /* add data to queue */ |
| 47 | | static void pc_mouse_queue_data(int data) |
| 48 | | { |
| 49 | | pc_mouse.queue[pc_mouse.head] = data; |
| 50 | | pc_mouse.head++; |
| 51 | | pc_mouse.head %= 256; |
| 52 | | } |
| 53 | | |
| 54 | | /************************************************************************** |
| 55 | | * Check for mouse moves and buttons. Build delta x/y packets |
| 56 | | **************************************************************************/ |
| 57 | | static TIMER_CALLBACK(pc_mouse_scan) |
| 58 | | { |
| 59 | | static int ox = 0, oy = 0; |
| 60 | | int nx,ny; |
| 61 | | int dx, dy, nb; |
| 62 | | int mbc; |
| 63 | | |
| 64 | | /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */ |
| 65 | | if (pc_mouse.head==pc_mouse.tail) |
| 66 | | { |
| 67 | | nx = input_port_read(machine, "pc_mouse_x"); |
| 68 | | |
| 69 | | dx = nx - ox; |
| 70 | | if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */ |
| 71 | | if (dx>=0x800) dx = nx - 0x1000 - ox; |
| 72 | | ox = nx; |
| 73 | | |
| 74 | | ny = input_port_read(machine, "pc_mouse_y"); |
| 75 | | |
| 76 | | dy = ny - oy; |
| 77 | | if (dy<=-0x800) dy = ny + 0x1000 - oy; |
| 78 | | if (dy>=0x800) dy = ny - 0x1000 - oy; |
| 79 | | oy = ny; |
| 80 | | |
| 81 | | nb = input_port_read(machine, "pc_mouse_misc"); |
| 82 | | if ((nb & 0x80) != 0) |
| 83 | | { |
| 84 | | pc_mouse.protocol=TYPE_MOUSE_SYSTEMS; |
| 85 | | } |
| 86 | | else |
| 87 | | { |
| 88 | | pc_mouse.protocol=TYPE_MICROSOFT_MOUSE; |
| 89 | | } |
| 90 | | mbc = nb^pc_mouse.mb; |
| 91 | | pc_mouse.mb = nb; |
| 92 | | |
| 93 | | /* check if there is any delta or mouse buttons changed */ |
| 94 | | if ( (dx!=0) || (dy!=0) || (mbc!=0) ) |
| 95 | | { |
| 96 | | switch (pc_mouse.protocol) |
| 97 | | { |
| 98 | | |
| 99 | | default: |
| 100 | | case TYPE_MICROSOFT_MOUSE: |
| 101 | | { |
| 102 | | /* split deltas into packtes of -128..+127 max */ |
| 103 | | do |
| 104 | | { |
| 105 | | UINT8 m0, m1, m2; |
| 106 | | int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx; |
| 107 | | int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy; |
| 108 | | m0 = 0x40 | ((nb << 4) & 0x30) | ((ddx >> 6) & 0x03) | ((ddy >> 4) & 0x0c); |
| 109 | | m1 = ddx & 0x3f; |
| 110 | | m2 = ddy & 0x3f; |
| 111 | | |
| 112 | | /* KT - changed to use a function */ |
| 113 | | pc_mouse_queue_data(m0 | 0x40); |
| 114 | | pc_mouse_queue_data(m1 & 0x03f); |
| 115 | | pc_mouse_queue_data(m2 & 0x03f); |
| 116 | | if ((mbc & 0x04) != 0) /* If button 3 changed send extra byte */ |
| 117 | | { |
| 118 | | pc_mouse_queue_data( (nb & 0x04) << 3); |
| 119 | | } |
| 120 | | |
| 121 | | dx -= ddx; |
| 122 | | dy -= ddy; |
| 123 | | } while( dx || dy ); |
| 124 | | } |
| 125 | | break; |
| 126 | | |
| 127 | | /* mouse systems mouse |
| 128 | | from "PC Mouse information" by Tomi Engdahl */ |
| 129 | | |
| 130 | | /* |
| 131 | | The data is sent in 5 byte packets in following format: |
| 132 | | D7 D6 D5 D4 D3 D2 D1 D0 |
| 133 | | |
| 134 | | 1. 1 0 0 0 0 LB CB RB |
| 135 | | 2. X7 X6 X5 X4 X3 X2 X1 X0 |
| 136 | | 3. Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0 |
| 137 | | 4. X7' X6' X5' X4' X3' X2' X1' X0' |
| 138 | | 5. Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0' |
| 139 | | |
| 140 | | LB is left button state (0=pressed, 1=released) |
| 141 | | CB is center button state (0=pressed, 1=released) |
| 142 | | RB is right button state (0=pressed, 1=released) |
| 143 | | X7-X0 movement in X direction since last packet in signed byte |
| 144 | | format (-128..+127), positive direction right |
| 145 | | Y7-Y0 movement in Y direction since last packet in signed byte |
| 146 | | format (-128..+127), positive direction up |
| 147 | | X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte |
| 148 | | format (-128..+127), positive direction right |
| 149 | | Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte |
| 150 | | format (-128..+127), positive direction up |
| 151 | | |
| 152 | | The last two bytes in the packet (bytes 4 and 5) contains information about movement data changes which have occurred after data butes 2 and 3 have been sent. */ |
| 153 | | |
| 154 | | case TYPE_MOUSE_SYSTEMS: |
| 155 | | { |
| 156 | | |
| 157 | | dy =-dy; |
| 158 | | |
| 159 | | do |
| 160 | | { |
| 161 | | int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx; |
| 162 | | int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy; |
| 163 | | |
| 164 | | /* KT - changed to use a function */ |
| 165 | | pc_mouse_queue_data(0x080 | ((((nb & 0x04) >> 1) + ((nb & 0x02) << 1) + (nb & 0x01)) ^ 0x07)); |
| 166 | | pc_mouse_queue_data(ddx); |
| 167 | | pc_mouse_queue_data(ddy); |
| 168 | | /* for now... */ |
| 169 | | pc_mouse_queue_data(0); |
| 170 | | pc_mouse_queue_data(0); |
| 171 | | dx -= ddx; |
| 172 | | dy -= ddy; |
| 173 | | } while( dx || dy ); |
| 174 | | |
| 175 | | } |
| 176 | | break; |
| 177 | | } |
| 178 | | } |
| 179 | | } |
| 180 | | |
| 181 | | /* Send any data from this scan or any pending data from a previous scan */ |
| 182 | | |
| 183 | | if( pc_mouse.tail != pc_mouse.head ) |
| 184 | | { |
| 185 | | int data; |
| 186 | | |
| 187 | | data = pc_mouse.queue[pc_mouse.tail]; |
| 188 | | ins8250_receive(pc_mouse.ins8250, data); |
| 189 | | pc_mouse.tail++; |
| 190 | | pc_mouse.tail &= 255; |
| 191 | | } |
| 192 | | } |
| 193 | | |
| 194 | | |
| 195 | | |
| 196 | | /************************************************************************** |
| 197 | | * Check for mouse control line changes and (de-)install timer |
| 198 | | **************************************************************************/ |
| 199 | | |
| 200 | | INS8250_HANDSHAKE_OUT( pc_mouse_handshake_in ) |
| 201 | | { |
| 202 | | if (device!=pc_mouse.ins8250) return; |
| 203 | | if (!(data ^ pc_mouse.inputs)) { |
| 204 | | ins8250_handshake_in(pc_mouse.ins8250, 0); |
| 205 | | return; |
| 206 | | } |
| 207 | | |
| 208 | | if ((data & UART8250_HANDSHAKE_OUT_DTR) && (data & UART8250_HANDSHAKE_OUT_RTS)) |
| 209 | | { |
| 210 | | /* RTS toggled */ |
| 211 | | if (!(pc_mouse.inputs & UART8250_HANDSHAKE_OUT_RTS) && (data & UART8250_HANDSHAKE_OUT_RTS)) |
| 212 | | { |
| 213 | | /* reset mouse */ |
| 214 | | pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0; |
| 215 | | |
| 216 | | if ((input_port_read(device->machine(), "pc_mouse_misc") & 0x80) == 0 ) |
| 217 | | { |
| 218 | | /* Identify as Microsoft 3 Button Mouse */ |
| 219 | | pc_mouse.queue[pc_mouse.head] = 'M'; |
| 220 | | pc_mouse.head++; |
| 221 | | pc_mouse.head %= 256; |
| 222 | | pc_mouse.queue[pc_mouse.head] = '3'; |
| 223 | | pc_mouse.head++; |
| 224 | | pc_mouse.head %= 256; |
| 225 | | } |
| 226 | | } |
| 227 | | /* start a timer to scan the mouse input */ |
| 228 | | pc_mouse.timer->adjust(attotime::zero, 0, attotime::from_hz(240)); |
| 229 | | } |
| 230 | | else |
| 231 | | { |
| 232 | | pc_mouse.timer->adjust(attotime::zero); |
| 233 | | pc_mouse.head = pc_mouse.tail = 0; |
| 234 | | } |
| 235 | | |
| 236 | | pc_mouse.inputs=data; |
| 237 | | // do not set DSR or CTS |
| 238 | | ins8250_handshake_in(pc_mouse.ins8250, 0); |
| 239 | | } |
| 240 | | |
| 241 | | |
| 242 | | |
| 243 | | /************************************************************************** |
| 244 | | * Mouse INPUT_PORT declarations |
| 245 | | **************************************************************************/ |
| 246 | | |
| 247 | | INPUT_PORTS_START( pc_mouse_mousesystems ) |
| 248 | | PORT_START( "pc_mouse_misc" ) |
| 249 | | PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" ) |
| 250 | | PORT_CONFSETTING( 0x80, "Mouse Systems" ) |
| 251 | | PORT_CONFSETTING( 0x00, "Microsoft" ) |
| 252 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) |
| 253 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) |
| 254 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) |
| 255 | | |
| 256 | | PORT_START( "pc_mouse_x" ) /* Mouse - X AXIS */ |
| 257 | | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 258 | | |
| 259 | | PORT_START( "pc_mouse_y" ) /* Mouse - Y AXIS */ |
| 260 | | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 261 | | INPUT_PORTS_END |
| 262 | | |
| 263 | | |
| 264 | | |
| 265 | | INPUT_PORTS_START( pc_mouse_microsoft ) |
| 266 | | PORT_START( "pc_mouse_misc" ) |
| 267 | | PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" ) |
| 268 | | PORT_CONFSETTING( 0x00, "Microsoft" ) |
| 269 | | PORT_CONFSETTING( 0x80, "Mouse Systems" ) |
| 270 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) |
| 271 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) |
| 272 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) |
| 273 | | |
| 274 | | PORT_START( "pc_mouse_x" ) /* Mouse - X AXIS */ |
| 275 | | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 276 | | |
| 277 | | PORT_START( "pc_mouse_y" ) /* Mouse - Y AXIS */ |
| 278 | | PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 279 | | INPUT_PORTS_END |
| 280 | | |
| 281 | | |
| 282 | | |
| 283 | | INPUT_PORTS_START( pc_mouse_none ) |
| 284 | | PORT_START( "pc_mouse_misc" ) /* IN12 */ |
| 285 | | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 286 | | PORT_START( "pc_mouse_x" ) /* IN13 */ |
| 287 | | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 288 | | PORT_START( "pc_mouse_y" ) /* IN14 */ |
| 289 | | PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED ) |
| 290 | | INPUT_PORTS_END |
src/mess/machine/isa_com.c
| r14535 | r14536 | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | | #include "emu.h" |
| 8 | 7 | #include "isa_com.h" |
| 9 | | #include "machine/ins8250.h" |
| 10 | 8 | #include "machine/ser_mouse.h" |
| 9 | #include "machine/terminal.h" |
| 10 | #include "machine/null_modem.h" |
| 11 | 11 | |
| 12 | 12 | /* called when a interrupt is set/cleared from com hardware */ |
| 13 | 13 | static WRITE_LINE_DEVICE_HANDLER( pc_com_interrupt_1 ) |
| r14535 | r14536 | |
| 22 | 22 | com->m_isa->irq3_w(state); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | | static void pc_com_refresh_connected_common(device_t *uart, int n, int data) |
| 25 | static void pc_com_tx(device_t *uart, UINT8 state, int n) |
| 26 | 26 | { |
| 27 | 27 | isa8_com_device *com = downcast<isa8_com_device *>(uart->owner()); |
| 28 | | rs232_port_device *port = com->get_port(n); |
| 29 | | |
| 30 | | port->dtr_w(data & 1); |
| 31 | | port->rts_w((data & 2) && 1); |
| 32 | | ins8250_handshake_in(uart, (port->cts_r() << 4)|(port->dsr_r() << 5)|(port->ri_r() << 6)|(port->dcd_r() << 7)); |
| 28 | com->get_port(n)->tx(state); |
| 33 | 29 | } |
| 34 | 30 | |
| 35 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_0 ) { pc_com_refresh_connected_common( device, 0, data ); } |
| 36 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_1 ) { pc_com_refresh_connected_common( device, 1, data ); } |
| 37 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_2 ) { pc_com_refresh_connected_common( device, 2, data ); } |
| 38 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_3 ) { pc_com_refresh_connected_common( device, 3, data ); } |
| 31 | static void pc_com_dtr(device_t *uart, UINT8 state, int n) |
| 32 | { |
| 33 | isa8_com_device *com = downcast<isa8_com_device *>(uart->owner()); |
| 34 | com->get_port(n)->dtr_w(state); |
| 35 | } |
| 39 | 36 | |
| 40 | | static void pc_com_tx(device_t *uart, UINT8 data, int n) |
| 37 | static void pc_com_rts(device_t *uart, UINT8 state, int n) |
| 41 | 38 | { |
| 42 | 39 | isa8_com_device *com = downcast<isa8_com_device *>(uart->owner()); |
| 43 | | com->get_port(n)->tx8(*memory_nonspecific_space(uart->machine()), 0, data); |
| 40 | com->get_port(n)->rts_w(state); |
| 44 | 41 | } |
| 45 | 42 | |
| 46 | | static INS8250_TRANSMIT( pc_com_tx_0 ) { pc_com_tx(device, data, 0); } |
| 47 | | static INS8250_TRANSMIT( pc_com_tx_1 ) { pc_com_tx(device, data, 1); } |
| 48 | | static INS8250_TRANSMIT( pc_com_tx_2 ) { pc_com_tx(device, data, 2); } |
| 49 | | static INS8250_TRANSMIT( pc_com_tx_3 ) { pc_com_tx(device, data, 3); } |
| 43 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_0 ) { pc_com_tx(device, state, 0); } |
| 44 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_0 ) { pc_com_dtr(device, state, 0); } |
| 45 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_0 ) { pc_com_rts(device, state, 0); } |
| 50 | 46 | |
| 51 | | WRITE8_DEVICE_HANDLER( pc_com_rx_0 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(0), data); } |
| 52 | | WRITE8_DEVICE_HANDLER( pc_com_rx_1 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(1), data); } |
| 53 | | WRITE8_DEVICE_HANDLER( pc_com_rx_2 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(2), data); } |
| 54 | | WRITE8_DEVICE_HANDLER( pc_com_rx_3 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(3), data); } |
| 47 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_1 ) { pc_com_tx(device, state, 1); } |
| 48 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_1 ) { pc_com_dtr(device, state, 1); } |
| 49 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_1 ) { pc_com_rts(device, state, 1); } |
| 55 | 50 | |
| 51 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_2 ) { pc_com_tx(device, state, 2); } |
| 52 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_2 ) { pc_com_dtr(device, state, 2); } |
| 53 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_2 ) { pc_com_rts(device, state, 2); } |
| 54 | |
| 55 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_3 ) { pc_com_tx(device, state, 3); } |
| 56 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_3 ) { pc_com_dtr(device, state, 3); } |
| 57 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_3 ) { pc_com_rts(device, state, 3); } |
| 58 | |
| 59 | static void pc_com_rx(device_t *port, UINT8 state, int n) |
| 60 | { |
| 61 | isa8_com_device *com = downcast<isa8_com_device *>(port->owner()); |
| 62 | com->get_uart(n)->rx_w(state); |
| 63 | } |
| 64 | |
| 65 | static void pc_com_dcd(device_t *port, UINT8 state, int n) |
| 66 | { |
| 67 | isa8_com_device *com = downcast<isa8_com_device *>(port->owner()); |
| 68 | com->get_uart(n)->dcd_w(state); |
| 69 | } |
| 70 | |
| 71 | static void pc_com_dsr(device_t *port, UINT8 state, int n) |
| 72 | { |
| 73 | isa8_com_device *com = downcast<isa8_com_device *>(port->owner()); |
| 74 | com->get_uart(n)->dsr_w(state); |
| 75 | } |
| 76 | |
| 77 | static void pc_com_ri(device_t *port, UINT8 state, int n) |
| 78 | { |
| 79 | isa8_com_device *com = downcast<isa8_com_device *>(port->owner()); |
| 80 | com->get_uart(n)->ri_w(state); |
| 81 | } |
| 82 | |
| 83 | static void pc_com_cts(device_t *port, UINT8 state, int n) |
| 84 | { |
| 85 | isa8_com_device *com = downcast<isa8_com_device *>(port->owner()); |
| 86 | com->get_uart(n)->cts_w(state); |
| 87 | } |
| 88 | |
| 89 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_0 ) { pc_com_rx(device, state, 0); } |
| 90 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_0 ) { pc_com_dcd(device, state, 0); } |
| 91 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_0 ) { pc_com_dsr(device, state, 0); } |
| 92 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_0 ) { pc_com_ri(device, state, 0); } |
| 93 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_0 ) { pc_com_cts(device, state, 0); } |
| 94 | |
| 95 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_1 ) { pc_com_rx(device, state, 1); } |
| 96 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_1 ) { pc_com_dcd(device, state, 1); } |
| 97 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_1 ) { pc_com_dsr(device, state, 1); } |
| 98 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_1 ) { pc_com_ri(device, state, 1); } |
| 99 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_1 ) { pc_com_cts(device, state, 1); } |
| 100 | |
| 101 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_2 ) { pc_com_rx(device, state, 2); } |
| 102 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_2 ) { pc_com_dcd(device, state, 2); } |
| 103 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_2 ) { pc_com_dsr(device, state, 2); } |
| 104 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_2 ) { pc_com_ri(device, state, 2); } |
| 105 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_2 ) { pc_com_cts(device, state, 2); } |
| 106 | |
| 107 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_3 ) { pc_com_rx(device, state, 3); } |
| 108 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_3 ) { pc_com_dcd(device, state, 3); } |
| 109 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_3 ) { pc_com_dsr(device, state, 3); } |
| 110 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_3 ) { pc_com_ri(device, state, 3); } |
| 111 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_3 ) { pc_com_cts(device, state, 3); } |
| 112 | |
| 56 | 113 | static const ins8250_interface genpc_com_interface[4]= |
| 57 | 114 | { |
| 58 | 115 | { |
| 59 | | 1843200, |
| 116 | DEVCB_LINE(pc_com_tx_0), |
| 117 | DEVCB_LINE(pc_com_dtr_0), |
| 118 | DEVCB_LINE(pc_com_rts_0), |
| 60 | 119 | DEVCB_LINE(pc_com_interrupt_1), |
| 61 | | pc_com_tx_0, |
| 62 | | pc_com_handshake_out_0, |
| 63 | | NULL |
| 120 | DEVCB_NULL, |
| 121 | DEVCB_NULL |
| 64 | 122 | }, |
| 65 | 123 | { |
| 66 | | 1843200, |
| 124 | DEVCB_LINE(pc_com_tx_1), |
| 125 | DEVCB_LINE(pc_com_dtr_1), |
| 126 | DEVCB_LINE(pc_com_rts_1), |
| 67 | 127 | DEVCB_LINE(pc_com_interrupt_2), |
| 68 | | pc_com_tx_1, |
| 69 | | pc_com_handshake_out_1, |
| 70 | | NULL |
| 128 | DEVCB_NULL, |
| 129 | DEVCB_NULL |
| 71 | 130 | }, |
| 72 | 131 | { |
| 73 | | 1843200, |
| 132 | DEVCB_LINE(pc_com_tx_2), |
| 133 | DEVCB_LINE(pc_com_dtr_2), |
| 134 | DEVCB_LINE(pc_com_rts_2), |
| 74 | 135 | DEVCB_LINE(pc_com_interrupt_1), |
| 75 | | pc_com_tx_2, |
| 76 | | pc_com_handshake_out_2, |
| 77 | | NULL |
| 136 | DEVCB_NULL, |
| 137 | DEVCB_NULL |
| 78 | 138 | }, |
| 79 | 139 | { |
| 80 | | 1843200, |
| 140 | DEVCB_LINE(pc_com_tx_3), |
| 141 | DEVCB_LINE(pc_com_dtr_3), |
| 142 | DEVCB_LINE(pc_com_rts_3), |
| 81 | 143 | DEVCB_LINE(pc_com_interrupt_2), |
| 82 | | pc_com_tx_3, |
| 83 | | pc_com_handshake_out_3, |
| 84 | | NULL |
| 144 | DEVCB_NULL, |
| 145 | DEVCB_NULL |
| 85 | 146 | } |
| 86 | 147 | }; |
| 87 | 148 | |
| 88 | 149 | static const rs232_port_interface serport_config[4] = |
| 89 | 150 | { |
| 90 | 151 | { |
| 91 | | DEVCB_HANDLER( pc_com_rx_0 ), |
| 92 | | DEVCB_NULL, |
| 93 | | DEVCB_NULL, |
| 94 | | DEVCB_NULL, |
| 95 | | DEVCB_NULL, |
| 96 | | DEVCB_NULL |
| 152 | DEVCB_LINE( pc_com_rx_0 ), |
| 153 | DEVCB_LINE( pc_com_dcd_0 ), |
| 154 | DEVCB_LINE( pc_com_dsr_0 ), |
| 155 | DEVCB_LINE( pc_com_ri_0 ), |
| 156 | DEVCB_LINE( pc_com_cts_0 ) |
| 97 | 157 | }, |
| 98 | 158 | { |
| 99 | | DEVCB_HANDLER( pc_com_rx_1 ), |
| 100 | | DEVCB_NULL, |
| 101 | | DEVCB_NULL, |
| 102 | | DEVCB_NULL, |
| 103 | | DEVCB_NULL, |
| 104 | | DEVCB_NULL |
| 159 | DEVCB_LINE( pc_com_rx_1 ), |
| 160 | DEVCB_LINE( pc_com_dcd_1 ), |
| 161 | DEVCB_LINE( pc_com_dsr_1 ), |
| 162 | DEVCB_LINE( pc_com_ri_1 ), |
| 163 | DEVCB_LINE( pc_com_cts_1 ) |
| 105 | 164 | }, |
| 106 | 165 | { |
| 107 | | DEVCB_HANDLER( pc_com_rx_2 ), |
| 108 | | DEVCB_NULL, |
| 109 | | DEVCB_NULL, |
| 110 | | DEVCB_NULL, |
| 111 | | DEVCB_NULL, |
| 112 | | DEVCB_NULL |
| 166 | DEVCB_LINE( pc_com_rx_2 ), |
| 167 | DEVCB_LINE( pc_com_dcd_2 ), |
| 168 | DEVCB_LINE( pc_com_dsr_2 ), |
| 169 | DEVCB_LINE( pc_com_ri_2 ), |
| 170 | DEVCB_LINE( pc_com_cts_2 ) |
| 113 | 171 | }, |
| 114 | 172 | { |
| 115 | | DEVCB_HANDLER( pc_com_rx_3 ), |
| 116 | | DEVCB_NULL, |
| 117 | | DEVCB_NULL, |
| 118 | | DEVCB_NULL, |
| 119 | | DEVCB_NULL, |
| 120 | | DEVCB_NULL |
| 173 | DEVCB_LINE( pc_com_rx_3 ), |
| 174 | DEVCB_LINE( pc_com_dcd_3 ), |
| 175 | DEVCB_LINE( pc_com_dsr_3 ), |
| 176 | DEVCB_LINE( pc_com_ri_3 ), |
| 177 | DEVCB_LINE( pc_com_cts_3 ) |
| 121 | 178 | } |
| 122 | 179 | }; |
| 123 | 180 | |
| 124 | 181 | static SLOT_INTERFACE_START(isa_com) |
| 125 | 182 | SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE) |
| 126 | | SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE) |
| 183 | SLOT_INTERFACE("msystems_mouse", MSYSTEM_SERIAL_MOUSE) |
| 184 | SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL) |
| 185 | SLOT_INTERFACE("null_modem", NULL_MODEM) |
| 127 | 186 | SLOT_INTERFACE_END |
| 128 | 187 | |
| 129 | 188 | static MACHINE_CONFIG_FRAGMENT( com_config ) |
| 130 | | MCFG_INS8250_ADD( "uart_0", genpc_com_interface[0] ) |
| 131 | | MCFG_INS8250_ADD( "uart_1", genpc_com_interface[1] ) |
| 132 | | MCFG_INS8250_ADD( "uart_2", genpc_com_interface[2] ) |
| 133 | | MCFG_INS8250_ADD( "uart_3", genpc_com_interface[3] ) |
| 189 | MCFG_INS8250_ADD( "uart_0", genpc_com_interface[0], XTAL_1_8432MHz ) |
| 190 | MCFG_INS8250_ADD( "uart_1", genpc_com_interface[1], XTAL_1_8432MHz ) |
| 191 | MCFG_INS8250_ADD( "uart_2", genpc_com_interface[2], XTAL_1_8432MHz ) |
| 192 | MCFG_INS8250_ADD( "uart_3", genpc_com_interface[3], XTAL_1_8432MHz ) |
| 134 | 193 | MCFG_RS232_PORT_ADD( "serport0", serport_config[0], isa_com, "microsoft_mouse", NULL ) |
| 135 | 194 | MCFG_RS232_PORT_ADD( "serport1", serport_config[1], isa_com, NULL, NULL ) |
| 136 | | MCFG_RS232_PORT_ADD( "serport2", serport_config[3], isa_com, NULL, NULL ) |
| 137 | | MCFG_RS232_PORT_ADD( "serport3", serport_config[4], isa_com, NULL, NULL ) |
| 195 | MCFG_RS232_PORT_ADD( "serport2", serport_config[2], isa_com, NULL, NULL ) |
| 196 | MCFG_RS232_PORT_ADD( "serport3", serport_config[3], isa_com, NULL, NULL ) |
| 138 | 197 | MACHINE_CONFIG_END |
| 139 | 198 | |
| 140 | 199 | //************************************************************************** |
| r14535 | r14536 | |
| 181 | 240 | void isa8_com_device::device_start() |
| 182 | 241 | { |
| 183 | 242 | set_isa_device(); |
| 184 | | m_uart[0] = subdevice("uart_0"); |
| 185 | | m_uart[1] = subdevice("uart_1"); |
| 186 | | m_uart[2] = subdevice("uart_2"); |
| 187 | | m_uart[3] = subdevice("uart_3"); |
| 188 | | m_isa->install_device(m_uart[0], 0x03f8, 0x03ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) ); |
| 189 | | m_isa->install_device(m_uart[1], 0x02f8, 0x02ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) ); |
| 190 | | m_isa->install_device(m_uart[2], 0x03e8, 0x03ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) ); |
| 191 | | m_isa->install_device(m_uart[3], 0x02e8, 0x02ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) ); |
| 243 | m_uart[0] = subdevice<ins8250_uart_device>("uart_0"); |
| 244 | m_uart[1] = subdevice<ins8250_uart_device>("uart_1"); |
| 245 | m_uart[2] = subdevice<ins8250_uart_device>("uart_2"); |
| 246 | m_uart[3] = subdevice<ins8250_uart_device>("uart_3"); |
| 247 | m_isa->install_device(0x03f8, 0x03ff, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[0]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[0]) ); |
| 248 | m_isa->install_device(0x02f8, 0x02ff, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[1]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[1]) ); |
| 249 | m_isa->install_device(0x03e8, 0x03ef, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[2]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[2]) ); |
| 250 | m_isa->install_device(0x02e8, 0x02ef, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[3]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[3]) ); |
| 192 | 251 | |
| 193 | 252 | m_serport[0] = subdevice<rs232_port_device>("serport0"); |
| 194 | 253 | m_serport[1] = subdevice<rs232_port_device>("serport1"); |
| r14535 | r14536 | |
| 205 | 264 | } |
| 206 | 265 | |
| 207 | 266 | static MACHINE_CONFIG_FRAGMENT( com_at_config ) |
| 208 | | MCFG_NS16450_ADD( "uart_0", genpc_com_interface[0] ) /* Verified: IBM P/N 6320947 Serial/Parallel card uses an NS16450N */ |
| 209 | | MCFG_NS16450_ADD( "uart_1", genpc_com_interface[1] ) |
| 210 | | MCFG_NS16450_ADD( "uart_2", genpc_com_interface[2] ) |
| 211 | | MCFG_NS16450_ADD( "uart_3", genpc_com_interface[3] ) |
| 267 | MCFG_NS16450_ADD( "uart_0", genpc_com_interface[0], XTAL_1_8432MHz ) /* Verified: IBM P/N 6320947 Serial/Parallel card uses an NS16450N */ |
| 268 | MCFG_NS16450_ADD( "uart_1", genpc_com_interface[1], XTAL_1_8432MHz ) |
| 269 | MCFG_NS16450_ADD( "uart_2", genpc_com_interface[2], XTAL_1_8432MHz ) |
| 270 | MCFG_NS16450_ADD( "uart_3", genpc_com_interface[3], XTAL_1_8432MHz ) |
| 212 | 271 | MCFG_RS232_PORT_ADD( "serport0", serport_config[0], isa_com, "microsoft_mouse", NULL ) |
| 213 | 272 | MCFG_RS232_PORT_ADD( "serport1", serport_config[1], isa_com, NULL, NULL ) |
| 214 | | MCFG_RS232_PORT_ADD( "serport2", serport_config[3], isa_com, NULL, NULL ) |
| 215 | | MCFG_RS232_PORT_ADD( "serport3", serport_config[4], isa_com, NULL, NULL ) |
| 273 | MCFG_RS232_PORT_ADD( "serport2", serport_config[2], isa_com, NULL, NULL ) |
| 274 | MCFG_RS232_PORT_ADD( "serport3", serport_config[3], isa_com, NULL, NULL ) |
| 216 | 275 | MACHINE_CONFIG_END |
| 217 | 276 | |
| 218 | 277 | //************************************************************************** |
src/mess/machine/pc.c
| r14535 | r14536 | |
| 26 | 26 | |
| 27 | 27 | #include "machine/pit8253.h" |
| 28 | 28 | |
| 29 | | #include "machine/pc_mouse.h" |
| 30 | 29 | #include "machine/pckeybrd.h" |
| 31 | 30 | #include "machine/pc_lpt.h" |
| 32 | 31 | #include "machine/pc_fdc.h" |
| r14535 | r14536 | |
| 357 | 356 | pic8259_ir3_w(st->m_pic8259, state); |
| 358 | 357 | } |
| 359 | 358 | |
| 360 | | /* called when com registers read/written - used to update peripherals that |
| 361 | | are connected */ |
| 362 | | static void pc_com_refresh_connected_common(device_t *device, int n, int data) |
| 359 | static void pc_com_tx(device_t *uart, UINT8 state, const char *portn) |
| 363 | 360 | { |
| 364 | | /* mouse connected to this port? */ |
| 365 | | //if (input_port_read(device->machine(), "DSW2") & (0x80>>n)) |
| 366 | | // pc_mouse_handshake_in(device,data); |
| 361 | rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn); |
| 362 | port->tx(state); |
| 367 | 363 | } |
| 368 | 364 | |
| 369 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_0 ) { pc_com_refresh_connected_common( device, 0, data ); } |
| 370 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_1 ) { pc_com_refresh_connected_common( device, 1, data ); } |
| 371 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_2 ) { pc_com_refresh_connected_common( device, 2, data ); } |
| 372 | | static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_3 ) { pc_com_refresh_connected_common( device, 3, data ); } |
| 365 | static void pc_com_dtr(device_t *uart, UINT8 state, const char *portn) |
| 366 | { |
| 367 | rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn); |
| 368 | port->dtr_w(state); |
| 369 | } |
| 373 | 370 | |
| 371 | static void pc_com_rts(device_t *uart, UINT8 state, const char *portn) |
| 372 | { |
| 373 | rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn); |
| 374 | port->rts_w(state); |
| 375 | } |
| 376 | |
| 377 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_0 ) { pc_com_tx(device, state, "serport0"); } |
| 378 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_0 ) { pc_com_dtr(device, state, "serport0"); } |
| 379 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_0 ) { pc_com_rts(device, state, "serport0"); } |
| 380 | |
| 381 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_1 ) { pc_com_tx(device, state, "serport1"); } |
| 382 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_1 ) { pc_com_dtr(device, state, "serport1"); } |
| 383 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_1 ) { pc_com_rts(device, state, "serport1"); } |
| 384 | |
| 385 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_2 ) { pc_com_tx(device, state, "serport2"); } |
| 386 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_2 ) { pc_com_dtr(device, state, "serport2"); } |
| 387 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_2 ) { pc_com_rts(device, state, "serport2"); } |
| 388 | |
| 389 | static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_3 ) { pc_com_tx(device, state, "serport3"); } |
| 390 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_3 ) { pc_com_dtr(device, state, "serport3"); } |
| 391 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_3 ) { pc_com_rts(device, state, "serport3"); } |
| 392 | |
| 393 | static void pc_com_rx(device_t *port, UINT8 state, const char *uartn) |
| 394 | { |
| 395 | ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn); |
| 396 | uart->rx_w(state); |
| 397 | } |
| 398 | |
| 399 | static void pc_com_dcd(device_t *port, UINT8 state, const char *uartn) |
| 400 | { |
| 401 | ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn); |
| 402 | uart->dcd_w(state); |
| 403 | } |
| 404 | |
| 405 | static void pc_com_dsr(device_t *port, UINT8 state, const char *uartn) |
| 406 | { |
| 407 | ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn); |
| 408 | uart->dsr_w(state); |
| 409 | } |
| 410 | |
| 411 | static void pc_com_ri(device_t *port, UINT8 state, const char *uartn) |
| 412 | { |
| 413 | ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn); |
| 414 | uart->ri_w(state); |
| 415 | } |
| 416 | |
| 417 | static void pc_com_cts(device_t *port, UINT8 state, const char *uartn) |
| 418 | { |
| 419 | ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn); |
| 420 | uart->cts_w(state); |
| 421 | } |
| 422 | |
| 423 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_0 ) { pc_com_rx(device, state, "ins8250_0"); } |
| 424 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_0 ) { pc_com_dcd(device, state, "ins8250_0"); } |
| 425 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_0 ) { pc_com_dsr(device, state, "ins8250_0"); } |
| 426 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_0 ) { pc_com_ri(device, state, "ins8250_0"); } |
| 427 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_0 ) { pc_com_cts(device, state, "ins8250_0"); } |
| 428 | |
| 429 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_1 ) { pc_com_rx(device, state, "ins8250_1"); } |
| 430 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_1 ) { pc_com_dcd(device, state, "ins8250_1"); } |
| 431 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_1 ) { pc_com_dsr(device, state, "ins8250_1"); } |
| 432 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_1 ) { pc_com_ri(device, state, "ins8250_1"); } |
| 433 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_1 ) { pc_com_cts(device, state, "ins8250_1"); } |
| 434 | |
| 435 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_2 ) { pc_com_rx(device, state, "ins8250_2"); } |
| 436 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_2 ) { pc_com_dcd(device, state, "ins8250_2"); } |
| 437 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_2 ) { pc_com_dsr(device, state, "ins8250_2"); } |
| 438 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_2 ) { pc_com_ri(device, state, "ins8250_2"); } |
| 439 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_2 ) { pc_com_cts(device, state, "ins8250_2"); } |
| 440 | |
| 441 | static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_3 ) { pc_com_rx(device, state, "ins8250_3"); } |
| 442 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_3 ) { pc_com_dcd(device, state, "ins8250_3"); } |
| 443 | static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_3 ) { pc_com_dsr(device, state, "ins8250_3"); } |
| 444 | static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_3 ) { pc_com_ri(device, state, "ins8250_3"); } |
| 445 | static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_3 ) { pc_com_cts(device, state, "ins8250_3"); } |
| 446 | |
| 374 | 447 | /* PC interface to PC-com hardware. Done this way because PCW16 also |
| 375 | 448 | uses PC-com hardware and doesn't have the same setup! */ |
| 376 | 449 | const ins8250_interface ibm5150_com_interface[4]= |
| 377 | 450 | { |
| 378 | 451 | { |
| 379 | | 1843200, |
| 452 | DEVCB_LINE(pc_com_tx_0), |
| 453 | DEVCB_LINE(pc_com_dtr_0), |
| 454 | DEVCB_LINE(pc_com_rts_0), |
| 380 | 455 | DEVCB_LINE(pc_com_interrupt_1), |
| 381 | | NULL, |
| 382 | | pc_com_handshake_out_0, |
| 383 | | NULL |
| 456 | DEVCB_NULL, |
| 457 | DEVCB_NULL |
| 384 | 458 | }, |
| 385 | 459 | { |
| 386 | | 1843200, |
| 460 | DEVCB_LINE(pc_com_tx_1), |
| 461 | DEVCB_LINE(pc_com_dtr_1), |
| 462 | DEVCB_LINE(pc_com_rts_1), |
| 387 | 463 | DEVCB_LINE(pc_com_interrupt_2), |
| 388 | | NULL, |
| 389 | | pc_com_handshake_out_1, |
| 390 | | NULL |
| 464 | DEVCB_NULL, |
| 465 | DEVCB_NULL |
| 391 | 466 | }, |
| 392 | 467 | { |
| 393 | | 1843200, |
| 468 | DEVCB_LINE(pc_com_tx_2), |
| 469 | DEVCB_LINE(pc_com_dtr_2), |
| 470 | DEVCB_LINE(pc_com_rts_2), |
| 394 | 471 | DEVCB_LINE(pc_com_interrupt_1), |
| 395 | | NULL, |
| 396 | | pc_com_handshake_out_2, |
| 397 | | NULL |
| 472 | DEVCB_NULL, |
| 473 | DEVCB_NULL |
| 398 | 474 | }, |
| 399 | 475 | { |
| 400 | | 1843200, |
| 476 | DEVCB_LINE(pc_com_tx_3), |
| 477 | DEVCB_LINE(pc_com_dtr_3), |
| 478 | DEVCB_LINE(pc_com_rts_3), |
| 401 | 479 | DEVCB_LINE(pc_com_interrupt_2), |
| 402 | | NULL, |
| 403 | | pc_com_handshake_out_3, |
| 404 | | NULL |
| 480 | DEVCB_NULL, |
| 481 | DEVCB_NULL |
| 405 | 482 | } |
| 406 | 483 | }; |
| 407 | 484 | |
| 485 | const rs232_port_interface ibm5150_serport_config[4] = |
| 486 | { |
| 487 | { |
| 488 | DEVCB_LINE( pc_com_rx_0 ), |
| 489 | DEVCB_LINE( pc_com_dcd_0 ), |
| 490 | DEVCB_LINE( pc_com_dsr_0 ), |
| 491 | DEVCB_LINE( pc_com_ri_0 ), |
| 492 | DEVCB_LINE( pc_com_cts_0 ) |
| 493 | }, |
| 494 | { |
| 495 | DEVCB_LINE( pc_com_rx_1 ), |
| 496 | DEVCB_LINE( pc_com_dcd_1 ), |
| 497 | DEVCB_LINE( pc_com_dsr_1 ), |
| 498 | DEVCB_LINE( pc_com_ri_1 ), |
| 499 | DEVCB_LINE( pc_com_cts_1 ) |
| 500 | }, |
| 501 | { |
| 502 | DEVCB_LINE( pc_com_rx_2 ), |
| 503 | DEVCB_LINE( pc_com_dcd_2 ), |
| 504 | DEVCB_LINE( pc_com_dsr_2 ), |
| 505 | DEVCB_LINE( pc_com_ri_2 ), |
| 506 | DEVCB_LINE( pc_com_cts_2 ) |
| 507 | }, |
| 508 | { |
| 509 | DEVCB_LINE( pc_com_rx_3 ), |
| 510 | DEVCB_LINE( pc_com_dcd_3 ), |
| 511 | DEVCB_LINE( pc_com_dsr_3 ), |
| 512 | DEVCB_LINE( pc_com_ri_3 ), |
| 513 | DEVCB_LINE( pc_com_cts_3 ) |
| 514 | } |
| 515 | }; |
| 408 | 516 | |
| 409 | 517 | /********************************************************** |
| 410 | 518 | * |
| r14535 | r14536 | |
| 973 | 1081 | /* MESS managed RAM */ |
| 974 | 1082 | if ( machine.device<ram_device>(RAM_TAG)->pointer() ) |
| 975 | 1083 | memory_set_bankptr( machine, "bank10", machine.device<ram_device>(RAM_TAG)->pointer() ); |
| 976 | | |
| 977 | | /* serial mouse */ |
| 978 | | //pc_mouse_initialise(machine); |
| 979 | 1084 | } |
| 980 | 1085 | |
| 981 | 1086 | |
| r14535 | r14536 | |
| 1139 | 1244 | st->m_ppi_shift_register = 0; |
| 1140 | 1245 | st->m_ppi_shift_enable = 0; |
| 1141 | 1246 | |
| 1142 | | //pc_mouse_set_serial_port( machine.device("ins8250_0") ); |
| 1143 | 1247 | speaker_level_w( speaker, 0 ); |
| 1144 | 1248 | } |
| 1145 | 1249 | |
| r14535 | r14536 | |
| 1178 | 1282 | st->m_ppi_data_signal = 0; |
| 1179 | 1283 | st->m_ppi_shift_register = 0; |
| 1180 | 1284 | st->m_ppi_shift_enable = 0; |
| 1181 | | //pc_mouse_set_serial_port( machine.device("ins8250_0") ); |
| 1182 | 1285 | speaker_level_w( speaker, 0 ); |
| 1183 | 1286 | |
| 1184 | 1287 | pcjr_keyb_init(machine); |
src/mess/machine/terminal.c
| r14535 | r14536 | |
| 7 | 7 | enum |
| 8 | 8 | { |
| 9 | 9 | START = 0, |
| 10 | | STOP = 9 |
| 10 | STOP = 9, |
| 11 | DONE = 10 |
| 11 | 12 | }; |
| 12 | 13 | |
| 13 | 14 | #define TERMINAL_WIDTH 80 |
| r14535 | r14536 | |
| 223 | 224 | |
| 224 | 225 | switch (term->tx_state) |
| 225 | 226 | { |
| 227 | case DONE: |
| 228 | break; |
| 226 | 229 | case STOP: |
| 227 | 230 | data = 1; |
| 231 | term->tx_state++; |
| 228 | 232 | break; |
| 229 | 233 | |
| 230 | 234 | case START: |
| r14535 | r14536 | |
| 313 | 317 | /*************************************************************************** |
| 314 | 318 | VIDEO HARDWARE |
| 315 | 319 | ***************************************************************************/ |
| 316 | | static void generic_terminal_update(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 320 | static void generic_terminal_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 317 | 321 | { |
| 318 | 322 | terminal_state *term = get_safe_token(device); |
| 319 | 323 | UINT8 options = input_port_read(*device, "TERM_CONF"); |
| 320 | 324 | UINT16 cursor = term->y_pos * TERMINAL_WIDTH + term->x_pos; |
| 321 | 325 | UINT8 y,ra,chr,gfx; |
| 322 | 326 | UINT16 sy=0,ma=0,x; |
| 327 | UINT32 font_color; |
| 328 | switch (options & 0x30) |
| 329 | { |
| 330 | case 0x10: |
| 331 | font_color = 0x00ff7e00; |
| 332 | break; |
| 333 | case 0x20: |
| 334 | font_color = 0x00ffffff; |
| 335 | break; |
| 336 | default: |
| 337 | font_color = 0x0000ff00; |
| 338 | break; |
| 339 | } |
| 323 | 340 | |
| 324 | 341 | term->framecnt++; |
| 325 | 342 | |
| r14535 | r14536 | |
| 327 | 344 | { |
| 328 | 345 | for (ra = 0; ra < 10; ra++) |
| 329 | 346 | { |
| 330 | | UINT16 *p = &bitmap.pix16(sy++); |
| 347 | UINT32 *p = &bitmap.pix32(sy++); |
| 331 | 348 | |
| 332 | 349 | for (x = ma; x < ma + TERMINAL_WIDTH; x++) |
| 333 | 350 | { |
| r14535 | r14536 | |
| 352 | 369 | } |
| 353 | 370 | |
| 354 | 371 | /* Display a scanline of a character */ |
| 355 | | *p++ = BIT( gfx, 7 ); |
| 356 | | *p++ = BIT( gfx, 6 ); |
| 357 | | *p++ = BIT( gfx, 5 ); |
| 358 | | *p++ = BIT( gfx, 4 ); |
| 359 | | *p++ = BIT( gfx, 3 ); |
| 360 | | *p++ = BIT( gfx, 2 ); |
| 361 | | *p++ = BIT( gfx, 1 ); |
| 362 | | *p++ = BIT( gfx, 0 ); |
| 372 | *p++ = (BIT( gfx, 7 ))?font_color:0; |
| 373 | *p++ = (BIT( gfx, 6 ))?font_color:0; |
| 374 | *p++ = (BIT( gfx, 5 ))?font_color:0; |
| 375 | *p++ = (BIT( gfx, 4 ))?font_color:0; |
| 376 | *p++ = (BIT( gfx, 3 ))?font_color:0; |
| 377 | *p++ = (BIT( gfx, 2 ))?font_color:0; |
| 378 | *p++ = (BIT( gfx, 1 ))?font_color:0; |
| 379 | *p++ = (BIT( gfx, 0 ))?font_color:0; |
| 363 | 380 | } |
| 364 | 381 | } |
| 365 | 382 | ma+=TERMINAL_WIDTH; |
| r14535 | r14536 | |
| 378 | 395 | return 0; |
| 379 | 396 | } |
| 380 | 397 | |
| 381 | | UINT8 terminal_keyboard_handler(running_machine &machine, devcb_resolved_write8 &callback, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device) |
| 398 | UINT8 terminal_keyboard_handler(running_machine &machine, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device) |
| 382 | 399 | { |
| 383 | 400 | static const char *const keynames[] = { "TERM_LINE0", "TERM_LINE1", "TERM_LINE2", "TERM_LINE3", "TERM_LINE4", "TERM_LINE5", "TERM_LINE6", "TERM_LINE7" }; |
| 384 | 401 | int i; |
| r14535 | r14536 | |
| 468 | 485 | } |
| 469 | 486 | } |
| 470 | 487 | if (last_code != key_code ) { |
| 471 | | callback(0, key_code); |
| 472 | 488 | if (tx_shift) *tx_shift = key_code; |
| 473 | 489 | if (tx_state) *tx_state = START; |
| 474 | 490 | } |
| r14535 | r14536 | |
| 485 | 501 | |
| 486 | 502 | static TIMER_CALLBACK(keyboard_callback) |
| 487 | 503 | { |
| 504 | UINT8 new_code; |
| 488 | 505 | terminal_state *term = get_safe_token((device_t *)ptr); |
| 489 | | term->last_code = terminal_keyboard_handler(machine, term->terminal_keyboard_func, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr); |
| 506 | new_code = terminal_keyboard_handler(machine, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr); |
| 507 | if(term->last_code != new_code) |
| 508 | term->terminal_keyboard_func(0, new_code); |
| 509 | term->last_code = new_code; |
| 490 | 510 | } |
| 491 | 511 | |
| 512 | static TIMER_CALLBACK(serial_callback) |
| 513 | { |
| 514 | static int count = 0; |
| 515 | terminal_state *term = get_safe_token((device_t *)ptr); |
| 516 | if(term->tx_state == DONE) { |
| 517 | if(count == 0) { |
| 518 | term->last_code = terminal_keyboard_handler(machine, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr); |
| 519 | } else |
| 520 | ++count %= 8; |
| 521 | } else |
| 522 | term->terminal_keyboard_func(0, terminal_serial_r((device_t *)ptr)); |
| 523 | } |
| 524 | |
| 492 | 525 | /*************************************************************************** |
| 493 | 526 | VIDEO HARDWARE |
| 494 | 527 | ***************************************************************************/ |
| 495 | | static VIDEO_START( terminal ) |
| 496 | | { |
| 497 | 528 | |
| 498 | | } |
| 499 | | |
| 500 | | static SCREEN_UPDATE_IND16(terminal ) |
| 529 | static SCREEN_UPDATE_RGB32(terminal ) |
| 501 | 530 | { |
| 502 | | device_t *devconf = screen.machine().device(TERMINAL_TAG); |
| 531 | device_t *devconf = screen.owner(); |
| 503 | 532 | generic_terminal_update( devconf, bitmap, cliprect); |
| 504 | 533 | return 0; |
| 505 | 534 | } |
| 506 | 535 | |
| 507 | | MACHINE_CONFIG_FRAGMENT( generic_terminal ) |
| 536 | static MACHINE_CONFIG_FRAGMENT( generic_terminal ) |
| 508 | 537 | MCFG_SCREEN_ADD(TERMINAL_SCREEN_TAG, RASTER) |
| 509 | 538 | MCFG_SCREEN_REFRESH_RATE(50) |
| 510 | 539 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 511 | 540 | MCFG_SCREEN_SIZE(TERMINAL_WIDTH*8, TERMINAL_HEIGHT*10) |
| 512 | 541 | MCFG_SCREEN_VISIBLE_AREA(0, TERMINAL_WIDTH*8-1, 0, TERMINAL_HEIGHT*10-1) |
| 513 | 542 | MCFG_SCREEN_UPDATE_STATIC(terminal) |
| 514 | | |
| 515 | | MCFG_PALETTE_LENGTH(2) |
| 516 | | MCFG_PALETTE_INIT(monochrome_green) |
| 517 | | |
| 518 | | MCFG_VIDEO_START(terminal) |
| 519 | 543 | MACHINE_CONFIG_END |
| 520 | 544 | |
| 521 | 545 | |
| r14535 | r14536 | |
| 527 | 551 | { |
| 528 | 552 | terminal_state *term = get_safe_token(device); |
| 529 | 553 | const terminal_interface *intf = get_interface(device); |
| 554 | if(dynamic_cast<serial_terminal_device *>(device->owner())) |
| 555 | term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device->owner()); |
| 556 | else |
| 557 | term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device); |
| 530 | 558 | |
| 531 | | term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device); |
| 532 | | |
| 533 | | if (!term->terminal_keyboard_func.isnull()) |
| 559 | if (device->clock()) |
| 560 | device->machine().scheduler().timer_pulse(attotime::from_hz(device->clock()), FUNC(serial_callback), 0, (void*)device); |
| 561 | else if (!term->terminal_keyboard_func.isnull()) |
| 534 | 562 | device->machine().scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback), 0, (void*)device); |
| 535 | 563 | } |
| 536 | 564 | |
| r14535 | r14536 | |
| 682 | 710 | PORT_CONFNAME( 0x08, 0x08, "Invert") |
| 683 | 711 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 684 | 712 | PORT_CONFSETTING( 0x08, DEF_STR(Yes)) |
| 713 | PORT_CONFNAME( 0x30, 0x00, "Color") |
| 714 | PORT_CONFSETTING( 0x00, "Green") |
| 715 | PORT_CONFSETTING( 0x10, "Amber") |
| 716 | PORT_CONFSETTING( 0x20, "White") |
| 685 | 717 | INPUT_PORTS_END |
| 686 | 718 | |
| 687 | 719 | /*------------------------------------------------- |
| r14535 | r14536 | |
| 702 | 734 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(terminal); break; |
| 703 | 735 | |
| 704 | 736 | case DEVINFO_PTR_INPUT_PORTS: info->ipt = INPUT_PORTS_NAME(generic_terminal); break; |
| 737 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_CONFIG_NAME(generic_terminal); break; |
| 705 | 738 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 706 | 739 | case DEVINFO_STR_NAME: strcpy(info->s, "Generic Terminal"); break; |
| 707 | 740 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Terminal"); break; |
| r14535 | r14536 | |
| 712 | 745 | } |
| 713 | 746 | |
| 714 | 747 | DEFINE_LEGACY_DEVICE(GENERIC_TERMINAL, terminal); |
| 748 | |
| 749 | serial_terminal_device::serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 750 | : device_t(mconfig, SERIAL_TERMINAL, "Serial Terminal", tag, owner, clock), |
| 751 | device_serial_port_interface(mconfig, *this), |
| 752 | m_terminal(*this, TERMINAL_TAG) |
| 753 | { |
| 754 | } |
| 755 | |
| 756 | static const terminal_interface serial_terminal_terminal_interface = { |
| 757 | DEVCB_MEMBER(serial_terminal_device, serial_keyboard_func) |
| 758 | }; |
| 759 | |
| 760 | static MACHINE_CONFIG_FRAGMENT(serial_terminal_config) |
| 761 | MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, serial_terminal_terminal_interface, 9600) |
| 762 | MACHINE_CONFIG_END |
| 763 | |
| 764 | const device_type SERIAL_TERMINAL = &device_creator<serial_terminal_device>; |
| 765 | |
| 766 | machine_config_constructor serial_terminal_device::device_mconfig_additions() const |
| 767 | { |
| 768 | return MACHINE_CONFIG_NAME(serial_terminal_config); |
| 769 | } |
| 770 | |
src/mess/drivers/amstr_pc.c
| r14535 | r14536 | |
| 44 | 44 | #include "machine/pc_joy.h" |
| 45 | 45 | #include "machine/pckeybrd.h" |
| 46 | 46 | #include "machine/pc_lpt.h" |
| 47 | | #include "machine/pc_mouse.h" |
| 48 | 47 | |
| 49 | 48 | #include "includes/amstr_pc.h" |
| 50 | 49 | |
| r14535 | r14536 | |
| 92 | 91 | AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) |
| 93 | 92 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc16le_JOY_r, pc16le_JOY_w) |
| 94 | 93 | AM_RANGE(0x0278, 0x027b) AM_READ(pc200_16le_port278_r) AM_DEVWRITE8("lpt_2", pc_lpt_w, 0x00ff) |
| 95 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff) |
| 96 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 94 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 95 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 97 | 96 | AM_RANGE(0x0378, 0x037b) AM_READ(pc200_16le_port378_r) AM_DEVWRITE8("lpt_1", pc_lpt_w, 0x00ff) |
| 98 | 97 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 99 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff) |
| 98 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 100 | 99 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 101 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 100 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 102 | 101 | ADDRESS_MAP_END |
| 103 | 102 | |
| 104 | 103 | static ADDRESS_MAP_START( pc200_map, AS_PROGRAM, 16 ) |
| r14535 | r14536 | |
| 120 | 119 | AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) |
| 121 | 120 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc16le_JOY_r, pc16le_JOY_w) |
| 122 | 121 | AM_RANGE(0x0278, 0x027b) AM_READ(pc200_16le_port278_r) AM_DEVWRITE8("lpt_2", pc_lpt_w, 0x00ff) |
| 123 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff) |
| 124 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 122 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 123 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 125 | 124 | AM_RANGE(0x0378, 0x037b) AM_READ(pc200_16le_port378_r) AM_DEVWRITE8("lpt_1", pc_lpt_w, 0x00ff) |
| 126 | 125 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 127 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff) |
| 126 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 128 | 127 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 129 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 128 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 130 | 129 | ADDRESS_MAP_END |
| 131 | 130 | |
| 132 | 131 | |
| r14535 | r14536 | |
| 188 | 187 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 189 | 188 | |
| 190 | 189 | PORT_START("DSW2") /* IN3 */ |
| 191 | | PORT_DIPNAME( 0xf0, 0x00, "Serial mouse") |
| 192 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 193 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 194 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 195 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 196 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 197 | 190 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 198 | 191 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 199 | 192 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 204 | 197 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 205 | 198 | |
| 206 | 199 | PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ |
| 207 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 208 | 200 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 209 | 201 | |
| 210 | 202 | PORT_START("VIDEO") /* IN20 */ |
| r14535 | r14536 | |
| 241 | 233 | NULL |
| 242 | 234 | }; |
| 243 | 235 | |
| 236 | SLOT_INTERFACE_START(amstr_com) |
| 237 | SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE) |
| 238 | SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE) |
| 239 | SLOT_INTERFACE_END |
| 244 | 240 | |
| 245 | 241 | #define MCFG_CPU_PC(mem, port, type, clock, vblankfunc) \ |
| 246 | 242 | MCFG_CPU_ADD("maincpu", type, clock) \ |
| r14535 | r14536 | |
| 282 | 278 | |
| 283 | 279 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 284 | 280 | |
| 285 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 286 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 287 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 288 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 281 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 282 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 283 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 284 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 285 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], amstr_com, NULL, NULL ) |
| 286 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], amstr_com, NULL, NULL ) |
| 287 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[3], amstr_com, NULL, NULL ) |
| 288 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[4], amstr_com, NULL, NULL ) |
| 289 | 289 | |
| 290 | 290 | /* video hardware */ |
| 291 | 291 | MCFG_FRAGMENT_ADD( pcvideo_pc200 ) |
| r14535 | r14536 | |
| 348 | 348 | |
| 349 | 349 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 350 | 350 | |
| 351 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 352 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 353 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 354 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 351 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 352 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 353 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 354 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 355 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], amstr_com, NULL, NULL ) |
| 356 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], amstr_com, NULL, NULL ) |
| 357 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[3], amstr_com, NULL, NULL ) |
| 358 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[4], amstr_com, NULL, NULL ) |
| 355 | 359 | |
| 356 | 360 | /* video hardware */ |
| 357 | 361 | MCFG_FRAGMENT_ADD( pcvideo_pc200 ) |
src/mess/drivers/pc.c
| r14535 | r14536 | |
| 78 | 78 | #include "machine/pc_joy.h" |
| 79 | 79 | #include "machine/pckeybrd.h" |
| 80 | 80 | #include "machine/pc_lpt.h" |
| 81 | | #include "machine/pc_mouse.h" |
| 81 | #include "machine/serial.h" |
| 82 | 82 | |
| 83 | 83 | #include "includes/europc.h" |
| 84 | 84 | #include "includes/tandy1t.h" |
| r14535 | r14536 | |
| 162 | 162 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r, pc_JOY_w) |
| 163 | 163 | AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r, pc_rtc_w) |
| 164 | 164 | AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_r, pc_lpt_w) |
| 165 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_r, ins8250_w) |
| 166 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w) |
| 165 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w) |
| 166 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w) |
| 167 | 167 | AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ |
| 168 | 168 | AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE("lpt_1", pc_lpt_r, pc_lpt_w) |
| 169 | 169 | AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w) |
| 170 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w) |
| 170 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w) |
| 171 | 171 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r, pc_fdc_w) |
| 172 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w) |
| 172 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w) |
| 173 | 173 | ADDRESS_MAP_END |
| 174 | 174 | |
| 175 | 175 | static ADDRESS_MAP_START(oliv_io, AS_IO, 8) |
| r14535 | r14536 | |
| 189 | 189 | AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc16le_rtc_r, pc16le_rtc_w) |
| 190 | 190 | AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 191 | 191 | AM_RANGE(0x02b0, 0x02bf) AM_RAM // needed for EC-18xx |
| 192 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff) |
| 193 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 192 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 193 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 194 | 194 | AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ |
| 195 | 195 | AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 196 | 196 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 197 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff) |
| 197 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 198 | 198 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 199 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 199 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 200 | 200 | ADDRESS_MAP_END |
| 201 | 201 | |
| 202 | 202 | |
| r14535 | r14536 | |
| 225 | 225 | AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc16le_rtc_r, pc16le_rtc_w) |
| 226 | 226 | AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 227 | 227 | AM_RANGE(0x02b0, 0x02bf) AM_RAM // needed for EC-18xx |
| 228 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff) |
| 229 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 228 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 229 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 230 | 230 | AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ |
| 231 | 231 | AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 232 | 232 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 233 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff) |
| 233 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 234 | 234 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 235 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 235 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 236 | 236 | ADDRESS_MAP_END |
| 237 | 237 | |
| 238 | 238 | |
| r14535 | r14536 | |
| 257 | 257 | AM_RANGE(0x0250, 0x025f) AM_READWRITE(europc_jim_r, europc_jim_w) |
| 258 | 258 | AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_r, pc_lpt_w) |
| 259 | 259 | AM_RANGE(0x02e0, 0x02e0) AM_READ (europc_jim2_r) |
| 260 | | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_r, ins8250_w) |
| 261 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w) |
| 260 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w) |
| 261 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w) |
| 262 | 262 | AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE("lpt_1", pc_lpt_r, pc_lpt_w) |
| 263 | 263 | // AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w) |
| 264 | | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w) |
| 264 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w) |
| 265 | 265 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r, pc_fdc_w) |
| 266 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w) |
| 266 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w) |
| 267 | 267 | ADDRESS_MAP_END |
| 268 | 268 | |
| 269 | 269 | |
| r14535 | r14536 | |
| 289 | 289 | AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w) |
| 290 | 290 | AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_w) |
| 291 | 291 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r, pc_JOY_w) |
| 292 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w) |
| 292 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w) |
| 293 | 293 | AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) |
| 294 | 294 | AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w) |
| 295 | 295 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r, pc_fdc_w) |
| 296 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w) |
| 296 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w) |
| 297 | 297 | ADDRESS_MAP_END |
| 298 | 298 | |
| 299 | 299 | |
| r14535 | r14536 | |
| 319 | 319 | AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) |
| 320 | 320 | AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", sn76496_w, 0xffff) |
| 321 | 321 | AM_RANGE(0x0200, 0x0207) AM_READWRITE8(pc_JOY_r, pc_JOY_w, 0xffff) |
| 322 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 322 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 323 | 323 | AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) |
| 324 | 324 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) |
| 325 | 325 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 326 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 326 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 327 | 327 | AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff) |
| 328 | 328 | ADDRESS_MAP_END |
| 329 | 329 | |
| r14535 | r14536 | |
| 350 | 350 | AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) |
| 351 | 351 | AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496", sn76496_w, 0xffff) |
| 352 | 352 | AM_RANGE(0x0200, 0x0207) AM_READWRITE8(pc_JOY_r, pc_JOY_w, 0xffff) |
| 353 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff) |
| 353 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 354 | 354 | AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) |
| 355 | 355 | AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) |
| 356 | 356 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r, pc_fdc_w, 0xffff) |
| 357 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff) |
| 357 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) |
| 358 | 358 | ADDRESS_MAP_END |
| 359 | 359 | |
| 360 | 360 | |
| r14535 | r14536 | |
| 381 | 381 | AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496", sn76496_w) |
| 382 | 382 | AM_RANGE(0x00f0, 0x00f7) AM_READWRITE(pc_fdc_r, pcjr_fdc_w) |
| 383 | 383 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r, pc_JOY_w) |
| 384 | | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w) |
| 384 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w) |
| 385 | 385 | AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) |
| 386 | 386 | AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w) |
| 387 | | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w) |
| 387 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w) |
| 388 | 388 | ADDRESS_MAP_END |
| 389 | 389 | |
| 390 | 390 | static ADDRESS_MAP_START(ibmpcjx_map, AS_PROGRAM, 8 ) |
| r14535 | r14536 | |
| 453 | 453 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 454 | 454 | |
| 455 | 455 | PORT_START("DSW2") /* IN3 */ |
| 456 | | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") |
| 457 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 458 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 459 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 460 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 461 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 462 | 456 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 463 | 457 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 464 | 458 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 469 | 463 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 470 | 464 | |
| 471 | 465 | PORT_INCLUDE( kb_keytronic_pc ) |
| 472 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 473 | 466 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 474 | 467 | PORT_INCLUDE( pcvideo_cga ) |
| 475 | 468 | INPUT_PORTS_END |
| r14535 | r14536 | |
| 530 | 523 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 531 | 524 | |
| 532 | 525 | PORT_START("DSW2") /* IN3 */ |
| 533 | | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") |
| 534 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 535 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 536 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 537 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 538 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 539 | 526 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 540 | 527 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 541 | 528 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 546 | 533 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 547 | 534 | |
| 548 | 535 | PORT_INCLUDE( kb_keytronic_pc ) |
| 549 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 550 | 536 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 551 | 537 | PORT_INCLUDE( pcvideo_cga ) |
| 552 | 538 | INPUT_PORTS_END |
| r14535 | r14536 | |
| 587 | 573 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 588 | 574 | |
| 589 | 575 | PORT_START("DSW2") /* IN3 */ |
| 590 | | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") |
| 591 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 592 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 593 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 594 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 595 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 596 | 576 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 597 | 577 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 598 | 578 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 604 | 584 | |
| 605 | 585 | EUROPC_KEYBOARD |
| 606 | 586 | |
| 607 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 608 | 587 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 609 | 588 | PORT_INCLUDE( pcvideo_cga ) |
| 610 | 589 | INPUT_PORTS_END |
| r14535 | r14536 | |
| 665 | 644 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 666 | 645 | |
| 667 | 646 | PORT_START("DSW2") /* IN3 */ |
| 668 | | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") |
| 669 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 670 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 671 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 672 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 673 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 674 | 647 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 675 | 648 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 676 | 649 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 684 | 657 | |
| 685 | 658 | // PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ |
| 686 | 659 | PORT_INCLUDE( kb_keytronic_pc ) |
| 687 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 688 | 660 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 689 | 661 | PORT_INCLUDE( pcvideo_cga ) |
| 690 | 662 | INPUT_PORTS_END |
| r14535 | r14536 | |
| 715 | 687 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 716 | 688 | |
| 717 | 689 | PORT_START("DSW2") /* IN3 */ |
| 718 | | PORT_DIPNAME( 0xf0, 0x80, "Serial mouse") |
| 719 | | PORT_DIPSETTING( 0x80, "COM1" ) |
| 720 | | PORT_DIPSETTING( 0x40, "COM2" ) |
| 721 | | PORT_DIPSETTING( 0x20, "COM3" ) |
| 722 | | PORT_DIPSETTING( 0x10, "COM4" ) |
| 723 | | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 724 | 690 | PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)") |
| 725 | 691 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 726 | 692 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r14535 | r14536 | |
| 731 | 697 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 732 | 698 | |
| 733 | 699 | PORT_INCLUDE( t1000_keyboard ) |
| 734 | | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 735 | 700 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| 736 | 701 | INPUT_PORTS_END |
| 737 | 702 | |
| r14535 | r14536 | |
| 756 | 721 | NULL |
| 757 | 722 | }; |
| 758 | 723 | |
| 724 | SLOT_INTERFACE_START(ibm5150_com) |
| 725 | SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE) |
| 726 | SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE) |
| 727 | SLOT_INTERFACE_END |
| 728 | |
| 759 | 729 | static const kb_keytronic_interface pc_keytronic_intf = |
| 760 | 730 | { |
| 761 | 731 | DEVCB_MEMORY_HANDLER("maincpu", IO, ibm5150_kb_set_clock_signal), |
| r14535 | r14536 | |
| 834 | 804 | |
| 835 | 805 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 836 | 806 | |
| 837 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 838 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 839 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 840 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 807 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 808 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 809 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 810 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 811 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 812 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 813 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 814 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 841 | 815 | |
| 842 | 816 | /* video hardware */ |
| 843 | 817 | MCFG_FRAGMENT_ADD( pcvideo_cga ) |
| r14535 | r14536 | |
| 882 | 856 | |
| 883 | 857 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 884 | 858 | |
| 885 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 886 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 887 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 888 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 859 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 860 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 861 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 862 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 863 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 864 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 865 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 866 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 889 | 867 | |
| 890 | 868 | /* video hardware */ |
| 891 | 869 | MCFG_FRAGMENT_ADD( pcvideo_cga32k ) |
| r14535 | r14536 | |
| 959 | 937 | |
| 960 | 938 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 961 | 939 | |
| 962 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 963 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 964 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 965 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 940 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 941 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 942 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 943 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 944 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 945 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 946 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 947 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 966 | 948 | |
| 967 | 949 | /* video hardware */ |
| 968 | 950 | MCFG_FRAGMENT_ADD( pcvideo_aga ) |
| r14535 | r14536 | |
| 1005 | 987 | |
| 1006 | 988 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 1007 | 989 | |
| 1008 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1009 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 990 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 991 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 992 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 993 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1010 | 994 | |
| 1011 | 995 | /* video hardware */ |
| 1012 | 996 | MCFG_FRAGMENT_ADD( pcvideo_t1000 ) |
| r14535 | r14536 | |
| 1051 | 1035 | |
| 1052 | 1036 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 1053 | 1037 | |
| 1054 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1055 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1038 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1039 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1040 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1041 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1056 | 1042 | |
| 1057 | 1043 | /* video hardware */ |
| 1058 | 1044 | MCFG_FRAGMENT_ADD( pcvideo_t1000 ) |
| r14535 | r14536 | |
| 1097 | 1083 | |
| 1098 | 1084 | MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface ) |
| 1099 | 1085 | |
| 1100 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1101 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1086 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1087 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1088 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1089 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1102 | 1090 | |
| 1103 | 1091 | /* video hardware */ |
| 1104 | 1092 | MCFG_FRAGMENT_ADD( pcvideo_t1000 ) |
| r14535 | r14536 | |
| 1154 | 1142 | |
| 1155 | 1143 | MCFG_I8255_ADD( "ppi8255", pcjr_ppi8255_interface ) |
| 1156 | 1144 | |
| 1157 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1158 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1145 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1146 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1147 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1148 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1159 | 1149 | |
| 1160 | 1150 | /* video hardware */ |
| 1161 | 1151 | MCFG_FRAGMENT_ADD( pcvideo_pcjr ) |
| r14535 | r14536 | |
| 1235 | 1225 | |
| 1236 | 1226 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1237 | 1227 | |
| 1238 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1239 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1240 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1241 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1228 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1229 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1230 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1231 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1232 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1233 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1234 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1235 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 1242 | 1236 | |
| 1243 | 1237 | /* video hardware */ |
| 1244 | 1238 | MCFG_FRAGMENT_ADD( pcvideo_cga ) |
| r14535 | r14536 | |
| 1284 | 1278 | |
| 1285 | 1279 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1286 | 1280 | |
| 1287 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1288 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1289 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1290 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1281 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1282 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1283 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1284 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1285 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1286 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1287 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1288 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 1291 | 1289 | |
| 1292 | 1290 | /* video hardware */ |
| 1293 | 1291 | // MCFG_FRAGMENT_ADD( pcvideo_ega ) // Put this back after ISA are added to this driver |
| r14535 | r14536 | |
| 1332 | 1330 | |
| 1333 | 1331 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1334 | 1332 | |
| 1335 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1336 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1337 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1338 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1333 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1334 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1335 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1336 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1337 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1338 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1339 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1340 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 1339 | 1341 | |
| 1340 | 1342 | /* video hardware */ |
| 1341 | 1343 | MCFG_FRAGMENT_ADD( pcvideo_poisk2 ) |
| r14535 | r14536 | |
| 1380 | 1382 | |
| 1381 | 1383 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1382 | 1384 | |
| 1383 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1384 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1385 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1386 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1385 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1386 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1387 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1388 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1389 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1390 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1391 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1392 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 1387 | 1393 | |
| 1388 | 1394 | /* video hardware */ |
| 1389 | 1395 | MCFG_FRAGMENT_ADD( pcvideo_cga ) |
| r14535 | r14536 | |
| 1428 | 1434 | |
| 1429 | 1435 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1430 | 1436 | |
| 1431 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1432 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1433 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1434 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1437 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1438 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1439 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1440 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1441 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1442 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1443 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1444 | MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL ) |
| 1435 | 1445 | |
| 1436 | 1446 | /* video hardware */ |
| 1437 | 1447 | MCFG_FRAGMENT_ADD( pcvideo_cga ) |
| r14535 | r14536 | |
| 1476 | 1486 | |
| 1477 | 1487 | MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface ) |
| 1478 | 1488 | |
| 1479 | | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] ) /* TODO: Verify model */ |
| 1480 | | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] ) /* TODO: Verify model */ |
| 1481 | | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] ) /* TODO: Verify model */ |
| 1482 | | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] ) /* TODO: Verify model */ |
| 1489 | MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1490 | MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1491 | MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1492 | MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz ) /* TODO: Verify model */ |
| 1493 | MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL ) |
| 1494 | MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL ) |
| 1495 | MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL ) |
| 1483 | 1496 | |
| 1484 | 1497 | /* video hardware */ |
| 1485 | 1498 | MCFG_FRAGMENT_ADD( pcvideo_cga ) |