if ((OPC->Info & OF_BRA) != 0) {
/* Branch */
AM = AM65_BRA;
- } else if (IsZPName (Arg)) {
+ } else if (IsZPName (Arg, 0)) {
AM = AM65_ZP;
} else {
AM = AM65_ABS;
Reg = toupper (*L);
L = SkipSpace (L+1);
if (Reg == 'X') {
- if (IsZPName (Arg)) {
+ if (IsZPName (Arg, 0)) {
AM = AM65_ZPX;
} else {
AM = AM65_ABSX;
/* Create a new code segment, initialize and return it */
{
unsigned I;
+ const type* RetType;
/* Allocate memory */
CodeSeg* S = xmalloc (sizeof (CodeSeg));
/* If we have a function given, get the return type of the function.
* Assume ANY return type besides void will use the A and X registers.
*/
- if (S->Func && !IsTypeVoid (GetFuncReturn (Func->Type))) {
- S->ExitRegs = REG_AX;
+ if (S->Func && !IsTypeVoid ((RetType = GetFuncReturn (Func->Type)))) {
+ if (SizeOf (RetType) == SizeOf (type_long)) {
+ S->ExitRegs = REG_EAX;
+ } else {
+ S->ExitRegs = REG_AX;
+ }
} else {
S->ExitRegs = REG_NONE;
}
-void CS_AddLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
+void CS_AddVLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
/* Add a line to the given code segment */
{
const char* L;
+void CS_AddLine (CodeSeg* S, LineInfo* LI, const char* Format, ...)
+/* Add a line to the given code segment */
+{
+ va_list ap;
+ va_start (ap, Format);
+ CS_AddVLine (S, LI, Format, ap);
+ va_end (ap);
+}
+
+
+
void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index)
/* Insert the code entry at the index given. Following code entries will be
* moved to slots with higher indices.
RC_Invalidate (&Regs);
CurrentRegs = &Regs;
- /* First pass. Walk over all insns an note just the changes from one
+ /* First pass. Walk over all insns and note just the changes from one
* insn to the next one.
*/
WasJump = 0;
if (J->RI->Out2.RegY != Regs.RegY) {
Regs.RegY = -1;
}
+ if (J->RI->Out2.SRegLo != Regs.SRegLo) {
+ Regs.SRegLo = -1;
+ }
+ if (J->RI->Out2.SRegHi != Regs.SRegHi) {
+ Regs.SRegHi = -1;
+ }
++Entry;
}