--- np2/i286c/v30patch.c 2005/03/05 06:02:29 1.10 +++ np2/i286c/v30patch.c 2005/03/26 07:48:36 1.11 @@ -37,7 +37,7 @@ static I286OPF6 v30ope0xf6_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, 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, @@ -55,7 +55,7 @@ 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}; -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, 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, @@ -73,7 +73,7 @@ static const UINT8 shiftbase09[256] = 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}; -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, 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, @@ -243,26 +243,36 @@ I286FN v30shift_ea8_data8(void) { // C madr = CALC_EA(op); if (madr >= I286_MEMWRITEMAX) { GET_PCBYTE(cl) - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase09[cl]; + I286_WORKCLOCK(cl); + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // rotate with carry + cl = rotatebase09[cl]; + } } else { - cl = shiftbase16[cl]; + cl = max(cl, 9); } - I286_WORKCLOCK(cl); sft_e8cl_table[(op >> 3) & 7](madr, cl); return; } out = mem + madr; } GET_PCBYTE(cl) - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase09[cl]; + I286_WORKCLOCK(cl); + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // rotate with carry + cl = rotatebase09[cl]; + } } else { - cl = shiftbase16[cl]; + cl = max(cl, 9); } - I286_WORKCLOCK(cl); sft_r8cl_table[(op >> 3) & 7](out, cl); } @@ -283,26 +293,36 @@ I286FN v30shift_ea16_data8(void) { // madr = CALC_EA(op); if (INHIBIT_WORDP(madr)) { GET_PCBYTE(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase17[cl]; + I286_WORKCLOCK(cl); + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // with carry + cl = rotatebase17[cl]; + } } - else { - cl = shiftbase16[cl]; + else { // shift + cl = max(cl, 17); } - I286_WORKCLOCK(cl); sft_e16cl_table[(op >> 3) & 7](madr, cl); return; } out = (UINT16 *)(mem + madr); } GET_PCBYTE(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase17[cl]; + I286_WORKCLOCK(cl); + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // with carry + cl = rotatebase17[cl]; + } } - else { - cl = shiftbase16[cl]; + else { // shift + cl = max(cl, 17); } - I286_WORKCLOCK(cl); sft_r16cl_table[(op >> 3) & 7](out, cl); } @@ -324,11 +344,16 @@ I286FN v30shift_ea8_cl(void) { // D2: if (madr >= I286_MEMWRITEMAX) { cl = I286_CL; I286_WORKCLOCK(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase09[cl]; + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // rotate with carry + cl = rotatebase09[cl]; + } } else { - cl = shiftbase16[cl]; + cl = max(cl, 9); } sft_e8cl_table[(op >> 3) & 7](madr, cl); return; @@ -337,11 +362,16 @@ I286FN v30shift_ea8_cl(void) { // D2: } cl = I286_CL; I286_WORKCLOCK(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase09[cl]; + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // rotate with carry + cl = rotatebase09[cl]; + } } else { - cl = shiftbase16[cl]; + cl = max(cl, 9); } sft_r8cl_table[(op >> 3) & 7](out, cl); } @@ -364,11 +394,16 @@ I286FN v30shift_ea16_cl(void) { // D3 if (INHIBIT_WORDP(madr)) { cl = I286_CL; I286_WORKCLOCK(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase17[cl]; + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // with carry + cl = rotatebase17[cl]; + } } - else { - cl = shiftbase16[cl]; + else { // shift + cl = max(cl, 17); } sft_e16cl_table[(op >> 3) & 7](madr, cl); return; @@ -377,11 +412,16 @@ I286FN v30shift_ea16_cl(void) { // D3 } cl = I286_CL; I286_WORKCLOCK(cl); - if ((op & 0x30) == 0x10) { // rotate with carry - cl = shiftbase17[cl]; + if (!(op & 0x20)) { // rotate + if (!(op & 0x10)) { + cl = rotatebase16[cl]; + } + else { // with carry + cl = rotatebase17[cl]; + } } - else { - cl = shiftbase16[cl]; + else { // shift + cl = max(cl, 17); } sft_r16cl_table[(op >> 3) & 7](out, cl); }