make <bit> part of the instruction, like in the huc6280

This commit is contained in:
mrdudz
2025-06-16 17:39:23 +02:00
parent ef33c4b71d
commit 2184ba80c7
2 changed files with 80 additions and 96 deletions

View File

@@ -92,29 +92,6 @@ static void OneLine (const OpcDesc* D, const char* Arg, ...)
LineFeed ();
}
static void OneLineNoIndent (const OpcDesc* D, const char* Arg, ...) attribute ((format(printf, 2, 3)));
static void OneLineNoIndent (const OpcDesc* D, const char* Arg, ...)
/* Output one line with the given mnemonic and argument */
{
char Buf [256];
va_list ap;
/* Mnemonic */
Mnemonic (D->Mnemo);
/* Argument */
va_start (ap, Arg);
xvsprintf (Buf, sizeof (Buf), Arg, ap);
va_end (ap);
Output ("%s", Buf);
/* Add the code stuff as comment */
LineComment (PC, D->Size);
/* End the line */
LineFeed ();
}
static const char* GetAbsOverride (unsigned Flags, unsigned Addr)
@@ -554,9 +531,11 @@ void OH_BitBranch (const OpcDesc* D)
xfree (BranchLabel);
}
/* <bit> zp, rel */
/* NOTE: currently <bit> is part of the instruction */
void OH_BitBranch_m740 (const OpcDesc* D)
{
unsigned Bit = GetCodeByte (PC) >> 5;
/* unsigned Bit = GetCodeByte (PC) >> 5; */
unsigned Addr = GetCodeByte (PC+1);
signed char BranchOffs = GetCodeByte (PC+2);
@@ -568,7 +547,7 @@ void OH_BitBranch_m740 (const OpcDesc* D)
GenerateLabel (flLabel, BranchAddr);
/* Output the line */
OneLineNoIndent (D, "%01X %s,%s", Bit, GetAddrArg (D->Flags, Addr), GetAddrArg (flLabel, BranchAddr));
OneLine (D, "%s, %s", GetAddrArg (D->Flags, Addr), GetAddrArg (flLabel, BranchAddr));
}
void OH_ImmediateDirect (const OpcDesc* D)
@@ -757,33 +736,38 @@ void OH_DirectImmediate (const OpcDesc* D)
/* <bit> zp */
/* NOTE: currently <bit> is part of the instruction */
void OH_ZeroPageBit (const OpcDesc* D)
{
unsigned Bit = GetCodeByte (PC) >> 5;
/* unsigned Bit = GetCodeByte (PC) >> 5; */
unsigned Addr = GetCodeByte (PC+1);
/* Generate a label in pass 1 */
GenerateLabel (D->Flags, Addr);
/* Output the line */
OneLineNoIndent (D, "%01X %s", Bit, GetAddrArg (D->Flags, Addr));
OneLine (D, "%s", GetAddrArg (D->Flags, Addr));
}
/* <bit> A */
/* NOTE: currently <bit> is part of the instruction */
void OH_AccumulatorBit (const OpcDesc* D)
{
unsigned Bit = GetCodeByte (PC) >> 5;
/* unsigned Bit = GetCodeByte (PC) >> 5; */
/* Output the line */
OneLineNoIndent (D, "%01X a", Bit);
OneLine (D, "a");
}
/* <bit> A, rel */
/* NOTE: currently <bit> is part of the instruction */
void OH_AccumulatorBitBranch (const OpcDesc* D)
{
unsigned Bit = GetCodeByte (PC) >> 5;
/* unsigned Bit = GetCodeByte (PC) >> 5; */
signed char BranchOffs = GetCodeByte (PC+1);
/* Calculate the target address for the branch */
@@ -793,7 +777,7 @@ void OH_AccumulatorBitBranch (const OpcDesc* D)
GenerateLabel (flLabel, BranchAddr);
/* Output the line */
OneLineNoIndent (D, "%01X a, %s", Bit, GetAddrArg (flLabel, BranchAddr));
OneLine (D, "a, %s", GetAddrArg (flLabel, BranchAddr));
}