Output MX states

This commit is contained in:
Lauri Kasanen
2022-10-12 15:16:24 +03:00
parent 4b04f81d37
commit 65907b1f10
3 changed files with 46 additions and 0 deletions

View File

@@ -64,6 +64,8 @@
#include "segment.h"
static unsigned PrevAddrMode;
/*****************************************************************************/
/* Code */
@@ -442,6 +444,22 @@ static void OneOpcode (unsigned RemainingBytes)
** following insn, fall through to byte mode.
*/
if (D->Size <= RemainingBytes) {
if (CPU == CPU_65816) {
const unsigned AddrMode = GetAttr (PC) & at65816Mask;
if (PrevAddrMode != AddrMode) {
if ((PrevAddrMode & atMem8) != (AddrMode & atMem8) ||
(PrevAddrMode & atMem16) != (AddrMode & atMem16)) {
OutputMFlag(!!(AddrMode & atMem8));
}
if ((PrevAddrMode & atIdx8) != (AddrMode & atIdx8) ||
(PrevAddrMode & atIdx16) != (AddrMode & atIdx16)) {
OutputXFlag(!!(AddrMode & atIdx8));
}
PrevAddrMode = AddrMode;
}
}
/* Output labels within the next insn */
for (I = 1; I < D->Size; ++I) {
ForwardLabel (I);
@@ -517,6 +535,8 @@ static void OnePass (void)
{
unsigned Count;
PrevAddrMode = 0;
/* Disassemble until nothing left */
while ((Count = GetRemainingBytes()) > 0) {
OneOpcode (Count);