trunk/src/emu/addrmap.c
| r18153 | r18154 | |
| 56 | 56 | m_addrmirror(0), |
| 57 | 57 | m_addrmask(0), |
| 58 | 58 | m_share(NULL), |
| 59 | | m_baseptr(NULL), |
| 60 | | m_sizeptr(NULL), |
| 61 | | m_baseptroffs_plus1(0), |
| 62 | | m_sizeptroffs_plus1(0), |
| 63 | 59 | m_region(NULL), |
| 64 | 60 | m_rgnoffs(0), |
| 65 | 61 | m_rspace8(NULL), |
| r18153 | r18154 | |
| 96 | 92 | // an I/O port |
| 97 | 93 | //------------------------------------------------- |
| 98 | 94 | |
| 99 | | void address_map_entry::set_read_port(const device_t &device, const char *tag) |
| 95 | void address_map_entry::set_read_port(device_t &device, const char *tag) |
| 100 | 96 | { |
| 101 | 97 | m_read.m_type = AMH_PORT; |
| 102 | | device.subtag(m_read.m_tag, tag); |
| 98 | m_read.m_tag = tag; |
| 99 | m_read.m_devbase = &device; |
| 103 | 100 | } |
| 104 | 101 | |
| 105 | 102 | |
| r18153 | r18154 | |
| 108 | 105 | // an I/O port |
| 109 | 106 | //------------------------------------------------- |
| 110 | 107 | |
| 111 | | void address_map_entry::set_write_port(const device_t &device, const char *tag) |
| 108 | void address_map_entry::set_write_port(device_t &device, const char *tag) |
| 112 | 109 | { |
| 113 | 110 | m_write.m_type = AMH_PORT; |
| 114 | | device.subtag(m_write.m_tag, tag); |
| 111 | m_write.m_tag = tag; |
| 112 | m_write.m_devbase = &device; |
| 115 | 113 | } |
| 116 | 114 | |
| 117 | 115 | |
| r18153 | r18154 | |
| 120 | 118 | // reading and writing an I/O port |
| 121 | 119 | //------------------------------------------------- |
| 122 | 120 | |
| 123 | | void address_map_entry::set_readwrite_port(const device_t &device, const char *tag) |
| 121 | void address_map_entry::set_readwrite_port(device_t &device, const char *tag) |
| 124 | 122 | { |
| 125 | 123 | m_read.m_type = AMH_PORT; |
| 126 | | device.subtag(m_read.m_tag, tag); |
| 124 | m_read.m_tag = tag; |
| 125 | m_read.m_devbase = &device; |
| 127 | 126 | m_write.m_type = AMH_PORT; |
| 128 | | device.subtag(m_write.m_tag, tag); |
| 127 | m_write.m_tag = tag; |
| 128 | m_write.m_devbase = &device; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| r18153 | r18154 | |
| 134 | 134 | // from a memory bank |
| 135 | 135 | //------------------------------------------------- |
| 136 | 136 | |
| 137 | | void address_map_entry::set_read_bank(const device_t &device, const char *tag) |
| 137 | void address_map_entry::set_read_bank(device_t &device, const char *tag) |
| 138 | 138 | { |
| 139 | 139 | m_read.m_type = AMH_BANK; |
| 140 | | device.subtag(m_read.m_tag, tag); |
| 140 | m_read.m_tag = tag; |
| 141 | m_read.m_devbase = &device; |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | 144 | |
| r18153 | r18154 | |
| 146 | 147 | // to a memory bank |
| 147 | 148 | //------------------------------------------------- |
| 148 | 149 | |
| 149 | | void address_map_entry::set_write_bank(const device_t &device, const char *tag) |
| 150 | void address_map_entry::set_write_bank(device_t &device, const char *tag) |
| 150 | 151 | { |
| 151 | 152 | m_write.m_type = AMH_BANK; |
| 152 | | device.subtag(m_write.m_tag, tag); |
| 153 | m_write.m_tag = tag; |
| 154 | m_write.m_devbase = &device; |
| 153 | 155 | } |
| 154 | 156 | |
| 155 | 157 | |
| r18153 | r18154 | |
| 158 | 160 | // reading and writing to a memory bank |
| 159 | 161 | //------------------------------------------------- |
| 160 | 162 | |
| 161 | | void address_map_entry::set_readwrite_bank(const device_t &device, const char *tag) |
| 163 | void address_map_entry::set_readwrite_bank(device_t &device, const char *tag) |
| 162 | 164 | { |
| 163 | 165 | m_read.m_type = AMH_BANK; |
| 164 | | device.subtag(m_read.m_tag, tag); |
| 166 | m_read.m_tag = tag; |
| 167 | m_read.m_devbase = &device; |
| 165 | 168 | m_write.m_type = AMH_BANK; |
| 166 | | device.subtag(m_write.m_tag, tag); |
| 169 | m_write.m_tag = tag; |
| 170 | m_write.m_devbase = &device; |
| 167 | 171 | } |
| 168 | 172 | |
| 169 | 173 | |
| r18153 | r18154 | |
| 172 | 176 | // retrieve a submap from a device |
| 173 | 177 | //------------------------------------------------- |
| 174 | 178 | |
| 175 | | void address_map_entry::set_submap(const device_t &device, const char *tag, address_map_delegate func, int bits, UINT64 mask) |
| 179 | void address_map_entry::set_submap(device_t &device, const char *tag, address_map_delegate func, int bits, UINT64 mask) |
| 176 | 180 | { |
| 177 | 181 | if(!bits) |
| 178 | 182 | bits = m_map.m_databits; |
| r18153 | r18154 | |
| 180 | 184 | assert(unitmask_is_appropriate(bits, mask, func.name())); |
| 181 | 185 | |
| 182 | 186 | m_read.m_type = AMH_DEVICE_SUBMAP; |
| 183 | | device.subtag(m_read.m_tag, tag); |
| 187 | m_read.m_tag = tag; |
| 188 | m_read.m_devbase = &device; |
| 184 | 189 | m_read.m_mask = mask; |
| 185 | 190 | m_write.m_type = AMH_DEVICE_SUBMAP; |
| 186 | | device.subtag(m_write.m_tag, tag); |
| 191 | m_write.m_tag = tag; |
| 192 | m_write.m_devbase = &device; |
| 187 | 193 | m_write.m_mask = mask; |
| 188 | 194 | m_submap_delegate = func; |
| 189 | 195 | m_submap_bits = bits; |
| r18153 | r18154 | |
| 226 | 232 | } |
| 227 | 233 | |
| 228 | 234 | |
| 229 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 unitmask) |
| 235 | void address_map_entry::internal_set_handler(device_t &device, read8_delegate func, UINT64 unitmask) |
| 230 | 236 | { |
| 231 | 237 | assert(!func.isnull()); |
| 232 | 238 | assert(unitmask_is_appropriate(8, unitmask, func.name())); |
| r18153 | r18154 | |
| 234 | 240 | m_read.m_bits = 8; |
| 235 | 241 | m_read.m_mask = unitmask; |
| 236 | 242 | m_read.m_name = func.name(); |
| 237 | | device.subtag(m_read.m_tag, tag); |
| 243 | m_read.m_devbase = &device; |
| 238 | 244 | m_rproto8 = func; |
| 239 | 245 | } |
| 240 | 246 | |
| 241 | 247 | |
| 242 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 unitmask) |
| 248 | void address_map_entry::internal_set_handler(device_t &device, write8_delegate func, UINT64 unitmask) |
| 243 | 249 | { |
| 244 | 250 | assert(!func.isnull()); |
| 245 | 251 | assert(unitmask_is_appropriate(8, unitmask, func.name())); |
| r18153 | r18154 | |
| 247 | 253 | m_write.m_bits = 8; |
| 248 | 254 | m_write.m_mask = unitmask; |
| 249 | 255 | m_write.m_name = func.name(); |
| 250 | | device.subtag(m_write.m_tag, tag); |
| 256 | m_write.m_devbase = &device; |
| 251 | 257 | m_wproto8 = func; |
| 252 | 258 | } |
| 253 | 259 | |
| 254 | 260 | |
| 255 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask) |
| 261 | void address_map_entry::internal_set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask) |
| 256 | 262 | { |
| 257 | | internal_set_handler(device, tag, rfunc, unitmask); |
| 258 | | internal_set_handler(device, tag, wfunc, unitmask); |
| 263 | internal_set_handler(device, rfunc, unitmask); |
| 264 | internal_set_handler(device, wfunc, unitmask); |
| 259 | 265 | } |
| 260 | 266 | |
| 261 | 267 | |
| r18153 | r18154 | |
| 295 | 301 | } |
| 296 | 302 | |
| 297 | 303 | |
| 298 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 unitmask) |
| 304 | void address_map_entry::internal_set_handler(device_t &device, read16_delegate func, UINT64 unitmask) |
| 299 | 305 | { |
| 300 | 306 | assert(!func.isnull()); |
| 301 | 307 | assert(unitmask_is_appropriate(16, unitmask, func.name())); |
| r18153 | r18154 | |
| 303 | 309 | m_read.m_bits = 16; |
| 304 | 310 | m_read.m_mask = unitmask; |
| 305 | 311 | m_read.m_name = func.name(); |
| 306 | | device.subtag(m_read.m_tag, tag); |
| 312 | m_read.m_devbase = &device; |
| 307 | 313 | m_rproto16 = func; |
| 308 | 314 | } |
| 309 | 315 | |
| 310 | 316 | |
| 311 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 unitmask) |
| 317 | void address_map_entry::internal_set_handler(device_t &device, write16_delegate func, UINT64 unitmask) |
| 312 | 318 | { |
| 313 | 319 | assert(!func.isnull()); |
| 314 | 320 | assert(unitmask_is_appropriate(16, unitmask, func.name())); |
| r18153 | r18154 | |
| 316 | 322 | m_write.m_bits = 16; |
| 317 | 323 | m_write.m_mask = unitmask; |
| 318 | 324 | m_write.m_name = func.name(); |
| 319 | | device.subtag(m_write.m_tag, tag); |
| 325 | m_write.m_devbase = &device; |
| 320 | 326 | m_wproto16 = func; |
| 321 | 327 | } |
| 322 | 328 | |
| 323 | 329 | |
| 324 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask) |
| 330 | void address_map_entry::internal_set_handler(device_t &device, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask) |
| 325 | 331 | { |
| 326 | | internal_set_handler(device, tag, rfunc, unitmask); |
| 327 | | internal_set_handler(device, tag, wfunc, unitmask); |
| 332 | internal_set_handler(device, rfunc, unitmask); |
| 333 | internal_set_handler(device, wfunc, unitmask); |
| 328 | 334 | } |
| 329 | 335 | |
| 330 | 336 | |
| r18153 | r18154 | |
| 364 | 370 | } |
| 365 | 371 | |
| 366 | 372 | |
| 367 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 unitmask) |
| 373 | void address_map_entry::internal_set_handler(device_t &device, read32_delegate func, UINT64 unitmask) |
| 368 | 374 | { |
| 369 | 375 | assert(!func.isnull()); |
| 370 | 376 | assert(unitmask_is_appropriate(32, unitmask, func.name())); |
| r18153 | r18154 | |
| 372 | 378 | m_read.m_bits = 32; |
| 373 | 379 | m_read.m_mask = unitmask; |
| 374 | 380 | m_read.m_name = func.name(); |
| 375 | | device.subtag(m_read.m_tag, tag); |
| 381 | m_read.m_devbase = &device; |
| 376 | 382 | m_rproto32 = func; |
| 377 | 383 | } |
| 378 | 384 | |
| 379 | 385 | |
| 380 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 unitmask) |
| 386 | void address_map_entry::internal_set_handler(device_t &device, write32_delegate func, UINT64 unitmask) |
| 381 | 387 | { |
| 382 | 388 | assert(!func.isnull()); |
| 383 | 389 | assert(unitmask_is_appropriate(32, unitmask, func.name())); |
| r18153 | r18154 | |
| 385 | 391 | m_write.m_bits = 32; |
| 386 | 392 | m_write.m_mask = unitmask; |
| 387 | 393 | m_write.m_name = func.name(); |
| 388 | | device.subtag(m_write.m_tag, tag); |
| 394 | m_write.m_devbase = &device; |
| 389 | 395 | m_wproto32 = func; |
| 390 | 396 | } |
| 391 | 397 | |
| 392 | 398 | |
| 393 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask) |
| 399 | void address_map_entry::internal_set_handler(device_t &device, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask) |
| 394 | 400 | { |
| 395 | | internal_set_handler(device, tag, rfunc, unitmask); |
| 396 | | internal_set_handler(device, tag, wfunc, unitmask); |
| 401 | internal_set_handler(device, rfunc, unitmask); |
| 402 | internal_set_handler(device, wfunc, unitmask); |
| 397 | 403 | } |
| 398 | 404 | |
| 399 | 405 | |
| r18153 | r18154 | |
| 433 | 439 | } |
| 434 | 440 | |
| 435 | 441 | |
| 436 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_delegate func, UINT64 unitmask) |
| 442 | void address_map_entry::internal_set_handler(device_t &device, read64_delegate func, UINT64 unitmask) |
| 437 | 443 | { |
| 438 | 444 | assert(!func.isnull()); |
| 439 | 445 | assert(unitmask_is_appropriate(64, unitmask, func.name())); |
| r18153 | r18154 | |
| 441 | 447 | m_read.m_bits = 64; |
| 442 | 448 | m_read.m_mask = 0; |
| 443 | 449 | m_read.m_name = func.name(); |
| 444 | | device.subtag(m_read.m_tag, tag); |
| 450 | m_read.m_devbase = &device; |
| 445 | 451 | m_rproto64 = func; |
| 446 | 452 | } |
| 447 | 453 | |
| 448 | 454 | |
| 449 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, write64_delegate func, UINT64 unitmask) |
| 455 | void address_map_entry::internal_set_handler(device_t &device, write64_delegate func, UINT64 unitmask) |
| 450 | 456 | { |
| 451 | 457 | assert(!func.isnull()); |
| 452 | 458 | assert(unitmask_is_appropriate(64, unitmask, func.name())); |
| r18153 | r18154 | |
| 454 | 460 | m_write.m_bits = 64; |
| 455 | 461 | m_write.m_mask = 0; |
| 456 | 462 | m_write.m_name = func.name(); |
| 457 | | device.subtag(m_write.m_tag, tag); |
| 463 | m_write.m_devbase = &device; |
| 458 | 464 | m_wproto64 = func; |
| 459 | 465 | } |
| 460 | 466 | |
| 461 | 467 | |
| 462 | | void address_map_entry::internal_set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask) |
| 468 | void address_map_entry::internal_set_handler(device_t &device, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask) |
| 463 | 469 | { |
| 464 | | internal_set_handler(device, tag, rfunc, unitmask); |
| 465 | | internal_set_handler(device, tag, wfunc, unitmask); |
| 470 | internal_set_handler(device, rfunc, unitmask); |
| 471 | internal_set_handler(device, wfunc, unitmask); |
| 466 | 472 | } |
| 467 | 473 | |
| 468 | 474 | |
| r18153 | r18154 | |
| 552 | 558 | // address_map - constructor |
| 553 | 559 | //------------------------------------------------- |
| 554 | 560 | |
| 555 | | address_map::address_map(const device_t &device, address_spacenum spacenum) |
| 561 | address_map::address_map(device_t &device, address_spacenum spacenum) |
| 556 | 562 | : m_spacenum(spacenum), |
| 557 | 563 | m_databits(0xff), |
| 558 | 564 | m_unmapval(0), |
| r18153 | r18154 | |
| 587 | 593 | // address_map - constructor in the submap case |
| 588 | 594 | //------------------------------------------------- |
| 589 | 595 | |
| 590 | | address_map::address_map(const device_t &device, address_map_entry *entry) |
| 596 | address_map::address_map(device_t &device, address_map_entry *entry) |
| 591 | 597 | : m_spacenum(AS_PROGRAM), |
| 592 | 598 | m_databits(0xff), |
| 593 | 599 | m_unmapval(0), |
| 594 | 600 | m_globalmask(0) |
| 595 | 601 | { |
| 596 | 602 | // Retrieve the submap |
| 597 | | entry->m_submap_delegate.late_bind(const_cast<device_t &>(device)); |
| 603 | entry->m_submap_delegate.late_bind(device); |
| 598 | 604 | entry->m_submap_delegate(*this, device); |
| 599 | 605 | } |
| 600 | 606 | |
| r18153 | r18154 | |
| 604 | 610 | // address_map - constructor dynamic device mapping case |
| 605 | 611 | //---------------------------------------------------------- |
| 606 | 612 | |
| 607 | | address_map::address_map(const address_space &space, offs_t start, offs_t end, int bits, UINT64 unitmask, const device_t &device, address_map_delegate submap_delegate) |
| 613 | address_map::address_map(const address_space &space, offs_t start, offs_t end, int bits, UINT64 unitmask, device_t &device, address_map_delegate submap_delegate) |
| 608 | 614 | : m_spacenum(space.spacenum()), |
| 609 | 615 | m_databits(space.data_width()), |
| 610 | 616 | m_unmapval(space.unmap()), |
trunk/src/emu/addrmap.h
| r18153 | r18154 | |
| 81 | 81 | : m_type(AMH_NONE), |
| 82 | 82 | m_bits(0), |
| 83 | 83 | m_mask(0), |
| 84 | | m_name(NULL) { } |
| 84 | m_name(NULL), |
| 85 | m_devbase(NULL), |
| 86 | m_tag(NULL) { } |
| 85 | 87 | |
| 86 | 88 | map_handler_type m_type; // type of the handler |
| 87 | 89 | UINT8 m_bits; // width of the handler in bits, or 0 for default |
| 88 | 90 | UINT64 m_mask; // mask for which lanes apply |
| 89 | 91 | const char * m_name; // name of the handler |
| 90 | | astring m_tag; // path to the target tag |
| 92 | device_t * m_devbase; // pointer to "base" device |
| 93 | const char * m_tag; // tag for I/O ports and banks |
| 91 | 94 | }; |
| 92 | 95 | |
| 93 | 96 | |
| r18153 | r18154 | |
| 110 | 113 | void set_write_type(map_handler_type _type) { m_write.m_type = _type; } |
| 111 | 114 | void set_region(const char *tag, offs_t offset) { m_region = tag; m_rgnoffs = offset; } |
| 112 | 115 | void set_share(const char *tag) { assert(m_share == NULL); m_share = tag; } |
| 113 | | void set_sizeptr(size_t *_sizeptr) { m_sizeptr = _sizeptr; } |
| 114 | | void set_member_baseptr(FPTR offs) { m_baseptroffs_plus1 = offs + 1; } |
| 115 | | void set_member_sizeptr(FPTR offs) { m_sizeptroffs_plus1 = offs + 1; } |
| 116 | 116 | |
| 117 | 117 | // mask setting |
| 118 | 118 | void set_mask(offs_t _mask); |
| 119 | 119 | |
| 120 | 120 | // I/O port configuration |
| 121 | | void set_read_port(const device_t &device, const char *tag); |
| 122 | | void set_write_port(const device_t &device, const char *tag); |
| 123 | | void set_readwrite_port(const device_t &device, const char *tag); |
| 121 | void set_read_port(device_t &device, const char *tag); |
| 122 | void set_write_port(device_t &device, const char *tag); |
| 123 | void set_readwrite_port(device_t &device, const char *tag); |
| 124 | 124 | |
| 125 | 125 | // memory bank configuration |
| 126 | | void set_read_bank(const device_t &device, const char *tag); |
| 127 | | void set_write_bank(const device_t &device, const char *tag); |
| 128 | | void set_readwrite_bank(const device_t &device, const char *tag); |
| 126 | void set_read_bank(device_t &device, const char *tag); |
| 127 | void set_write_bank(device_t &device, const char *tag); |
| 128 | void set_readwrite_bank(device_t &device, const char *tag); |
| 129 | 129 | |
| 130 | 130 | // submap referencing |
| 131 | | void set_submap(const device_t &device, const char *tag, address_map_delegate func, int bits, UINT64 mask); |
| 131 | void set_submap(device_t &device, const char *tag, address_map_delegate func, int bits, UINT64 mask); |
| 132 | 132 | |
| 133 | 133 | // public state |
| 134 | 134 | address_map_entry * m_next; // pointer to the next entry |
| r18153 | r18154 | |
| 143 | 143 | map_handler_data m_read; // data for read handler |
| 144 | 144 | map_handler_data m_write; // data for write handler |
| 145 | 145 | const char * m_share; // tag of a shared memory block |
| 146 | | void ** m_baseptr; // receives pointer to memory (optional) |
| 147 | | size_t * m_sizeptr; // receives size of area in bytes (optional) |
| 148 | | UINT32 m_baseptroffs_plus1; // offset of base pointer within driver_data, plus 1 |
| 149 | | UINT32 m_sizeptroffs_plus1; // offset of size pointer within driver_data, plus 1 |
| 150 | 146 | const char * m_region; // tag of region containing the memory backing this entry |
| 151 | 147 | offs_t m_rgnoffs; // offset within the region |
| 152 | 148 | |
| r18153 | r18154 | |
| 179 | 175 | offs_t m_bytemask; // byte-adjusted mask bits |
| 180 | 176 | |
| 181 | 177 | protected: |
| 182 | | // internal base pointer setting (derived classes provide typed versions) |
| 183 | | void internal_set_baseptr(void **_baseptr) { m_baseptr = _baseptr; } |
| 184 | | |
| 185 | 178 | // internal handler setters for 8-bit functions |
| 186 | 179 | void internal_set_handler(read8_space_func func, const char *string, UINT64 mask); |
| 187 | 180 | void internal_set_handler(write8_space_func func, const char *string, UINT64 mask); |
| 188 | 181 | void internal_set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT64 mask); |
| 189 | | void internal_set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 mask); |
| 190 | | void internal_set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 mask); |
| 191 | | void internal_set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask); |
| 182 | void internal_set_handler(device_t &device, read8_delegate func, UINT64 mask); |
| 183 | void internal_set_handler(device_t &device, write8_delegate func, UINT64 mask); |
| 184 | void internal_set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask); |
| 192 | 185 | |
| 193 | 186 | // internal handler setters for 16-bit functions |
| 194 | 187 | void internal_set_handler(read16_space_func func, const char *string, UINT64 mask); |
| 195 | 188 | void internal_set_handler(write16_space_func func, const char *string, UINT64 mask); |
| 196 | 189 | void internal_set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT64 mask); |
| 197 | | void internal_set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 mask); |
| 198 | | void internal_set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 mask); |
| 199 | | void internal_set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask); |
| 190 | void internal_set_handler(device_t &device, read16_delegate func, UINT64 mask); |
| 191 | void internal_set_handler(device_t &device, write16_delegate func, UINT64 mask); |
| 192 | void internal_set_handler(device_t &device, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask); |
| 200 | 193 | |
| 201 | 194 | // internal handler setters for 32-bit functions |
| 202 | 195 | void internal_set_handler(read32_space_func func, const char *string, UINT64 mask); |
| 203 | 196 | void internal_set_handler(write32_space_func func, const char *string, UINT64 mask); |
| 204 | 197 | void internal_set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring, UINT64 mask); |
| 205 | | void internal_set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 mask); |
| 206 | | void internal_set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 mask); |
| 207 | | void internal_set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask); |
| 198 | void internal_set_handler(device_t &device, read32_delegate func, UINT64 mask); |
| 199 | void internal_set_handler(device_t &device, write32_delegate func, UINT64 mask); |
| 200 | void internal_set_handler(device_t &device, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask); |
| 208 | 201 | |
| 209 | 202 | // internal handler setters for 64-bit functions |
| 210 | 203 | void internal_set_handler(read64_space_func func, const char *string, UINT64 mask); |
| 211 | 204 | void internal_set_handler(write64_space_func func, const char *string, UINT64 mask); |
| 212 | 205 | void internal_set_handler(read64_space_func rfunc, const char *rstring, write64_space_func wfunc, const char *wstring, UINT64 mask); |
| 213 | | void internal_set_handler(const device_t &device, const char *tag, read64_delegate func, UINT64 mask); |
| 214 | | void internal_set_handler(const device_t &device, const char *tag, write64_delegate func, UINT64 mask); |
| 215 | | void internal_set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask); |
| 206 | void internal_set_handler(device_t &device, read64_delegate func, UINT64 mask); |
| 207 | void internal_set_handler(device_t &device, write64_delegate func, UINT64 mask); |
| 208 | void internal_set_handler(device_t &device, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask); |
| 216 | 209 | |
| 217 | 210 | private: |
| 218 | 211 | // helper functions |
| r18153 | r18154 | |
| 228 | 221 | public: |
| 229 | 222 | address_map_entry8(address_map &map, offs_t start, offs_t end); |
| 230 | 223 | |
| 231 | | void set_baseptr(UINT8 **baseptr) { internal_set_baseptr(reinterpret_cast<void **>(baseptr)); } |
| 232 | | |
| 233 | 224 | // native-size handlers |
| 234 | 225 | void set_handler(read8_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 235 | 226 | void set_handler(write8_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 236 | 227 | void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); } |
| 237 | | void set_handler(const device_t &device, const char *tag, read8_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 238 | | void set_handler(const device_t &device, const char *tag, write8_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 239 | | void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); } |
| 228 | void set_handler(device_t &device, read8_delegate func) { internal_set_handler(device, func, 0); } |
| 229 | void set_handler(device_t &device, write8_delegate func) { internal_set_handler(device, func, 0); } |
| 230 | void set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(device, rfunc, wfunc, 0); } |
| 240 | 231 | }; |
| 241 | 232 | |
| 242 | 233 | |
| r18153 | r18154 | |
| 248 | 239 | public: |
| 249 | 240 | address_map_entry16(address_map &map, offs_t start, offs_t end); |
| 250 | 241 | |
| 251 | | void set_baseptr(UINT16 **baseptr) { internal_set_baseptr(reinterpret_cast<void **>(baseptr)); } |
| 252 | | |
| 253 | 242 | // native-size handlers |
| 254 | 243 | void set_handler(read16_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 255 | 244 | void set_handler(write16_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 256 | 245 | void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); } |
| 257 | | void set_handler(const device_t &device, const char *tag, read16_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 258 | | void set_handler(const device_t &device, const char *tag, write16_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 259 | | void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); } |
| 246 | void set_handler(device_t &device, read16_delegate func) { internal_set_handler(device, func, 0); } |
| 247 | void set_handler(device_t &device, write16_delegate func) { internal_set_handler(device, func, 0); } |
| 248 | void set_handler(device_t &device, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(device, rfunc, wfunc, 0); } |
| 260 | 249 | |
| 261 | 250 | // 8-bit handlers |
| 262 | 251 | void set_handler(read8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); } |
| 263 | 252 | void set_handler(write8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); } |
| 264 | 253 | void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 265 | | void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT16 mask) { internal_set_handler(device, tag, func, mask); } |
| 266 | | void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT16 mask) { internal_set_handler(device, tag, func, mask); } |
| 267 | | void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 254 | void set_handler(device_t &device, read8_delegate func, UINT16 mask) { internal_set_handler(device, func, mask); } |
| 255 | void set_handler(device_t &device, write8_delegate func, UINT16 mask) { internal_set_handler(device, func, mask); } |
| 256 | void set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 268 | 257 | }; |
| 269 | 258 | |
| 270 | 259 | |
| r18153 | r18154 | |
| 276 | 265 | public: |
| 277 | 266 | address_map_entry32(address_map &map, offs_t start, offs_t end); |
| 278 | 267 | |
| 279 | | void set_baseptr(UINT32 **baseptr) { internal_set_baseptr(reinterpret_cast<void **>(baseptr)); } |
| 280 | | |
| 281 | 268 | // native-size handlers |
| 282 | 269 | void set_handler(read32_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 283 | 270 | void set_handler(write32_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 284 | 271 | void set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); } |
| 285 | | void set_handler(const device_t &device, const char *tag, read32_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 286 | | void set_handler(const device_t &device, const char *tag, write32_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 287 | | void set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); } |
| 272 | void set_handler(device_t &device, read32_delegate func) { internal_set_handler(device, func, 0); } |
| 273 | void set_handler(device_t &device, write32_delegate func) { internal_set_handler(device, func, 0); } |
| 274 | void set_handler(device_t &device, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(device, rfunc, wfunc, 0); } |
| 288 | 275 | |
| 289 | 276 | // 16-bit handlers |
| 290 | 277 | void set_handler(read16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } |
| 291 | 278 | void set_handler(write16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } |
| 292 | 279 | void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 293 | | void set_handler(const device_t &device, const char *tag, read16_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); } |
| 294 | | void set_handler(const device_t &device, const char *tag, write16_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); } |
| 295 | | void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 280 | void set_handler(device_t &device, read16_delegate func, UINT32 mask) { internal_set_handler(device, func, mask); } |
| 281 | void set_handler(device_t &device, write16_delegate func, UINT32 mask) { internal_set_handler(device, func, mask); } |
| 282 | void set_handler(device_t &device, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 296 | 283 | |
| 297 | 284 | // 8-bit handlers |
| 298 | 285 | void set_handler(read8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } |
| 299 | 286 | void set_handler(write8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); } |
| 300 | 287 | void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 301 | | void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); } |
| 302 | | void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT32 mask) { internal_set_handler(device, tag, func, mask); } |
| 303 | | void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 288 | void set_handler(device_t &device, read8_delegate func, UINT32 mask) { internal_set_handler(device, func, mask); } |
| 289 | void set_handler(device_t &device, write8_delegate func, UINT32 mask) { internal_set_handler(device, func, mask); } |
| 290 | void set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 304 | 291 | }; |
| 305 | 292 | |
| 306 | 293 | |
| r18153 | r18154 | |
| 312 | 299 | public: |
| 313 | 300 | address_map_entry64(address_map &map, offs_t start, offs_t end); |
| 314 | 301 | |
| 315 | | void set_baseptr(UINT64 **baseptr) { internal_set_baseptr(reinterpret_cast<void **>(baseptr)); } |
| 316 | | |
| 317 | 302 | // native-size handlers |
| 318 | 303 | void set_handler(read64_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 319 | 304 | void set_handler(write64_space_func func, const char *string) { internal_set_handler(func, string, 0); } |
| 320 | 305 | void set_handler(read64_space_func rfunc, const char *rstring, write64_space_func wfunc, const char *wstring) { internal_set_handler(rfunc, rstring, wfunc, wstring, 0); } |
| 321 | | void set_handler(const device_t &device, const char *tag, read64_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 322 | | void set_handler(const device_t &device, const char *tag, write64_delegate func) { internal_set_handler(device, tag, func, 0); } |
| 323 | | void set_handler(const device_t &device, const char *tag, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(device, tag, rfunc, wfunc, 0); } |
| 306 | void set_handler(device_t &device, read64_delegate func) { internal_set_handler(device, func, 0); } |
| 307 | void set_handler(device_t &device, write64_delegate func) { internal_set_handler(device, func, 0); } |
| 308 | void set_handler(device_t &device, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(device, rfunc, wfunc, 0); } |
| 324 | 309 | |
| 325 | 310 | // 32-bit handlers |
| 326 | 311 | void set_handler(read32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 327 | 312 | void set_handler(write32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 328 | 313 | void set_handler(read32_space_func rfunc, const char *rstring, write32_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 329 | | void set_handler(const device_t &device, const char *tag, read32_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 330 | | void set_handler(const device_t &device, const char *tag, write32_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 331 | | void set_handler(const device_t &device, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 314 | void set_handler(device_t &device, read32_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 315 | void set_handler(device_t &device, write32_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 316 | void set_handler(device_t &device, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 332 | 317 | |
| 333 | 318 | // 16-bit handlers |
| 334 | 319 | void set_handler(read16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 335 | 320 | void set_handler(write16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 336 | 321 | void set_handler(read16_space_func rfunc, const char *rstring, write16_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 337 | | void set_handler(const device_t &device, const char *tag, read16_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 338 | | void set_handler(const device_t &device, const char *tag, write16_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 339 | | void set_handler(const device_t &device, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 322 | void set_handler(device_t &device, read16_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 323 | void set_handler(device_t &device, write16_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 324 | void set_handler(device_t &device, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 340 | 325 | |
| 341 | 326 | // 8-bit handlers |
| 342 | 327 | void set_handler(read8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 343 | 328 | void set_handler(write8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); } |
| 344 | 329 | void set_handler(read8_space_func rfunc, const char *rstring, write8_space_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(rfunc, rstring, wfunc, wstring, mask); } |
| 345 | | void set_handler(const device_t &device, const char *tag, read8_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 346 | | void set_handler(const device_t &device, const char *tag, write8_delegate func, UINT64 mask) { internal_set_handler(device, tag, func, mask); } |
| 347 | | void set_handler(const device_t &device, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(device, tag, rfunc, wfunc, mask); } |
| 330 | void set_handler(device_t &device, read8_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 331 | void set_handler(device_t &device, write8_delegate func, UINT64 mask) { internal_set_handler(device, func, mask); } |
| 332 | void set_handler(device_t &device, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(device, rfunc, wfunc, mask); } |
| 348 | 333 | }; |
| 349 | 334 | |
| 350 | 335 | |
| r18153 | r18154 | |
| 355 | 340 | { |
| 356 | 341 | public: |
| 357 | 342 | // construction/destruction |
| 358 | | address_map(const device_t &device, address_spacenum spacenum); |
| 359 | | address_map(const device_t &device, address_map_entry *entry); |
| 360 | | address_map(const address_space &space, offs_t start, offs_t end, int bits, UINT64 unitmask, const device_t &device, address_map_delegate submap_delegate); |
| 343 | address_map(device_t &device, address_spacenum spacenum); |
| 344 | address_map(device_t &device, address_map_entry *entry); |
| 345 | address_map(const address_space &space, offs_t start, offs_t end, int bits, UINT64 unitmask, device_t &device, address_map_delegate submap_delegate); |
| 361 | 346 | ~address_map(); |
| 362 | 347 | |
| 363 | 348 | // configuration |
| r18153 | r18154 | |
| 395 | 380 | #define ADDRESS_MAP_NAME(_name) construct_address_map_##_name |
| 396 | 381 | |
| 397 | 382 | #define ADDRESS_MAP_START(_name, _space, _bits, _class) \ |
| 398 | | void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device) \ |
| 383 | void ADDRESS_MAP_NAME(_name)(address_map &map, device_t &device) \ |
| 399 | 384 | { \ |
| 400 | 385 | typedef read##_bits##_delegate read_delegate; \ |
| 401 | 386 | typedef write##_bits##_delegate write_delegate; \ |
| r18153 | r18154 | |
| 405 | 390 | typedef _class drivdata_class; \ |
| 406 | 391 | |
| 407 | 392 | #define DEVICE_ADDRESS_MAP_START(_name, _bits, _class) \ |
| 408 | | void _class :: _name(address_map &map, const device_t &device) \ |
| 393 | void _class :: _name(address_map &map, device_t &device) \ |
| 409 | 394 | { \ |
| 410 | 395 | typedef read##_bits##_delegate read_delegate; \ |
| 411 | 396 | typedef write##_bits##_delegate write_delegate; \ |
| r18153 | r18154 | |
| 419 | 404 | |
| 420 | 405 | // use this to declare external references to an address map |
| 421 | 406 | #define ADDRESS_MAP_EXTERN(_name, _bits) \ |
| 422 | | extern void ADDRESS_MAP_NAME(_name)(address_map &map, const device_t &device) |
| 407 | extern void ADDRESS_MAP_NAME(_name)(address_map &map, device_t &device) |
| 423 | 408 | |
| 424 | 409 | // use this to declare an address map as a member of a modern device class |
| 425 | 410 | #define DECLARE_ADDRESS_MAP(_name, _bits) \ |
| 426 | | void _name(address_map &map, const device_t &device) |
| 411 | void _name(address_map &map, device_t &device) |
| 427 | 412 | |
| 428 | 413 | |
| 429 | 414 | // global controls |
| r18153 | r18154 | |
| 495 | 480 | |
| 496 | 481 | // legacy device reads |
| 497 | 482 | #define AM_DEVREAD_LEGACY(_tag, _handler) \ |
| 498 | | curentry->set_handler(device, _tag, read_delegate(&_handler, #_handler, (device_t *)0)); \ |
| 483 | curentry->set_handler(device, read_delegate(&_handler, #_handler, _tag, (device_t *)0)); \ |
| 499 | 484 | |
| 500 | 485 | #define AM_DEVREAD8_LEGACY(_tag, _handler, _unitmask) \ |
| 501 | | curentry->set_handler(device, _tag, read8_delegate(&_handler, #_handler, (device_t *)0), _unitmask); \ |
| 486 | curentry->set_handler(device, read8_delegate(&_handler, #_handler, _tag, (device_t *)0), _unitmask); \ |
| 502 | 487 | |
| 503 | 488 | |
| 504 | 489 | |
| 505 | 490 | |
| 506 | 491 | // legacy device writes |
| 507 | 492 | #define AM_DEVWRITE_LEGACY(_tag, _handler) \ |
| 508 | | curentry->set_handler(device, _tag, write_delegate(&_handler, #_handler, (device_t *)0)); \ |
| 493 | curentry->set_handler(device, write_delegate(&_handler, #_handler, _tag, (device_t *)0)); \ |
| 509 | 494 | |
| 510 | 495 | #define AM_DEVWRITE8_LEGACY(_tag, _handler, _unitmask) \ |
| 511 | | curentry->set_handler(device, _tag, write8_delegate(&_handler, #_handler, (device_t *)0), _unitmask); \ |
| 496 | curentry->set_handler(device, write8_delegate(&_handler, #_handler, _tag, (device_t *)0), _unitmask); \ |
| 512 | 497 | |
| 513 | 498 | #define AM_DEVWRITE16_LEGACY(_tag, _handler, _unitmask) \ |
| 514 | | curentry->set_handler(device, _tag, write16_delegate(&_handler, #_handler, (device_t *)0), _unitmask); \ |
| 499 | curentry->set_handler(device, write16_delegate(&_handler, #_handler, _tag, (device_t *)0), _unitmask); \ |
| 515 | 500 | |
| 516 | 501 | |
| 517 | 502 | |
| 518 | 503 | // legacy device reads/writes |
| 519 | 504 | #define AM_DEVREADWRITE_LEGACY(_tag, _rhandler, _whandler) \ |
| 520 | | curentry->set_handler(device, _tag, read_delegate(&_rhandler, #_rhandler, (device_t *)0), write_delegate(&_whandler, #_whandler, (device_t *)0)); \ |
| 505 | curentry->set_handler(device, read_delegate(&_rhandler, #_rhandler, _tag, (device_t *)0), write_delegate(&_whandler, #_whandler, _tag, (device_t *)0)); \ |
| 521 | 506 | |
| 522 | 507 | #define AM_DEVREADWRITE8_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 523 | | curentry->set_handler(device, _tag, read8_delegate(&_rhandler, #_rhandler, (device_t *)0), write8_delegate(&_whandler, #_whandler, (device_t *)0), _unitmask); \ |
| 508 | curentry->set_handler(device, read8_delegate(&_rhandler, #_rhandler, _tag, (device_t *)0), write8_delegate(&_whandler, #_whandler, _tag, (device_t *)0), _unitmask); \ |
| 524 | 509 | |
| 525 | 510 | #define AM_DEVREADWRITE16_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 526 | | curentry->set_handler(device, _tag, read16_delegate(&_rhandler, #_rhandler, (device_t *)0), write16_delegate(&_whandler, #_whandler, (device_t *)0), _unitmask); \ |
| 511 | curentry->set_handler(device, read16_delegate(&_rhandler, #_rhandler, _tag, (device_t *)0), write16_delegate(&_whandler, #_whandler, _tag, (device_t *)0), _unitmask); \ |
| 527 | 512 | |
| 528 | 513 | #define AM_DEVREADWRITE32_LEGACY(_tag, _rhandler, _whandler, _unitmask) \ |
| 529 | | curentry->set_handler(device, _tag, read32_delegate(&_rhandler, #_rhandler, (device_t *)0), write32_delegate(&_whandler, #_whandler, (device_t *)0), _unitmask); \ |
| 514 | curentry->set_handler(device, read32_delegate(&_rhandler, #_rhandler, _tag, (device_t *)0), write32_delegate(&_whandler, #_whandler, _tag, (device_t *)0), _unitmask); \ |
| 530 | 515 | |
| 531 | 516 | |
| 532 | 517 | // driver data reads |
| 533 | 518 | #define AM_READ(_handler) \ |
| 534 | | curentry->set_handler(device, DEVICE_SELF, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \ |
| 519 | curentry->set_handler(device, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0)); \ |
| 535 | 520 | |
| 536 | 521 | #define AM_READ8(_handler, _unitmask) \ |
| 537 | | curentry->set_handler(device, DEVICE_SELF, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 522 | curentry->set_handler(device, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 538 | 523 | |
| 539 | 524 | #define AM_READ16(_handler, _unitmask) \ |
| 540 | | curentry->set_handler(device, DEVICE_SELF, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 525 | curentry->set_handler(device, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 541 | 526 | |
| 542 | 527 | #define AM_READ32(_handler, _unitmask) \ |
| 543 | | curentry->set_handler(device, DEVICE_SELF, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 528 | curentry->set_handler(device, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 544 | 529 | |
| 545 | 530 | |
| 546 | 531 | // driver data writes |
| 547 | 532 | #define AM_WRITE(_handler) \ |
| 548 | | curentry->set_handler(device, DEVICE_SELF, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \ |
| 533 | curentry->set_handler(device, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0)); \ |
| 549 | 534 | |
| 550 | 535 | #define AM_WRITE8(_handler, _unitmask) \ |
| 551 | | curentry->set_handler(device, DEVICE_SELF, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 536 | curentry->set_handler(device, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 552 | 537 | |
| 553 | 538 | #define AM_WRITE16(_handler, _unitmask) \ |
| 554 | | curentry->set_handler(device, DEVICE_SELF, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 539 | curentry->set_handler(device, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 555 | 540 | |
| 556 | 541 | #define AM_WRITE32(_handler, _unitmask) \ |
| 557 | | curentry->set_handler(device, DEVICE_SELF, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \ |
| 542 | curentry->set_handler(device, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 558 | 543 | |
| 559 | 544 | |
| 560 | 545 | // driver data reads/writes |
| 561 | 546 | #define AM_READWRITE(_rhandler, _whandler) \ |
| 562 | | curentry->set_handler(device, DEVICE_SELF, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0)); \ |
| 547 | curentry->set_handler(device, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, DEVICE_SELF, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, DEVICE_SELF, (drivdata_class *)0)); \ |
| 563 | 548 | |
| 564 | 549 | #define AM_READWRITE8(_rhandler, _whandler, _unitmask) \ |
| 565 | | curentry->set_handler(device, DEVICE_SELF, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ |
| 550 | curentry->set_handler(device, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, DEVICE_SELF, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 566 | 551 | |
| 567 | 552 | #define AM_READWRITE16(_rhandler, _whandler, _unitmask) \ |
| 568 | | curentry->set_handler(device, DEVICE_SELF, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ |
| 553 | curentry->set_handler(device, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, DEVICE_SELF, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 569 | 554 | |
| 570 | 555 | #define AM_READWRITE32(_rhandler, _whandler, _unitmask) \ |
| 571 | | curentry->set_handler(device, DEVICE_SELF, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \ |
| 556 | curentry->set_handler(device, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, DEVICE_SELF, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, DEVICE_SELF, (drivdata_class *)0), _unitmask); \ |
| 572 | 557 | |
| 573 | 558 | |
| 574 | 559 | // device reads |
| 575 | 560 | #define AM_DEVREAD(_tag, _class, _handler) \ |
| 576 | | curentry->set_handler(device, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ |
| 561 | curentry->set_handler(device, read_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0)); \ |
| 577 | 562 | |
| 578 | 563 | #define AM_DEVREAD8(_tag, _class, _handler, _unitmask) \ |
| 579 | | curentry->set_handler(device, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 564 | curentry->set_handler(device, read8_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 580 | 565 | |
| 581 | 566 | #define AM_DEVREAD16(_tag, _class, _handler, _unitmask) \ |
| 582 | | curentry->set_handler(device, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 567 | curentry->set_handler(device, read16_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 583 | 568 | |
| 584 | 569 | #define AM_DEVREAD32(_tag, _class, _handler, _unitmask) \ |
| 585 | | curentry->set_handler(device, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 570 | curentry->set_handler(device, read32_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 586 | 571 | |
| 587 | 572 | |
| 588 | 573 | // device writes |
| 589 | 574 | #define AM_DEVWRITE(_tag, _class, _handler) \ |
| 590 | | curentry->set_handler(device, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \ |
| 575 | curentry->set_handler(device, write_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0)); \ |
| 591 | 576 | |
| 592 | 577 | #define AM_DEVWRITE8(_tag, _class, _handler, _unitmask) \ |
| 593 | | curentry->set_handler(device, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 578 | curentry->set_handler(device, write8_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 594 | 579 | |
| 595 | 580 | #define AM_DEVWRITE16(_tag, _class, _handler, _unitmask) \ |
| 596 | | curentry->set_handler(device, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 581 | curentry->set_handler(device, write16_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 597 | 582 | |
| 598 | 583 | #define AM_DEVWRITE32(_tag, _class, _handler, _unitmask) \ |
| 599 | | curentry->set_handler(device, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \ |
| 584 | curentry->set_handler(device, write32_delegate(&_class::_handler, #_class "::" #_handler, _tag, (_class *)0), _unitmask); \ |
| 600 | 585 | |
| 601 | 586 | |
| 602 | 587 | // device reads/writes |
| 603 | 588 | #define AM_DEVREADWRITE(_tag, _class, _rhandler, _whandler) \ |
| 604 | | curentry->set_handler(device, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \ |
| 589 | curentry->set_handler(device, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, _tag, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, _tag, (_class *)0)); \ |
| 605 | 590 | |
| 606 | 591 | #define AM_DEVREADWRITE8(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 607 | | curentry->set_handler(device, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ |
| 592 | curentry->set_handler(device, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, _tag, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, _tag, (_class *)0), _unitmask); \ |
| 608 | 593 | |
| 609 | 594 | #define AM_DEVREADWRITE16(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 610 | | curentry->set_handler(device, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ |
| 595 | curentry->set_handler(device, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, _tag, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, _tag, (_class *)0), _unitmask); \ |
| 611 | 596 | |
| 612 | 597 | #define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \ |
| 613 | | curentry->set_handler(device, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \ |
| 598 | curentry->set_handler(device, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, _tag, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, _tag, (_class *)0), _unitmask); \ |
| 614 | 599 | |
| 615 | 600 | |
| 616 | 601 | // device mapping |