mirror of
https://github.com/cc65/cc65.git
synced 2025-04-19 15:37:21 +00:00
Output MX states
This commit is contained in:
parent
4b04f81d37
commit
65907b1f10
@ -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);
|
||||
|
@ -401,3 +401,23 @@ void OutputSettings (void)
|
||||
LineFeed ();
|
||||
LineFeed ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OutputMFlag (unsigned char enabled)
|
||||
/* Output the 65816 M-flag state */
|
||||
{
|
||||
Indent (MCol);
|
||||
Output (enabled ? ".a8" : ".a16");
|
||||
LineFeed ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OutputXFlag (unsigned char enabled)
|
||||
/* Output the 65816 X-flag state */
|
||||
{
|
||||
Indent (MCol);
|
||||
Output (enabled ? ".i8" : ".i16");
|
||||
LineFeed ();
|
||||
}
|
||||
|
@ -108,6 +108,12 @@ void LineComment (unsigned PC, unsigned Count);
|
||||
void OutputSettings (void);
|
||||
/* Output CPU and other settings */
|
||||
|
||||
void OutputMFlag (unsigned char enabled);
|
||||
/* Output the 65816 M-flag state */
|
||||
|
||||
void OutputXFlag (unsigned char enabled);
|
||||
/* Output the 65816 X-flag state */
|
||||
|
||||
|
||||
|
||||
/* End of output.h */
|
||||
|
Loading…
x
Reference in New Issue
Block a user