|
|
| version 1.9, 2005/02/08 09:57:26 | version 1.11, 2005/03/26 07:48:36 |
|---|---|
| Line 7 | Line 7 |
| #include "bios.h" | #include "bios.h" |
| #include "dmav30.h" | #include "dmav30.h" |
| #include "i286c.mcr" | #include "i286c.mcr" |
| #if defined(ENABLE_TRAP) | |
| #include "steptrap.h" | |
| #endif | |
| // victory30 patch | // victory30 patch |
| Line 34 static I286OPF6 v30ope0xf6_table[8]; | Line 37 static I286OPF6 v30ope0xf6_table[8]; |
| static I286OPF6 v30ope0xf7_table[8]; | static I286OPF6 v30ope0xf7_table[8]; |
| static const UINT8 shiftbase16[256] = | static const UINT8 rotatebase16[256] = |
| {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, |
| 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, | 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, |
| 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, | 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, |
| Line 52 static const UINT8 shiftbase16[256] = | Line 55 static const UINT8 shiftbase16[256] = |
| 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, | 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, |
| 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}; | 16, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15}; |
| static const UINT8 shiftbase09[256] = | static const UINT8 rotatebase09[256] = |
| {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, |
| 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, | 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, |
| 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, | 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, |
| Line 70 static const UINT8 shiftbase09[256] = | Line 73 static const UINT8 shiftbase09[256] = |
| 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, | 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, |
| 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3}; | 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3}; |
| static const UINT8 shiftbase17[256] = | static const UINT8 rotatebase17[256] = |
| {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, |
| 16,17, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, | 16,17, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, |
| 15,16,17, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13, | 15,16,17, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13, |
| Line 240 I286FN v30shift_ea8_data8(void) { // C | Line 243 I286FN v30shift_ea8_data8(void) { // C |
| madr = CALC_EA(op); | madr = CALC_EA(op); |
| if (madr >= I286_MEMWRITEMAX) { | if (madr >= I286_MEMWRITEMAX) { |
| GET_PCBYTE(cl) | GET_PCBYTE(cl) |
| if ((op & 0x30) == 0x10) { // rotate with carry | I286_WORKCLOCK(cl); |
| cl = shiftbase09[cl]; | if (!(op & 0x20)) { // rotate |
| if (!(op & 0x10)) { | |
| cl = rotatebase16[cl]; | |
| } | |
| else { // rotate with carry | |
| cl = rotatebase09[cl]; | |
| } | |
| } | } |
| else { | else { |
| cl = shiftbase16[cl]; | cl = max(cl, 9); |
| } | } |
| I286_WORKCLOCK(cl); | |
| sft_e8cl_table[(op >> 3) & 7](madr, cl); | sft_e8cl_table[(op >> 3) & 7](madr, cl); |
| return; | return; |
| } | } |
| out = mem + madr; | out = mem + madr; |
| } | } |
| GET_PCBYTE(cl) | GET_PCBYTE(cl) |
| if ((op & 0x30) == 0x10) { // rotate with carry | I286_WORKCLOCK(cl); |
| cl = shiftbase09[cl]; | if (!(op & 0x20)) { // rotate |
| if (!(op & 0x10)) { | |
| cl = rotatebase16[cl]; | |
| } | |
| else { // rotate with carry | |
| cl = rotatebase09[cl]; | |
| } | |
| } | } |
| else { | else { |
| cl = shiftbase16[cl]; | cl = max(cl, 9); |
| } | } |
| I286_WORKCLOCK(cl); | |
| sft_r8cl_table[(op >> 3) & 7](out, cl); | sft_r8cl_table[(op >> 3) & 7](out, cl); |
| } | } |
| Line 280 I286FN v30shift_ea16_data8(void) { // | Line 293 I286FN v30shift_ea16_data8(void) { // |
| madr = CALC_EA(op); | madr = CALC_EA(op); |
| if (INHIBIT_WORDP(madr)) { | if (INHIBIT_WORDP(madr)) { |
| GET_PCBYTE(cl); | GET_PCBYTE(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | I286_WORKCLOCK(cl); |
| cl = shiftbase17[cl]; | if (!(op & 0x20)) { // rotate |
| if (!(op & 0x10)) { | |
| cl = rotatebase16[cl]; | |
| } | |
| else { // with carry | |
| cl = rotatebase17[cl]; | |
| } | |
| } | } |
| else { | else { // shift |
| cl = shiftbase16[cl]; | cl = max(cl, 17); |
| } | } |
| I286_WORKCLOCK(cl); | |
| sft_e16cl_table[(op >> 3) & 7](madr, cl); | sft_e16cl_table[(op >> 3) & 7](madr, cl); |
| return; | return; |
| } | } |
| out = (UINT16 *)(mem + madr); | out = (UINT16 *)(mem + madr); |
| } | } |
| GET_PCBYTE(cl); | GET_PCBYTE(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | I286_WORKCLOCK(cl); |
| cl = shiftbase17[cl]; | if (!(op & 0x20)) { // rotate |
| if (!(op & 0x10)) { | |
| cl = rotatebase16[cl]; | |
| } | |
| else { // with carry | |
| cl = rotatebase17[cl]; | |
| } | |
| } | } |
| else { | else { // shift |
| cl = shiftbase16[cl]; | cl = max(cl, 17); |
| } | } |
| I286_WORKCLOCK(cl); | |
| sft_r16cl_table[(op >> 3) & 7](out, cl); | sft_r16cl_table[(op >> 3) & 7](out, cl); |
| } | } |
| Line 321 I286FN v30shift_ea8_cl(void) { // D2: | Line 344 I286FN v30shift_ea8_cl(void) { // D2: |
| if (madr >= I286_MEMWRITEMAX) { | if (madr >= I286_MEMWRITEMAX) { |
| cl = I286_CL; | cl = I286_CL; |
| I286_WORKCLOCK(cl); | I286_WORKCLOCK(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | if (!(op & 0x20)) { // rotate |
| cl = shiftbase09[cl]; | if (!(op & 0x10)) { |
| cl = rotatebase16[cl]; | |
| } | |
| else { // rotate with carry | |
| cl = rotatebase09[cl]; | |
| } | |
| } | } |
| else { | else { |
| cl = shiftbase16[cl]; | cl = max(cl, 9); |
| } | } |
| sft_e8cl_table[(op >> 3) & 7](madr, cl); | sft_e8cl_table[(op >> 3) & 7](madr, cl); |
| return; | return; |
| Line 334 I286FN v30shift_ea8_cl(void) { // D2: | Line 362 I286FN v30shift_ea8_cl(void) { // D2: |
| } | } |
| cl = I286_CL; | cl = I286_CL; |
| I286_WORKCLOCK(cl); | I286_WORKCLOCK(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | if (!(op & 0x20)) { // rotate |
| cl = shiftbase09[cl]; | if (!(op & 0x10)) { |
| cl = rotatebase16[cl]; | |
| } | |
| else { // rotate with carry | |
| cl = rotatebase09[cl]; | |
| } | |
| } | } |
| else { | else { |
| cl = shiftbase16[cl]; | cl = max(cl, 9); |
| } | } |
| sft_r8cl_table[(op >> 3) & 7](out, cl); | sft_r8cl_table[(op >> 3) & 7](out, cl); |
| } | } |
| Line 361 I286FN v30shift_ea16_cl(void) { // D3 | Line 394 I286FN v30shift_ea16_cl(void) { // D3 |
| if (INHIBIT_WORDP(madr)) { | if (INHIBIT_WORDP(madr)) { |
| cl = I286_CL; | cl = I286_CL; |
| I286_WORKCLOCK(cl); | I286_WORKCLOCK(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | if (!(op & 0x20)) { // rotate |
| cl = shiftbase17[cl]; | if (!(op & 0x10)) { |
| cl = rotatebase16[cl]; | |
| } | |
| else { // with carry | |
| cl = rotatebase17[cl]; | |
| } | |
| } | } |
| else { | else { // shift |
| cl = shiftbase16[cl]; | cl = max(cl, 17); |
| } | } |
| sft_e16cl_table[(op >> 3) & 7](madr, cl); | sft_e16cl_table[(op >> 3) & 7](madr, cl); |
| return; | return; |
| Line 374 I286FN v30shift_ea16_cl(void) { // D3 | Line 412 I286FN v30shift_ea16_cl(void) { // D3 |
| } | } |
| cl = I286_CL; | cl = I286_CL; |
| I286_WORKCLOCK(cl); | I286_WORKCLOCK(cl); |
| if ((op & 0x30) == 0x10) { // rotate with carry | if (!(op & 0x20)) { // rotate |
| cl = shiftbase17[cl]; | if (!(op & 0x10)) { |
| cl = rotatebase16[cl]; | |
| } | |
| else { // with carry | |
| cl = rotatebase17[cl]; | |
| } | |
| } | } |
| else { | else { // shift |
| cl = shiftbase16[cl]; | cl = max(cl, 17); |
| } | } |
| sft_r16cl_table[(op >> 3) & 7](out, cl); | sft_r16cl_table[(op >> 3) & 7](out, cl); |
| } | } |
| Line 812 void v30c(void) { | Line 855 void v30c(void) { |
| if (I286_TRAP) { | if (I286_TRAP) { |
| do { | do { |
| #if defined(ENABLE_TRAP) | |
| steptrap(CPU_CS, CPU_IP); | |
| #endif | |
| GET_PCBYTE(opcode); | GET_PCBYTE(opcode); |
| v30op[opcode](); | v30op[opcode](); |
| if (I286_TRAP) { | if (I286_TRAP) { |
| Line 822 void v30c(void) { | Line 868 void v30c(void) { |
| } | } |
| else if (dmac.working) { | else if (dmac.working) { |
| do { | do { |
| #if defined(ENABLE_TRAP) | |
| steptrap(CPU_CS, CPU_IP); | |
| #endif | |
| GET_PCBYTE(opcode); | GET_PCBYTE(opcode); |
| v30op[opcode](); | v30op[opcode](); |
| dmav30(); | dmav30(); |
| Line 829 void v30c(void) { | Line 878 void v30c(void) { |
| } | } |
| else { | else { |
| do { | do { |
| #if defined(ENABLE_TRAP) | |
| steptrap(CPU_CS, CPU_IP); | |
| #endif | |
| GET_PCBYTE(opcode); | GET_PCBYTE(opcode); |
| v30op[opcode](); | v30op[opcode](); |
| } while(I286_REMCLOCK > 0); | } while(I286_REMCLOCK > 0); |