Fixed some bugs in da65's HuC6280 section.

This commit is contained in:
Greg King
2016-09-02 14:24:29 -04:00
parent 579b89ad98
commit 4b2e3be2fc
3 changed files with 57 additions and 24 deletions

View File

@@ -36,6 +36,7 @@
#include <stdarg.h>
/* common */
#include "xmalloc.h"
#include "xsprintf.h"
/* da65 */
@@ -406,6 +407,8 @@ void OH_AbsoluteIndirect (const OpcDesc* D)
void OH_BitBranch (const OpcDesc* D)
{
char* BranchLabel;
/* Get the operands */
unsigned char TestAddr = GetCodeByte (PC+1);
signed char BranchOffs = GetCodeByte (PC+2);
@@ -421,8 +424,16 @@ void OH_BitBranch (const OpcDesc* D)
GenerateLabel (D->Flags, TestAddr);
GenerateLabel (flLabel, BranchAddr);
/* Make a copy of an operand, so that
** the other operand can't overwrite it.
** [GetAddrArg() uses a statically-stored buffer.]
*/
BranchLabel = xstrdup (GetAddrArg (flLabel, BranchAddr));
/* Output the line */
OneLine (D, "%s,%s", GetAddrArg (D->Flags, TestAddr), GetAddrArg (flLabel, BranchAddr));
OneLine (D, "%s,%s", GetAddrArg (D->Flags, TestAddr), BranchLabel);
xfree (BranchLabel);
}
@@ -518,8 +529,10 @@ void OH_DirectIndirectLongY (const OpcDesc* D attribute ((unused)))
void OH_BlockMove (const OpcDesc* D attribute ((unused)))
void OH_BlockMove (const OpcDesc* D)
{
char* DstLabel;
/* Get source operand */
unsigned Src = GetCodeWord (PC+1);
/* Get destination operand */
@@ -529,11 +542,19 @@ void OH_BlockMove (const OpcDesc* D attribute ((unused)))
GenerateLabel (D->Flags, Src);
GenerateLabel (D->Flags, Dst);
/* Make a copy of an operand, so that
** the other operand can't overwrite it.
** [GetAddrArg() uses a statically-stored buffer.]
*/
DstLabel = xstrdup (GetAddrArg (D->Flags, Dst));
/* Output the line */
OneLine (D, "%s%s,%s%s,#$%02X",
OneLine (D, "%s%s,%s%s,$%04X",
GetAbsOverride (D->Flags, Src), GetAddrArg (D->Flags, Src),
GetAbsOverride (D->Flags, Dst), GetAddrArg (D->Flags, Dst),
GetAbsOverride (D->Flags, Dst), DstLabel,
GetCodeWord (PC+5));
xfree (DstLabel);
}
@@ -662,3 +683,14 @@ void OH_JmpAbsoluteIndirect (const OpcDesc* D)
}
SeparatorLine ();
}
void OH_JmpAbsoluteXIndirect (const OpcDesc* D)
{
OH_AbsoluteXIndirect (D);
if (NewlineAfterJMP) {
LineFeed ();
}
SeparatorLine ();
}