src/mess/machine/6551.c
| r12758 | r12759 | |
| 14 | 14 | |
| 15 | 15 | #include "emu.h" |
| 16 | 16 | #include "6551.h" |
| 17 | | #include "machine/serial.h" |
| 18 | 17 | |
| 19 | 18 | |
| 20 | | /*************************************************************************** |
| 21 | | TYPE DEFINITIONS |
| 22 | | ***************************************************************************/ |
| 19 | //************************************************************************** |
| 20 | // DEVICE DEFINITIONS |
| 21 | //************************************************************************** |
| 23 | 22 | |
| 24 | | typedef struct _acia6551_t acia6551_t; |
| 25 | | struct _acia6551_t |
| 26 | | { |
| 27 | | unsigned char transmit_data_register; |
| 28 | | unsigned char receive_data_register; |
| 29 | | unsigned char status_register; |
| 30 | | unsigned char command_register; |
| 31 | | unsigned char control_register; |
| 23 | const device_type ACIA6551 = &device_creator<acia6551_device>; |
| 32 | 24 | |
| 33 | | /* internal baud rate timer */ |
| 34 | | emu_timer *timer; |
| 35 | | /* callback for internal baud rate timer */ |
| 36 | | void (*acia_updated_callback)(int id, unsigned long State); |
| 25 | //------------------------------------------------- |
| 26 | // acia6551_device - constructor |
| 27 | //------------------------------------------------- |
| 37 | 28 | |
| 38 | | void (*irq_callback)(int); |
| 39 | | |
| 40 | | data_form form; |
| 41 | | |
| 42 | | /* receive register */ |
| 43 | | serial_receive_register receive_reg; |
| 44 | | /* transmit register */ |
| 45 | | serial_transmit_register transmit_reg; |
| 46 | | |
| 47 | | serial_connection connection; |
| 48 | | }; |
| 49 | | |
| 50 | | |
| 51 | | /*************************************************************************** |
| 52 | | FUNCTION PROTOTYPES |
| 53 | | ***************************************************************************/ |
| 54 | | |
| 55 | | static void acia_6551_refresh_ints(device_t *device); |
| 56 | | |
| 57 | | |
| 58 | | |
| 59 | | /*************************************************************************** |
| 60 | | INLINE FUNCTIONS |
| 61 | | ***************************************************************************/ |
| 62 | | |
| 63 | | INLINE acia6551_t *get_token(device_t *device) |
| 29 | acia6551_device::acia6551_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 30 | : device_t(mconfig, ACIA6551, "MOS Technology 6551 ACIA", tag, owner, clock) |
| 64 | 31 | { |
| 65 | | assert(device != NULL); |
| 66 | | assert(device->type() == ACIA6551); |
| 67 | | |
| 68 | | return (acia6551_t *) downcast<legacy_device_base *>(device)->token(); |
| 69 | 32 | } |
| 70 | 33 | |
| 71 | | |
| 72 | | |
| 73 | 34 | /*************************************************************************** |
| 74 | 35 | IMPLEMENTATION |
| 75 | 36 | ***************************************************************************/ |
| r12758 | r12759 | |
| 80 | 41 | -------------------------------------------------*/ |
| 81 | 42 | |
| 82 | 43 | static void acia_6551_in_callback(running_machine &machine, int id, unsigned long state) |
| 83 | | { |
| 84 | | device_t *device; |
| 85 | | acia6551_t *acia; |
| 86 | | |
| 44 | { |
| 87 | 45 | /* NPW 29-Nov-2008 - These two lines are a hack and indicate why our "serial" infrastructure needs to be updated */ |
| 88 | | device = machine.device("acia"); |
| 89 | | acia = get_token(device); |
| 90 | | |
| 91 | | acia->connection.input_state = state; |
| 46 | acia6551_device *acia = machine.device<acia6551_device>("acia"); |
| 47 | acia->get_connection()->input_state = state; |
| 92 | 48 | } |
| 93 | 49 | |
| 94 | 50 | |
| 95 | 51 | |
| 96 | 52 | /*------------------------------------------------- |
| 97 | | TIMER_CALLBACK(acia_6551_timer_callback) |
| 53 | timer_callback |
| 98 | 54 | -------------------------------------------------*/ |
| 99 | | |
| 100 | | static TIMER_CALLBACK(acia_6551_timer_callback) |
| 55 | void acia6551_device::timer_callback() |
| 101 | 56 | { |
| 102 | | device_t *device = (device_t *)ptr; |
| 103 | | acia6551_t *acia = get_token(device); |
| 104 | | |
| 105 | 57 | /* get bit received from other side and update receive register */ |
| 106 | | receive_register_update_bit(&acia->receive_reg, get_in_data_bit(acia->connection.input_state)); |
| 58 | receive_register_update_bit(&m_receive_reg, get_in_data_bit(m_connection.input_state)); |
| 107 | 59 | |
| 108 | | if (acia->receive_reg.flags & RECEIVE_REGISTER_FULL) |
| 60 | if (m_receive_reg.flags & RECEIVE_REGISTER_FULL) |
| 109 | 61 | { |
| 110 | | receive_register_extract(&acia->receive_reg, &acia->form); |
| 111 | | acia_6551_receive_char(device, acia->receive_reg.byte_received); |
| 62 | receive_register_extract(&m_receive_reg, &m_form); |
| 63 | receive_character(m_receive_reg.byte_received); |
| 112 | 64 | } |
| 113 | 65 | |
| 114 | 66 | /* transmit register full? */ |
| 115 | | if ((acia->status_register & (1<<4))==0) |
| 67 | if ((m_status_register & (1<<4))==0) |
| 116 | 68 | { |
| 117 | 69 | /* if transmit reg is empty */ |
| 118 | | if (acia->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY) |
| 70 | if (m_transmit_reg.flags & TRANSMIT_REGISTER_EMPTY) |
| 119 | 71 | { |
| 120 | 72 | /* set it up */ |
| 121 | | transmit_register_setup(&acia->transmit_reg, &acia->form, acia->transmit_data_register); |
| 73 | transmit_register_setup(&m_transmit_reg, &m_form, m_transmit_data_register); |
| 122 | 74 | /* acia transmit reg now empty */ |
| 123 | | acia->status_register |=(1<<4); |
| 75 | m_status_register |=(1<<4); |
| 124 | 76 | /* and refresh ints */ |
| 125 | | acia_6551_refresh_ints(device); |
| 77 | refresh_ints(); |
| 126 | 78 | } |
| 127 | 79 | } |
| 128 | 80 | |
| 129 | 81 | /* if transmit is not empty... transmit data */ |
| 130 | | if ((acia->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 82 | if ((m_transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 131 | 83 | { |
| 132 | 84 | // logerror("UART6551\n"); |
| 133 | | transmit_register_send_bit(machine, &acia->transmit_reg, &acia->connection); |
| 85 | transmit_register_send_bit(machine(), &m_transmit_reg, &m_connection); |
| 134 | 86 | } |
| 135 | 87 | } |
| 136 | 88 | |
| 89 | static TIMER_CALLBACK(acia_6551_timer_callback) |
| 90 | { |
| 91 | reinterpret_cast<acia6551_device *>(ptr)->timer_callback(); |
| 92 | } |
| 137 | 93 | |
| 94 | //------------------------------------------------- |
| 95 | // device_start - device-specific startup |
| 96 | //------------------------------------------------- |
| 138 | 97 | |
| 139 | | /*------------------------------------------------- |
| 140 | | DEVICE_START( acia6551 ) |
| 141 | | -------------------------------------------------*/ |
| 142 | | |
| 143 | | static DEVICE_START( acia6551 ) |
| 98 | void acia6551_device::device_start() |
| 144 | 99 | { |
| 145 | | acia6551_t *acia = get_token(device); |
| 146 | | |
| 147 | 100 | serial_helper_setup(); |
| 148 | 101 | |
| 149 | | memset(acia, 0, sizeof(*acia)); |
| 150 | 102 | /* transmit data reg is empty */ |
| 151 | | acia->status_register |= (1<<4); |
| 152 | | acia->timer = device->machine().scheduler().timer_alloc(FUNC(acia_6551_timer_callback), (void *) device); |
| 103 | m_status_register |= (1<<4); |
| 104 | m_timer = machine().scheduler().timer_alloc(FUNC(acia_6551_timer_callback), (void *) this); |
| 153 | 105 | |
| 154 | | serial_connection_init(device->machine(), &acia->connection); |
| 155 | | serial_connection_set_in_callback(device->machine(), &acia->connection, acia_6551_in_callback); |
| 156 | | transmit_register_reset(&acia->transmit_reg); |
| 157 | | receive_register_reset(&acia->receive_reg); |
| 106 | serial_connection_init(machine(), &m_connection); |
| 107 | serial_connection_set_in_callback(machine(), &m_connection, acia_6551_in_callback); |
| 108 | transmit_register_reset(&m_transmit_reg); |
| 109 | receive_register_reset(&m_receive_reg); |
| 158 | 110 | } |
| 159 | 111 | |
| 160 | 112 | |
| r12758 | r12759 | |
| 163 | 115 | acia_6551_refresh_ints - update interrupt output |
| 164 | 116 | -------------------------------------------------*/ |
| 165 | 117 | |
| 166 | | static void acia_6551_refresh_ints(device_t *device) |
| 118 | void acia6551_device::refresh_ints() |
| 167 | 119 | { |
| 168 | | acia6551_t *acia = get_token(device); |
| 169 | 120 | int interrupt_state; |
| 170 | 121 | |
| 171 | 122 | interrupt_state = 0; |
| r12758 | r12759 | |
| 173 | 124 | /* receive interrupts */ |
| 174 | 125 | |
| 175 | 126 | /* receive data register full? */ |
| 176 | | if (acia->status_register & (1<<3)) |
| 127 | if (m_status_register & (1<<3)) |
| 177 | 128 | { |
| 178 | 129 | /* receiver interrupt enable? */ |
| 179 | | if ((acia->command_register & (1<<1))==0) |
| 130 | if ((m_command_register & (1<<1))==0) |
| 180 | 131 | { |
| 181 | 132 | /* trigger a interrupt */ |
| 182 | 133 | interrupt_state = 1; |
| r12758 | r12759 | |
| 184 | 135 | } |
| 185 | 136 | |
| 186 | 137 | /* set state of irq bit in status register */ |
| 187 | | acia->status_register &= ~(1<<7); |
| 138 | m_status_register &= ~(1<<7); |
| 188 | 139 | |
| 189 | 140 | if (interrupt_state) |
| 190 | 141 | { |
| 191 | | acia->status_register |=(1<<7); |
| 142 | m_status_register |=(1<<7); |
| 192 | 143 | } |
| 193 | 144 | |
| 194 | | if (acia->irq_callback != NULL) |
| 195 | | (*acia->irq_callback)(interrupt_state); |
| 145 | //if (m_irq_callback != NULL) |
| 146 | //(*m_irq_callback)(interrupt_state); |
| 196 | 147 | } |
| 197 | 148 | |
| 198 | 149 | |
| 199 | 150 | |
| 200 | 151 | /*------------------------------------------------- |
| 201 | | acia_6551_receive_char |
| 152 | receive_character |
| 202 | 153 | -------------------------------------------------*/ |
| 203 | 154 | |
| 204 | | extern void acia_6551_receive_char(device_t *device, unsigned char ch) |
| 155 | void acia6551_device::receive_character(UINT8 ch) |
| 205 | 156 | { |
| 206 | | acia6551_t *acia = get_token(device); |
| 207 | | |
| 208 | 157 | /* receive register full? */ |
| 209 | | if (acia->status_register & (1<<3)) |
| 158 | if (m_status_register & (1<<3)) |
| 210 | 159 | { |
| 211 | 160 | /* set overrun error */ |
| 212 | | acia->status_register |= (1<<2); |
| 161 | m_status_register |= (1<<2); |
| 213 | 162 | return; |
| 214 | 163 | } |
| 215 | 164 | |
| 216 | 165 | /* set new byte */ |
| 217 | | acia->receive_data_register = ch; |
| 166 | m_receive_data_register = ch; |
| 218 | 167 | /* receive register is full */ |
| 219 | | acia->status_register |= (1<<3); |
| 168 | m_status_register |= (1<<3); |
| 220 | 169 | /* update ints */ |
| 221 | | acia_6551_refresh_ints(device); |
| 170 | refresh_ints(); |
| 222 | 171 | } |
| 223 | 172 | |
| 224 | 173 | |
| r12758 | r12759 | |
| 227 | 176 | acia_6551_r |
| 228 | 177 | -------------------------------------------------*/ |
| 229 | 178 | |
| 230 | | READ8_DEVICE_HANDLER(acia_6551_r) |
| 179 | READ8_MEMBER(acia6551_device::data_r) |
| 231 | 180 | { |
| 232 | | acia6551_t *acia = get_token(device); |
| 233 | | |
| 234 | 181 | unsigned char data; |
| 235 | 182 | |
| 236 | 183 | data = 0x0ff; |
| r12758 | r12759 | |
| 240 | 187 | { |
| 241 | 188 | /* clear parity error, framing error and overrun error */ |
| 242 | 189 | /* when read of data reigster is done */ |
| 243 | | acia->status_register &=~((1<<0) | (1<<1) | (1<<2)); |
| 190 | m_status_register &=~((1<<0) | (1<<1) | (1<<2)); |
| 244 | 191 | /* clear receive data register full flag */ |
| 245 | | acia->status_register &=~(1<<3); |
| 192 | m_status_register &=~(1<<3); |
| 246 | 193 | /* return data */ |
| 247 | | data = acia->receive_data_register; |
| 194 | data = m_receive_data_register; |
| 248 | 195 | } |
| 249 | 196 | break; |
| 250 | 197 | |
| r12758 | r12759 | |
| 261 | 208 | */ |
| 262 | 209 | case 1: |
| 263 | 210 | { |
| 264 | | data = acia->status_register; |
| 211 | data = m_status_register; |
| 265 | 212 | /* clear interrupt */ |
| 266 | | acia->status_register &= ~(1<<7); |
| 213 | m_status_register &= ~(1<<7); |
| 267 | 214 | } |
| 268 | 215 | break; |
| 269 | 216 | |
| 270 | 217 | case 2: |
| 271 | | data = acia->command_register; |
| 218 | data = m_command_register; |
| 272 | 219 | break; |
| 273 | 220 | |
| 274 | 221 | case 3: |
| 275 | | data = acia->control_register; |
| 222 | data = m_control_register; |
| 276 | 223 | break; |
| 277 | 224 | |
| 278 | 225 | default: |
| r12758 | r12759 | |
| 290 | 237 | acia_6551_update_data_form |
| 291 | 238 | -------------------------------------------------*/ |
| 292 | 239 | |
| 293 | | static void acia_6551_update_data_form(device_t *device) |
| 294 | | { |
| 295 | | acia6551_t *acia = get_token(device); |
| 240 | void acia6551_device::update_data_form() |
| 241 | { |
| 242 | m_form.word_length = 8-((m_control_register>>5) & 0x03); |
| 243 | m_form.stop_bit_count = (m_control_register>>7)+1; |
| 296 | 244 | |
| 297 | | acia->form.word_length = 8-((acia->control_register>>5) & 0x03); |
| 298 | | acia->form.stop_bit_count = (acia->control_register>>7)+1; |
| 299 | | |
| 300 | | if (acia->command_register & (1<<5)) |
| 245 | if (m_command_register & (1<<5)) |
| 301 | 246 | { |
| 302 | | acia->form.parity = SERIAL_PARITY_ODD; |
| 247 | m_form.parity = SERIAL_PARITY_ODD; |
| 303 | 248 | } |
| 304 | 249 | else |
| 305 | 250 | { |
| 306 | | acia->form.parity = SERIAL_PARITY_NONE; |
| 251 | m_form.parity = SERIAL_PARITY_NONE; |
| 307 | 252 | } |
| 308 | 253 | |
| 309 | | receive_register_setup(&acia->receive_reg, &acia->form); |
| 254 | receive_register_setup(&m_receive_reg, &m_form); |
| 310 | 255 | } |
| 311 | 256 | |
| 312 | 257 | |
| r12758 | r12759 | |
| 315 | 260 | acia_6551_w |
| 316 | 261 | -------------------------------------------------*/ |
| 317 | 262 | |
| 318 | | WRITE8_DEVICE_HANDLER(acia_6551_w) |
| 263 | WRITE8_MEMBER(acia6551_device::data_w) |
| 319 | 264 | { |
| 320 | | acia6551_t *acia = get_token(device); |
| 321 | | |
| 322 | 265 | logerror("6551 W %04x %02x\n",offset & 0x03, data); |
| 323 | 266 | |
| 324 | 267 | switch (offset & 0x03) |
| r12758 | r12759 | |
| 326 | 269 | case 0: |
| 327 | 270 | { |
| 328 | 271 | /* clear transmit data register empty */ |
| 329 | | acia->status_register &= ~(1<<4); |
| 272 | m_status_register &= ~(1<<4); |
| 330 | 273 | /* store byte */ |
| 331 | | acia->transmit_data_register = data; |
| 274 | m_transmit_data_register = data; |
| 332 | 275 | |
| 333 | 276 | } |
| 334 | 277 | break; |
| r12758 | r12759 | |
| 370 | 313 | |
| 371 | 314 | case 2: |
| 372 | 315 | { |
| 373 | | acia->command_register = data; |
| 316 | m_command_register = data; |
| 374 | 317 | |
| 375 | 318 | /* update state of dtr */ |
| 376 | | acia->connection.State &=~SERIAL_STATE_DTR; |
| 377 | | if (acia->command_register & (1<<0)) |
| 319 | m_connection.State &=~SERIAL_STATE_DTR; |
| 320 | if (m_command_register & (1<<0)) |
| 378 | 321 | { |
| 379 | | acia->connection.State |=SERIAL_STATE_DTR; |
| 322 | m_connection.State |=SERIAL_STATE_DTR; |
| 380 | 323 | } |
| 381 | 324 | |
| 382 | 325 | /* update state of rts */ |
| 383 | | switch ((acia->command_register>>2) & 0x03) |
| 326 | switch ((m_command_register>>2) & 0x03) |
| 384 | 327 | { |
| 385 | 328 | case 0: |
| 386 | 329 | { |
| 387 | | acia->connection.State &=~SERIAL_STATE_RTS; |
| 330 | m_connection.State &=~SERIAL_STATE_RTS; |
| 388 | 331 | } |
| 389 | 332 | break; |
| 390 | 333 | |
| r12758 | r12759 | |
| 392 | 335 | case 2: |
| 393 | 336 | case 3: |
| 394 | 337 | { |
| 395 | | acia->connection.State |=SERIAL_STATE_RTS; |
| 338 | m_connection.State |=SERIAL_STATE_RTS; |
| 396 | 339 | } |
| 397 | 340 | break; |
| 398 | 341 | } |
| 399 | 342 | |
| 400 | | serial_connection_out(device->machine(), &acia->connection); |
| 343 | serial_connection_out(machine(), &m_connection); |
| 401 | 344 | |
| 402 | | acia_6551_update_data_form(device); |
| 345 | update_data_form(); |
| 403 | 346 | } |
| 404 | 347 | break; |
| 405 | 348 | |
| r12758 | r12759 | |
| 441 | 384 | { |
| 442 | 385 | unsigned char previous_control_register; |
| 443 | 386 | |
| 444 | | previous_control_register = acia->control_register; |
| 387 | previous_control_register = m_control_register; |
| 445 | 388 | |
| 446 | 389 | if (((previous_control_register^data) & 0x07)!=0) |
| 447 | 390 | { |
| r12758 | r12759 | |
| 450 | 393 | rate = data & 0x07; |
| 451 | 394 | |
| 452 | 395 | /* baud rate changed? */ |
| 453 | | acia->timer->reset(); |
| 396 | m_timer->reset(); |
| 454 | 397 | |
| 455 | 398 | if (rate==0) |
| 456 | 399 | { |
| r12758 | r12759 | |
| 556 | 499 | break; |
| 557 | 500 | } |
| 558 | 501 | |
| 559 | | acia->timer->adjust(attotime::zero, 0, attotime::from_hz(baud_rate)); |
| 502 | m_timer->adjust(attotime::zero, 0, attotime::from_hz(baud_rate)); |
| 560 | 503 | } |
| 561 | 504 | } |
| 562 | 505 | |
| 563 | | acia->control_register = data; |
| 564 | | acia_6551_update_data_form(device); |
| 506 | m_control_register = data; |
| 507 | update_data_form(); |
| 565 | 508 | } |
| 566 | 509 | break; |
| 567 | 510 | |
| r12758 | r12759 | |
| 573 | 516 | |
| 574 | 517 | |
| 575 | 518 | /*------------------------------------------------- |
| 576 | | acia_6551_connect_to_serial_device |
| 519 | connect_to_serial_device |
| 577 | 520 | -------------------------------------------------*/ |
| 578 | 521 | |
| 579 | | void acia_6551_connect_to_serial_device(device_t *device, device_t *image) |
| 522 | void acia6551_device::connect_to_serial_device(device_t *image) |
| 580 | 523 | { |
| 581 | | acia6551_t *acia = get_token(device); |
| 582 | | serial_device_connect(image, &acia->connection); |
| 583 | | } |
| 584 | | |
| 585 | | |
| 586 | | |
| 587 | | /*------------------------------------------------- |
| 588 | | DEVICE_GET_INFO( acia6551 ) |
| 589 | | -------------------------------------------------*/ |
| 590 | | |
| 591 | | DEVICE_GET_INFO( acia6551 ) |
| 592 | | { |
| 593 | | switch (state) |
| 594 | | { |
| 595 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 596 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(acia6551_t); break; |
| 597 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 598 | | |
| 599 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 600 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(acia6551); break; |
| 601 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 602 | | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 603 | | |
| 604 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 605 | | case DEVINFO_STR_NAME: strcpy(info->s, "MOS Technology 6551 ACIA"); break; |
| 606 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "MOS Technology 6551 ACIA"); break; |
| 607 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 608 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 609 | | case DEVINFO_STR_CREDITS: /* Nothing */ break; |
| 610 | | } |
| 611 | | } |
| 612 | | |
| 613 | | DEFINE_LEGACY_DEVICE(ACIA6551, acia6551); |
| 524 | serial_device_connect(image, &m_connection); |
| 525 | } |
| | No newline at end of file |
src/mess/drivers/coco.c
| r12758 | r12759 | |
| 161 | 161 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank15") |
| 162 | 162 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK("bank16") |
| 163 | 163 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE_MODERN("pia_0", pia6821_device, read, write) AM_MIRROR(0x0018) |
| 164 | | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w) AM_MIRROR(0x0018) |
| 164 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE_MODERN("acia", acia6551_device, data_r, data_w) AM_MIRROR(0x0018) |
| 165 | 165 | AM_RANGE(0xff20, 0xff3f) AM_DEVREAD_MODERN("pia_1", pia6821_device, read) AM_DEVWRITE("pia_1", coco_pia_1_w) |
| 166 | 166 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE_MODERN("ext", cococart_slot_device, read, write) |
| 167 | 167 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| r12758 | r12759 | |
| 195 | 195 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank15") |
| 196 | 196 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK("bank16") |
| 197 | 197 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE_MODERN("pia_0", pia6821_device, read, write) AM_MIRROR(0x0018) |
| 198 | | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w) AM_MIRROR(0x0018) |
| 198 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE_MODERN("acia", acia6551_device, data_r, data_w) AM_MIRROR(0x0018) |
| 199 | 199 | AM_RANGE(0xff20, 0xff3f) AM_DEVREAD_MODERN("pia_1", pia6821_device, read) AM_DEVWRITE("pia_1", coco_pia_1_w) |
| 200 | 200 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE_MODERN("ext", cococart_slot_device, read, write) |
| 201 | 201 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| r12758 | r12759 | |
| 273 | 273 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK("bank15") |
| 274 | 274 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK("bank16") |
| 275 | 275 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE_MODERN("pia_0", pia6821_device, read, write) |
| 276 | | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w) |
| 276 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE_MODERN("acia", acia6551_device, data_r, data_w) |
| 277 | 277 | AM_RANGE(0xff20, 0xff23) AM_DEVREAD_MODERN("pia_1", pia6821_device, read) AM_DEVWRITE("pia_1", coco_pia_1_w) |
| 278 | 278 | AM_RANGE(0xff24, 0xff27) AM_DEVREADWRITE_MODERN("pia_2", pia6821_device, read, write) /* Third PIA on Dragon Alpha */ |
| 279 | 279 | AM_RANGE(0Xff28, 0xff2b) AM_READWRITE(dgnalpha_modem_r, dgnalpha_modem_w) /* Modem, dummy to stop eror log ! */ |
src/mess/drivers/thomson.c
| r12758 | r12759 | |
| 329 | 329 | AM_RANGE ( 0xe7cc, 0xe7cf ) AM_DEVREADWRITE_MODERN( "pia_1", pia6821_device, read_alt, write_alt ) |
| 330 | 330 | AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w ) |
| 331 | 331 | AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE_MODERN( "pia_2", pia6821_device, read_alt, write_alt ) |
| 332 | | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 332 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 333 | 333 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 334 | 334 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt ) |
| 335 | 335 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, |
| r12758 | r12759 | |
| 773 | 773 | AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_DEVREADWRITE_MODERN( "pia_2", pia6821_device, read_alt, write_alt ) |
| 774 | 774 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r, |
| 775 | 775 | to770_gatearray_w ) |
| 776 | | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 776 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 777 | 777 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 778 | 778 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt ) |
| 779 | 779 | AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r, |
| r12758 | r12759 | |
| 961 | 961 | AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_DEVREADWRITE_MODERN( "pia_2", pia6821_device, read_alt, write_alt ) |
| 962 | 962 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo5_gatearray_r, |
| 963 | 963 | mo5_gatearray_w ) |
| 964 | | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 964 | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 965 | 965 | AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 966 | 966 | AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_r, mea8000_w) |
| 967 | 967 | AM_RANGE ( 0xb000, 0xefff ) AM_READ_BANK ( THOM_CART_BANK) AM_WRITE( mo5_cartridge_w ) |
| r12758 | r12759 | |
| 1163 | 1163 | AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w ) |
| 1164 | 1164 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to9_gatearray_r, |
| 1165 | 1165 | to9_gatearray_w ) |
| 1166 | | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 1166 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 1167 | 1167 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1168 | 1168 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1169 | 1169 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt) |
| r12758 | r12759 | |
| 1488 | 1488 | AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w ) |
| 1489 | 1489 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, |
| 1490 | 1490 | to8_gatearray_w ) |
| 1491 | | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 1491 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 1492 | 1492 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1493 | 1493 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1494 | 1494 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt) |
| r12758 | r12759 | |
| 1686 | 1686 | AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w ) |
| 1687 | 1687 | AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r, |
| 1688 | 1688 | to8_gatearray_w ) |
| 1689 | | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 1689 | AM_RANGE ( 0xe7e8, 0xe7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 1690 | 1690 | /* AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 1691 | 1691 | AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1692 | 1692 | AM_RANGE ( 0xe7f8, 0xe7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt) |
| r12758 | r12759 | |
| 1848 | 1848 | AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w ) |
| 1849 | 1849 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, |
| 1850 | 1850 | mo6_gatearray_w ) |
| 1851 | | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 1851 | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 1852 | 1852 | /* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w )*/ |
| 1853 | 1853 | AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 1854 | 1854 | AM_RANGE ( 0xa7fe, 0xa7ff ) AM_DEVREADWRITE("mea8000", mea8000_r, mea8000_w) |
| r12758 | r12759 | |
| 2162 | 2162 | AM_RANGE ( 0xa7e3, 0xa7e3 ) AM_READWRITE ( mo5nr_prn_r, mo5nr_prn_w ) |
| 2163 | 2163 | AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r, |
| 2164 | 2164 | mo6_gatearray_w ) |
| 2165 | | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE("acia", acia_6551_r, acia_6551_w ) |
| 2165 | AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE_MODERN( "acia", acia6551_device, data_r, data_w ) |
| 2166 | 2166 | /* AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */ |
| 2167 | 2167 | AM_RANGE ( 0xa7f2, 0xa7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w ) |
| 2168 | 2168 | AM_RANGE ( 0xa7f8, 0xa7fb ) AM_DEVREADWRITE_MODERN( "pia_3", pia6821_device, read_alt, write_alt) |
src/mess/drivers/digel804.c
| r12758 | r12759 | |
| 72 | 72 | required_device<cpu_device> m_maincpu; |
| 73 | 73 | required_device<device_t> m_terminal; |
| 74 | 74 | required_device<device_t> m_speaker; |
| 75 | | required_device<device_t> m_acia; |
| 75 | required_device<acia6551_device> m_acia; |
| 76 | 76 | DECLARE_WRITE8_MEMBER( port_43_w ); |
| 77 | 77 | DECLARE_READ8_MEMBER( port_43_r ); |
| 78 | 78 | DECLARE_WRITE8_MEMBER( port_44_w ); |
| r12758 | r12759 | |
| 261 | 261 | /* ACIA Trampolines */ |
| 262 | 262 | READ8_MEMBER( digel804_state::acia_rxd_r ) |
| 263 | 263 | { |
| 264 | | return acia_6551_r(m_acia, 0); |
| 264 | return m_acia->data_r(space, 0); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | WRITE8_MEMBER( digel804_state::acia_txd_w ) |
| 268 | 268 | { |
| 269 | | acia_6551_w(m_acia, 0, data); |
| 269 | m_acia->data_w(space, 0, data); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | READ8_MEMBER( digel804_state::acia_status_r ) |
| 273 | 273 | { |
| 274 | | return acia_6551_r(m_acia, 1); |
| 274 | return m_acia->data_r(space, 1); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | WRITE8_MEMBER( digel804_state::acia_reset_w ) |
| 278 | 278 | { |
| 279 | | acia_6551_w(m_acia, 1, data); |
| 279 | m_acia->data_w(space, 1, data); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | READ8_MEMBER( digel804_state::acia_command_r ) |
| 283 | 283 | { |
| 284 | | return acia_6551_r(m_acia, 2); |
| 284 | return m_acia->data_r(space, 2); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | WRITE8_MEMBER( digel804_state::acia_command_w ) |
| 288 | 288 | { |
| 289 | | acia_6551_w(m_acia, 2, data); |
| 289 | m_acia->data_w(space, 2, data); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | READ8_MEMBER( digel804_state::acia_control_r ) |
| 293 | 293 | { |
| 294 | | return acia_6551_r(m_acia, 3); |
| 294 | return m_acia->data_r(space, 3); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | WRITE8_MEMBER( digel804_state::acia_control_w ) |
| 298 | 298 | { |
| 299 | | acia_6551_w(m_acia, 3, data); |
| 299 | m_acia->data_w(space, 3, data); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /****************************************************************************** |
| r12758 | r12759 | |
| 355 | 355 | AM_RANGE(0x85, 0x85) AM_MIRROR(0x38) AM_READ(acia_command_r) // (ACIA command reg) |
| 356 | 356 | AM_RANGE(0x86, 0x86) AM_MIRROR(0x38) AM_WRITE(acia_control_w) // (ACIA control reg) |
| 357 | 357 | AM_RANGE(0x87, 0x87) AM_MIRROR(0x38) AM_READ(acia_control_r) // (ACIA control reg) |
| 358 | | //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE_LEGACY("acia", acia_6551_r, acia_6551_w) // this doesn't work since we lack an AM_SHIFT command |
| 358 | //AM_RANGE(0x80,0x87) AM_MIRROR(0x38) AM_SHIFT(-1) AM_DEVREADWRITE("acia", acia6551_device, data_r, data_w) // this doesn't work since we lack an AM_SHIFT command |
| 359 | 359 | |
| 360 | 360 | ADDRESS_MAP_END |
| 361 | 361 | |
| r12758 | r12759 | |
| 371 | 371 | ******************************************************************************/ |
| 372 | 372 | static WRITE8_DEVICE_HANDLER( digel804_serial_put ) |
| 373 | 373 | { |
| 374 | | acia_6551_receive_char(device->machine().device("acia"), data); |
| 374 | digel804_state *state = device->machine().driver_data<digel804_state>(); |
| 375 | state->m_acia->receive_character(data); |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | 378 | static GENERIC_TERMINAL_INTERFACE( digel804_terminal_intf ) |