src/emu/memory.c
| r1364 | r1365 | |
| 367 | 367 | |
| 368 | 368 | |
| 369 | 369 | /*------------------------------------------------- |
| 370 | INLINE FUNCTIONS |
| 371 | -------------------------------------------------*/ |
| 372 | |
| 373 | INLINE void force_opbase_update(void) |
| 374 | { |
| 375 | opcode_entry = 0xff; |
| 376 | memory_set_opbase(activecpu_get_physical_pc_byte()); |
| 377 | } |
| 378 | |
| 379 | |
| 380 | /*------------------------------------------------- |
| 370 | 381 | FUNCTION PROTOTYPES |
| 371 | 382 | -------------------------------------------------*/ |
| 372 | 383 | |
| r1364 | r1365 | |
| 576 | 587 | |
| 577 | 588 | void memory_set_opbase(offs_t pc) |
| 578 | 589 | { |
| 579 | | address_space *space = &active_address_space[ADDRESS_SPACE_PROGRAM]; |
| 580 | | |
| 590 | const address_space *space = &active_address_space[ADDRESS_SPACE_PROGRAM]; |
| 581 | 591 | UINT8 *base = NULL, *based = NULL; |
| 582 | | handler_data *handlers; |
| 592 | const handler_data *handlers; |
| 583 | 593 | UINT8 entry; |
| 584 | 594 | |
| 585 | 595 | /* allow overrides */ |
| 586 | | if (opbasefunc) |
| 596 | if (opbasefunc != NULL) |
| 587 | 597 | { |
| 588 | 598 | pc = (*opbasefunc)(pc); |
| 589 | 599 | if (pc == ~0) |
| r1364 | r1365 | |
| 623 | 633 | /* if no decrypted opcodes, point to the same base */ |
| 624 | 634 | base = bank_ptr[entry]; |
| 625 | 635 | based = bankd_ptr[entry]; |
| 626 | | if (!based) |
| 636 | if (based == NULL) |
| 627 | 637 | based = base; |
| 628 | 638 | |
| 629 | 639 | /* compute the adjusted base */ |
| r1364 | r1365 | |
| 658 | 668 | |
| 659 | 669 | /* if this is live, adjust now */ |
| 660 | 670 | if (cpu_getactivecpu() >= 0 && cpunum == cur_context && opcode_entry == banknum) |
| 661 | | memory_set_opbase(activecpu_get_physical_pc_byte()); |
| 671 | force_opbase_update(); |
| 662 | 672 | } |
| 663 | 673 | else if (bdata->base < end && bdata->end > start) |
| 664 | 674 | fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for CPU %d", start, end, cpunum); |
| r1364 | r1365 | |
| 858 | 868 | |
| 859 | 869 | /* if we're executing out of this bank, adjust the opbase pointer */ |
| 860 | 870 | if (opcode_entry == banknum && cpu_getactivecpu() >= 0) |
| 861 | | { |
| 862 | | opcode_entry = 0xff; |
| 863 | | memory_set_opbase(activecpu_get_physical_pc_byte()); |
| 864 | | } |
| 871 | force_opbase_update(); |
| 865 | 872 | } |
| 866 | 873 | |
| 867 | 874 | |
| r1364 | r1365 | |
| 887 | 894 | |
| 888 | 895 | /* if we're executing out of this bank, adjust the opbase pointer */ |
| 889 | 896 | if (opcode_entry == banknum && cpu_getactivecpu() >= 0) |
| 890 | | { |
| 891 | | opcode_entry = 0xff; |
| 892 | | memory_set_opbase(activecpu_get_physical_pc_byte()); |
| 893 | | } |
| 897 | force_opbase_update(); |
| 894 | 898 | } |
| 895 | 899 | |
| 896 | 900 | |