src/emu/cpu/v60/op7a.c
| r8829 | r8830 | |
| 39 | 39 | cpustate->op1 = cpustate->amout; |
| 40 | 40 | |
| 41 | 41 | // Decode length |
| 42 | | appb = OpRead8(cpustate->program, cpustate->PC + 2 + cpustate->amlength1); |
| 42 | appb = OpRead8(cpustate, cpustate->PC + 2 + cpustate->amlength1); |
| 43 | 43 | if (appb & 0x80) |
| 44 | 44 | cpustate->lenop1 = cpustate->reg[appb & 0x1F]; |
| 45 | 45 | else |
| r8829 | r8830 | |
| 54 | 54 | cpustate->op2 = cpustate->amout; |
| 55 | 55 | |
| 56 | 56 | // Decode length |
| 57 | | appb = OpRead8(cpustate->program, cpustate->PC + 3 + cpustate->amlength1 + cpustate->amlength2); |
| 57 | appb = OpRead8(cpustate, cpustate->PC + 3 + cpustate->amlength1 + cpustate->amlength2); |
| 58 | 58 | if (appb & 0x80) |
| 59 | 59 | cpustate->lenop2 = cpustate->reg[appb & 0x1F]; |
| 60 | 60 | else |
| r8829 | r8830 | |
| 73 | 73 | cpustate->op1 = cpustate->amout; |
| 74 | 74 | |
| 75 | 75 | // Decode ext |
| 76 | | appb = OpRead8(cpustate->program, cpustate->PC + 2 + cpustate->amlength1); |
| 76 | appb = OpRead8(cpustate, cpustate->PC + 2 + cpustate->amlength1); |
| 77 | 77 | if (appb & 0x80) |
| 78 | 78 | cpustate->lenop1 = cpustate->reg[appb & 0x1F]; |
| 79 | 79 | else |
| r8829 | r8830 | |
| 126 | 126 | cpustate->op2 = cpustate->amout; |
| 127 | 127 | |
| 128 | 128 | // Decode ext |
| 129 | | appb = OpRead8(cpustate->program, cpustate->PC + 2 + cpustate->amlength1 + cpustate->amlength2); |
| 129 | appb = OpRead8(cpustate, cpustate->PC + 2 + cpustate->amlength1 + cpustate->amlength2); |
| 130 | 130 | if (appb & 0x80) |
| 131 | 131 | cpustate->lenop1 = cpustate->reg[appb & 0x1F]; |
| 132 | 132 | else |
| r8829 | r8830 | |
| 137 | 137 | if ((cs)->flag1) \ |
| 138 | 138 | appb = (UINT8)((cs)->reg[(cs)->op1]&0xFF); \ |
| 139 | 139 | else \ |
| 140 | | appb = MemRead8((cs)->program, (cs)->op1); |
| 140 | appb = (cs)->program->read_byte((cs)->op1); |
| 141 | 141 | |
| 142 | 142 | #define F7CLOADOP2BYTE(cs,appb) \ |
| 143 | 143 | if ((cs)->flag2) \ |
| 144 | 144 | appb = (UINT8)((cs)->reg[(cs)->op2]&0xFF); \ |
| 145 | 145 | else \ |
| 146 | | appb = MemRead8((cs)->program, (cs)->op2); |
| 146 | appb = (cs)->program->read_byte((cs)->op2); |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | #define F7CSTOREOP2BYTE(cs) \ |
| 150 | 150 | if ((cs)->flag2) \ |
| 151 | 151 | SETREG8((cs)->reg[(cs)->op2], appb); \ |
| 152 | 152 | else \ |
| 153 | | MemWrite8((cs)->program, (cs)->op2, appb); |
| 153 | (cs)->program->write_byte((cs)->op2, appb); |
| 154 | 154 | |
| 155 | 155 | #define F7CSTOREOP2HALF(cs) \ |
| 156 | 156 | if ((cs)->flag2) \ |
| 157 | 157 | SETREG16((cs)->reg[(cs)->op2], apph); \ |
| 158 | 158 | else \ |
| 159 | | MemWrite16((cs)->program, (cs)->op2, apph); |
| 159 | (cs)->program->write_word_unaligned((cs)->op2, apph); |
| 160 | 160 | |
| 161 | 161 | static UINT32 opCMPSTRB(v60_state *cpustate, UINT8 bFill, UINT8 bStop) |
| 162 | 162 | { |
| r8829 | r8830 | |
| 171 | 171 | if (cpustate->lenop1 < cpustate->lenop2) |
| 172 | 172 | { |
| 173 | 173 | for (i = cpustate->lenop1; i < cpustate->lenop2; i++) |
| 174 | | MemWrite8(cpustate->program, cpustate->op1 + i,(UINT8)cpustate->R26); |
| 174 | cpustate->program->write_byte(cpustate->op1 + i,(UINT8)cpustate->R26); |
| 175 | 175 | } |
| 176 | 176 | else if (cpustate->lenop2 < cpustate->lenop1) |
| 177 | 177 | { |
| 178 | 178 | for (i = cpustate->lenop2; i < cpustate->lenop1; i++) |
| 179 | | MemWrite8(cpustate->program, cpustate->op2 + i,(UINT8)cpustate->R26); |
| 179 | cpustate->program->write_byte(cpustate->op2 + i,(UINT8)cpustate->R26); |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| r8829 | r8830 | |
| 188 | 188 | |
| 189 | 189 | for (i = 0; i < dest; i++) |
| 190 | 190 | { |
| 191 | | c1 = MemRead8(cpustate->program, cpustate->op1 + i); |
| 192 | | c2 = MemRead8(cpustate->program, cpustate->op2 + i); |
| 191 | c1 = cpustate->program->read_byte(cpustate->op1 + i); |
| 192 | c2 = cpustate->program->read_byte(cpustate->op2 + i); |
| 193 | 193 | |
| 194 | 194 | if (c1 > c2) |
| 195 | 195 | { |
| r8829 | r8830 | |
| 237 | 237 | if (cpustate->lenop1 < cpustate->lenop2) |
| 238 | 238 | { |
| 239 | 239 | for (i = cpustate->lenop1; i < cpustate->lenop2; i++) |
| 240 | | MemWrite16(cpustate->program, cpustate->op1 + i * 2,(UINT16)cpustate->R26); |
| 240 | cpustate->program->write_word_unaligned(cpustate->op1 + i * 2,(UINT16)cpustate->R26); |
| 241 | 241 | } |
| 242 | 242 | else if (cpustate->lenop2 < cpustate->lenop1) |
| 243 | 243 | { |
| 244 | 244 | for (i = cpustate->lenop2; i < cpustate->lenop1; i++) |
| 245 | | MemWrite16(cpustate->program, cpustate->op2 + i * 2,(UINT16)cpustate->R26); |
| 245 | cpustate->program->write_word_unaligned(cpustate->op2 + i * 2,(UINT16)cpustate->R26); |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| r8829 | r8830 | |
| 254 | 254 | |
| 255 | 255 | for (i = 0; i < dest; i++) |
| 256 | 256 | { |
| 257 | | c1 = MemRead16(cpustate->program, cpustate->op1 + i * 2); |
| 258 | | c2 = MemRead16(cpustate->program, cpustate->op2 + i * 2); |
| 257 | c1 = cpustate->program->read_word_unaligned(cpustate->op1 + i * 2); |
| 258 | c2 = cpustate->program->read_word_unaligned(cpustate->op2 + i * 2); |
| 259 | 259 | |
| 260 | 260 | if (c1 > c2) |
| 261 | 261 | { |
| r8829 | r8830 | |
| 308 | 308 | |
| 309 | 309 | for (i = 0; i < dest; i++) |
| 310 | 310 | { |
| 311 | | MemWrite8(cpustate->program, cpustate->op2 + i,(c1 = MemRead8(cpustate->program, cpustate->op1 + i))); |
| 311 | cpustate->program->write_byte(cpustate->op2 + i,(c1 = cpustate->program->read_byte(cpustate->op1 + i))); |
| 312 | 312 | |
| 313 | 313 | if (bStop && c1 == (UINT8)cpustate->R26) |
| 314 | 314 | break; |
| r8829 | r8830 | |
| 320 | 320 | if (bFill && cpustate->lenop1 < cpustate->lenop2) |
| 321 | 321 | { |
| 322 | 322 | for (;i < cpustate->lenop2; i++) |
| 323 | | MemWrite8(cpustate->program, cpustate->op2 + i,(UINT8)cpustate->R26); |
| 323 | cpustate->program->write_byte(cpustate->op2 + i,(UINT8)cpustate->R26); |
| 324 | 324 | |
| 325 | 325 | cpustate->R27 = cpustate->op2 + i; |
| 326 | 326 | } |
| r8829 | r8830 | |
| 340 | 340 | |
| 341 | 341 | for (i = 0; i < dest; i++) |
| 342 | 342 | { |
| 343 | | MemWrite8(cpustate->program, cpustate->op2 + (dest - i - 1),(c1 = MemRead8(cpustate->program, cpustate->op1 + (dest - i - 1)))); |
| 343 | cpustate->program->write_byte(cpustate->op2 + (dest - i - 1),(c1 = cpustate->program->read_byte(cpustate->op1 + (dest - i - 1)))); |
| 344 | 344 | |
| 345 | 345 | if (bStop && c1 == (UINT8)cpustate->R26) |
| 346 | 346 | break; |
| r8829 | r8830 | |
| 352 | 352 | if (bFill && cpustate->lenop1 < cpustate->lenop2) |
| 353 | 353 | { |
| 354 | 354 | for (;i < cpustate->lenop2; i++) |
| 355 | | MemWrite8(cpustate->program, cpustate->op2 + dest + (cpustate->lenop2 - i - 1),(UINT8)cpustate->R26); |
| 355 | cpustate->program->write_byte(cpustate->op2 + dest + (cpustate->lenop2 - i - 1),(UINT8)cpustate->R26); |
| 356 | 356 | |
| 357 | 357 | cpustate->R27 = cpustate->op2 + (cpustate->lenop2 - i - 1); |
| 358 | 358 | } |
| r8829 | r8830 | |
| 376 | 376 | |
| 377 | 377 | for (i = 0; i < dest; i++) |
| 378 | 378 | { |
| 379 | | MemWrite16(cpustate->program, cpustate->op2 + i * 2,(c1 = MemRead16(cpustate->program, cpustate->op1 + i * 2))); |
| 379 | cpustate->program->write_word_unaligned(cpustate->op2 + i * 2,(c1 = cpustate->program->read_word_unaligned(cpustate->op1 + i * 2))); |
| 380 | 380 | |
| 381 | 381 | if (bStop && c1 == (UINT16)cpustate->R26) |
| 382 | 382 | break; |
| r8829 | r8830 | |
| 388 | 388 | if (bFill && cpustate->lenop1 < cpustate->lenop2) |
| 389 | 389 | { |
| 390 | 390 | for (;i < cpustate->lenop2; i++) |
| 391 | | MemWrite16(cpustate->program, cpustate->op2 + i * 2,(UINT16)cpustate->R26); |
| 391 | cpustate->program->write_word_unaligned(cpustate->op2 + i * 2,(UINT16)cpustate->R26); |
| 392 | 392 | |
| 393 | 393 | cpustate->R27 = cpustate->op2 + i * 2; |
| 394 | 394 | } |
| r8829 | r8830 | |
| 413 | 413 | |
| 414 | 414 | for (i = 0; i < dest; i++) |
| 415 | 415 | { |
| 416 | | MemWrite16(cpustate->program, cpustate->op2 + (dest - i - 1) * 2,(c1 = MemRead16(cpustate->program, cpustate->op1 + (dest - i - 1) * 2))); |
| 416 | cpustate->program->write_word_unaligned(cpustate->op2 + (dest - i - 1) * 2,(c1 = cpustate->program->read_word_unaligned(cpustate->op1 + (dest - i - 1) * 2))); |
| 417 | 417 | |
| 418 | 418 | if (bStop && c1 == (UINT16)cpustate->R26) |
| 419 | 419 | break; |
| r8829 | r8830 | |
| 425 | 425 | if (bFill && cpustate->lenop1 < cpustate->lenop2) |
| 426 | 426 | { |
| 427 | 427 | for (;i < cpustate->lenop2; i++) |
| 428 | | MemWrite16(cpustate->program, cpustate->op2 + (cpustate->lenop2 - i - 1) * 2,(UINT16)cpustate->R26); |
| 428 | cpustate->program->write_word_unaligned(cpustate->op2 + (cpustate->lenop2 - i - 1) * 2,(UINT16)cpustate->R26); |
| 429 | 429 | |
| 430 | 430 | cpustate->R27 = cpustate->op2 + (cpustate->lenop2 - i - 1) * 2; |
| 431 | 431 | } |
| r8829 | r8830 | |
| 442 | 442 | |
| 443 | 443 | for (i = 0; i < cpustate->lenop1; i++) |
| 444 | 444 | { |
| 445 | | appb = (MemRead8(cpustate->program, cpustate->op1 + i) == (UINT8)cpustate->op2); |
| 445 | appb = (cpustate->program->read_byte(cpustate->op1 + i) == (UINT8)cpustate->op2); |
| 446 | 446 | if ((bSearch && appb) || (!bSearch && !appb)) |
| 447 | 447 | break; |
| 448 | 448 | } |
| r8829 | r8830 | |
| 468 | 468 | |
| 469 | 469 | for (i = 0; i < cpustate->lenop1; i++) |
| 470 | 470 | { |
| 471 | | appb = (MemRead16(cpustate->program, cpustate->op1 + i * 2) == (UINT16)cpustate->op2); |
| 471 | appb = (cpustate->program->read_word_unaligned(cpustate->op1 + i * 2) == (UINT16)cpustate->op2); |
| 472 | 472 | if ((bSearch && appb) || (!bSearch && !appb)) |
| 473 | 473 | break; |
| 474 | 474 | } |
| r8829 | r8830 | |
| 493 | 493 | |
| 494 | 494 | for (i = cpustate->lenop1; i >= 0; i--) |
| 495 | 495 | { |
| 496 | | appb = (MemRead8(cpustate->program, cpustate->op1 + i) == (UINT8)cpustate->op2); |
| 496 | appb = (cpustate->program->read_byte(cpustate->op1 + i) == (UINT8)cpustate->op2); |
| 497 | 497 | if ((bSearch && appb) || (!bSearch && !appb)) |
| 498 | 498 | break; |
| 499 | 499 | } |
| r8829 | r8830 | |
| 519 | 519 | |
| 520 | 520 | for (i = cpustate->lenop1 - 1; i >= 0; i--) |
| 521 | 521 | { |
| 522 | | appb = (MemRead16(cpustate->program, cpustate->op1 + i * 2) == (UINT16)cpustate->op2); |
| 522 | appb = (cpustate->program->read_word_unaligned(cpustate->op1 + i * 2) == (UINT16)cpustate->op2); |
| 523 | 523 | if ((bSearch && appb) || (!bSearch && !appb)) |
| 524 | 524 | break; |
| 525 | 525 | } |
| r8829 | r8830 | |
| 618 | 618 | |
| 619 | 619 | // Read first UINT8 |
| 620 | 620 | cpustate->op1 += cpustate->bamoffset / 8; |
| 621 | | data = MemRead8(cpustate->program, cpustate->op1); |
| 621 | data = cpustate->program->read_byte(cpustate->op1); |
| 622 | 622 | offset = cpustate->bamoffset & 7; |
| 623 | 623 | |
| 624 | 624 | // Scan bitstring |
| r8829 | r8830 | |
| 639 | 639 | // Next UINT8 please |
| 640 | 640 | offset = 0; |
| 641 | 641 | cpustate->op1++; |
| 642 | | data = MemRead8(cpustate->program, cpustate->op1); |
| 642 | data = cpustate->program->read_byte(cpustate->op1); |
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | |
| r8829 | r8830 | |
| 664 | 664 | F7CCREATEBITMASK(cpustate->lenop1); |
| 665 | 665 | |
| 666 | 666 | cpustate->op2 += cpustate->bamoffset / 8; |
| 667 | | appw = MemRead32(cpustate->program, cpustate->op2); |
| 667 | appw = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 668 | 668 | cpustate->bamoffset &= 7; |
| 669 | 669 | |
| 670 | 670 | appw &= ~(cpustate->lenop1 << cpustate->bamoffset); |
| 671 | 671 | appw |= (cpustate->lenop1 & cpustate->op1) << cpustate->bamoffset; |
| 672 | 672 | |
| 673 | | MemWrite32(cpustate->program, cpustate->op2, appw); |
| 673 | cpustate->program->write_dword_unaligned(cpustate->op2, appw); |
| 674 | 674 | |
| 675 | 675 | F7CEND(cpustate); |
| 676 | 676 | } |
| r8829 | r8830 | |
| 685 | 685 | F7CCREATEBITMASK(cpustate->lenop1); |
| 686 | 686 | |
| 687 | 687 | cpustate->op2 += cpustate->bamoffset / 8; |
| 688 | | appw = MemRead32(cpustate->program, cpustate->op2); |
| 688 | appw = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 689 | 689 | cpustate->bamoffset &= 7; |
| 690 | 690 | |
| 691 | 691 | appw &= ~(cpustate->lenop1 << cpustate->bamoffset); |
| 692 | 692 | appw |= (cpustate->lenop1 & cpustate->op1) << cpustate->bamoffset; |
| 693 | 693 | |
| 694 | | MemWrite32(cpustate->program, cpustate->op2, appw); |
| 694 | cpustate->program->write_dword_unaligned(cpustate->op2, appw); |
| 695 | 695 | |
| 696 | 696 | F7CEND(cpustate); |
| 697 | 697 | } |
| r8829 | r8830 | |
| 715 | 715 | cpustate->bamoffset1 &= 7; |
| 716 | 716 | cpustate->bamoffset2 &= 7; |
| 717 | 717 | |
| 718 | | srcdata = MemRead8(cpustate->program, cpustate->op1); |
| 719 | | dstdata = MemRead8(cpustate->program, cpustate->op2); |
| 718 | srcdata = cpustate->program->read_byte(cpustate->op1); |
| 719 | dstdata = cpustate->program->read_byte(cpustate->op2); |
| 720 | 720 | |
| 721 | 721 | for (i = 0; i < cpustate->lenop1; i++) |
| 722 | 722 | { |
| r8829 | r8830 | |
| 731 | 731 | { |
| 732 | 732 | cpustate->bamoffset1 = 8; |
| 733 | 733 | cpustate->op1--; |
| 734 | | srcdata = MemRead8(cpustate->program, cpustate->op1); |
| 734 | srcdata = cpustate->program->read_byte(cpustate->op1); |
| 735 | 735 | } |
| 736 | 736 | if (cpustate->bamoffset2 == 0) |
| 737 | 737 | { |
| 738 | | MemWrite8(cpustate->program, cpustate->op2, dstdata); |
| 738 | cpustate->program->write_byte(cpustate->op2, dstdata); |
| 739 | 739 | cpustate->bamoffset2 = 8; |
| 740 | 740 | cpustate->op2--; |
| 741 | | dstdata = MemRead8(cpustate->program, cpustate->op2); |
| 741 | dstdata = cpustate->program->read_byte(cpustate->op2); |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | cpustate->bamoffset1--; |
| r8829 | r8830 | |
| 747 | 747 | |
| 748 | 748 | // Flush of the final data |
| 749 | 749 | if (cpustate->bamoffset2 != 7) |
| 750 | | MemWrite8(cpustate->program, cpustate->op2, dstdata); |
| 750 | cpustate->program->write_byte(cpustate->op2, dstdata); |
| 751 | 751 | |
| 752 | 752 | F7BEND(cpustate); |
| 753 | 753 | } |
| r8829 | r8830 | |
| 765 | 765 | cpustate->bamoffset1 &= 7; |
| 766 | 766 | cpustate->bamoffset2 &= 7; |
| 767 | 767 | |
| 768 | | srcdata = MemRead8(cpustate->program, cpustate->op1); |
| 769 | | dstdata = MemRead8(cpustate->program, cpustate->op2); |
| 768 | srcdata = cpustate->program->read_byte(cpustate->op1); |
| 769 | dstdata = cpustate->program->read_byte(cpustate->op2); |
| 770 | 770 | |
| 771 | 771 | for (i = 0; i < cpustate->lenop1; i++) |
| 772 | 772 | { |
| r8829 | r8830 | |
| 783 | 783 | { |
| 784 | 784 | cpustate->bamoffset1 = 0; |
| 785 | 785 | cpustate->op1++; |
| 786 | | srcdata = MemRead8(cpustate->program, cpustate->op1); |
| 786 | srcdata = cpustate->program->read_byte(cpustate->op1); |
| 787 | 787 | } |
| 788 | 788 | if (cpustate->bamoffset2 == 8) |
| 789 | 789 | { |
| 790 | | MemWrite8(cpustate->program, cpustate->op2, dstdata); |
| 790 | cpustate->program->write_byte(cpustate->op2, dstdata); |
| 791 | 791 | cpustate->bamoffset2 = 0; |
| 792 | 792 | cpustate->op2++; |
| 793 | | dstdata = MemRead8(cpustate->program, cpustate->op2); |
| 793 | dstdata = cpustate->program->read_byte(cpustate->op2); |
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // Flush of the final data |
| 798 | 798 | if (cpustate->bamoffset2 != 0) |
| 799 | | MemWrite8(cpustate->program, cpustate->op2, dstdata); |
| 799 | cpustate->program->write_byte(cpustate->op2, dstdata); |
| 800 | 800 | |
| 801 | 801 | F7BEND(cpustate); |
| 802 | 802 | } |
| r8829 | r8830 | |
| 1177 | 1177 | |
| 1178 | 1178 | static UINT32 op58(v60_state *cpustate) |
| 1179 | 1179 | { |
| 1180 | | cpustate->subop = OpRead8(cpustate->program, cpustate->PC + 1); |
| 1180 | cpustate->subop = OpRead8(cpustate, cpustate->PC + 1); |
| 1181 | 1181 | |
| 1182 | 1182 | return Op58Table[cpustate->subop & 0x1F](cpustate); |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | static UINT32 op5A(v60_state *cpustate) |
| 1186 | 1186 | { |
| 1187 | | cpustate->subop = OpRead8(cpustate->program, cpustate->PC + 1); |
| 1187 | cpustate->subop = OpRead8(cpustate, cpustate->PC + 1); |
| 1188 | 1188 | |
| 1189 | 1189 | return Op5ATable[cpustate->subop & 0x1F](cpustate); |
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | static UINT32 op5B(v60_state *cpustate) |
| 1193 | 1193 | { |
| 1194 | | cpustate->subop = OpRead8(cpustate->program, cpustate->PC + 1); |
| 1194 | cpustate->subop = OpRead8(cpustate, cpustate->PC + 1); |
| 1195 | 1195 | |
| 1196 | 1196 | return Op5BTable[cpustate->subop & 0x1F](cpustate); |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | static UINT32 op5D(v60_state *cpustate) |
| 1200 | 1200 | { |
| 1201 | | cpustate->subop = OpRead8(cpustate->program, cpustate->PC + 1); |
| 1201 | cpustate->subop = OpRead8(cpustate, cpustate->PC + 1); |
| 1202 | 1202 | |
| 1203 | 1203 | return Op5DTable[cpustate->subop & 0x1F](cpustate); |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | static UINT32 op59(v60_state *cpustate) |
| 1207 | 1207 | { |
| 1208 | | cpustate->subop = OpRead8(cpustate->program, cpustate->PC + 1); |
| 1208 | cpustate->subop = OpRead8(cpustate, cpustate->PC + 1); |
| 1209 | 1209 | |
| 1210 | 1210 | return Op59Table[cpustate->subop & 0x1F](cpustate); |
| 1211 | 1211 | } |
src/emu/cpu/v60/am1.c
| r8829 | r8830 | |
| 25 | 25 | switch (cpustate->moddim) |
| 26 | 26 | { |
| 27 | 27 | case 0: |
| 28 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 28 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F]); |
| 29 | 29 | break; |
| 30 | 30 | case 1: |
| 31 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 31 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 32 | 32 | break; |
| 33 | 33 | case 2: |
| 34 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 34 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| r8829 | r8830 | |
| 41 | 41 | static UINT32 bam1RegisterIndirect(v60_state *cpustate) |
| 42 | 42 | { |
| 43 | 43 | cpustate->bamoffset = 0; |
| 44 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 44 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 45 | 45 | return 1; |
| 46 | 46 | } |
| 47 | 47 | |
| r8829 | r8830 | |
| 50 | 50 | switch (cpustate->moddim) |
| 51 | 51 | { |
| 52 | 52 | case 0: |
| 53 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F]); |
| 53 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F]); |
| 54 | 54 | break; |
| 55 | 55 | case 1: |
| 56 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 56 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 57 | 57 | break; |
| 58 | 58 | case 2: |
| 59 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 59 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 60 | 60 | break; |
| 61 | 61 | } |
| 62 | 62 | |
| r8829 | r8830 | |
| 66 | 66 | static UINT32 bam1RegisterIndirectIndexed(v60_state *cpustate) |
| 67 | 67 | { |
| 68 | 68 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 69 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->bamoffset / 8); |
| 69 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->bamoffset / 8); |
| 70 | 70 | cpustate->bamoffset&=7; |
| 71 | 71 | return 2; |
| 72 | 72 | } |
| r8829 | r8830 | |
| 76 | 76 | switch (cpustate->moddim) |
| 77 | 77 | { |
| 78 | 78 | case 0: |
| 79 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 79 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F]); |
| 80 | 80 | cpustate->reg[cpustate->modval & 0x1F]++; |
| 81 | 81 | break; |
| 82 | 82 | case 1: |
| 83 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 83 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 84 | 84 | cpustate->reg[cpustate->modval & 0x1F] +=2; |
| 85 | 85 | break; |
| 86 | 86 | case 2: |
| 87 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 87 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 88 | 88 | cpustate->reg[cpustate->modval & 0x1F] +=4; |
| 89 | 89 | break; |
| 90 | 90 | } |
| r8829 | r8830 | |
| 95 | 95 | static UINT32 bam1Autoincrement(v60_state *cpustate) |
| 96 | 96 | { |
| 97 | 97 | cpustate->bamoffset = 0; |
| 98 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 98 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 99 | 99 | switch (cpustate->moddim) |
| 100 | 100 | { |
| 101 | 101 | case 10: |
| r8829 | r8830 | |
| 117 | 117 | { |
| 118 | 118 | case 0: |
| 119 | 119 | cpustate->reg[cpustate->modval & 0x1F]--; |
| 120 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 120 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F]); |
| 121 | 121 | break; |
| 122 | 122 | case 1: |
| 123 | 123 | cpustate->reg[cpustate->modval & 0x1F]-=2; |
| 124 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 124 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 125 | 125 | break; |
| 126 | 126 | case 2: |
| 127 | 127 | cpustate->reg[cpustate->modval & 0x1F]-=4; |
| 128 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 128 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | 131 | |
| r8829 | r8830 | |
| 147 | 147 | fatalerror("CPU - BAM1 - 7"); |
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F]); |
| 150 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F]); |
| 151 | 151 | return 1; |
| 152 | 152 | } |
| 153 | 153 | |
| r8829 | r8830 | |
| 156 | 156 | switch (cpustate->moddim) |
| 157 | 157 | { |
| 158 | 158 | case 0: |
| 159 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 159 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 160 | 160 | break; |
| 161 | 161 | case 1: |
| 162 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 162 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 163 | 163 | break; |
| 164 | 164 | case 2: |
| 165 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 165 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 166 | 166 | break; |
| 167 | 167 | } |
| 168 | 168 | |
| r8829 | r8830 | |
| 171 | 171 | |
| 172 | 172 | static UINT32 bam1Displacement8(v60_state *cpustate) |
| 173 | 173 | { |
| 174 | | cpustate->bamoffset = MemRead8(cpustate->program, cpustate->modadd + 1); |
| 175 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 174 | cpustate->bamoffset = cpustate->program->read_byte(cpustate->modadd + 1); |
| 175 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 176 | 176 | cpustate->bamoffset&=7; |
| 177 | 177 | return 2; |
| 178 | 178 | } |
| r8829 | r8830 | |
| 183 | 183 | switch (cpustate->moddim) |
| 184 | 184 | { |
| 185 | 185 | case 0: |
| 186 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 186 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 187 | 187 | break; |
| 188 | 188 | case 1: |
| 189 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 189 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 190 | 190 | break; |
| 191 | 191 | case 2: |
| 192 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 192 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 193 | 193 | break; |
| 194 | 194 | } |
| 195 | 195 | |
| r8829 | r8830 | |
| 198 | 198 | |
| 199 | 199 | static UINT32 bam1Displacement16(v60_state *cpustate) |
| 200 | 200 | { |
| 201 | | cpustate->bamoffset = OpRead16(cpustate->program, cpustate->modadd + 1); |
| 202 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 201 | cpustate->bamoffset = OpRead16(cpustate, cpustate->modadd + 1); |
| 202 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 203 | 203 | cpustate->bamoffset&=7; |
| 204 | 204 | return 3; |
| 205 | 205 | } |
| r8829 | r8830 | |
| 209 | 209 | switch (cpustate->moddim) |
| 210 | 210 | { |
| 211 | 211 | case 0: |
| 212 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 212 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 213 | 213 | break; |
| 214 | 214 | case 1: |
| 215 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 215 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 216 | 216 | break; |
| 217 | 217 | case 2: |
| 218 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 218 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 219 | 219 | break; |
| 220 | 220 | } |
| 221 | 221 | |
| r8829 | r8830 | |
| 224 | 224 | |
| 225 | 225 | static UINT32 bam1Displacement32(v60_state *cpustate) |
| 226 | 226 | { |
| 227 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 228 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 227 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 1); |
| 228 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + cpustate->bamoffset / 8); |
| 229 | 229 | cpustate->bamoffset&=7; |
| 230 | 230 | return 5; |
| 231 | 231 | } |
| r8829 | r8830 | |
| 235 | 235 | switch (cpustate->moddim) |
| 236 | 236 | { |
| 237 | 237 | case 0: |
| 238 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 238 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 239 | 239 | break; |
| 240 | 240 | case 1: |
| 241 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 241 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 242 | 242 | break; |
| 243 | 243 | case 2: |
| 244 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 244 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 245 | 245 | break; |
| 246 | 246 | } |
| 247 | 247 | |
| r8829 | r8830 | |
| 251 | 251 | static UINT32 bam1DisplacementIndexed8(v60_state *cpustate) |
| 252 | 252 | { |
| 253 | 253 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 254 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 254 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 255 | 255 | cpustate->bamoffset&=7; |
| 256 | 256 | return 3; |
| 257 | 257 | } |
| r8829 | r8830 | |
| 261 | 261 | switch (cpustate->moddim) |
| 262 | 262 | { |
| 263 | 263 | case 0: |
| 264 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 264 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 265 | 265 | break; |
| 266 | 266 | case 1: |
| 267 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 267 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 268 | 268 | break; |
| 269 | 269 | case 2: |
| 270 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 270 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 271 | 271 | break; |
| 272 | 272 | } |
| 273 | 273 | |
| r8829 | r8830 | |
| 277 | 277 | static UINT32 bam1DisplacementIndexed16(v60_state *cpustate) |
| 278 | 278 | { |
| 279 | 279 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 280 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 280 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 281 | 281 | cpustate->bamoffset&=7; |
| 282 | 282 | return 4; |
| 283 | 283 | } |
| r8829 | r8830 | |
| 287 | 287 | switch (cpustate->moddim) |
| 288 | 288 | { |
| 289 | 289 | case 0: |
| 290 | | cpustate->amout = MemRead8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 290 | cpustate->amout = cpustate->program->read_byte(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 291 | 291 | break; |
| 292 | 292 | case 1: |
| 293 | | cpustate->amout = MemRead16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 293 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 294 | 294 | break; |
| 295 | 295 | case 2: |
| 296 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 296 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 297 | 297 | break; |
| 298 | 298 | } |
| 299 | 299 | |
| r8829 | r8830 | |
| 303 | 303 | static UINT32 bam1DisplacementIndexed32(v60_state *cpustate) |
| 304 | 304 | { |
| 305 | 305 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 306 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 306 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 307 | 307 | cpustate->bamoffset&=7; |
| 308 | 308 | return 6; |
| 309 | 309 | } |
| r8829 | r8830 | |
| 314 | 314 | switch (cpustate->moddim) |
| 315 | 315 | { |
| 316 | 316 | case 0: |
| 317 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 317 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 318 | 318 | break; |
| 319 | 319 | case 1: |
| 320 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 320 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 321 | 321 | break; |
| 322 | 322 | case 2: |
| 323 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 323 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 324 | 324 | break; |
| 325 | 325 | } |
| 326 | 326 | |
| r8829 | r8830 | |
| 329 | 329 | |
| 330 | 330 | static UINT32 bam1PCDisplacement8(v60_state *cpustate) |
| 331 | 331 | { |
| 332 | | cpustate->bamoffset = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 333 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + cpustate->bamoffset / 8); |
| 332 | cpustate->bamoffset = OpRead8(cpustate, cpustate->modadd + 1); |
| 333 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + cpustate->bamoffset / 8); |
| 334 | 334 | cpustate->bamoffset&=7; |
| 335 | 335 | return 2; |
| 336 | 336 | } |
| r8829 | r8830 | |
| 340 | 340 | switch (cpustate->moddim) |
| 341 | 341 | { |
| 342 | 342 | case 0: |
| 343 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 343 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 344 | 344 | break; |
| 345 | 345 | case 1: |
| 346 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 346 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 347 | 347 | break; |
| 348 | 348 | case 2: |
| 349 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 349 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 350 | 350 | break; |
| 351 | 351 | } |
| 352 | 352 | |
| r8829 | r8830 | |
| 355 | 355 | |
| 356 | 356 | static UINT32 bam1PCDisplacement16(v60_state *cpustate) |
| 357 | 357 | { |
| 358 | | cpustate->bamoffset = OpRead16(cpustate->program, cpustate->modadd + 1); |
| 359 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + cpustate->bamoffset / 8); |
| 358 | cpustate->bamoffset = OpRead16(cpustate, cpustate->modadd + 1); |
| 359 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + cpustate->bamoffset / 8); |
| 360 | 360 | cpustate->bamoffset&=7; |
| 361 | 361 | return 3; |
| 362 | 362 | } |
| r8829 | r8830 | |
| 366 | 366 | switch (cpustate->moddim) |
| 367 | 367 | { |
| 368 | 368 | case 0: |
| 369 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 369 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 370 | 370 | break; |
| 371 | 371 | case 1: |
| 372 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 372 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 373 | 373 | break; |
| 374 | 374 | case 2: |
| 375 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 375 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 376 | 376 | break; |
| 377 | 377 | } |
| 378 | 378 | |
| r8829 | r8830 | |
| 381 | 381 | |
| 382 | 382 | static UINT32 bam1PCDisplacement32(v60_state *cpustate) |
| 383 | 383 | { |
| 384 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 385 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + cpustate->bamoffset / 8); |
| 384 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 1); |
| 385 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + cpustate->bamoffset / 8); |
| 386 | 386 | cpustate->bamoffset&=7; |
| 387 | 387 | return 5; |
| 388 | 388 | } |
| r8829 | r8830 | |
| 392 | 392 | switch (cpustate->moddim) |
| 393 | 393 | { |
| 394 | 394 | case 0: |
| 395 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 395 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 396 | 396 | break; |
| 397 | 397 | case 1: |
| 398 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 398 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 399 | 399 | break; |
| 400 | 400 | case 2: |
| 401 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 401 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 402 | 402 | break; |
| 403 | 403 | } |
| 404 | 404 | |
| r8829 | r8830 | |
| 408 | 408 | static UINT32 bam1PCDisplacementIndexed8(v60_state *cpustate) |
| 409 | 409 | { |
| 410 | 410 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 411 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 411 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 412 | 412 | cpustate->bamoffset&=7; |
| 413 | 413 | return 3; |
| 414 | 414 | } |
| r8829 | r8830 | |
| 419 | 419 | switch (cpustate->moddim) |
| 420 | 420 | { |
| 421 | 421 | case 0: |
| 422 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 422 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 423 | 423 | break; |
| 424 | 424 | case 1: |
| 425 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 425 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 426 | 426 | break; |
| 427 | 427 | case 2: |
| 428 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 428 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 429 | 429 | break; |
| 430 | 430 | } |
| 431 | 431 | |
| r8829 | r8830 | |
| 435 | 435 | static UINT32 bam1PCDisplacementIndexed16(v60_state *cpustate) |
| 436 | 436 | { |
| 437 | 437 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 438 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 438 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 439 | 439 | cpustate->bamoffset&=7; |
| 440 | 440 | return 4; |
| 441 | 441 | } |
| r8829 | r8830 | |
| 445 | 445 | switch (cpustate->moddim) |
| 446 | 446 | { |
| 447 | 447 | case 0: |
| 448 | | cpustate->amout = MemRead8(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 448 | cpustate->amout = cpustate->program->read_byte(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 449 | 449 | break; |
| 450 | 450 | case 1: |
| 451 | | cpustate->amout = MemRead16(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 451 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 452 | 452 | break; |
| 453 | 453 | case 2: |
| 454 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 454 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 455 | 455 | break; |
| 456 | 456 | } |
| 457 | 457 | |
| r8829 | r8830 | |
| 461 | 461 | static UINT32 bam1PCDisplacementIndexed32(v60_state *cpustate) |
| 462 | 462 | { |
| 463 | 463 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 464 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 464 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 465 | 465 | cpustate->bamoffset&=7; |
| 466 | 466 | return 6; |
| 467 | 467 | } |
| r8829 | r8830 | |
| 471 | 471 | switch (cpustate->moddim) |
| 472 | 472 | { |
| 473 | 473 | case 0: |
| 474 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 474 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 475 | 475 | break; |
| 476 | 476 | case 1: |
| 477 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 477 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 478 | 478 | break; |
| 479 | 479 | case 2: |
| 480 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 480 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 481 | 481 | break; |
| 482 | 482 | } |
| 483 | 483 | |
| r8829 | r8830 | |
| 487 | 487 | static UINT32 bam1DisplacementIndirect8(v60_state *cpustate) |
| 488 | 488 | { |
| 489 | 489 | cpustate->bamoffset = 0; |
| 490 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 490 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 491 | 491 | return 2; |
| 492 | 492 | } |
| 493 | 493 | |
| r8829 | r8830 | |
| 496 | 496 | switch (cpustate->moddim) |
| 497 | 497 | { |
| 498 | 498 | case 0: |
| 499 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 499 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 500 | 500 | break; |
| 501 | 501 | case 1: |
| 502 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 502 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 503 | 503 | break; |
| 504 | 504 | case 2: |
| 505 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 505 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 506 | 506 | break; |
| 507 | 507 | } |
| 508 | 508 | |
| r8829 | r8830 | |
| 512 | 512 | static UINT32 bam1DisplacementIndirect16(v60_state *cpustate) |
| 513 | 513 | { |
| 514 | 514 | cpustate->bamoffset = 0; |
| 515 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 515 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 516 | 516 | return 3; |
| 517 | 517 | } |
| 518 | 518 | |
| r8829 | r8830 | |
| 521 | 521 | switch (cpustate->moddim) |
| 522 | 522 | { |
| 523 | 523 | case 0: |
| 524 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 524 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1))); |
| 525 | 525 | break; |
| 526 | 526 | case 1: |
| 527 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 527 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1))); |
| 528 | 528 | break; |
| 529 | 529 | case 2: |
| 530 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 530 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1))); |
| 531 | 531 | break; |
| 532 | 532 | } |
| 533 | 533 | |
| r8829 | r8830 | |
| 537 | 537 | static UINT32 bam1DisplacementIndirect32(v60_state *cpustate) |
| 538 | 538 | { |
| 539 | 539 | cpustate->bamoffset = 0; |
| 540 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 540 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1))); |
| 541 | 541 | return 5; |
| 542 | 542 | } |
| 543 | 543 | |
| r8829 | r8830 | |
| 546 | 546 | switch (cpustate->moddim) |
| 547 | 547 | { |
| 548 | 548 | case 0: |
| 549 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 549 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 550 | 550 | break; |
| 551 | 551 | case 1: |
| 552 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 552 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 553 | 553 | break; |
| 554 | 554 | case 2: |
| 555 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 555 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 556 | 556 | break; |
| 557 | 557 | } |
| 558 | 558 | |
| r8829 | r8830 | |
| 562 | 562 | static UINT32 bam1DisplacementIndirectIndexed8(v60_state *cpustate) |
| 563 | 563 | { |
| 564 | 564 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 565 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 565 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 566 | 566 | cpustate->bamoffset&=7; |
| 567 | 567 | return 3; |
| 568 | 568 | } |
| r8829 | r8830 | |
| 572 | 572 | switch (cpustate->moddim) |
| 573 | 573 | { |
| 574 | 574 | case 0: |
| 575 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 575 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 576 | 576 | break; |
| 577 | 577 | case 1: |
| 578 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 578 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 579 | 579 | break; |
| 580 | 580 | case 2: |
| 581 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 581 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 582 | 582 | break; |
| 583 | 583 | } |
| 584 | 584 | |
| r8829 | r8830 | |
| 588 | 588 | static UINT32 bam1DisplacementIndirectIndexed16(v60_state *cpustate) |
| 589 | 589 | { |
| 590 | 590 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 591 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 591 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 592 | 592 | cpustate->bamoffset&=7; |
| 593 | 593 | return 4; |
| 594 | 594 | } |
| r8829 | r8830 | |
| 598 | 598 | switch (cpustate->moddim) |
| 599 | 599 | { |
| 600 | 600 | case 0: |
| 601 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 601 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 602 | 602 | break; |
| 603 | 603 | case 1: |
| 604 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 604 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 605 | 605 | break; |
| 606 | 606 | case 2: |
| 607 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 607 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 608 | 608 | break; |
| 609 | 609 | } |
| 610 | 610 | |
| r8829 | r8830 | |
| 614 | 614 | static UINT32 bam1DisplacementIndirectIndexed32(v60_state *cpustate) |
| 615 | 615 | { |
| 616 | 616 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 617 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 617 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 618 | 618 | cpustate->bamoffset&=7; |
| 619 | 619 | return 6; |
| 620 | 620 | } |
| r8829 | r8830 | |
| 624 | 624 | switch (cpustate->moddim) |
| 625 | 625 | { |
| 626 | 626 | case 0: |
| 627 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 627 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 628 | 628 | break; |
| 629 | 629 | case 1: |
| 630 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 630 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 631 | 631 | break; |
| 632 | 632 | case 2: |
| 633 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 633 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 634 | 634 | break; |
| 635 | 635 | } |
| 636 | 636 | |
| r8829 | r8830 | |
| 640 | 640 | static UINT32 bam1PCDisplacementIndirect8(v60_state *cpustate) |
| 641 | 641 | { |
| 642 | 642 | cpustate->bamoffset = 0; |
| 643 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1))); |
| 643 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1))); |
| 644 | 644 | return 2; |
| 645 | 645 | } |
| 646 | 646 | |
| r8829 | r8830 | |
| 649 | 649 | switch (cpustate->moddim) |
| 650 | 650 | { |
| 651 | 651 | case 0: |
| 652 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 652 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 653 | 653 | break; |
| 654 | 654 | case 1: |
| 655 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 655 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 656 | 656 | break; |
| 657 | 657 | case 2: |
| 658 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 658 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 659 | 659 | break; |
| 660 | 660 | } |
| 661 | 661 | |
| r8829 | r8830 | |
| 665 | 665 | static UINT32 bam1PCDisplacementIndirect16(v60_state *cpustate) |
| 666 | 666 | { |
| 667 | 667 | cpustate->bamoffset = 0; |
| 668 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1))); |
| 668 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1))); |
| 669 | 669 | return 3; |
| 670 | 670 | } |
| 671 | 671 | |
| r8829 | r8830 | |
| 674 | 674 | switch (cpustate->moddim) |
| 675 | 675 | { |
| 676 | 676 | case 0: |
| 677 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 677 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1))); |
| 678 | 678 | break; |
| 679 | 679 | case 1: |
| 680 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 680 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1))); |
| 681 | 681 | break; |
| 682 | 682 | case 2: |
| 683 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 683 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1))); |
| 684 | 684 | break; |
| 685 | 685 | } |
| 686 | 686 | |
| r8829 | r8830 | |
| 690 | 690 | static UINT32 bam1PCDisplacementIndirect32(v60_state *cpustate) |
| 691 | 691 | { |
| 692 | 692 | cpustate->bamoffset = 0; |
| 693 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 693 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1))); |
| 694 | 694 | return 5; |
| 695 | 695 | } |
| 696 | 696 | |
| r8829 | r8830 | |
| 699 | 699 | switch (cpustate->moddim) |
| 700 | 700 | { |
| 701 | 701 | case 0: |
| 702 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 702 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 703 | 703 | break; |
| 704 | 704 | case 1: |
| 705 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 705 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 706 | 706 | break; |
| 707 | 707 | case 2: |
| 708 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 708 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 709 | 709 | break; |
| 710 | 710 | } |
| 711 | 711 | |
| r8829 | r8830 | |
| 715 | 715 | static UINT32 bam1PCDisplacementIndirectIndexed8(v60_state *cpustate) |
| 716 | 716 | { |
| 717 | 717 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 718 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 718 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 719 | 719 | cpustate->bamoffset&=7; |
| 720 | 720 | return 3; |
| 721 | 721 | } |
| r8829 | r8830 | |
| 725 | 725 | switch (cpustate->moddim) |
| 726 | 726 | { |
| 727 | 727 | case 0: |
| 728 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 728 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 729 | 729 | break; |
| 730 | 730 | case 1: |
| 731 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 731 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 732 | 732 | break; |
| 733 | 733 | case 2: |
| 734 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 734 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 735 | 735 | break; |
| 736 | 736 | } |
| 737 | 737 | |
| r8829 | r8830 | |
| 741 | 741 | static UINT32 bam1PCDisplacementIndirectIndexed16(v60_state *cpustate) |
| 742 | 742 | { |
| 743 | 743 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 744 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 744 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 745 | 745 | cpustate->bamoffset&=7; |
| 746 | 746 | return 4; |
| 747 | 747 | } |
| r8829 | r8830 | |
| 751 | 751 | switch (cpustate->moddim) |
| 752 | 752 | { |
| 753 | 753 | case 0: |
| 754 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 754 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 755 | 755 | break; |
| 756 | 756 | case 1: |
| 757 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 757 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 758 | 758 | break; |
| 759 | 759 | case 2: |
| 760 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 760 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 761 | 761 | break; |
| 762 | 762 | } |
| 763 | 763 | |
| r8829 | r8830 | |
| 767 | 767 | static UINT32 bam1PCDisplacementIndirectIndexed32(v60_state *cpustate) |
| 768 | 768 | { |
| 769 | 769 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 770 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 770 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 771 | 771 | cpustate->bamoffset&=7; |
| 772 | 772 | return 6; |
| 773 | 773 | } |
| r8829 | r8830 | |
| 777 | 777 | switch (cpustate->moddim) |
| 778 | 778 | { |
| 779 | 779 | case 0: |
| 780 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 780 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 781 | 781 | break; |
| 782 | 782 | |
| 783 | 783 | case 1: |
| 784 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 784 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 785 | 785 | break; |
| 786 | 786 | |
| 787 | 787 | case 2: |
| 788 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 788 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 789 | 789 | break; |
| 790 | 790 | } |
| 791 | 791 | |
| r8829 | r8830 | |
| 794 | 794 | |
| 795 | 795 | static UINT32 bam1DoubleDisplacement8(v60_state *cpustate) |
| 796 | 796 | { |
| 797 | | cpustate->bamoffset = OpRead8(cpustate->program, cpustate->modadd + 2); |
| 798 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 797 | cpustate->bamoffset = OpRead8(cpustate, cpustate->modadd + 2); |
| 798 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 799 | 799 | cpustate->bamoffset&=7; |
| 800 | 800 | return 3; |
| 801 | 801 | } |
| r8829 | r8830 | |
| 805 | 805 | switch (cpustate->moddim) |
| 806 | 806 | { |
| 807 | 807 | case 0: |
| 808 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 808 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 809 | 809 | break; |
| 810 | 810 | |
| 811 | 811 | case 1: |
| 812 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 812 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 813 | 813 | break; |
| 814 | 814 | |
| 815 | 815 | case 2: |
| 816 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 816 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 817 | 817 | break; |
| 818 | 818 | } |
| 819 | 819 | |
| r8829 | r8830 | |
| 822 | 822 | |
| 823 | 823 | static UINT32 bam1DoubleDisplacement16(v60_state *cpustate) |
| 824 | 824 | { |
| 825 | | cpustate->bamoffset = OpRead16(cpustate->program, cpustate->modadd + 3); |
| 826 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 825 | cpustate->bamoffset = OpRead16(cpustate, cpustate->modadd + 3); |
| 826 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 827 | 827 | cpustate->bamoffset&=7; |
| 828 | 828 | return 5; |
| 829 | 829 | } |
| r8829 | r8830 | |
| 833 | 833 | switch (cpustate->moddim) |
| 834 | 834 | { |
| 835 | 835 | case 0: |
| 836 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 836 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 837 | 837 | break; |
| 838 | 838 | |
| 839 | 839 | case 1: |
| 840 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 840 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 841 | 841 | break; |
| 842 | 842 | |
| 843 | 843 | case 2: |
| 844 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 844 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 845 | 845 | break; |
| 846 | 846 | } |
| 847 | 847 | |
| r8829 | r8830 | |
| 850 | 850 | |
| 851 | 851 | static UINT32 bam1DoubleDisplacement32(v60_state *cpustate) |
| 852 | 852 | { |
| 853 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 5); |
| 854 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 853 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 5); |
| 854 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 855 | 855 | cpustate->bamoffset&=7; |
| 856 | 856 | return 9; |
| 857 | 857 | } |
| r8829 | r8830 | |
| 861 | 861 | switch (cpustate->moddim) |
| 862 | 862 | { |
| 863 | 863 | case 0: |
| 864 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 864 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 865 | 865 | break; |
| 866 | 866 | |
| 867 | 867 | case 1: |
| 868 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 868 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 869 | 869 | break; |
| 870 | 870 | |
| 871 | 871 | case 2: |
| 872 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 872 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 873 | 873 | break; |
| 874 | 874 | } |
| 875 | 875 | |
| r8829 | r8830 | |
| 878 | 878 | |
| 879 | 879 | static UINT32 bam1PCDoubleDisplacement8(v60_state *cpustate) |
| 880 | 880 | { |
| 881 | | cpustate->bamoffset = OpRead8(cpustate->program, cpustate->modadd + 2); |
| 882 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 881 | cpustate->bamoffset = OpRead8(cpustate, cpustate->modadd + 2); |
| 882 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 883 | 883 | cpustate->bamoffset&=7; |
| 884 | 884 | return 3; |
| 885 | 885 | } |
| r8829 | r8830 | |
| 889 | 889 | switch (cpustate->moddim) |
| 890 | 890 | { |
| 891 | 891 | case 0: |
| 892 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 892 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 893 | 893 | break; |
| 894 | 894 | |
| 895 | 895 | case 1: |
| 896 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 896 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 897 | 897 | break; |
| 898 | 898 | |
| 899 | 899 | case 2: |
| 900 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3)); |
| 900 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3)); |
| 901 | 901 | break; |
| 902 | 902 | } |
| 903 | 903 | |
| r8829 | r8830 | |
| 906 | 906 | |
| 907 | 907 | static UINT32 bam1PCDoubleDisplacement16(v60_state *cpustate) |
| 908 | 908 | { |
| 909 | | cpustate->bamoffset = OpRead16(cpustate->program, cpustate->modadd + 3); |
| 910 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 909 | cpustate->bamoffset = OpRead16(cpustate, cpustate->modadd + 3); |
| 910 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 911 | 911 | cpustate->bamoffset&=7; |
| 912 | 912 | return 5; |
| 913 | 913 | } |
| r8829 | r8830 | |
| 918 | 918 | switch (cpustate->moddim) |
| 919 | 919 | { |
| 920 | 920 | case 0: |
| 921 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 921 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 922 | 922 | break; |
| 923 | 923 | |
| 924 | 924 | case 1: |
| 925 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 925 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 926 | 926 | break; |
| 927 | 927 | |
| 928 | 928 | case 2: |
| 929 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5)); |
| 929 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5)); |
| 930 | 930 | break; |
| 931 | 931 | } |
| 932 | 932 | |
| r8829 | r8830 | |
| 935 | 935 | |
| 936 | 936 | static UINT32 bam1PCDoubleDisplacement32(v60_state *cpustate) |
| 937 | 937 | { |
| 938 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 5); |
| 939 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 938 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 5); |
| 939 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + cpustate->bamoffset / 8); |
| 940 | 940 | cpustate->bamoffset&=7; |
| 941 | 941 | return 9; |
| 942 | 942 | } |
| r8829 | r8830 | |
| 946 | 946 | switch (cpustate->moddim) |
| 947 | 947 | { |
| 948 | 948 | case 0: |
| 949 | | cpustate->amout = MemRead8(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 949 | cpustate->amout = cpustate->program->read_byte(OpRead32(cpustate, cpustate->modadd + 1)); |
| 950 | 950 | break; |
| 951 | 951 | |
| 952 | 952 | case 1: |
| 953 | | cpustate->amout = MemRead16(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 953 | cpustate->amout = cpustate->program->read_word_unaligned(OpRead32(cpustate, cpustate->modadd + 1)); |
| 954 | 954 | break; |
| 955 | 955 | |
| 956 | 956 | case 2: |
| 957 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 957 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)); |
| 958 | 958 | break; |
| 959 | 959 | } |
| 960 | 960 | |
| r8829 | r8830 | |
| 964 | 964 | static UINT32 bam1DirectAddress(v60_state *cpustate) |
| 965 | 965 | { |
| 966 | 966 | cpustate->bamoffset = 0; |
| 967 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 967 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)); |
| 968 | 968 | return 5; |
| 969 | 969 | } |
| 970 | 970 | |
| r8829 | r8830 | |
| 973 | 973 | switch (cpustate->moddim) |
| 974 | 974 | { |
| 975 | 975 | case 0: |
| 976 | | cpustate->amout = MemRead8(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 976 | cpustate->amout = cpustate->program->read_byte(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]); |
| 977 | 977 | break; |
| 978 | 978 | |
| 979 | 979 | case 1: |
| 980 | | cpustate->amout = MemRead16(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 980 | cpustate->amout = cpustate->program->read_word_unaligned(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 981 | 981 | break; |
| 982 | 982 | |
| 983 | 983 | case 2: |
| 984 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 984 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 985 | 985 | break; |
| 986 | 986 | } |
| 987 | 987 | |
| r8829 | r8830 | |
| 991 | 991 | static UINT32 bam1DirectAddressIndexed(v60_state *cpustate) |
| 992 | 992 | { |
| 993 | 993 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 994 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 994 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->bamoffset / 8); |
| 995 | 995 | cpustate->bamoffset&=7; |
| 996 | 996 | return 6; |
| 997 | 997 | } |
| r8829 | r8830 | |
| 1001 | 1001 | switch (cpustate->moddim) |
| 1002 | 1002 | { |
| 1003 | 1003 | case 0: |
| 1004 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 1004 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1))); |
| 1005 | 1005 | break; |
| 1006 | 1006 | |
| 1007 | 1007 | case 1: |
| 1008 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 1008 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1))); |
| 1009 | 1009 | break; |
| 1010 | 1010 | |
| 1011 | 1011 | case 2: |
| 1012 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 1012 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1))); |
| 1013 | 1013 | break; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| r8829 | r8830 | |
| 1019 | 1019 | static UINT32 bam1DirectAddressDeferred(v60_state *cpustate) |
| 1020 | 1020 | { |
| 1021 | 1021 | cpustate->bamoffset = 0; |
| 1022 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1))); |
| 1022 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1))); |
| 1023 | 1023 | return 5; |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| r8829 | r8830 | |
| 1028 | 1028 | switch (cpustate->moddim) |
| 1029 | 1029 | { |
| 1030 | 1030 | case 0: |
| 1031 | | cpustate->amout = MemRead8(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 1031 | cpustate->amout = cpustate->program->read_byte(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]); |
| 1032 | 1032 | break; |
| 1033 | 1033 | |
| 1034 | 1034 | case 1: |
| 1035 | | cpustate->amout = MemRead16(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 1035 | cpustate->amout = cpustate->program->read_word_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2); |
| 1036 | 1036 | break; |
| 1037 | 1037 | |
| 1038 | 1038 | case 2: |
| 1039 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 1039 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4); |
| 1040 | 1040 | break; |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| r8829 | r8830 | |
| 1046 | 1046 | static UINT32 bam1DirectAddressDeferredIndexed(v60_state *cpustate) |
| 1047 | 1047 | { |
| 1048 | 1048 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 1049 | | cpustate->amout = MemRead32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 1049 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->bamoffset / 8); |
| 1050 | 1050 | cpustate->bamoffset&=7; |
| 1051 | 1051 | return 6; |
| 1052 | 1052 | } |
| r8829 | r8830 | |
| 1056 | 1056 | switch (cpustate->moddim) |
| 1057 | 1057 | { |
| 1058 | 1058 | case 0: |
| 1059 | | cpustate->amout = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1059 | cpustate->amout = OpRead8(cpustate, cpustate->modadd + 1); |
| 1060 | 1060 | return 2; |
| 1061 | 1061 | |
| 1062 | 1062 | case 1: |
| 1063 | | cpustate->amout = OpRead16(cpustate->program, cpustate->modadd + 1); |
| 1063 | cpustate->amout = OpRead16(cpustate, cpustate->modadd + 1); |
| 1064 | 1064 | return 3; |
| 1065 | 1065 | |
| 1066 | 1066 | case 2: |
| 1067 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 1067 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 1); |
| 1068 | 1068 | return 5; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
| r8829 | r8830 | |
| 1311 | 1311 | |
| 1312 | 1312 | static UINT32 am1Group6(v60_state *cpustate) |
| 1313 | 1313 | { |
| 1314 | | cpustate->modval2 = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1314 | cpustate->modval2 = OpRead8(cpustate, cpustate->modadd + 1); |
| 1315 | 1315 | return AMTable1_G6[cpustate->modval2 >> 5](cpustate); |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | static UINT32 bam1Group6(v60_state *cpustate) |
| 1319 | 1319 | { |
| 1320 | | cpustate->modval2 = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1320 | cpustate->modval2 = OpRead8(cpustate, cpustate->modadd + 1); |
| 1321 | 1321 | return BAMTable1_G6[cpustate->modval2 >> 5](cpustate); |
| 1322 | 1322 | } |
| 1323 | 1323 | |
src/emu/cpu/v60/am2.c
| r8829 | r8830 | |
| 151 | 151 | static UINT32 am2Displacement8(v60_state *cpustate) |
| 152 | 152 | { |
| 153 | 153 | cpustate->amflag = 0; |
| 154 | | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1); |
| 154 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1); |
| 155 | 155 | |
| 156 | 156 | return 2; |
| 157 | 157 | } |
| r8829 | r8830 | |
| 160 | 160 | { |
| 161 | 161 | cpustate->amflag = 0; |
| 162 | 162 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F]; |
| 163 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 1); |
| 163 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 1); |
| 164 | 164 | |
| 165 | 165 | return 2; |
| 166 | 166 | } |
| r8829 | r8830 | |
| 168 | 168 | static UINT32 am2Displacement16(v60_state *cpustate) |
| 169 | 169 | { |
| 170 | 170 | cpustate->amflag = 0; |
| 171 | | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1); |
| 171 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1); |
| 172 | 172 | |
| 173 | 173 | return 3; |
| 174 | 174 | } |
| r8829 | r8830 | |
| 177 | 177 | { |
| 178 | 178 | cpustate->amflag = 0; |
| 179 | 179 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F]; |
| 180 | | cpustate->bamoffset = (INT16)OpRead16(cpustate->program, cpustate->modadd + 1); |
| 180 | cpustate->bamoffset = (INT16)OpRead16(cpustate, cpustate->modadd + 1); |
| 181 | 181 | |
| 182 | 182 | return 3; |
| 183 | 183 | } |
| r8829 | r8830 | |
| 185 | 185 | static UINT32 am2Displacement32(v60_state *cpustate) |
| 186 | 186 | { |
| 187 | 187 | cpustate->amflag = 0; |
| 188 | | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1); |
| 188 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1); |
| 189 | 189 | |
| 190 | 190 | return 5; |
| 191 | 191 | } |
| r8829 | r8830 | |
| 194 | 194 | { |
| 195 | 195 | cpustate->amflag = 0; |
| 196 | 196 | cpustate->amout = cpustate->reg[cpustate->modval & 0x1F]; |
| 197 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 197 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 1); |
| 198 | 198 | |
| 199 | 199 | return 5; |
| 200 | 200 | } |
| r8829 | r8830 | |
| 206 | 206 | switch (cpustate->moddim) |
| 207 | 207 | { |
| 208 | 208 | case 0: |
| 209 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 209 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 210 | 210 | break; |
| 211 | 211 | case 1: |
| 212 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 212 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 213 | 213 | break; |
| 214 | 214 | case 2: |
| 215 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 215 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 216 | 216 | break; |
| 217 | 217 | case 3: |
| 218 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 218 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 219 | 219 | break; |
| 220 | 220 | } |
| 221 | 221 | |
| r8829 | r8830 | |
| 225 | 225 | static UINT32 bam2DisplacementIndexed8(v60_state *cpustate) |
| 226 | 226 | { |
| 227 | 227 | cpustate->amflag = 0; |
| 228 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 228 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 229 | 229 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 230 | 230 | |
| 231 | 231 | return 3; |
| r8829 | r8830 | |
| 238 | 238 | switch (cpustate->moddim) |
| 239 | 239 | { |
| 240 | 240 | case 0: |
| 241 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 241 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 242 | 242 | break; |
| 243 | 243 | case 1: |
| 244 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 244 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 245 | 245 | break; |
| 246 | 246 | case 2: |
| 247 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 247 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 248 | 248 | break; |
| 249 | 249 | case 3: |
| 250 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 250 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 251 | 251 | break; |
| 252 | 252 | } |
| 253 | 253 | |
| r8829 | r8830 | |
| 257 | 257 | static UINT32 bam2DisplacementIndexed16(v60_state *cpustate) |
| 258 | 258 | { |
| 259 | 259 | cpustate->amflag = 0; |
| 260 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2); |
| 260 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2); |
| 261 | 261 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 262 | 262 | |
| 263 | 263 | return 4; |
| r8829 | r8830 | |
| 270 | 270 | switch (cpustate->moddim) |
| 271 | 271 | { |
| 272 | 272 | case 0: |
| 273 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 273 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 274 | 274 | break; |
| 275 | 275 | case 1: |
| 276 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 276 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 277 | 277 | break; |
| 278 | 278 | case 2: |
| 279 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 279 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 280 | 280 | break; |
| 281 | 281 | case 3: |
| 282 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 282 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 283 | 283 | break; |
| 284 | 284 | } |
| 285 | 285 | |
| r8829 | r8830 | |
| 289 | 289 | static UINT32 bam2DisplacementIndexed32(v60_state *cpustate) |
| 290 | 290 | { |
| 291 | 291 | cpustate->amflag = 0; |
| 292 | | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2); |
| 292 | cpustate->amout = cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2); |
| 293 | 293 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 294 | 294 | |
| 295 | 295 | return 6; |
| r8829 | r8830 | |
| 298 | 298 | static UINT32 am2PCDisplacement8(v60_state *cpustate) |
| 299 | 299 | { |
| 300 | 300 | cpustate->amflag = 0; |
| 301 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1); |
| 301 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1); |
| 302 | 302 | |
| 303 | 303 | return 2; |
| 304 | 304 | } |
| r8829 | r8830 | |
| 307 | 307 | { |
| 308 | 308 | cpustate->amflag = 0; |
| 309 | 309 | cpustate->amout = cpustate->PC; |
| 310 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 1); |
| 310 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 1); |
| 311 | 311 | |
| 312 | 312 | return 2; |
| 313 | 313 | } |
| r8829 | r8830 | |
| 315 | 315 | static UINT32 am2PCDisplacement16(v60_state *cpustate) |
| 316 | 316 | { |
| 317 | 317 | cpustate->amflag = 0; |
| 318 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1); |
| 318 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1); |
| 319 | 319 | |
| 320 | 320 | return 3; |
| 321 | 321 | } |
| r8829 | r8830 | |
| 324 | 324 | { |
| 325 | 325 | cpustate->amflag = 0; |
| 326 | 326 | cpustate->amout = cpustate->PC; |
| 327 | | cpustate->bamoffset = (INT16)OpRead16(cpustate->program, cpustate->modadd + 1); |
| 327 | cpustate->bamoffset = (INT16)OpRead16(cpustate, cpustate->modadd + 1); |
| 328 | 328 | |
| 329 | 329 | return 3; |
| 330 | 330 | } |
| r8829 | r8830 | |
| 332 | 332 | static UINT32 am2PCDisplacement32(v60_state *cpustate) |
| 333 | 333 | { |
| 334 | 334 | cpustate->amflag = 0; |
| 335 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1); |
| 335 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1); |
| 336 | 336 | |
| 337 | 337 | return 5; |
| 338 | 338 | } |
| r8829 | r8830 | |
| 341 | 341 | { |
| 342 | 342 | cpustate->amflag = 0; |
| 343 | 343 | cpustate->amout = cpustate->PC; |
| 344 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 344 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 1); |
| 345 | 345 | |
| 346 | 346 | return 5; |
| 347 | 347 | } |
| r8829 | r8830 | |
| 354 | 354 | switch (cpustate->moddim) |
| 355 | 355 | { |
| 356 | 356 | case 0: |
| 357 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 357 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 358 | 358 | break; |
| 359 | 359 | case 1: |
| 360 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 360 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 361 | 361 | break; |
| 362 | 362 | case 2: |
| 363 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 363 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 364 | 364 | break; |
| 365 | 365 | case 3: |
| 366 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 366 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 367 | 367 | break; |
| 368 | 368 | } |
| 369 | 369 | |
| r8829 | r8830 | |
| 373 | 373 | static UINT32 bam2PCDisplacementIndexed8(v60_state *cpustate) |
| 374 | 374 | { |
| 375 | 375 | cpustate->amflag = 0; |
| 376 | | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 376 | cpustate->amout = cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 377 | 377 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 378 | 378 | |
| 379 | 379 | return 3; |
| r8829 | r8830 | |
| 386 | 386 | switch (cpustate->moddim) |
| 387 | 387 | { |
| 388 | 388 | case 0: |
| 389 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 389 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 390 | 390 | break; |
| 391 | 391 | case 1: |
| 392 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 392 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 393 | 393 | break; |
| 394 | 394 | case 2: |
| 395 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 395 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 396 | 396 | break; |
| 397 | 397 | case 3: |
| 398 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 398 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 399 | 399 | break; |
| 400 | 400 | } |
| 401 | 401 | |
| r8829 | r8830 | |
| 405 | 405 | static UINT32 bam2PCDisplacementIndexed16(v60_state *cpustate) |
| 406 | 406 | { |
| 407 | 407 | cpustate->amflag = 0; |
| 408 | | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2); |
| 408 | cpustate->amout = cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2); |
| 409 | 409 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 410 | 410 | |
| 411 | 411 | return 4; |
| r8829 | r8830 | |
| 418 | 418 | switch (cpustate->moddim) |
| 419 | 419 | { |
| 420 | 420 | case 0: |
| 421 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 421 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 422 | 422 | break; |
| 423 | 423 | case 1: |
| 424 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 424 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 425 | 425 | break; |
| 426 | 426 | case 2: |
| 427 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 427 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 428 | 428 | break; |
| 429 | 429 | case 3: |
| 430 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 430 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 431 | 431 | break; |
| 432 | 432 | } |
| 433 | 433 | |
| r8829 | r8830 | |
| 437 | 437 | static UINT32 bam2PCDisplacementIndexed32(v60_state *cpustate) |
| 438 | 438 | { |
| 439 | 439 | cpustate->amflag = 0; |
| 440 | | cpustate->amout = cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2); |
| 440 | cpustate->amout = cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2); |
| 441 | 441 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 442 | 442 | |
| 443 | 443 | return 6; |
| r8829 | r8830 | |
| 446 | 446 | static UINT32 am2DisplacementIndirect8(v60_state *cpustate) |
| 447 | 447 | { |
| 448 | 448 | cpustate->amflag = 0; |
| 449 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 449 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 450 | 450 | |
| 451 | 451 | return 2; |
| 452 | 452 | } |
| r8829 | r8830 | |
| 454 | 454 | static UINT32 bam2DisplacementIndirect8(v60_state *cpustate) |
| 455 | 455 | { |
| 456 | 456 | cpustate->amflag = 0; |
| 457 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 457 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 458 | 458 | cpustate->bamoffset = 0; |
| 459 | 459 | return 2; |
| 460 | 460 | } |
| r8829 | r8830 | |
| 462 | 462 | static UINT32 am2DisplacementIndirect16(v60_state *cpustate) |
| 463 | 463 | { |
| 464 | 464 | cpustate->amflag = 0; |
| 465 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 465 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 466 | 466 | |
| 467 | 467 | return 3; |
| 468 | 468 | } |
| r8829 | r8830 | |
| 470 | 470 | static UINT32 bam2DisplacementIndirect16(v60_state *cpustate) |
| 471 | 471 | { |
| 472 | 472 | cpustate->amflag = 0; |
| 473 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 473 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 474 | 474 | cpustate->bamoffset = 0; |
| 475 | 475 | return 3; |
| 476 | 476 | } |
| r8829 | r8830 | |
| 478 | 478 | static UINT32 am2DisplacementIndirect32(v60_state *cpustate) |
| 479 | 479 | { |
| 480 | 480 | cpustate->amflag = 0; |
| 481 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 481 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 482 | 482 | |
| 483 | 483 | return 5; |
| 484 | 484 | } |
| r8829 | r8830 | |
| 486 | 486 | static UINT32 bam2DisplacementIndirect32(v60_state *cpustate) |
| 487 | 487 | { |
| 488 | 488 | cpustate->amflag = 0; |
| 489 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 489 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 490 | 490 | cpustate->bamoffset = 0; |
| 491 | 491 | |
| 492 | 492 | return 5; |
| r8829 | r8830 | |
| 499 | 499 | switch (cpustate->moddim) |
| 500 | 500 | { |
| 501 | 501 | case 0: |
| 502 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 502 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 503 | 503 | break; |
| 504 | 504 | case 1: |
| 505 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 505 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 506 | 506 | break; |
| 507 | 507 | case 2: |
| 508 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 508 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 509 | 509 | break; |
| 510 | 510 | case 3: |
| 511 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 511 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 512 | 512 | break; |
| 513 | 513 | } |
| 514 | 514 | |
| r8829 | r8830 | |
| 518 | 518 | static UINT32 bam2DisplacementIndirectIndexed8(v60_state *cpustate) |
| 519 | 519 | { |
| 520 | 520 | cpustate->amflag = 0; |
| 521 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 521 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 522 | 522 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 523 | 523 | |
| 524 | 524 | return 3; |
| r8829 | r8830 | |
| 531 | 531 | switch (cpustate->moddim) |
| 532 | 532 | { |
| 533 | 533 | case 0: |
| 534 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 534 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 535 | 535 | break; |
| 536 | 536 | case 1: |
| 537 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 537 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 538 | 538 | break; |
| 539 | 539 | case 2: |
| 540 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 540 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 541 | 541 | break; |
| 542 | 542 | case 3: |
| 543 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 543 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 544 | 544 | break; |
| 545 | 545 | } |
| 546 | 546 | |
| r8829 | r8830 | |
| 550 | 550 | static UINT32 bam2DisplacementIndirectIndexed16(v60_state *cpustate) |
| 551 | 551 | { |
| 552 | 552 | cpustate->amflag = 0; |
| 553 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)); |
| 553 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)); |
| 554 | 554 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 555 | 555 | |
| 556 | 556 | return 4; |
| r8829 | r8830 | |
| 563 | 563 | switch (cpustate->moddim) |
| 564 | 564 | { |
| 565 | 565 | case 0: |
| 566 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 566 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 567 | 567 | break; |
| 568 | 568 | case 1: |
| 569 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 569 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 570 | 570 | break; |
| 571 | 571 | case 2: |
| 572 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 572 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 573 | 573 | break; |
| 574 | 574 | case 3: |
| 575 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 575 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 576 | 576 | break; |
| 577 | 577 | } |
| 578 | 578 | |
| r8829 | r8830 | |
| 582 | 582 | static UINT32 bam2DisplacementIndirectIndexed32(v60_state *cpustate) |
| 583 | 583 | { |
| 584 | 584 | cpustate->amflag = 0; |
| 585 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)); |
| 585 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)); |
| 586 | 586 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 587 | 587 | |
| 588 | 588 | return 6; |
| r8829 | r8830 | |
| 591 | 591 | static UINT32 am2PCDisplacementIndirect8(v60_state *cpustate) |
| 592 | 592 | { |
| 593 | 593 | cpustate->amflag = 0; |
| 594 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 594 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 595 | 595 | |
| 596 | 596 | return 2; |
| 597 | 597 | } |
| r8829 | r8830 | |
| 599 | 599 | static UINT32 bam2PCDisplacementIndirect8(v60_state *cpustate) |
| 600 | 600 | { |
| 601 | 601 | cpustate->amflag = 0; |
| 602 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 602 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 603 | 603 | cpustate->bamoffset = 0; |
| 604 | 604 | |
| 605 | 605 | return 2; |
| r8829 | r8830 | |
| 608 | 608 | static UINT32 am2PCDisplacementIndirect16(v60_state *cpustate) |
| 609 | 609 | { |
| 610 | 610 | cpustate->amflag = 0; |
| 611 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 611 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 612 | 612 | |
| 613 | 613 | return 3; |
| 614 | 614 | } |
| r8829 | r8830 | |
| 616 | 616 | static UINT32 bam2PCDisplacementIndirect16(v60_state *cpustate) |
| 617 | 617 | { |
| 618 | 618 | cpustate->amflag = 0; |
| 619 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 619 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 620 | 620 | cpustate->bamoffset = 0; |
| 621 | 621 | |
| 622 | 622 | return 3; |
| r8829 | r8830 | |
| 625 | 625 | static UINT32 am2PCDisplacementIndirect32(v60_state *cpustate) |
| 626 | 626 | { |
| 627 | 627 | cpustate->amflag = 0; |
| 628 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 628 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 629 | 629 | |
| 630 | 630 | return 5; |
| 631 | 631 | } |
| r8829 | r8830 | |
| 633 | 633 | static UINT32 bam2PCDisplacementIndirect32(v60_state *cpustate) |
| 634 | 634 | { |
| 635 | 635 | cpustate->amflag = 0; |
| 636 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 636 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 637 | 637 | cpustate->bamoffset = 0; |
| 638 | 638 | |
| 639 | 639 | return 5; |
| r8829 | r8830 | |
| 646 | 646 | switch (cpustate->moddim) |
| 647 | 647 | { |
| 648 | 648 | case 0: |
| 649 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 649 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 650 | 650 | break; |
| 651 | 651 | case 1: |
| 652 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 652 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 653 | 653 | break; |
| 654 | 654 | case 2: |
| 655 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 655 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 656 | 656 | break; |
| 657 | 657 | case 3: |
| 658 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 658 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 659 | 659 | break; |
| 660 | 660 | } |
| 661 | 661 | |
| r8829 | r8830 | |
| 665 | 665 | static UINT32 bam2PCDisplacementIndirectIndexed8(v60_state *cpustate) |
| 666 | 666 | { |
| 667 | 667 | cpustate->amflag = 0; |
| 668 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)); |
| 668 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)); |
| 669 | 669 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 670 | 670 | |
| 671 | 671 | return 3; |
| r8829 | r8830 | |
| 678 | 678 | switch (cpustate->moddim) |
| 679 | 679 | { |
| 680 | 680 | case 0: |
| 681 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 681 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 682 | 682 | break; |
| 683 | 683 | case 1: |
| 684 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 684 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 685 | 685 | break; |
| 686 | 686 | case 2: |
| 687 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 687 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 688 | 688 | break; |
| 689 | 689 | case 3: |
| 690 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 690 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 691 | 691 | break; |
| 692 | 692 | } |
| 693 | 693 | |
| r8829 | r8830 | |
| 698 | 698 | static UINT32 bam2PCDisplacementIndirectIndexed16(v60_state *cpustate) |
| 699 | 699 | { |
| 700 | 700 | cpustate->amflag = 0; |
| 701 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)); |
| 701 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)); |
| 702 | 702 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 703 | 703 | |
| 704 | 704 | return 4; |
| r8829 | r8830 | |
| 712 | 712 | switch (cpustate->moddim) |
| 713 | 713 | { |
| 714 | 714 | case 0: |
| 715 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 715 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 716 | 716 | break; |
| 717 | 717 | case 1: |
| 718 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 718 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 719 | 719 | break; |
| 720 | 720 | case 2: |
| 721 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 721 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 722 | 722 | break; |
| 723 | 723 | case 3: |
| 724 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 724 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 725 | 725 | break; |
| 726 | 726 | } |
| 727 | 727 | |
| r8829 | r8830 | |
| 731 | 731 | static UINT32 bam2PCDisplacementIndirectIndexed32(v60_state *cpustate) |
| 732 | 732 | { |
| 733 | 733 | cpustate->amflag = 0; |
| 734 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)); |
| 734 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)); |
| 735 | 735 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 736 | 736 | |
| 737 | 737 | return 6; |
| r8829 | r8830 | |
| 740 | 740 | static UINT32 am2DoubleDisplacement8(v60_state *cpustate) |
| 741 | 741 | { |
| 742 | 742 | cpustate->amflag = 0; |
| 743 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 743 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 744 | 744 | |
| 745 | 745 | return 3; |
| 746 | 746 | } |
| r8829 | r8830 | |
| 748 | 748 | static UINT32 bam2DoubleDisplacement8(v60_state *cpustate) |
| 749 | 749 | { |
| 750 | 750 | cpustate->amflag = 0; |
| 751 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 752 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 751 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 752 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 753 | 753 | |
| 754 | 754 | return 3; |
| 755 | 755 | } |
| r8829 | r8830 | |
| 757 | 757 | static UINT32 am2DoubleDisplacement16(v60_state *cpustate) |
| 758 | 758 | { |
| 759 | 759 | cpustate->amflag = 0; |
| 760 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3); |
| 760 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3); |
| 761 | 761 | |
| 762 | 762 | return 5; |
| 763 | 763 | } |
| r8829 | r8830 | |
| 765 | 765 | static UINT32 bam2DoubleDisplacement16(v60_state *cpustate) |
| 766 | 766 | { |
| 767 | 767 | cpustate->amflag = 0; |
| 768 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 769 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 3); |
| 768 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 769 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 3); |
| 770 | 770 | |
| 771 | 771 | return 5; |
| 772 | 772 | } |
| r8829 | r8830 | |
| 774 | 774 | static UINT32 am2DoubleDisplacement32(v60_state *cpustate) |
| 775 | 775 | { |
| 776 | 776 | cpustate->amflag = 0; |
| 777 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5); |
| 777 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5); |
| 778 | 778 | |
| 779 | 779 | return 9; |
| 780 | 780 | } |
| r8829 | r8830 | |
| 782 | 782 | static UINT32 bam2DoubleDisplacement32(v60_state *cpustate) |
| 783 | 783 | { |
| 784 | 784 | cpustate->amflag = 0; |
| 785 | | cpustate->amout = MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 786 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 5); |
| 785 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)); |
| 786 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 5); |
| 787 | 787 | |
| 788 | 788 | return 9; |
| 789 | 789 | } |
| r8829 | r8830 | |
| 792 | 792 | static UINT32 am2PCDoubleDisplacement8(v60_state *cpustate) |
| 793 | 793 | { |
| 794 | 794 | cpustate->amflag = 0; |
| 795 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 795 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 796 | 796 | |
| 797 | 797 | return 3; |
| 798 | 798 | } |
| r8829 | r8830 | |
| 800 | 800 | static UINT32 bam2PCDoubleDisplacement8(v60_state *cpustate) |
| 801 | 801 | { |
| 802 | 802 | cpustate->amflag = 0; |
| 803 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)); |
| 804 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 2); |
| 803 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)); |
| 804 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 2); |
| 805 | 805 | |
| 806 | 806 | return 3; |
| 807 | 807 | } |
| r8829 | r8830 | |
| 809 | 809 | static UINT32 am2PCDoubleDisplacement16(v60_state *cpustate) |
| 810 | 810 | { |
| 811 | 811 | cpustate->amflag = 0; |
| 812 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3); |
| 812 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3); |
| 813 | 813 | |
| 814 | 814 | return 5; |
| 815 | 815 | } |
| r8829 | r8830 | |
| 817 | 817 | static UINT32 bam2PCDoubleDisplacement16(v60_state *cpustate) |
| 818 | 818 | { |
| 819 | 819 | cpustate->amflag = 0; |
| 820 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)); |
| 821 | | cpustate->bamoffset = (INT8)OpRead8(cpustate->program, cpustate->modadd + 3); |
| 820 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)); |
| 821 | cpustate->bamoffset = (INT8)OpRead8(cpustate, cpustate->modadd + 3); |
| 822 | 822 | |
| 823 | 823 | return 5; |
| 824 | 824 | } |
| r8829 | r8830 | |
| 826 | 826 | static UINT32 am2PCDoubleDisplacement32(v60_state *cpustate) |
| 827 | 827 | { |
| 828 | 828 | cpustate->amflag = 0; |
| 829 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5); |
| 829 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5); |
| 830 | 830 | |
| 831 | 831 | return 9; |
| 832 | 832 | } |
| r8829 | r8830 | |
| 834 | 834 | static UINT32 bam2PCDoubleDisplacement32(v60_state *cpustate) |
| 835 | 835 | { |
| 836 | 836 | cpustate->amflag = 0; |
| 837 | | cpustate->amout = MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 838 | | cpustate->bamoffset = OpRead32(cpustate->program, cpustate->modadd + 5); |
| 837 | cpustate->amout = cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)); |
| 838 | cpustate->bamoffset = OpRead32(cpustate, cpustate->modadd + 5); |
| 839 | 839 | |
| 840 | 840 | return 9; |
| 841 | 841 | } |
| r8829 | r8830 | |
| 843 | 843 | static UINT32 am2DirectAddress(v60_state *cpustate) |
| 844 | 844 | { |
| 845 | 845 | cpustate->amflag = 0; |
| 846 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 846 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 1); |
| 847 | 847 | |
| 848 | 848 | return 5; |
| 849 | 849 | } |
| r8829 | r8830 | |
| 851 | 851 | static UINT32 bam2DirectAddress(v60_state *cpustate) |
| 852 | 852 | { |
| 853 | 853 | cpustate->amflag = 0; |
| 854 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 1); |
| 854 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 1); |
| 855 | 855 | cpustate->bamoffset = 0; |
| 856 | 856 | |
| 857 | 857 | return 5; |
| r8829 | r8830 | |
| 864 | 864 | switch (cpustate->moddim) |
| 865 | 865 | { |
| 866 | 866 | case 0: |
| 867 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 867 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F]; |
| 868 | 868 | break; |
| 869 | 869 | case 1: |
| 870 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 870 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 871 | 871 | break; |
| 872 | 872 | case 2: |
| 873 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 873 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 874 | 874 | break; |
| 875 | 875 | case 3: |
| 876 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 876 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 877 | 877 | break; |
| 878 | 878 | } |
| 879 | 879 | |
| r8829 | r8830 | |
| 883 | 883 | static UINT32 bam2DirectAddressIndexed(v60_state *cpustate) |
| 884 | 884 | { |
| 885 | 885 | cpustate->amflag = 0; |
| 886 | | cpustate->amout = OpRead32(cpustate->program, cpustate->modadd + 2); |
| 886 | cpustate->amout = OpRead32(cpustate, cpustate->modadd + 2); |
| 887 | 887 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 888 | 888 | |
| 889 | 889 | return 6; |
| r8829 | r8830 | |
| 892 | 892 | static UINT32 am2DirectAddressDeferred(v60_state *cpustate) |
| 893 | 893 | { |
| 894 | 894 | cpustate->amflag = 0; |
| 895 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 895 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)); |
| 896 | 896 | |
| 897 | 897 | return 5; |
| 898 | 898 | } |
| r8829 | r8830 | |
| 900 | 900 | static UINT32 bam2DirectAddressDeferred(v60_state *cpustate) |
| 901 | 901 | { |
| 902 | 902 | cpustate->amflag = 0; |
| 903 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)); |
| 903 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)); |
| 904 | 904 | cpustate->bamoffset = 0; |
| 905 | 905 | |
| 906 | 906 | return 5; |
| r8829 | r8830 | |
| 913 | 913 | switch (cpustate->moddim) |
| 914 | 914 | { |
| 915 | 915 | case 0: |
| 916 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 916 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F]; |
| 917 | 917 | break; |
| 918 | 918 | case 1: |
| 919 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 919 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2; |
| 920 | 920 | break; |
| 921 | 921 | case 2: |
| 922 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 922 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4; |
| 923 | 923 | break; |
| 924 | 924 | case 3: |
| 925 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 925 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 8; |
| 926 | 926 | break; |
| 927 | 927 | } |
| 928 | 928 | |
| r8829 | r8830 | |
| 932 | 932 | static UINT32 bam2DirectAddressDeferredIndexed(v60_state *cpustate) |
| 933 | 933 | { |
| 934 | 934 | cpustate->amflag = 0; |
| 935 | | cpustate->amout = MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)); |
| 935 | cpustate->amout = cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)); |
| 936 | 936 | cpustate->bamoffset = cpustate->reg[cpustate->modval & 0x1F]; |
| 937 | 937 | |
| 938 | 938 | return 6; |
| r8829 | r8830 | |
| 1182 | 1182 | |
| 1183 | 1183 | static UINT32 am2Group6(v60_state *cpustate) |
| 1184 | 1184 | { |
| 1185 | | cpustate->modval2 = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1185 | cpustate->modval2 = OpRead8(cpustate, cpustate->modadd + 1); |
| 1186 | 1186 | return AMTable2_G6[cpustate->modval2 >> 5](cpustate); |
| 1187 | 1187 | } |
| 1188 | 1188 | static UINT32 bam2Group6(v60_state *cpustate) |
| 1189 | 1189 | { |
| 1190 | | cpustate->modval2 = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 1190 | cpustate->modval2 = OpRead8(cpustate, cpustate->modadd + 1); |
| 1191 | 1191 | return BAMTable2_G6[cpustate->modval2 >> 5](cpustate); |
| 1192 | 1192 | } |
| 1193 | 1193 | |
src/emu/cpu/v60/am3.c
| r8829 | r8830 | |
| 25 | 25 | switch (cpustate->moddim) |
| 26 | 26 | { |
| 27 | 27 | case 0: |
| 28 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 28 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 29 | 29 | break; |
| 30 | 30 | case 1: |
| 31 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 31 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 32 | 32 | break; |
| 33 | 33 | case 2: |
| 34 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 34 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| r8829 | r8830 | |
| 43 | 43 | switch (cpustate->moddim) |
| 44 | 44 | { |
| 45 | 45 | case 0: |
| 46 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 46 | cpustate->program->write_byte(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 47 | 47 | break; |
| 48 | 48 | case 1: |
| 49 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 49 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 50 | 50 | break; |
| 51 | 51 | case 2: |
| 52 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 52 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 53 | 53 | break; |
| 54 | 54 | } |
| 55 | 55 | |
| r8829 | r8830 | |
| 61 | 61 | switch (cpustate->moddim) |
| 62 | 62 | { |
| 63 | 63 | case 0: |
| 64 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 64 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 65 | 65 | cpustate->reg[cpustate->modval & 0x1F] += 1; |
| 66 | 66 | break; |
| 67 | 67 | case 1: |
| 68 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 68 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 69 | 69 | cpustate->reg[cpustate->modval & 0x1F] += 2; |
| 70 | 70 | break; |
| 71 | 71 | case 2: |
| 72 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 72 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 73 | 73 | cpustate->reg[cpustate->modval & 0x1F] += 4; |
| 74 | 74 | break; |
| 75 | 75 | } |
| r8829 | r8830 | |
| 83 | 83 | { |
| 84 | 84 | case 0: |
| 85 | 85 | cpustate->reg[cpustate->modval & 0x1F] -= 1; |
| 86 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 86 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 87 | 87 | break; |
| 88 | 88 | case 1: |
| 89 | 89 | cpustate->reg[cpustate->modval & 0x1F] -= 2; |
| 90 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 90 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 91 | 91 | break; |
| 92 | 92 | case 2: |
| 93 | 93 | cpustate->reg[cpustate->modval & 0x1F] -= 4; |
| 94 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 94 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 95 | 95 | break; |
| 96 | 96 | } |
| 97 | 97 | |
| r8829 | r8830 | |
| 103 | 103 | switch (cpustate->moddim) |
| 104 | 104 | { |
| 105 | 105 | case 0: |
| 106 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 106 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 107 | 107 | break; |
| 108 | 108 | case 1: |
| 109 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 109 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 110 | 110 | break; |
| 111 | 111 | case 2: |
| 112 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 112 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 113 | 113 | break; |
| 114 | 114 | } |
| 115 | 115 | |
| r8829 | r8830 | |
| 121 | 121 | switch (cpustate->moddim) |
| 122 | 122 | { |
| 123 | 123 | case 0: |
| 124 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 124 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 125 | 125 | break; |
| 126 | 126 | case 1: |
| 127 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 127 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 128 | 128 | break; |
| 129 | 129 | case 2: |
| 130 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 130 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 131 | 131 | break; |
| 132 | 132 | } |
| 133 | 133 | |
| r8829 | r8830 | |
| 139 | 139 | switch (cpustate->moddim) |
| 140 | 140 | { |
| 141 | 141 | case 0: |
| 142 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 142 | cpustate->program->write_byte(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 143 | 143 | break; |
| 144 | 144 | case 1: |
| 145 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 145 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 146 | 146 | break; |
| 147 | 147 | case 2: |
| 148 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 148 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 149 | 149 | break; |
| 150 | 150 | } |
| 151 | 151 | |
| r8829 | r8830 | |
| 158 | 158 | switch (cpustate->moddim) |
| 159 | 159 | { |
| 160 | 160 | case 0: |
| 161 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 161 | cpustate->program->write_byte(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 162 | 162 | break; |
| 163 | 163 | case 1: |
| 164 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 164 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 165 | 165 | break; |
| 166 | 166 | case 2: |
| 167 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 167 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | |
| r8829 | r8830 | |
| 176 | 176 | switch (cpustate->moddim) |
| 177 | 177 | { |
| 178 | 178 | case 0: |
| 179 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 179 | cpustate->program->write_byte(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 180 | 180 | break; |
| 181 | 181 | case 1: |
| 182 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 182 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 183 | 183 | break; |
| 184 | 184 | case 2: |
| 185 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 185 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 186 | 186 | break; |
| 187 | 187 | } |
| 188 | 188 | |
| r8829 | r8830 | |
| 194 | 194 | switch (cpustate->moddim) |
| 195 | 195 | { |
| 196 | 196 | case 0: |
| 197 | | MemWrite8(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 197 | cpustate->program->write_byte(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 198 | 198 | break; |
| 199 | 199 | case 1: |
| 200 | | MemWrite16(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 200 | cpustate->program->write_word_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 201 | 201 | break; |
| 202 | 202 | case 2: |
| 203 | | MemWrite32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 203 | cpustate->program->write_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 204 | 204 | break; |
| 205 | 205 | } |
| 206 | 206 | |
| r8829 | r8830 | |
| 213 | 213 | switch (cpustate->moddim) |
| 214 | 214 | { |
| 215 | 215 | case 0: |
| 216 | | MemWrite8(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 216 | cpustate->program->write_byte(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 217 | 217 | break; |
| 218 | 218 | case 1: |
| 219 | | MemWrite16(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 219 | cpustate->program->write_word_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 220 | 220 | break; |
| 221 | 221 | case 2: |
| 222 | | MemWrite32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 222 | cpustate->program->write_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 223 | 223 | break; |
| 224 | 224 | } |
| 225 | 225 | |
| r8829 | r8830 | |
| 231 | 231 | switch (cpustate->moddim) |
| 232 | 232 | { |
| 233 | 233 | case 0: |
| 234 | | MemWrite8(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 234 | cpustate->program->write_byte(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 235 | 235 | break; |
| 236 | 236 | case 1: |
| 237 | | MemWrite16(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 237 | cpustate->program->write_word_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 238 | 238 | break; |
| 239 | 239 | case 2: |
| 240 | | MemWrite32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 240 | cpustate->program->write_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 241 | 241 | break; |
| 242 | 242 | } |
| 243 | 243 | |
| r8829 | r8830 | |
| 249 | 249 | switch (cpustate->moddim) |
| 250 | 250 | { |
| 251 | 251 | case 0: |
| 252 | | MemWrite8(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 252 | cpustate->program->write_byte(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 253 | 253 | break; |
| 254 | 254 | case 1: |
| 255 | | MemWrite16(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 255 | cpustate->program->write_word_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 256 | 256 | break; |
| 257 | 257 | case 2: |
| 258 | | MemWrite32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 258 | cpustate->program->write_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | |
| r8829 | r8830 | |
| 267 | 267 | switch (cpustate->moddim) |
| 268 | 268 | { |
| 269 | 269 | case 0: |
| 270 | | MemWrite8(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 270 | cpustate->program->write_byte(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 271 | 271 | break; |
| 272 | 272 | case 1: |
| 273 | | MemWrite16(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 273 | cpustate->program->write_word_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 274 | 274 | break; |
| 275 | 275 | case 2: |
| 276 | | MemWrite32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 276 | cpustate->program->write_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 277 | 277 | break; |
| 278 | 278 | } |
| 279 | 279 | |
| r8829 | r8830 | |
| 285 | 285 | switch (cpustate->moddim) |
| 286 | 286 | { |
| 287 | 287 | case 0: |
| 288 | | MemWrite8(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 288 | cpustate->program->write_byte(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 289 | 289 | break; |
| 290 | 290 | case 1: |
| 291 | | MemWrite16(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 291 | cpustate->program->write_word_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 292 | 292 | break; |
| 293 | 293 | case 2: |
| 294 | | MemWrite32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 294 | cpustate->program->write_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 295 | 295 | break; |
| 296 | 296 | } |
| 297 | 297 | |
| r8829 | r8830 | |
| 303 | 303 | switch (cpustate->moddim) |
| 304 | 304 | { |
| 305 | 305 | case 0: |
| 306 | | MemWrite8(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 306 | cpustate->program->write_byte(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 307 | 307 | break; |
| 308 | 308 | case 1: |
| 309 | | MemWrite16(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 309 | cpustate->program->write_word_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 310 | 310 | break; |
| 311 | 311 | case 2: |
| 312 | | MemWrite32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 312 | cpustate->program->write_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 313 | 313 | break; |
| 314 | 314 | } |
| 315 | 315 | |
| r8829 | r8830 | |
| 321 | 321 | switch (cpustate->moddim) |
| 322 | 322 | { |
| 323 | 323 | case 0: |
| 324 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 324 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 325 | 325 | break; |
| 326 | 326 | case 1: |
| 327 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 327 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 328 | 328 | break; |
| 329 | 329 | case 2: |
| 330 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 330 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 331 | 331 | break; |
| 332 | 332 | } |
| 333 | 333 | |
| r8829 | r8830 | |
| 339 | 339 | switch (cpustate->moddim) |
| 340 | 340 | { |
| 341 | 341 | case 0: |
| 342 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 342 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 343 | 343 | break; |
| 344 | 344 | case 1: |
| 345 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 345 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 346 | 346 | break; |
| 347 | 347 | case 2: |
| 348 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 348 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 349 | 349 | break; |
| 350 | 350 | } |
| 351 | 351 | |
| r8829 | r8830 | |
| 357 | 357 | switch (cpustate->moddim) |
| 358 | 358 | { |
| 359 | 359 | case 0: |
| 360 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 360 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 361 | 361 | break; |
| 362 | 362 | case 1: |
| 363 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 363 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 364 | 364 | break; |
| 365 | 365 | case 2: |
| 366 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 366 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 367 | 367 | break; |
| 368 | 368 | } |
| 369 | 369 | |
| r8829 | r8830 | |
| 376 | 376 | switch (cpustate->moddim) |
| 377 | 377 | { |
| 378 | 378 | case 0: |
| 379 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 379 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 380 | 380 | break; |
| 381 | 381 | case 1: |
| 382 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 382 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 383 | 383 | break; |
| 384 | 384 | case 2: |
| 385 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 385 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 386 | 386 | break; |
| 387 | 387 | } |
| 388 | 388 | |
| r8829 | r8830 | |
| 394 | 394 | switch (cpustate->moddim) |
| 395 | 395 | { |
| 396 | 396 | case 0: |
| 397 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 397 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 398 | 398 | break; |
| 399 | 399 | case 1: |
| 400 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 400 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 401 | 401 | break; |
| 402 | 402 | case 2: |
| 403 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 403 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 404 | 404 | break; |
| 405 | 405 | } |
| 406 | 406 | |
| r8829 | r8830 | |
| 412 | 412 | switch (cpustate->moddim) |
| 413 | 413 | { |
| 414 | 414 | case 0: |
| 415 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 415 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 416 | 416 | break; |
| 417 | 417 | case 1: |
| 418 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 418 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 419 | 419 | break; |
| 420 | 420 | case 2: |
| 421 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 421 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval2 & 0x1F] + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 422 | 422 | break; |
| 423 | 423 | } |
| 424 | 424 | |
| r8829 | r8830 | |
| 430 | 430 | switch (cpustate->moddim) |
| 431 | 431 | { |
| 432 | 432 | case 0: |
| 433 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 433 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 434 | 434 | break; |
| 435 | 435 | case 1: |
| 436 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 436 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 437 | 437 | break; |
| 438 | 438 | case 2: |
| 439 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 439 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 440 | 440 | break; |
| 441 | 441 | } |
| 442 | 442 | |
| r8829 | r8830 | |
| 448 | 448 | switch (cpustate->moddim) |
| 449 | 449 | { |
| 450 | 450 | case 0: |
| 451 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 451 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 452 | 452 | break; |
| 453 | 453 | case 1: |
| 454 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 454 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 455 | 455 | break; |
| 456 | 456 | case 2: |
| 457 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 457 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 458 | 458 | break; |
| 459 | 459 | } |
| 460 | 460 | |
| r8829 | r8830 | |
| 466 | 466 | switch (cpustate->moddim) |
| 467 | 467 | { |
| 468 | 468 | case 0: |
| 469 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 469 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 470 | 470 | break; |
| 471 | 471 | case 1: |
| 472 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 472 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 473 | 473 | break; |
| 474 | 474 | case 2: |
| 475 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 475 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 476 | 476 | break; |
| 477 | 477 | } |
| 478 | 478 | |
| r8829 | r8830 | |
| 485 | 485 | switch (cpustate->moddim) |
| 486 | 486 | { |
| 487 | 487 | case 0: |
| 488 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 488 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 489 | 489 | break; |
| 490 | 490 | case 1: |
| 491 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 491 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 492 | 492 | break; |
| 493 | 493 | case 2: |
| 494 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 494 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 495 | 495 | break; |
| 496 | 496 | } |
| 497 | 497 | |
| r8829 | r8830 | |
| 503 | 503 | switch (cpustate->moddim) |
| 504 | 504 | { |
| 505 | 505 | case 0: |
| 506 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 506 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 507 | 507 | break; |
| 508 | 508 | case 1: |
| 509 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 509 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 510 | 510 | break; |
| 511 | 511 | case 2: |
| 512 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 512 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 513 | 513 | break; |
| 514 | 514 | } |
| 515 | 515 | |
| r8829 | r8830 | |
| 521 | 521 | switch (cpustate->moddim) |
| 522 | 522 | { |
| 523 | 523 | case 0: |
| 524 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 524 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 525 | 525 | break; |
| 526 | 526 | case 1: |
| 527 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 527 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 528 | 528 | break; |
| 529 | 529 | case 2: |
| 530 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 530 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 531 | 531 | break; |
| 532 | 532 | } |
| 533 | 533 | |
| r8829 | r8830 | |
| 540 | 540 | switch (cpustate->moddim) |
| 541 | 541 | { |
| 542 | 542 | case 0: |
| 543 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalb); |
| 543 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalb); |
| 544 | 544 | break; |
| 545 | 545 | case 1: |
| 546 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalh); |
| 546 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalh); |
| 547 | 547 | break; |
| 548 | 548 | case 2: |
| 549 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalw); |
| 549 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalw); |
| 550 | 550 | break; |
| 551 | 551 | } |
| 552 | 552 | |
| r8829 | r8830 | |
| 558 | 558 | switch (cpustate->moddim) |
| 559 | 559 | { |
| 560 | 560 | case 0: |
| 561 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalb); |
| 561 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalb); |
| 562 | 562 | break; |
| 563 | 563 | case 1: |
| 564 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalh); |
| 564 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalh); |
| 565 | 565 | break; |
| 566 | 566 | case 2: |
| 567 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalw); |
| 567 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalw); |
| 568 | 568 | break; |
| 569 | 569 | } |
| 570 | 570 | |
| r8829 | r8830 | |
| 576 | 576 | switch (cpustate->moddim) |
| 577 | 577 | { |
| 578 | 578 | case 0: |
| 579 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalb); |
| 579 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalb); |
| 580 | 580 | break; |
| 581 | 581 | case 1: |
| 582 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalh); |
| 582 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalh); |
| 583 | 583 | break; |
| 584 | 584 | case 2: |
| 585 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalw); |
| 585 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->reg[cpustate->modval & 0x1F] + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalw); |
| 586 | 586 | break; |
| 587 | 587 | } |
| 588 | 588 | |
| r8829 | r8830 | |
| 595 | 595 | switch (cpustate->moddim) |
| 596 | 596 | { |
| 597 | 597 | case 0: |
| 598 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalb); |
| 598 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalb); |
| 599 | 599 | break; |
| 600 | 600 | case 1: |
| 601 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalh); |
| 601 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalh); |
| 602 | 602 | break; |
| 603 | 603 | case 2: |
| 604 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT8)OpRead8(cpustate->program, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate->program, cpustate->modadd + 2), cpustate->modwritevalw); |
| 604 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT8)OpRead8(cpustate, cpustate->modadd + 1)) + (INT8)OpRead8(cpustate, cpustate->modadd + 2), cpustate->modwritevalw); |
| 605 | 605 | break; |
| 606 | 606 | } |
| 607 | 607 | |
| r8829 | r8830 | |
| 613 | 613 | switch (cpustate->moddim) |
| 614 | 614 | { |
| 615 | 615 | case 0: |
| 616 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalb); |
| 616 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalb); |
| 617 | 617 | break; |
| 618 | 618 | case 1: |
| 619 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalh); |
| 619 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalh); |
| 620 | 620 | break; |
| 621 | 621 | case 2: |
| 622 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + (INT16)OpRead16(cpustate->program, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate->program, cpustate->modadd + 3), cpustate->modwritevalw); |
| 622 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + (INT16)OpRead16(cpustate, cpustate->modadd + 1)) + (INT16)OpRead16(cpustate, cpustate->modadd + 3), cpustate->modwritevalw); |
| 623 | 623 | break; |
| 624 | 624 | } |
| 625 | 625 | |
| r8829 | r8830 | |
| 631 | 631 | switch (cpustate->moddim) |
| 632 | 632 | { |
| 633 | 633 | case 0: |
| 634 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalb); |
| 634 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalb); |
| 635 | 635 | break; |
| 636 | 636 | case 1: |
| 637 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalh); |
| 637 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalh); |
| 638 | 638 | break; |
| 639 | 639 | case 2: |
| 640 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, cpustate->PC + OpRead32(cpustate->program, cpustate->modadd + 1)) + OpRead32(cpustate->program, cpustate->modadd + 5), cpustate->modwritevalw); |
| 640 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(cpustate->PC + OpRead32(cpustate, cpustate->modadd + 1)) + OpRead32(cpustate, cpustate->modadd + 5), cpustate->modwritevalw); |
| 641 | 641 | break; |
| 642 | 642 | } |
| 643 | 643 | |
| r8829 | r8830 | |
| 649 | 649 | switch (cpustate->moddim) |
| 650 | 650 | { |
| 651 | 651 | case 0: |
| 652 | | MemWrite8(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalb); |
| 652 | cpustate->program->write_byte(OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalb); |
| 653 | 653 | break; |
| 654 | 654 | case 1: |
| 655 | | MemWrite16(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalh); |
| 655 | cpustate->program->write_word_unaligned(OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalh); |
| 656 | 656 | break; |
| 657 | 657 | case 2: |
| 658 | | MemWrite32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1), cpustate->modwritevalw); |
| 658 | cpustate->program->write_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1), cpustate->modwritevalw); |
| 659 | 659 | break; |
| 660 | 660 | } |
| 661 | 661 | |
| r8829 | r8830 | |
| 667 | 667 | switch (cpustate->moddim) |
| 668 | 668 | { |
| 669 | 669 | case 0: |
| 670 | | MemWrite8(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 670 | cpustate->program->write_byte(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 671 | 671 | break; |
| 672 | 672 | case 1: |
| 673 | | MemWrite16(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 673 | cpustate->program->write_word_unaligned(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 2, cpustate->modwritevalh); |
| 674 | 674 | break; |
| 675 | 675 | case 2: |
| 676 | | MemWrite32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 676 | cpustate->program->write_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2) + cpustate->reg[cpustate->modval & 0x1F] * 4, cpustate->modwritevalw); |
| 677 | 677 | break; |
| 678 | 678 | } |
| 679 | 679 | |
| r8829 | r8830 | |
| 685 | 685 | switch (cpustate->moddim) |
| 686 | 686 | { |
| 687 | 687 | case 0: |
| 688 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 688 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalb); |
| 689 | 689 | break; |
| 690 | 690 | case 1: |
| 691 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 691 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalh); |
| 692 | 692 | break; |
| 693 | 693 | case 2: |
| 694 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 694 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 1)), cpustate->modwritevalw); |
| 695 | 695 | break; |
| 696 | 696 | } |
| 697 | 697 | |
| r8829 | r8830 | |
| 703 | 703 | switch (cpustate->moddim) |
| 704 | 704 | { |
| 705 | 705 | case 0: |
| 706 | | MemWrite8(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 706 | cpustate->program->write_byte(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalb); |
| 707 | 707 | break; |
| 708 | 708 | case 1: |
| 709 | | MemWrite16(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 709 | cpustate->program->write_word_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalh); |
| 710 | 710 | break; |
| 711 | 711 | case 2: |
| 712 | | MemWrite32(cpustate->program, MemRead32(cpustate->program, OpRead32(cpustate->program, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 712 | cpustate->program->write_dword_unaligned(cpustate->program->read_dword_unaligned(OpRead32(cpustate, cpustate->modadd + 2)) + cpustate->reg[cpustate->modval & 0x1F], cpustate->modwritevalw); |
| 713 | 713 | break; |
| 714 | 714 | } |
| 715 | 715 | |
| r8829 | r8830 | |
| 846 | 846 | |
| 847 | 847 | static UINT32 am3Group6(v60_state *cpustate) |
| 848 | 848 | { |
| 849 | | cpustate->modval2 = OpRead8(cpustate->program, cpustate->modadd + 1); |
| 849 | cpustate->modval2 = OpRead8(cpustate, cpustate->modadd + 1); |
| 850 | 850 | return AMTable3_G6[cpustate->modval2 >> 5](cpustate); |
| 851 | 851 | } |
| 852 | 852 | |
src/emu/cpu/v60/op12.c
| r8829 | r8830 | |
| 20 | 20 | if ((cs)->flag##num) \ |
| 21 | 21 | appb = (UINT8)(cs)->reg[(cs)->op##num]; \ |
| 22 | 22 | else \ |
| 23 | | appb = MemRead8((cs)->program, (cs)->op##num); |
| 23 | appb = (cs)->program->read_byte((cs)->op##num); |
| 24 | 24 | |
| 25 | 25 | #define F12LOADOPHALF(cs, num) \ |
| 26 | 26 | if ((cs)->flag##num) \ |
| 27 | 27 | apph = (UINT16)(cs)->reg[(cs)->op##num]; \ |
| 28 | 28 | else \ |
| 29 | | apph = MemRead16((cs)->program, (cs)->op##num); |
| 29 | apph = (cs)->program->read_word_unaligned((cs)->op##num); |
| 30 | 30 | |
| 31 | 31 | #define F12LOADOPWORD(cs, num) \ |
| 32 | 32 | if ((cs)->flag##num) \ |
| 33 | 33 | appw = (cs)->reg[(cs)->op##num]; \ |
| 34 | 34 | else \ |
| 35 | | appw = MemRead32((cs)->program,(cs)->op##num); |
| 35 | appw = (cs)->program->read_dword_unaligned((cs)->op##num); |
| 36 | 36 | |
| 37 | 37 | #define F12STOREOPBYTE(cs, num) \ |
| 38 | 38 | if ((cs)->flag##num) \ |
| 39 | 39 | SETREG8((cs)->reg[(cs)->op##num], appb); \ |
| 40 | 40 | else \ |
| 41 | | MemWrite8((cs)->program, (cs)->op##num, appb); |
| 41 | (cs)->program->write_byte((cs)->op##num, appb); |
| 42 | 42 | |
| 43 | 43 | #define F12STOREOPHALF(cs, num) \ |
| 44 | 44 | if ((cs)->flag##num) \ |
| 45 | 45 | SETREG16((cs)->reg[(cs)->op##num], apph); \ |
| 46 | 46 | else \ |
| 47 | | MemWrite16((cs)->program, (cs)->op##num, apph); |
| 47 | (cs)->program->write_word_unaligned((cs)->op##num, apph); |
| 48 | 48 | |
| 49 | 49 | #define F12STOREOPWORD(cs, num) \ |
| 50 | 50 | if ((cs)->flag##num) \ |
| 51 | 51 | (cs)->reg[(cs)->op##num] = appw; \ |
| 52 | 52 | else \ |
| 53 | | MemWrite32((cs)->program, (cs)->op##num, appw); |
| 53 | (cs)->program->write_dword_unaligned((cs)->op##num, appw); |
| 54 | 54 | |
| 55 | 55 | #define F12LOADOP1BYTE(cs) F12LOADOPBYTE(cs, 1) |
| 56 | 56 | #define F12LOADOP1HALF(cs) F12LOADOPHALF(cs, 1) |
| r8829 | r8830 | |
| 76 | 76 | // writing to the second operand. |
| 77 | 77 | static void F12DecodeFirstOperand(v60_state *cpustate, UINT32 (*DecodeOp1)(v60_state *), UINT8 dim1) |
| 78 | 78 | { |
| 79 | | cpustate->instflags = OpRead8(cpustate->program, cpustate->PC + 1); |
| 79 | cpustate->instflags = OpRead8(cpustate, cpustate->PC + 1); |
| 80 | 80 | |
| 81 | 81 | // Check if F1 or F2 |
| 82 | 82 | if (cpustate->instflags & 0x80) |
| r8829 | r8830 | |
| 177 | 177 | // Decode both format 1 / 2 operands |
| 178 | 178 | static void F12DecodeOperands(v60_state *cpustate, UINT32 (*DecodeOp1)(v60_state *), UINT8 dim1, UINT32 (*DecodeOp2)(v60_state *), UINT8 dim2) |
| 179 | 179 | { |
| 180 | | UINT8 _if12 = OpRead8(cpustate->program, cpustate->PC + 1); |
| 180 | UINT8 _if12 = OpRead8(cpustate, cpustate->PC + 1); |
| 181 | 181 | |
| 182 | 182 | // Check if F1 or F2 |
| 183 | 183 | if (_if12 & 0x80) |
| r8829 | r8830 | |
| 402 | 402 | F12DecodeOperands(cpustate, ReadAMAddress, 0,ReadAMAddress, 2); |
| 403 | 403 | |
| 404 | 404 | cpustate->SP -= 4; |
| 405 | | MemWrite32(cpustate->program, cpustate->SP, cpustate->AP); |
| 405 | cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->AP); |
| 406 | 406 | cpustate->AP = cpustate->op2; |
| 407 | 407 | |
| 408 | 408 | cpustate->SP -= 4; |
| 409 | | MemWrite32(cpustate->program, cpustate->SP, cpustate->PC + cpustate->amlength1 + cpustate->amlength2 + 2); |
| 409 | cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->PC + cpustate->amlength1 + cpustate->amlength2 + 2); |
| 410 | 410 | cpustate->PC = cpustate->op1; |
| 411 | 411 | |
| 412 | 412 | return 0; |
| r8829 | r8830 | |
| 462 | 462 | oldPSW = v60_update_psw_for_exception(cpustate, 0, cpustate->op1); |
| 463 | 463 | |
| 464 | 464 | cpustate->SP -= 4; |
| 465 | | MemWrite32(cpustate->program, cpustate->SP, cpustate->op2); |
| 465 | cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->op2); |
| 466 | 466 | |
| 467 | 467 | cpustate->SP -= 4; |
| 468 | | MemWrite32(cpustate->program, cpustate->SP, EXCEPTION_CODE_AND_SIZE(0x1800 + cpustate->op1 * 0x100, 8)); |
| 468 | cpustate->program->write_dword_unaligned(cpustate->SP, EXCEPTION_CODE_AND_SIZE(0x1800 + cpustate->op1 * 0x100, 8)); |
| 469 | 469 | |
| 470 | 470 | cpustate->SP -= 4; |
| 471 | | MemWrite32(cpustate->program, cpustate->SP, oldPSW); |
| 471 | cpustate->program->write_dword_unaligned(cpustate->SP, oldPSW); |
| 472 | 472 | |
| 473 | 473 | cpustate->SP -= 4; |
| 474 | | MemWrite32(cpustate->program, cpustate->SP, cpustate->PC + cpustate->amlength1 + cpustate->amlength2 + 2); |
| 474 | cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->PC + cpustate->amlength1 + cpustate->amlength2 + 2); |
| 475 | 475 | |
| 476 | 476 | cpustate->PC = GETINTVECT(cpustate, 24 + cpustate->op1); |
| 477 | 477 | |
| r8829 | r8830 | |
| 591 | 591 | } |
| 592 | 592 | else |
| 593 | 593 | { |
| 594 | | a = MemRead32(cpustate->program, cpustate->op2); |
| 595 | | b = MemRead32(cpustate->program, cpustate->op2 + 4); |
| 594 | a = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 595 | b = cpustate->program->read_dword_unaligned(cpustate->op2 + 4); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | dv = ((UINT64)b << 32) | ((UINT64)a); |
| r8829 | r8830 | |
| 610 | 610 | } |
| 611 | 611 | else |
| 612 | 612 | { |
| 613 | | MemWrite32(cpustate->program, cpustate->op2, a); |
| 614 | | MemWrite32(cpustate->program, cpustate->op2 + 4, b); |
| 613 | cpustate->program->write_dword_unaligned(cpustate->op2, a); |
| 614 | cpustate->program->write_dword_unaligned(cpustate->op2 + 4, b); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | F12END(cpustate); |
| r8829 | r8830 | |
| 631 | 631 | } |
| 632 | 632 | else |
| 633 | 633 | { |
| 634 | | a = MemRead32(cpustate->program, cpustate->op2); |
| 635 | | b = MemRead32(cpustate->program, cpustate->op2 + 4); |
| 634 | a = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 635 | b = cpustate->program->read_dword_unaligned(cpustate->op2 + 4); |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | dv = (UINT64)(((UINT64)b << 32) | (UINT64)a); |
| r8829 | r8830 | |
| 649 | 649 | } |
| 650 | 650 | else |
| 651 | 651 | { |
| 652 | | MemWrite32(cpustate->program, cpustate->op2, a); |
| 653 | | MemWrite32(cpustate->program, cpustate->op2 + 4, b); |
| 652 | cpustate->program->write_dword_unaligned(cpustate->op2, a); |
| 653 | cpustate->program->write_dword_unaligned(cpustate->op2 + 4, b); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | F12END(cpustate); |
| r8829 | r8830 | |
| 708 | 708 | static UINT32 opINB(v60_state *cpustate) |
| 709 | 709 | { |
| 710 | 710 | F12DecodeFirstOperand(cpustate, ReadAMAddress, 0); |
| 711 | | cpustate->modwritevalb = MemRead8(cpustate->io, cpustate->op1); |
| 711 | cpustate->modwritevalb = cpustate->io->read_byte(cpustate->op1); |
| 712 | 712 | |
| 713 | 713 | if ( cpustate->stall_io ) |
| 714 | 714 | { |
| r8829 | r8830 | |
| 723 | 723 | static UINT32 opINH(v60_state *cpustate) |
| 724 | 724 | { |
| 725 | 725 | F12DecodeFirstOperand(cpustate, ReadAMAddress, 1); |
| 726 | | cpustate->modwritevalh = MemRead16(cpustate->io, cpustate->op1); |
| 726 | cpustate->modwritevalh = cpustate->io->read_word_unaligned(cpustate->op1); |
| 727 | 727 | |
| 728 | 728 | if ( cpustate->stall_io ) |
| 729 | 729 | { |
| r8829 | r8830 | |
| 738 | 738 | static UINT32 opINW(v60_state *cpustate) |
| 739 | 739 | { |
| 740 | 740 | F12DecodeFirstOperand(cpustate, ReadAMAddress, 2); |
| 741 | | cpustate->modwritevalw = MemRead32(cpustate->io, cpustate->op1); |
| 741 | cpustate->modwritevalw = cpustate->io->read_dword_unaligned(cpustate->op1); |
| 742 | 742 | |
| 743 | 743 | if ( cpustate->stall_io ) |
| 744 | 744 | { |
| r8829 | r8830 | |
| 755 | 755 | F12DecodeOperands(cpustate, ReadAMAddress, 2,ReadAM, 2); |
| 756 | 756 | if (cpustate->op2 >= 0 && cpustate->op2 <= 28) |
| 757 | 757 | { |
| 758 | | if (cpustate->flag1 &&(!(OpRead8(cpustate->program, cpustate->PC + 1)&0x80 && OpRead8(cpustate->program, cpustate->PC + 2) == 0xf4 ) )) |
| 758 | if (cpustate->flag1 &&(!(OpRead8(cpustate, cpustate->PC + 1)&0x80 && OpRead8(cpustate, cpustate->PC + 2) == 0xf4 ) )) |
| 759 | 759 | cpustate->reg[cpustate->op2 + 36] = cpustate->reg[cpustate->op1]; |
| 760 | 760 | else |
| 761 | 761 | cpustate->reg[cpustate->op2 + 36] = cpustate->op1; |
| r8829 | r8830 | |
| 776 | 776 | |
| 777 | 777 | cpustate->TR = cpustate->op2; |
| 778 | 778 | |
| 779 | | cpustate->TKCW = MemRead32(cpustate->program, cpustate->op2); |
| 779 | cpustate->TKCW = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 780 | 780 | cpustate->op2 += 4; |
| 781 | 781 | if(cpustate->SYCW & 0x100) { |
| 782 | | cpustate->L0SP = MemRead32(cpustate->program, cpustate->op2); |
| 782 | cpustate->L0SP = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 783 | 783 | cpustate->op2 += 4; |
| 784 | 784 | } |
| 785 | 785 | if(cpustate->SYCW & 0x200) { |
| 786 | | cpustate->L1SP = MemRead32(cpustate->program, cpustate->op2); |
| 786 | cpustate->L1SP = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 787 | 787 | cpustate->op2 += 4; |
| 788 | 788 | } |
| 789 | 789 | if(cpustate->SYCW & 0x400) { |
| 790 | | cpustate->L2SP = MemRead32(cpustate->program, cpustate->op2); |
| 790 | cpustate->L2SP = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 791 | 791 | cpustate->op2 += 4; |
| 792 | 792 | } |
| 793 | 793 | if(cpustate->SYCW & 0x800) { |
| 794 | | cpustate->L3SP = MemRead32(cpustate->program, cpustate->op2); |
| 794 | cpustate->L3SP = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 795 | 795 | cpustate->op2 += 4; |
| 796 | 796 | } |
| 797 | 797 | |
| r8829 | r8830 | |
| 800 | 800 | // 31 registers supported, _not_ 32 |
| 801 | 801 | for(i = 0; i < 31; i++) |
| 802 | 802 | if(cpustate->op1 & (1 << i)) { |
| 803 | | cpustate->reg[i] = MemRead32(cpustate->program, cpustate->op2); |
| 803 | cpustate->reg[i] = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 804 | 804 | cpustate->op2 += 4; |
| 805 | 805 | } |
| 806 | 806 | |
| r8829 | r8830 | |
| 822 | 822 | } |
| 823 | 823 | else |
| 824 | 824 | { |
| 825 | | a = MemRead32(cpustate->program, cpustate->op1); |
| 826 | | b = MemRead32(cpustate->program, cpustate->op1 + 4); |
| 825 | a = cpustate->program->read_dword_unaligned(cpustate->op1); |
| 826 | b = cpustate->program->read_dword_unaligned(cpustate->op1 + 4); |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | if (cpustate->flag2) |
| r8829 | r8830 | |
| 833 | 833 | } |
| 834 | 834 | else |
| 835 | 835 | { |
| 836 | | MemWrite32(cpustate->program, cpustate->op2, a); |
| 837 | | MemWrite32(cpustate->program, cpustate->op2 + 4, b); |
| 836 | cpustate->program->write_dword_unaligned(cpustate->op2, a); |
| 837 | cpustate->program->write_dword_unaligned(cpustate->op2 + 4, b); |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | F12END(cpustate); |
| r8829 | r8830 | |
| 1235 | 1235 | static UINT32 opOUTB(v60_state *cpustate) |
| 1236 | 1236 | { |
| 1237 | 1237 | F12DecodeOperands(cpustate, ReadAM, 0,ReadAMAddress, 2); |
| 1238 | | MemWrite8(cpustate->io, cpustate->op2,(UINT8)cpustate->op1); |
| 1238 | cpustate->io->write_byte(cpustate->op2,(UINT8)cpustate->op1); |
| 1239 | 1239 | F12END(cpustate); |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | static UINT32 opOUTH(v60_state *cpustate) |
| 1243 | 1243 | { |
| 1244 | 1244 | F12DecodeOperands(cpustate, ReadAM, 1,ReadAMAddress, 2); |
| 1245 | | MemWrite16(cpustate->io, cpustate->op2,(UINT16)cpustate->op1); |
| 1245 | cpustate->io->write_word_unaligned(cpustate->op2,(UINT16)cpustate->op1); |
| 1246 | 1246 | F12END(cpustate); |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | static UINT32 opOUTW(v60_state *cpustate) |
| 1250 | 1250 | { |
| 1251 | 1251 | F12DecodeOperands(cpustate, ReadAM, 2,ReadAMAddress, 2); |
| 1252 | | MemWrite32(cpustate->io, cpustate->op2, cpustate->op1); |
| 1252 | cpustate->io->write_dword_unaligned(cpustate->op2, cpustate->op1); |
| 1253 | 1253 | F12END(cpustate); |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| r8829 | r8830 | |
| 2328 | 2328 | } |
| 2329 | 2329 | else |
| 2330 | 2330 | { |
| 2331 | | a = MemRead32(cpustate->program, cpustate->op2); |
| 2331 | a = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 2332 | 2332 | } |
| 2333 | 2333 | |
| 2334 | 2334 | res = (INT64)a * (INT64)(INT32)cpustate->op1; |
| r8829 | r8830 | |
| 2346 | 2346 | } |
| 2347 | 2347 | else |
| 2348 | 2348 | { |
| 2349 | | MemWrite32(cpustate->program, cpustate->op2, a); |
| 2350 | | MemWrite32(cpustate->program, cpustate->op2 + 4, b); |
| 2349 | cpustate->program->write_dword_unaligned(cpustate->op2, a); |
| 2350 | cpustate->program->write_dword_unaligned(cpustate->op2 + 4, b); |
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | 2353 | F12END(cpustate); |
| r8829 | r8830 | |
| 2366 | 2366 | } |
| 2367 | 2367 | else |
| 2368 | 2368 | { |
| 2369 | | a = MemRead32(cpustate->program, cpustate->op2); |
| 2369 | a = cpustate->program->read_dword_unaligned(cpustate->op2); |
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | res = (UINT64)a * (UINT64)cpustate->op1; |
| r8829 | r8830 | |
| 2383 | 2383 | } |
| 2384 | 2384 | else |
| 2385 | 2385 | { |
| 2386 | | MemWrite32(cpustate->program, cpustate->op2, a); |
| 2387 | | MemWrite32(cpustate->program, cpustate->op2 + 4, b); |
| 2386 | cpustate->program->write_dword_unaligned(cpustate->op2, a); |
| 2387 | cpustate->program->write_dword_unaligned(cpustate->op2 + 4, b); |
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | F12END(cpustate); |
src/emu/memory.c
| r8829 | r8830 | |
| 211 | 211 | |
| 212 | 212 | #define MEM_DUMP (0) |
| 213 | 213 | #define VERBOSE (0) |
| 214 | #define TEST_HANDLER (0) |
| 214 | 215 | |
| 215 | 216 | #define VPRINTF(x) do { if (VERBOSE) mame_printf_debug x; } while (0) |
| 216 | 217 | |
| r8829 | r8830 | |
| 351 | 352 | |
| 352 | 353 | // compare a range against our range |
| 353 | 354 | bool matches_exactly(offs_t bytestart, offs_t byteend) const { return (m_bytestart == bytestart && m_byteend == byteend); } |
| 354 | | bool fully_covers(offs_t bytestart, offs_t byteend) const { return m_bytestart <= bytestart && m_byteend >= byteend; } |
| 355 | | bool partially_covers(offs_t bytestart, offs_t byteend) const { return m_bytestart <= byteend && m_byteend >= bytestart; } |
| 355 | bool fully_covers(offs_t bytestart, offs_t byteend) const { return (m_bytestart <= bytestart && m_byteend >= byteend); } |
| 356 | bool partially_covers(offs_t bytestart, offs_t byteend) const { return (m_bytestart <= byteend && m_byteend >= bytestart); } |
| 356 | 357 | |
| 357 | 358 | // track and verify address space references to this bank |
| 358 | 359 | bool references_space(address_space &space, read_or_write readorwrite) const; |
| r8829 | r8830 | |
| 764 | 765 | _UintType unmap_r(address_space &space, offs_t offset, _UintType mask) |
| 765 | 766 | { |
| 766 | 767 | if (m_space.log_unmap() && !m_space.debugger_access()) |
| 767 | | logerror("%s: unmapped %s memory read from %s\n", cpuexec_describe_context(&m_space.m_machine), m_space.name(), core_i64_hex_format(m_space.byte_to_address(offset), m_space.addrchars())); |
| 768 | logerror("%s: unmapped %s memory read from %s & %s\n", |
| 769 | cpuexec_describe_context(&m_space.m_machine), m_space.name(), |
| 770 | core_i64_hex_format(m_space.byte_to_address(offset), m_space.addrchars()), |
| 771 | core_i64_hex_format(mask, 2 * sizeof(_UintType))); |
| 768 | 772 | return m_space.unmap(); |
| 769 | 773 | } |
| 770 | 774 | |
| r8829 | r8830 | |
| 817 | 821 | void unmap_w(address_space &space, offs_t offset, _UintType data, _UintType mask) |
| 818 | 822 | { |
| 819 | 823 | if (m_space.log_unmap() && !m_space.debugger_access()) |
| 820 | | logerror("%s: unmapped %s memory write to %s = %x & %x\n", cpuexec_describe_context(&m_space.m_machine), m_space.name(), core_i64_hex_format(m_space.byte_to_address(offset), m_space.addrchars()),(UINT32)data,(UINT32)mask); |
| 824 | logerror("%s: unmapped %s memory write to %s = %s & %s\n", |
| 825 | cpuexec_describe_context(&m_space.m_machine), m_space.name(), |
| 826 | core_i64_hex_format(m_space.byte_to_address(offset), m_space.addrchars()), |
| 827 | core_i64_hex_format(data, 2 * sizeof(_UintType)), |
| 828 | core_i64_hex_format(mask, 2 * sizeof(_UintType))); |
| 821 | 829 | } |
| 822 | 830 | |
| 823 | 831 | template<typename _UintType> |
| r8829 | r8830 | |
| 851 | 859 | class address_space_specific : public address_space |
| 852 | 860 | { |
| 853 | 861 | typedef address_space_specific<_NativeType, _Endian, _Large> this_type; |
| 862 | |
| 863 | // constants describing the native size |
| 864 | static const UINT32 NATIVE_BYTES = sizeof(_NativeType); |
| 865 | static const UINT32 NATIVE_MASK = NATIVE_BYTES - 1; |
| 866 | static const UINT32 NATIVE_BITS = 8 * NATIVE_BYTES; |
| 854 | 867 | |
| 855 | 868 | // helpers to simplify core code |
| 856 | | offs_t endian_xor(offs_t value) { if (_Endian == ENDIANNESS_BIG) value = ~value; return value; } |
| 857 | | int endian_shift(int levalue, int bevalue) { return (_Endian == ENDIANNESS_LITTLE) ? levalue : bevalue; } |
| 858 | 869 | UINT32 read_lookup(offs_t byteaddress) const { return _Large ? m_read.lookup_live_large(byteaddress) : m_read.lookup_live_small(byteaddress); } |
| 859 | 870 | UINT32 write_lookup(offs_t byteaddress) const { return _Large ? m_write.lookup_live_large(byteaddress) : m_write.lookup_live_small(byteaddress); } |
| 860 | 871 | |
| r8829 | r8830 | |
| 863 | 874 | address_space_specific(device_memory_interface &memory, int spacenum) |
| 864 | 875 | : address_space(memory, spacenum, _Large), |
| 865 | 876 | m_read(*this, _Large), |
| 866 | | m_write(*this, _Large) { } |
| 877 | m_write(*this, _Large) |
| 878 | { |
| 879 | #if (TEST_HANDLER) |
| 880 | // test code to verify the read/write handlers are touching the correct bits |
| 881 | // and returning the correct results |
| 882 | |
| 883 | // install some dummy RAM for the first 16 bytes with well-known values |
| 884 | UINT8 buffer[16]; |
| 885 | for (int index = 0; index < 16; index++) |
| 886 | buffer[index ^ ((_Endian == ENDIANNESS_NATIVE) ? 0 : (data_width()/8 - 1))] = index * 0x11; |
| 887 | install_ram(0x00, 0x0f, 0x0f, 0, ROW_READWRITE, buffer); |
| 888 | printf("\n\naddress_space(%d, %s, %s)\n", NATIVE_BITS, (_Endian == ENDIANNESS_LITTLE) ? "little" : "big", _Large ? "large" : "small"); |
| 867 | 889 | |
| 890 | // walk through the first 8 addresses |
| 891 | for (int address = 0; address < 8; address++) |
| 892 | { |
| 893 | // determine expected values |
| 894 | UINT64 expected64 = ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 7 : 0)) * 0x11) << 56) | |
| 895 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 6 : 1)) * 0x11) << 48) | |
| 896 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 5 : 2)) * 0x11) << 40) | |
| 897 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 4 : 3)) * 0x11) << 32) | |
| 898 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 3 : 4)) * 0x11) << 24) | |
| 899 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 2 : 5)) * 0x11) << 16) | |
| 900 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 1 : 6)) * 0x11) << 8) | |
| 901 | ((UINT64)((address + ((_Endian == ENDIANNESS_LITTLE) ? 0 : 7)) * 0x11) << 0); |
| 902 | UINT32 expected32 = (_Endian == ENDIANNESS_LITTLE) ? expected64 : (expected64 >> 32); |
| 903 | UINT16 expected16 = (_Endian == ENDIANNESS_LITTLE) ? expected32 : (expected32 >> 16); |
| 904 | UINT8 expected8 = (_Endian == ENDIANNESS_LITTLE) ? expected16 : (expected16 >> 8); |
| 905 | |
| 906 | UINT64 result64; |
| 907 | UINT32 result32; |
| 908 | UINT16 result16; |
| 909 | UINT8 result8; |
| 910 | |
| 911 | // validate byte accesses |
| 912 | printf("\nAddress %d\n", address); |
| 913 | printf(" read_byte = "); printf("%02X\n", result8 = read_byte(address)); assert(result8 == expected8); |
| 914 | |
| 915 | // validate word accesses (if aligned) |
| 916 | if (address % 2 == 0) { printf(" read_word = "); printf("%04X\n", result16 = read_word(address)); assert(result16 == expected16); } |
| 917 | if (address % 2 == 0) { printf(" read_word (0xff00) = "); printf("%04X\n", result16 = read_word(address, 0xff00)); assert((result16 & 0xff00) == (expected16 & 0xff00)); } |
| 918 | if (address % 2 == 0) { printf(" (0x00ff) = "); printf("%04X\n", result16 = read_word(address, 0x00ff)); assert((result16 & 0x00ff) == (expected16 & 0x00ff)); } |
| 919 | |
| 920 | // validate unaligned word accesses |
| 921 | printf(" read_word_unaligned = "); printf("%04X\n", result16 = read_word_unaligned(address)); assert(result16 == expected16); |
| 922 | printf(" read_word_unaligned (0xff00) = "); printf("%04X\n", result16 = read_word_unaligned(address, 0xff00)); assert((result16 & 0xff00) == (expected16 & 0xff00)); |
| 923 | printf(" (0x00ff) = "); printf("%04X\n", result16 = read_word_unaligned(address, 0x00ff)); assert((result16 & 0x00ff) == (expected16 & 0x00ff)); |
| 924 | |
| 925 | // validate dword acceses (if aligned) |
| 926 | if (address % 4 == 0) { printf(" read_dword = "); printf("%08X\n", result32 = read_dword(address)); assert(result32 == expected32); } |
| 927 | if (address % 4 == 0) { printf(" read_dword (0xff000000) = "); printf("%08X\n", result32 = read_dword(address, 0xff000000)); assert((result32 & 0xff000000) == (expected32 & 0xff000000)); } |
| 928 | if (address % 4 == 0) { printf(" (0x00ff0000) = "); printf("%08X\n", result32 = read_dword(address, 0x00ff0000)); assert((result32 & 0x00ff0000) == (expected32 & 0x00ff0000)); } |
| 929 | if (address % 4 == 0) { printf(" (0x0000ff00) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ff00)); assert((result32 & 0x0000ff00) == (expected32 & 0x0000ff00)); } |
| 930 | if (address % 4 == 0) { printf(" (0x000000ff) = "); printf("%08X\n", result32 = read_dword(address, 0x000000ff)); assert((result32 & 0x000000ff) == (expected32 & 0x000000ff)); } |
| 931 | if (address % 4 == 0) { printf(" (0xffff0000) = "); printf("%08X\n", result32 = read_dword(address, 0xffff0000)); assert((result32 & 0xffff0000) == (expected32 & 0xffff0000)); } |
| 932 | if (address % 4 == 0) { printf(" (0x0000ffff) = "); printf("%08X\n", result32 = read_dword(address, 0x0000ffff)); assert((result32 & 0x0000ffff) == (expected32 & 0x0000ffff)); } |
| 933 | if (address % 4 == 0) { printf(" (0xffffff00) = "); printf("%08X\n", result32 = read_dword(address, 0xffffff00)); assert((result32 & 0xffffff00) == (expected32 & 0xffffff00)); } |
| 934 | if (address % 4 == 0) { printf(" (0x00ffffff) = "); printf("%08X\n", result32 = read_dword(address, 0x00ffffff)); assert((result32 & 0x00ffffff) == (expected32 & 0x00ffffff)); } |
| 935 | |
| 936 | // validate unaligned dword accesses |
| 937 | printf(" read_dword_unaligned = "); printf("%08X\n", result32 = read_dword_unaligned(address)); assert(result32 == expected32); |
| 938 | printf(" read_dword_unaligned (0xff000000) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0xff000000)); assert((result32 & 0xff000000) == (expected32 & 0xff000000)); |
| 939 | printf(" (0x00ff0000) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x00ff0000)); assert((result32 & 0x00ff0000) == (expected32 & 0x00ff0000)); |
| 940 | printf(" (0x0000ff00) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x0000ff00)); assert((result32 & 0x0000ff00) == (expected32 & 0x0000ff00)); |
| 941 | printf(" (0x000000ff) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x000000ff)); assert((result32 & 0x000000ff) == (expected32 & 0x000000ff)); |
| 942 | printf(" (0xffff0000) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0xffff0000)); assert((result32 & 0xffff0000) == (expected32 & 0xffff0000)); |
| 943 | printf(" (0x0000ffff) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x0000ffff)); assert((result32 & 0x0000ffff) == (expected32 & 0x0000ffff)); |
| 944 | printf(" (0xffffff00) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0xffffff00)); assert((result32 & 0xffffff00) == (expected32 & 0xffffff00)); |
| 945 | printf(" (0x00ffffff) = "); printf("%08X\n", result32 = read_dword_unaligned(address, 0x00ffffff)); assert((result32 & 0x00ffffff) == (expected32 & 0x00ffffff)); |
| 946 | |
| 947 | // validate qword acceses (if aligned) |
| 948 | if (address % 8 == 0) { printf(" read_qword = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address), 16)); assert(result64 == expected64); } |
| 949 | if (address % 8 == 0) { printf(" read_qword (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); } |
| 950 | if (address % 8 == 0) { printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); } |
| 951 | if (address % 8 == 0) { printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); } |
| 952 | if (address % 8 == 0) { printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); } |
| 953 | if (address % 8 == 0) { printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); } |
| 954 | if (address % 8 == 0) { printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); } |
| 955 | if (address % 8 == 0) { printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); } |
| 956 | if (address % 8 == 0) { printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); } |
| 957 | if (address % 8 == 0) { printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); } |
| 958 | if (address % 8 == 0) { printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); } |
| 959 | if (address % 8 == 0) { printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); } |
| 960 | if (address % 8 == 0) { printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); } |
| 961 | if (address % 8 == 0) { printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); } |
| 962 | if (address % 8 == 0) { printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); } |
| 963 | if (address % 8 == 0) { printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); } |
| 964 | if (address % 8 == 0) { printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); } |
| 965 | if (address % 8 == 0) { printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); } |
| 966 | if (address % 8 == 0) { printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); } |
| 967 | if (address % 8 == 0) { printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); } |
| 968 | if (address % 8 == 0) { printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); } |
| 969 | if (address % 8 == 0) { printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); } |
| 970 | if (address % 8 == 0) { printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); } |
| 971 | if (address % 8 == 0) { printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); } |
| 972 | if (address % 8 == 0) { printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); } |
| 973 | if (address % 8 == 0) { printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); } |
| 974 | if (address % 8 == 0) { printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); } |
| 975 | if (address % 8 == 0) { printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); } |
| 976 | if (address % 8 == 0) { printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); } |
| 977 | if (address % 8 == 0) { printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); } |
| 978 | if (address % 8 == 0) { printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); } |
| 979 | |
| 980 | // validate unaligned qword accesses |
| 981 | printf(" read_qword_unaligned = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address), 16)); assert(result64 == expected64); |
| 982 | printf(" read_qword_unaligned (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); |
| 983 | printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); |
| 984 | printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); |
| 985 | printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); |
| 986 | printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); |
| 987 | printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); |
| 988 | printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); |
| 989 | printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); |
| 990 | printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); |
| 991 | printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); |
| 992 | printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); |
| 993 | printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); |
| 994 | printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); |
| 995 | printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); |
| 996 | printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); |
| 997 | printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); |
| 998 | printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); |
| 999 | printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); |
| 1000 | printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); |
| 1001 | printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); |
| 1002 | printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); |
| 1003 | printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); |
| 1004 | printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); |
| 1005 | printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); |
| 1006 | printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); |
| 1007 | printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); |
| 1008 | printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); |
| 1009 | printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); |
| 1010 | printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); |
| 1011 | printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); |
| 1012 | } |
| 1013 | #endif |
| 1014 | } |
| 1015 | |
| 868 | 1016 | // accessors |
| 869 | 1017 | virtual address_table_read &read() { return m_read; } |
| 870 | 1018 | virtual address_table_write &write() { return m_write; } |
| r8829 | r8830 | |
| 892 | 1040 | accessors.write_qword_masked = reinterpret_cast<void (*)(address_space *, offs_t, UINT64, UINT64)>(&write_qword_masked_static); |
| 893 | 1041 | } |
| 894 | 1042 | |
| 895 | | // |
| 1043 | // return a pointer to the read bank, or NULL if none |
| 896 | 1044 | virtual void *get_read_ptr(offs_t byteaddress) |
| 897 | 1045 | { |
| 898 | 1046 | // perform the lookup |
| r8829 | r8830 | |
| 906 | 1054 | return handler.ramptr(handler.byteoffset(byteaddress)); |
| 907 | 1055 | } |
| 908 | 1056 | |
| 1057 | // return a pointer to the write bank, or NULL if none |
| 909 | 1058 | virtual void *get_write_ptr(offs_t byteaddress) |
| 910 | 1059 | { |
| 911 | 1060 | // perform the lookup |
| r8829 | r8830 | |
| 924 | 1073 | { |
| 925 | 1074 | profiler_mark_start(PROFILER_MEMREAD); |
| 926 | 1075 | |
| 1076 | if (TEST_HANDLER) printf("[r%X,%s]", offset, core_i64_hex_format(mask, sizeof(_NativeType) * 2)); |
| 1077 | |
| 927 | 1078 | // look up the handler |
| 928 | 1079 | offs_t byteaddress = offset & m_bytemask; |
| 929 | 1080 | UINT32 entry = read_lookup(byteaddress); |
| 930 | 1081 | const handler_entry_read &handler = m_read.handler_read(entry); |
| 931 | 1082 | |
| 932 | 1083 | // either read directly from RAM, or call the delegate |
| 933 | | offset = handler.byteoffset(byteaddress) / sizeof(_NativeType); |
| 1084 | offset = handler.byteoffset(byteaddress); |
| 934 | 1085 | _NativeType result; |
| 935 | | if (entry < STATIC_RAM) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset * sizeof(_NativeType))); |
| 1086 | if (entry < STATIC_RAM) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset)); |
| 936 | 1087 | else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, mask); |
| 937 | | else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset, mask); |
| 938 | | else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset, mask); |
| 939 | | else if (sizeof(_NativeType) == 8) result = handler.read64(*this, offset, mask); |
| 1088 | else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset >> 1, mask); |
| 1089 | else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset >> 2, mask); |
| 1090 | else if (sizeof(_NativeType) == 8) result = handler.read64(*this, offset >> 3, mask); |
| 940 | 1091 | |
| 941 | 1092 | profiler_mark_end(); |
| 942 | 1093 | return result; |
| 943 | 1094 | } |
| 944 | 1095 | |
| 1096 | // mask-less native read |
| 1097 | _NativeType read_native(offs_t offset) |
| 1098 | { |
| 1099 | profiler_mark_start(PROFILER_MEMREAD); |
| 1100 | |
| 1101 | if (TEST_HANDLER) printf("[r%X]", offset); |
| 1102 | |
| 1103 | // look up the handler |
| 1104 | offs_t byteaddress = offset & m_bytemask; |
| 1105 | UINT32 entry = read_lookup(byteaddress); |
| 1106 | const handler_entry_read &handler = m_read.handler_read(entry); |
| 1107 | |
| 1108 | // either read directly from RAM, or call the delegate |
| 1109 | offset = handler.byteoffset(byteaddress); |
| 1110 | _NativeType result; |
| 1111 | if (entry < STATIC_RAM) result = *reinterpret_cast<_NativeType *>(handler.ramptr(offset)); |
| 1112 | else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, 0xff); |
| 1113 | else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset >> 1, 0xffff); |
| 1114 | else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset >> 2, 0xffffffff); |
| 1115 | else if (sizeof(_NativeType) == 8) result = handler.read64(*this, offset >> 3, U64(0xffffffffffffffff)); |
| 1116 | |
| 1117 | profiler_mark_end(); |
| 1118 | return result; |
| 1119 | } |
| 1120 | |
| 945 | 1121 | // native write |
| 946 | 1122 | void write_native(offs_t offset, _NativeType data, _NativeType mask) |
| 947 | 1123 | { |
| r8829 | r8830 | |
| 953 | 1129 | const handler_entry_write &handler = m_write.handler_write(entry); |
| 954 | 1130 | |
| 955 | 1131 | // either write directly to RAM, or call the delegate |
| 956 | | offset = handler.byteoffset(byteaddress) / sizeof(_NativeType); |
| 1132 | offset = handler.byteoffset(byteaddress); |
| 957 | 1133 | if (entry < STATIC_RAM) |
| 958 | 1134 | { |
| 959 | | _NativeType *dest = reinterpret_cast<_NativeType *>(handler.ramptr(offset * sizeof(_NativeType))); |
| 1135 | _NativeType *dest = reinterpret_cast<_NativeType *>(handler.ramptr(offset)); |
| 960 | 1136 | *dest = (*dest & ~mask) | (data & mask); |
| 961 | 1137 | } |
| 962 | 1138 | else if (sizeof(_NativeType) == 1) handler.write8(*this, offset, data, mask); |
| 963 | | else if (sizeof(_NativeType) == 2) handler.write16(*this, offset, data, mask); |
| 964 | | else if (sizeof(_NativeType) == 4) handler.write32(*this, offset, data, mask); |
| 965 | | else if (sizeof(_NativeType) == 8) handler.write64(*this, offset, data, mask); |
| 1139 | else if (sizeof(_NativeType) == 2) handler.write16(*this, offset >> 1, data, mask); |
| 1140 | else if (sizeof(_NativeType) == 4) handler.write32(*this, offset >> 2, data, mask); |
| 1141 | else if (sizeof(_NativeType) == 8) handler.write64(*this, offset >> 3, data, mask); |
| 966 | 1142 | |
| 967 | 1143 | profiler_mark_end(); |
| 968 | 1144 | } |
| 969 | 1145 | |
| 970 | | // read byte |
| 971 | | UINT8 read_byte_direct(offs_t address) |
| 1146 | // mask-less native write |
| 1147 | void write_native(offs_t offset, _NativeType data) |
| 972 | 1148 | { |
| 973 | | if (sizeof(_NativeType) == 1) |
| 974 | | return read_native(address, 0xff); |
| 1149 | profiler_mark_start(PROFILER_MEMWRITE); |
| 975 | 1150 | |
| 976 | | if (sizeof(_NativeType) > 1) |
| 977 | | { |
| 978 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 1)) * 8; |
| 979 | | return read_native(address, (_NativeType)0xff << shift) >> shift; |
| 980 | | } |
| 1151 | // look up the handler |
| 1152 | offs_t byteaddress = offset & m_bytemask; |
| 1153 | UINT32 entry = write_lookup(byteaddress); |
| 1154 | const handler_entry_write &handler = m_write.handler_write(entry); |
| 1155 | |
| 1156 | // either write directly to RAM, or call the delegate |
| 1157 | offset = handler.byteoffset(byteaddress); |
| 1158 | if (entry < STATIC_RAM) *reinterpret_cast<_NativeType *>(handler.ramptr(offset)) = data; |
| 1159 | else if (sizeof(_NativeType) == 1) handler.write8(*this, offset, data, 0xff); |
| 1160 | else if (sizeof(_NativeType) == 2) handler.write16(*this, offset >> 1, data, 0xffff); |
| 1161 | else if (sizeof(_NativeType) == 4) handler.write32(*this, offset >> 2, data, 0xffffffff); |
| 1162 | else if (sizeof(_NativeType) == 8) handler.write64(*this, offset >> 3, data, U64(0xffffffffffffffff)); |
| 1163 | |
| 1164 | profiler_mark_end(); |
| 981 | 1165 | } |
| 982 | 1166 | |
| 983 | | // read word |
| 984 | | UINT16 read_word_direct(offs_t address, UINT16 mask) |
| 1167 | // generic direct read |
| 1168 | template<typename _TargetType, bool _Aligned> |
| 1169 | _TargetType read_direct(offs_t address, _TargetType mask) |
| 985 | 1170 | { |
| 986 | | if (sizeof(_NativeType) == 2) |
| 987 | | return read_native(address, mask); |
| 1171 | const UINT32 TARGET_BYTES = sizeof(_TargetType); |
| 1172 | const UINT32 TARGET_BITS = 8 * TARGET_BYTES; |
| 988 | 1173 | |
| 989 | | if (sizeof(_NativeType) > 2) |
| 1174 | // equal to native size and aligned; simple pass-through to the native reader |
| 1175 | if (NATIVE_BYTES == TARGET_BYTES && (_Aligned || (address & NATIVE_MASK) == 0)) |
| 1176 | return read_native(address & ~NATIVE_MASK, mask); |
| 1177 | |
| 1178 | // if native size is larger, see if we can do a single masked read (guaranteed if we're aligned) |
| 1179 | if (NATIVE_BYTES > TARGET_BYTES) |
| 990 | 1180 | { |
| 991 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 2)) * 8; |
| 992 | | return read_native(address, (_NativeType)mask << shift) >> shift; |
| 1181 | UINT32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); |
| 1182 | if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS)) |
| 1183 | { |
| 1184 | if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits; |
| 1185 | return read_native(address & ~NATIVE_MASK, (_NativeType)mask << offsbits) >> offsbits; |
| 1186 | } |
| 993 | 1187 | } |
| 994 | 1188 | |
| 995 | | if (sizeof(_NativeType) < 2) |
| 1189 | // determine our alignment against the native boundaries, and mask the address |
| 1190 | UINT32 offsbits = 8 * (address & (NATIVE_BYTES - 1)); |
| 1191 | address &= ~NATIVE_MASK; |
| 1192 | |
| 1193 | // if we're here, and native size is larger or equal to the target, we need exactly 2 reads |
| 1194 | if (NATIVE_BYTES >= TARGET_BYTES) |
| 996 | 1195 | { |
| 997 | | UINT16 result = 0; |
| 998 | | if (EXPECTED(mask & (0xff << endian_shift(0,8)))) result |= read_byte_direct(address + 0) << endian_shift(0,8); |
| 999 | | if (EXPECTED(mask & (0xff << endian_shift(8,0)))) result |= read_byte_direct(address + 1) << endian_shift(8,0); |
| 1000 | | return result; |
| 1001 | | } |
| 1002 | | } |
| 1196 | // little-endian case |
| 1197 | if (_Endian == ENDIANNESS_LITTLE) |
| 1198 | { |
| 1199 | // read lower bits from lower address |
| 1200 | _TargetType result = 0; |
| 1201 | _NativeType curmask = (_NativeType)mask << offsbits; |
| 1202 | if (curmask != 0) result = read_native(address, curmask) >> offsbits; |
| 1003 | 1203 | |
| 1004 | | // read dword |
| 1005 | | UINT32 read_dword_direct(offs_t address, UINT32 mask) |
| 1006 | | { |
| 1007 | | if (sizeof(_NativeType) == 4) |
| 1008 | | return read_native(address, mask); |
| 1204 | // read upper bits from upper address |
| 1205 | offsbits = NATIVE_BITS - offsbits; |
| 1206 | curmask = mask >> offsbits; |
| 1207 | if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) << offsbits; |
| 1208 | return result; |
| 1209 | } |
| 1009 | 1210 | |
| 1010 | | if (sizeof(_NativeType) > 4) |
| 1011 | | { |
| 1012 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 4)) * 8; |
| 1013 | | return read_native(address, (_NativeType)mask << shift) >> shift; |
| 1211 | // big-endian case |
| 1212 | else |
| 1213 | { |
| 1214 | // left-justify the mask to the target type |
| 1215 | const UINT32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); |
| 1216 | _NativeType result = 0; |
| 1217 | _NativeType ljmask = (_NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; |
| 1218 | _NativeType curmask = ljmask >> offsbits; |
| 1219 | |
| 1220 | // read upper bits from lower address |
| 1221 | if (curmask != 0) result = read_native(address, curmask) << offsbits; |
| 1222 | offsbits = NATIVE_BITS - offsbits; |
| 1223 | |
| 1224 | // read lower bits from upper address |
| 1225 | curmask = ljmask << offsbits; |
| 1226 | if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) >> offsbits; |
| 1227 | |
| 1228 | // return the un-justified result |
| 1229 | return result >> LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; |
| 1230 | } |
| 1014 | 1231 | } |
| 1015 | 1232 | |
| 1016 | | if (sizeof(_NativeType) < 4) |
| 1233 | // if we're here, then we have 2 or more reads needed to get our final result |
| 1234 | else |
| 1017 | 1235 | { |
| 1018 | | UINT32 result = 0; |
| 1019 | | if (EXPECTED(mask & (0xffff << endian_shift(0,16)))) result |= read_word_direct(address + 0, mask >> endian_shift(0,16)) << endian_shift(0,16); |
| 1020 | | if (EXPECTED(mask & (0xffff << endian_shift(16,0)))) result |= read_word_direct(address + 2, mask >> endian_shift(16,0)) << endian_shift(16,0); |
| 1021 | | return result; |
| 1022 | | } |
| 1023 | | } |
| 1236 | // compute the maximum number of loops; we do it this way so that there are |
| 1237 | // a fixed number of loops for the compiler to unroll if it desires |
| 1238 | const UINT32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; |
| 1239 | _TargetType result = 0; |
| 1240 | |
| 1241 | // little-endian case |
| 1242 | if (_Endian == ENDIANNESS_LITTLE) |
| 1243 | { |
| 1244 | // read lowest bits from first address |
| 1245 | _NativeType curmask = mask << offsbits; |
| 1246 | if (curmask != 0) result = read_native(address, curmask) >> offsbits; |
| 1024 | 1247 | |
| 1025 | | // read qword |
| 1026 | | UINT64 read_qword_direct(offs_t address, UINT64 mask) |
| 1027 | | { |
| 1028 | | if (sizeof(_NativeType) == 8) |
| 1029 | | return read_native(address, mask); |
| 1248 | // read middle bits from subsequent addresses |
| 1249 | offsbits = NATIVE_BITS - offsbits; |
| 1250 | for (UINT32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) |
| 1251 | { |
| 1252 | address += NATIVE_BYTES; |
| 1253 | curmask = mask >> offsbits; |
| 1254 | if (curmask != 0) result |= (_TargetType)read_native(address, curmask) << offsbits; |
| 1255 | offsbits += NATIVE_BITS; |
| 1256 | } |
| 1030 | 1257 | |
| 1031 | | if (sizeof(_NativeType) < 8) |
| 1032 | | { |
| 1033 | | UINT64 result = 0; |
| 1034 | | if (EXPECTED(mask & (U64(0xffffffff) << endian_shift(0,32)))) result |= (UINT64)read_dword_direct(address + 0, mask >> endian_shift(0,32)) << endian_shift(0,32); |
| 1035 | | if (EXPECTED(mask & (U64(0xffffffff) << endian_shift(32,0)))) result |= (UINT64)read_dword_direct(address + 4, mask >> endian_shift(32,0)) << endian_shift(32,0); |
| 1258 | // if we're not aligned and we still have bits left, read uppermost bits from last address |
| 1259 | if (!_Aligned && offsbits < TARGET_BITS) |
| 1260 | { |
| 1261 | curmask = mask >> offsbits; |
| 1262 | if (curmask != 0) result |= (_TargetType)read_native(address + NATIVE_BYTES, curmask) << offsbits; |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | // big-endian case |
| 1267 | else |
| 1268 | { |
| 1269 | // read highest bits from first address |
| 1270 | offsbits = TARGET_BITS - (NATIVE_BITS - offsbits); |
| 1271 | _NativeType curmask = mask >> offsbits; |
| 1272 | if (curmask != 0) result = (_TargetType)read_native(address, curmask) << offsbits; |
| 1273 | |
| 1274 | // read middle bits from subsequent addresses |
| 1275 | for (UINT32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) |
| 1276 | { |
| 1277 | offsbits -= NATIVE_BITS; |
| 1278 | address += NATIVE_BYTES; |
| 1279 | curmask = mask >> offsbits; |
| 1280 | if (curmask != 0) result |= (_TargetType)read_native(address, curmask) << offsbits; |
| 1281 | } |
| 1282 | |
| 1283 | // if we're not aligned and we still have bits left, read lowermost bits from the last address |
| 1284 | if (!_Aligned && offsbits != 0) |
| 1285 | { |
| 1286 | offsbits = NATIVE_BITS - offsbits; |
| 1287 | curmask = mask << offsbits; |
| 1288 | if (curmask != 0) result |= read_native(address + NATIVE_BYTES, curmask) >> offsbits; |
| 1289 | } |
| 1290 | } |
| 1036 | 1291 | return result; |
| 1037 | 1292 | } |
| 1038 | 1293 | } |
| 1039 | | |
| 1040 | | // write byte |
| 1041 | | void write_byte_direct(offs_t address, UINT8 data) |
| 1294 | |
| 1295 | // generic direct write |
| 1296 | template<typename _TargetType, bool _Aligned> |
| 1297 | void write_direct(offs_t address, _TargetType data, _TargetType mask) |
| 1042 | 1298 | { |
| 1043 | | if (sizeof(_NativeType) == 1) |
| 1044 | | return write_native(address, data, 0xff); |
| 1299 | const UINT32 TARGET_BYTES = sizeof(_TargetType); |
| 1300 | const UINT32 TARGET_BITS = 8 * TARGET_BYTES; |
| 1045 | 1301 | |
| 1046 | | if (sizeof(_NativeType) > 1) |
| 1302 | // equal to native size and aligned; simple pass-through to the native writer |
| 1303 | if (NATIVE_BYTES == TARGET_BYTES && (_Aligned || (address & NATIVE_MASK) == 0)) |
| 1304 | return write_native(address & ~NATIVE_MASK, data, mask); |
| 1305 | |
| 1306 | // if native size is larger, see if we can do a single masked write (guaranteed if we're aligned) |
| 1307 | if (NATIVE_BYTES > TARGET_BYTES) |
| 1047 | 1308 | { |
| 1048 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 1)) * 8; |
| 1049 | | return write_native(address, (_NativeType)data << shift, (_NativeType)0xff << shift); |
| 1309 | UINT32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); |
| 1310 | if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS)) |
| 1311 | { |
| 1312 | if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits; |
| 1313 | return write_native(address & ~NATIVE_MASK, (_NativeType)data << offsbits, (_NativeType)mask << offsbits); |
| 1314 | } |
| 1050 | 1315 | } |
| 1051 | | } |
| 1052 | 1316 | |
| 1053 | | // write word |
| 1054 | | void write_word_direct(offs_t address, UINT16 data, UINT16 mask) |
| 1055 | | { |
| 1056 | | if (sizeof(_NativeType) == 2) |
| 1057 | | return write_native(address, data, mask); |
| 1317 | // determine our alignment against the native boundaries, and mask the address |
| 1318 | UINT32 offsbits = 8 * (address & (NATIVE_BYTES - 1)); |
| 1319 | address &= ~NATIVE_MASK; |
| 1058 | 1320 | |
| 1059 | | if (sizeof(_NativeType) > 2) |
| 1321 | // if we're here, and native size is larger or equal to the target, we need exactly 2 writes |
| 1322 | if (NATIVE_BYTES >= TARGET_BYTES) |
| 1060 | 1323 | { |
| 1061 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 2)) * 8; |
| 1062 | | return write_native(address, (_NativeType)data << shift, (_NativeType)mask << shift); |
| 1063 | | } |
| 1324 | // little-endian case |
| 1325 | if (_Endian == ENDIANNESS_LITTLE) |
| 1326 | { |
| 1327 | // write lower bits to lower address |
| 1328 | _NativeType curmask = (_NativeType)mask << offsbits; |
| 1329 | if (curmask != 0) write_native(address, (_NativeType)data << offsbits, curmask); |
| 1330 | |
| 1331 | // write upper bits to upper address |
| 1332 | offsbits = NATIVE_BITS - offsbits; |
| 1333 | curmask = mask >> offsbits; |
| 1334 | if (curmask != 0) write_native(address + NATIVE_BYTES, data >> offsbits, curmask); |
| 1335 | } |
| 1064 | 1336 | |
| 1065 | | if (sizeof(_NativeType) < 2) |
| 1066 | | { |
| 1067 | | if (EXPECTED(mask & (0xff << endian_shift(0,8)))) write_byte_direct(address + 0, data >> endian_shift(0,8)); |
| 1068 | | if (EXPECTED(mask & (0xff << endian_shift(8,0)))) write_byte_direct(address + 1, data >> endian_shift(8,0)); |
| 1337 | // big-endian case |
| 1338 | else |
| 1339 | { |
| 1340 | // left-justify the mask and data to the target type |
| 1341 | const UINT32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); |
| 1342 | _NativeType ljdata = (_NativeType)data << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; |
| 1343 | _NativeType ljmask = (_NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; |
| 1344 | |
| 1345 | // write upper bits to lower address |
| 1346 | _NativeType curmask = ljmask >> offsbits; |
| 1347 | if (curmask != 0) write_native(address, ljdata >> offsbits, curmask); |
| 1348 | |
| 1349 | // write lower bits to upper address |
| 1350 | offsbits = NATIVE_BITS - offsbits; |
| 1351 | curmask = ljmask << offsbits; |
| 1352 | if (curmask != 0) write_native(address + NATIVE_BYTES, ljdata << offsbits, curmask); |
| 1353 | } |
| 1069 | 1354 | } |
| 1070 | | } |
| 1071 | 1355 | |
| 1072 | | // write dword |
| 1073 | | void write_dword_direct(offs_t address, UINT32 data, UINT32 mask) |
| 1074 | | { |
| 1075 | | if (sizeof(_NativeType) == 4) |
| 1076 | | return write_native(address, data, mask); |
| 1077 | | |
| 1078 | | if (sizeof(_NativeType) > 4) |
| 1356 | // if we're here, then we have 2 or more writes needed to get our final result |
| 1357 | else |
| 1079 | 1358 | { |
| 1080 | | UINT32 shift = (endian_xor(address) & (sizeof(_NativeType) - 4)) * 8; |
| 1081 | | return write_native(address, (_NativeType)data << shift, (_NativeType)mask << shift); |
| 1082 | | } |
| 1359 | // compute the maximum number of loops; we do it this way so that there are |
| 1360 | // a fixed number of loops for the compiler to unroll if it desires |
| 1361 | const UINT32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; |
| 1362 | |
| 1363 | // little-endian case |
| 1364 | if (_Endian == ENDIANNESS_LITTLE) |
| 1365 | { |
| 1366 | // write lowest bits to first address |
| 1367 | _NativeType curmask = mask << offsbits; |
| 1368 | if (curmask != 0) write_native(address, data << offsbits, curmask); |
| 1369 | |
| 1370 | // write middle bits to subsequent addresses |
| 1371 | offsbits = NATIVE_BITS - offsbits; |
| 1372 | for (UINT32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) |
| 1373 | { |
| 1374 | address += NATIVE_BYTES; |
| 1375 | curmask = mask >> offsbits; |
| 1376 | if (curmask != 0) write_native(address, data >> offsbits, curmask); |
| 1377 | offsbits += NATIVE_BITS; |
| 1378 | } |
| 1379 | |
| 1380 | // if we're not aligned and we still have bits left, write uppermost bits to last address |
| 1381 | if (!_Aligned && offsbits < TARGET_BITS) |
| 1382 | { |
| 1383 | curmask = mask >> offsbits; |
| 1384 | if (curmask != 0) write_native(address + NATIVE_BYTES, data >> offsbits, curmask); |
| 1385 | } |
| 1386 | } |
| 1083 | 1387 | |
| 1084 | | if (sizeof(_NativeType) < 4) |
| 1085 | | { |
| 1086 | | if (EXPECTED(mask & (0xffff << endian_shift(0,16)))) write_word_direct(address + 0, data >> endian_shift(0,16), mask >> endian_shift(0,16)); |
| 1087 | | if (EXPECTED(mask & (0xffff << endian_shift(16,0)))) write_word_direct(address + 2, data >> endian_shift(16,0), mask >> endian_shift(16,0)); |
| 1388 | // big-endian case |
| 1389 | else |
| 1390 | { |
| 1391 | // write highest bits to first address |
| 1392 | offsbits = TARGET_BITS - (NATIVE_BITS - offsbits); |
| 1393 | _NativeType curmask = mask >> offsbits; |
| 1394 | if (curmask != 0) write_native(address, data >> offsbits, curmask); |
| 1395 | |
| 1396 | // write middle bits to subsequent addresses |
| 1397 | for (UINT32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) |
| 1398 | { |
| 1399 | offsbits -= NATIVE_BITS; |
| 1400 | address += NATIVE_BYTES; |
| 1401 | curmask = mask >> offsbits; |
| 1402 | if (curmask != 0) write_native(address, data >> offsbits, curmask); |
| 1403 | } |
| 1404 | |
| 1405 | // if we're not aligned and we still have bits left, write lowermost bits to the last address |
| 1406 | if (!_Aligned && offsbits != 0) |
| 1407 | { |
| 1408 | offsbits = NATIVE_BITS - offsbits; |
| 1409 | curmask = mask << offsbits; |
| 1410 | if (curmask != 0) write_native(address + NATIVE_BYTES, data << offsbits, curmask); |
| 1411 | } |
| 1412 | } |
| 1088 | 1413 | } |
| 1089 | 1414 | } |
| 1090 | 1415 | |
| 1091 | | // write qword |
| 1092 | | void write_qword_direct(offs_t address, UINT64 data, UINT64 mask) |
| 1093 | | { |
| 1094 | | if (sizeof(_NativeType) == 8) |
| 1095 | | return write_native(address, data, mask); |
| 1416 | // virtual access to these functions |
| 1417 | UINT8 read_byte(offs_t address) { return (NATIVE_BITS == 8) ? read_native(address & ~NATIVE_MASK) : read_direct<UINT8, true>(address, 0xff); } |
| 1418 | UINT16 read_word(offs_t address) { return (NATIVE_BITS == 16) ? read_native(address & ~NATIVE_MASK) : read_direct<UINT16, true>(address, 0xffff); } |
| 1419 | UINT16 read_word(offs_t address, UINT16 mask) { return read_direct<UINT16, true>(address, mask); } |
| 1420 | UINT16 read_word_unaligned(offs_t address) { return read_direct<UINT16, false>(address, 0xffff); } |
| 1421 | UINT16 read_word_unaligned(offs_t address, UINT16 mask) { return read_direct<UINT16, false>(address, mask); } |
| 1422 | UINT32 read_dword(offs_t address) { return (NATIVE_BITS == 32) ? read_native(address & ~NATIVE_MASK) : read_direct<UINT32, true>(address, 0xffffffff); } |
| 1423 | UINT32 read_dword(offs_t address, UINT32 mask) { return read_direct<UINT32, true>(address, mask); } |
| 1424 | UINT32 read_dword_unaligned(offs_t address) { return read_direct<UINT32, false>(address, 0xffffffff); } |
| 1425 | UINT32 read_dword_unaligned(offs_t address, UINT32 mask) { return read_direct<UINT32, false>(address, mask); } |
| 1426 | UINT64 read_qword(offs_t address) { return (NATIVE_BITS == 64) ? read_native(address & ~NATIVE_MASK) : read_direct<UINT64, true>(address, U64(0xffffffffffffffff)); } |
| 1427 | UINT64 read_qword(offs_t address, UINT64 mask) { return read_direct<UINT64, true>(address, mask); } |
| 1428 | UINT64 read_qword_unaligned(offs_t address) { return read_direct<UINT64, false>(address, U64(0xffffffffffffffff)); } |
| 1429 | UINT64 read_qword_unaligned(offs_t address, UINT64 mask) { return read_direct<UINT64, false>(address, mask); } |
| 1096 | 1430 | |
| 1097 | | if (sizeof(_NativeType) < 8) |
| 1098 | | { |
| 1099 | | if (EXPECTED(mask & (U64(0xffffffff) << endian_shift(0,32)))) write_dword_direct(address + 0, data >> endian_shift(0,32), mask >> endian_shift(0,32)); |
| 1100 | | if (EXPECTED(mask & (U64(0xffffffff) << endian_shift(32,0)))) write_dword_direct(address + 4, data >> endian_shift(32,0), mask >> endian_shift(32,0)); |
| 1101 | | } |
| 1102 | | } |
| 1431 | void write_byte(offs_t address, UINT8 data) { if (NATIVE_BITS == 8) write_native(address & ~NATIVE_MASK, data); else write_direct<UINT8, true>(address, data, 0xff); } |
| 1432 | void write_word(offs_t address, UINT16 data) { if (NATIVE_BITS == 16) write_native(address & ~NATIVE_MASK, data); else write_direct<UINT16, true>(address, data, 0xffff); } |
| 1433 | void write_word(offs_t address, UINT16 data, UINT16 mask) { write_direct<UINT16, true>(address, data, mask); } |
| 1434 | void write_word_unaligned(offs_t address, UINT16 data) { write_direct<UINT16, false>(address, data, 0xffff); } |
| 1435 | void write_word_unaligned(offs_t address, UINT16 data, UINT16 mask) { write_direct<UINT16, false>(address, data, mask); } |
| 1436 | void write_dword(offs_t address, UINT32 data) { if (NATIVE_BITS == 32) write_native(address & ~NATIVE_MASK, data); else write_direct<UINT32, true>(address, data, 0xffffffff); } |
| 1437 | void write_dword(offs_t address, UINT32 data, UINT32 mask) { write_direct<UINT32, true>(address, data, mask); } |
| 1438 | void write_dword_unaligned(offs_t address, UINT32 data) { write_direct<UINT32, false>(address, data, 0xffffffff); } |
| 1439 | void write_dword_unaligned(offs_t address, UINT32 data, UINT32 mask) { write_direct<UINT32, false>(address, data, mask); } |
| 1440 | void write_qword(offs_t address, UINT64 data) { if (NATIVE_BITS == 64) write_native(address & ~NATIVE_MASK, data); else write_direct<UINT64, true>(address, data, U64(0xffffffffffffffff)); } |
| 1441 | void write_qword(offs_t address, UINT64 data, UINT64 mask) { write_direct<UINT64, true>(address, data, mask); } |
| 1442 | void write_qword_unaligned(offs_t address, UINT64 data) { write_direct<UINT64, false>(address, data, U64(0xffffffffffffffff)); } |
| 1443 | void write_qword_unaligned(offs_t address, UINT64 data, UINT64 mask) { write_direct<UINT64, false>(address, data, mask); } |
| 1103 | 1444 | |
| 1104 | | // virtual access to these functions |
| 1105 | | UINT8 read_byte(offs_t address) { return read_byte_direct(address); } |
| 1106 | | UINT16 read_word(offs_t address, UINT16 mask) { return read_word_direct(address, mask); } |
| 1107 | | UINT32 read_dword(offs_t address, UINT32 mask) { return read_dword_direct(address, mask); } |
| 1108 | | UINT64 read_qword(offs_t address, UINT64 mask) { return read_qword_direct(address, mask); } |
| 1109 | | void write_byte(offs_t address, UINT8 data) { write_byte_direct(address, data); } |
| 1110 | | void write_word(offs_t address, UINT16 data, UINT16 mask) { write_word_direct(address, data, mask); } |
| 1111 | | void write_dword(offs_t address, UINT32 data, UINT32 mask) { write_dword_direct(address, data, mask); } |
| 1112 | | void write_qword(offs_t address, UINT64 data, UINT64 mask) { write_qword_direct(address, data, mask); } |
| 1113 | | |
| 1114 | 1445 | // static access to these functions |
| 1115 | | static UINT8 read_byte_static(this_type *space, offs_t address) { return space->read_byte_direct(address); } |
| 1116 | | static UINT16 read_word_static(this_type *space, offs_t address) { return space->read_word_direct(address, 0xffff); } |
| 1117 | | static UINT16 read_word_masked_static(this_type *space, offs_t address, UINT16 mask) { return space->read_word_direct(address, mask); } |
| 1118 | | static UINT32 read_dword_static(this_type *space, offs_t address) { return space->read_dword_direct(address, 0xffffffff); } |
| 1119 | | static UINT32 read_dword_masked_static(this_type *space, offs_t address, UINT32 mask) { return space->read_dword_direct(address, mask); } |
| 1120 | | static UINT64 read_qword_static(this_type *space, offs_t address) { return space->read_qword_direct(address, U64(0xffffffffffffffff)); } |
| 1121 | | static UINT64 read_qword_masked_static(this_type *space, offs_t address, UINT64 mask) { return space->read_qword_direct(address, mask); } |
| 1122 | | static void write_byte_static(this_type *space, offs_t address, UINT8 data) { space->write_byte_direct(address, data); } |
| 1123 | | static void write_word_static(this_type *space, offs_t address, UINT16 data) { space->write_word_direct(address, data, 0xffff); } |
| 1124 | | static void write_word_masked_static(this_type *space, offs_t address, UINT16 data, UINT16 mask) { space->write_word_direct(address, data, mask); } |
| 1125 | | static void write_dword_static(this_type *space, offs_t address, UINT32 data) { space->write_dword_direct(address, data, 0xffffffff); } |
| 1126 | | static void write_dword_masked_static(this_type *space, offs_t address, UINT32 data, UINT32 mask) { space->write_dword_direct(address, data, mask); } |
| 1127 | | static void write_qword_static(this_type *space, offs_t address, UINT64 data) { space->write_qword_direct(address, data, U64(0xffffffffffffffff)); } |
| 1128 | | static void write_qword_masked_static(this_type *space, offs_t address, UINT64 data, UINT64 mask) { space->write_qword_direct(address, data, mask); } |
| 1446 | static UINT8 read_byte_static(this_type *space, offs_t address) { return (NATIVE_BITS == 8) ? space->read_native(address & ~NATIVE_MASK) : space->read_direct<UINT8, true>(address, 0xff); } |
| 1447 | static UINT16 read_word_static(this_type *space, offs_t address) { return (NATIVE_BITS == 16) ? space->read_native(address & ~NATIVE_MASK) : space->read_direct<UINT16, true>(address, 0xffff); } |
| 1448 | static UINT16 read_word_masked_static(this_type *space, offs_t address, UINT16 mask) { return space->read_direct<UINT16, true>(address, mask); } |
| 1449 | static UINT32 read_dword_static(this_type *space, offs_t address) { return (NATIVE_BITS == 32) ? space->read_native(address & ~NATIVE_MASK) : space->read_direct<UINT32, true>(address, 0xffffffff); } |
| 1450 | static UINT32 read_dword_masked_static(this_type *space, offs_t address, UINT32 mask) { return space->read_direct<UINT32, true>(address, mask); } |
| 1451 | static UINT64 read_qword_static(this_type *space, offs_t address) { return (NATIVE_BITS == 64) ? space->read_native(address & ~NATIVE_MASK) : space->read_direct<UINT64, true>(address, U64(0xffffffffffffffff)); } |
| 1452 | static UINT64 read_qword_masked_static(this_type *space, offs_t address, UINT64 mask) { return space->read_direct<UINT64, true>(address, mask); } |
| 1453 | static void write_byte_static(this_type *space, offs_t address, UINT8 data) { if (NATIVE_BITS == 8) space->write_native(address & ~NATIVE_MASK, data); else space->write_direct<UINT8, true>(address, data, 0xff); } |
| 1454 | static void write_word_static(this_type *space, offs_t address, UINT16 data) { if (NATIVE_BITS == 16) space->write_native(address & ~NATIVE_MASK, data); else space->write_direct<UINT16, true>(address, data, 0xffff); } |
| 1455 | static void write_word_masked_static(this_type *space, offs_t address, UINT16 data, UINT16 mask) { space->write_direct<UINT16, true>(address, data, mask); } |
| 1456 | static void write_dword_static(this_type *space, offs_t address, UINT32 data) { if (NATIVE_BITS == 32) space->write_native(address & ~NATIVE_MASK, data); else space->write_direct<UINT32, true>(address, data, 0xffffffff); } |
| 1457 | static void write_dword_masked_static(this_type *space, offs_t address, UINT32 data, UINT32 mask) { space->write_direct<UINT32, true>(address, data, mask); } |
| 1458 | static void write_qword_static(this_type *space, offs_t address, UINT64 data) { if (NATIVE_BITS == 64) space->write_native(address & ~NATIVE_MASK, data); else space->write_direct<UINT64, true>(address, data, U64(0xffffffffffffffff)); } |
| 1459 | static void write_qword_masked_static(this_type *space, offs_t address, UINT64 data, UINT64 mask) { space->write_direct<UINT64, true>(address, data, mask); } |
| 1129 | 1460 | |
| 1130 | 1461 | address_table_read m_read; // memory read lookup table |
| 1131 | 1462 | address_table_write m_write; // memory write lookup table |
| r8829 | r8830 | |
| 2533 | 2864 | |
| 2534 | 2865 | VPRINTF(("address_space::find_backing_memory('%s',%s,%08X-%08X) -> ", m_device.tag(), m_name, bytestart, byteend)); |
| 2535 | 2866 | |
| 2867 | if (m_map == NULL) |
| 2868 | return NULL; |
| 2869 | |
| 2536 | 2870 | // look in the address map first |
| 2537 | 2871 | for (address_map_entry *entry = m_map->m_entrylist.first(); entry != NULL; entry = entry->next()) |
| 2538 | 2872 | { |