With the following code in necinstr.c :
OP( 0x8e, i_mov_sregw ) { UINT16 src; GetModRM; src = GetRMWord(ModRM); CLKR(15,15,7,15,11,5,2,EA);
switch (ModRM & 0x38) {
case 0x00: bprintf (PRINT_NORMAL, _T("op 0x8e : DS1 : %d : %d\n"), DS1, src); Sreg(DS1) = src; break; /* mov es,ew */
case 0x08: Sreg(PS) = src; break; /* mov cs,ew */
case 0x10: Sreg(SS) = src; break; /* mov ss,ew */
case 0x18: bprintf (PRINT_NORMAL, _T("op 0x8e : DS0 : %d : %d\n"), DS0, src); Sreg(DS0) = src; break; /* mov ds,ew */
// default: logerror("%06x: MOV Sreg - Invalid register\n",PC(nec_state));
}
nec_state->no_interrupt=1;
}
I noticed the following outputs :
on X86 :
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 0
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 8192
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 57344
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 59392
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 51200
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 51200
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 8192
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 57344
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
on ARM :
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 3
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
i notice nec_state->sregs[0] is depleting then the 0x00 case in 0x8e opcode will never run again, and nec_state->sregs[3] will start at 53248 and never change, unlike on x86.
Then i tried :
OP( 0x8e, i_mov_sregw ) { UINT16 src; GetModRM; src = GetRMWord(ModRM); bprintf(PRINT_NORMAL, _T("op 0x8e : ModRM : %d : %d\n"), ModRM, src); CLKR(15,15,7,15,11,5,2,EA);
switch (ModRM & 0x38) {
case 0x00: bprintf (PRINT_NORMAL, _T("op 0x8e : DS1 : %d : %d\n"), DS1, src); Sreg(DS1) = src; break; /* mov es,ew */
case 0x08: Sreg(PS) = src; break; /* mov cs,ew */
case 0x10: Sreg(SS) = src; break; /* mov ss,ew */
case 0x18: bprintf (PRINT_NORMAL, _T("op 0x8e : DS0 : %d : %d\n"), DS0, src); Sreg(DS0) = src; break; /* mov ds,ew */
// default: logerror("%06x: MOV Sreg - Invalid register\n",PC(nec_state));
}
nec_state->no_interrupt=1;
}
And got the following outputs :
X86:
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 218 : 0
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 0
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 218 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 218 : 8192
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 8192
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 218 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 218 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 12288
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 16384
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 57344
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 57344
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 59392
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 59392
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 49152
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 51200
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 51200
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 52224
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 51200
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 51200
ARM :
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 55296
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 4096
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 192 : 3
RetroArch [libretro DEBUG] :: op 0x8e : DS1 : 0 : 3
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : DS0 : 3 : 53248
RetroArch [libretro DEBUG] :: op 0x8e : ModRM : 216 : 53248
Those numbers on arm feels quite strange, do you think i'm on the right track ? Next step would be to check Wreg values ?