case OP65_AND:
if (RegValIsKnown (In->RegA)) {
- if (CE_IsConstImm (E)) {
- Out->RegA = In->RegA & (short) E->Num;
- } else if (E->AM == AM65_ZP) {
- switch (GetKnownReg (E->Use & REG_ZP, In)) {
- case REG_TMP1:
- Out->RegA = In->RegA & In->Tmp1;
- break;
- case REG_PTR1_LO:
- Out->RegA = In->RegA & In->Ptr1Lo;
- break;
- case REG_PTR1_HI:
- Out->RegA = In->RegA & In->Ptr1Hi;
- break;
- case REG_SREG_LO:
- Out->RegA = In->RegA & In->SRegLo;
- break;
- case REG_SREG_HI:
- Out->RegA = In->RegA & In->SRegHi;
- break;
- default:
- Out->RegA = UNKNOWN_REGVAL;
- break;
- }
- } else {
- Out->RegA = UNKNOWN_REGVAL;
- }
- }
+ if (CE_IsConstImm (E)) {
+ Out->RegA = In->RegA & (short) E->Num;
+ } else if (E->AM == AM65_ZP) {
+ switch (GetKnownReg (E->Use & REG_ZP, In)) {
+ case REG_TMP1:
+ Out->RegA = In->RegA & In->Tmp1;
+ break;
+ case REG_PTR1_LO:
+ Out->RegA = In->RegA & In->Ptr1Lo;
+ break;
+ case REG_PTR1_HI:
+ Out->RegA = In->RegA & In->Ptr1Hi;
+ break;
+ case REG_SREG_LO:
+ Out->RegA = In->RegA & In->SRegLo;
+ break;
+ case REG_SREG_HI:
+ Out->RegA = In->RegA & In->SRegHi;
+ break;
+ default:
+ Out->RegA = UNKNOWN_REGVAL;
+ break;
+ }
+ } else {
+ Out->RegA = UNKNOWN_REGVAL;
+ }
+ } else if (CE_IsKnownImm (E, 0)) {
+ /* A and $00 does always give zero */
+ Out->RegA = 0;
+ }
break;
case OP65_ASL:
break;
case REG_SREG_LO:
Out->SRegLo = (In->SRegLo - 1) & 0xFF;
- break;
+ break;
case REG_SREG_HI:
Out->SRegHi = (In->SRegHi - 1) & 0xFF;
break;
if (In->RegA == 0xFF) {
Out->RegA = 0xFF;
}
- if (In->RegX == 0xFF) {
+ if (In->RegX == 0xFF) {
Out->RegX = 0xFF;
}
} else if (FindBoolCmpCond (E->Arg) != CMP_INV) {
Out->RegX = In->Tmp1;
break;
case REG_PTR1_LO:
- Out->RegX = In->Ptr1Lo;
+ Out->RegX = In->Ptr1Lo;
break;
case REG_PTR1_HI:
Out->RegX = In->Ptr1Hi;
case OP65_LSR:
if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) {
- Out->RegA = (In->RegA >> 1) & 0xFF;
+ Out->RegA = (In->RegA >> 1) & 0xFF;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Chg & REG_ZP, In)) {
case REG_TMP1:
Out->RegA = UNKNOWN_REGVAL;
break;
}
- } else {
- /* A is now unknown */
- Out->RegA = UNKNOWN_REGVAL;
- }
- }
+ } else {
+ /* A is now unknown */
+ Out->RegA = UNKNOWN_REGVAL;
+ }
+ } else if (CE_IsKnownImm (E, 0xFF)) {
+ /* ORA with 0xFF does always give 0xFF */
+ Out->RegA = 0xFF;
+ }
break;
case OP65_PHA:
Out->SRegLo = UNKNOWN_REGVAL;
break;
case REG_SREG_HI:
- Out->SRegHi = UNKNOWN_REGVAL;
+ Out->SRegHi = UNKNOWN_REGVAL;
break;
}
} else if (E->AM == AM65_ZPX) {
-void g_getlocal (unsigned flags, int offs)
+void g_getlocal (unsigned Flags, int Offs)
/* Fetch specified local object (local var). */
{
- offs -= StackPtr;
- CheckLocalOffs (offs);
- switch (flags & CF_TYPE) {
+ Offs -= StackPtr;
+ switch (Flags & CF_TYPE) {
case CF_CHAR:
- if ((flags & CF_FORCECHAR) || (flags & CF_TEST)) {
- ldyconst (offs);
+ CheckLocalOffs (Offs);
+ if ((Flags & CF_FORCECHAR) || (Flags & CF_TEST)) {
+ ldyconst (Offs);
AddCodeLine ("lda (sp),y");
} else {
- ldyconst (offs);
+ ldyconst (Offs);
AddCodeLine ("ldx #$00");
AddCodeLine ("lda (sp),y");
- if ((flags & CF_UNSIGNED) == 0) {
+ if ((Flags & CF_UNSIGNED) == 0) {
unsigned L = GetLocalLabel();
AddCodeLine ("bpl %s", LocalLabelName (L));
AddCodeLine ("dex");
break;
case CF_INT:
- CheckLocalOffs (offs + 1);
- if (flags & CF_TEST) {
- ldyconst (offs + 1);
+ CheckLocalOffs (Offs + 1);
+ AddCodeLine ("ldy #$%02X", (unsigned char) (Offs+1));
+ if (Flags & CF_TEST) {
AddCodeLine ("lda (sp),y");
AddCodeLine ("dey");
AddCodeLine ("ora (sp),y");
- } else {
- ldyconst (offs+1);
+ } else if (IS_Get (&CodeSizeFactor) < 165) {
AddCodeLine ("jsr ldaxysp");
+ } else {
+ AddCodeLine ("lda (sp),y");
+ AddCodeLine ("tax");
+ AddCodeLine ("dey");
+ AddCodeLine ("lda (sp),y");
}
break;
case CF_LONG:
- ldyconst (offs+3);
+ CheckLocalOffs (Offs + 3);
+ AddCodeLine ("ldy #$%02X", (unsigned char) (Offs+3));
AddCodeLine ("jsr ldeaxysp");
- if (flags & CF_TEST) {
- g_test (flags);
+ if (Flags & CF_TEST) {
+ g_test (Flags);
}
break;
default:
- typeerror (flags);
+ typeerror (Flags);
}
}
-void g_getind (unsigned flags, unsigned offs)
+void g_getind (unsigned Flags, unsigned Offs)
/* Fetch the specified object type indirect through the primary register
* into the primary register
*/
* the primary. This way we get an easy addition and use the low byte
* as the offset
*/
- offs = MakeByteOffs (flags, offs);
+ Offs = MakeByteOffs (Flags, Offs);
/* Handle the indirect fetch */
- switch (flags & CF_TYPE) {
+ switch (Flags & CF_TYPE) {
case CF_CHAR:
/* Character sized */
- if (flags & CF_UNSIGNED) {
- ldyconst (offs);
+ if (Flags & CF_UNSIGNED) {
+ ldyconst (Offs);
AddCodeLine ("jsr ldauidx");
} else {
- ldyconst (offs);
+ ldyconst (Offs);
AddCodeLine ("jsr ldaidx");
}
break;
case CF_INT:
- if (flags & CF_TEST) {
- ldyconst (offs);
+ if (Flags & CF_TEST) {
+ ldyconst (Offs);
AddCodeLine ("sta ptr1");
AddCodeLine ("stx ptr1+1");
AddCodeLine ("lda (ptr1),y");
AddCodeLine ("iny");
AddCodeLine ("ora (ptr1),y");
} else {
- ldyconst (offs+1);
+ ldyconst (Offs+1);
AddCodeLine ("jsr ldaxidx");
}
break;
case CF_LONG:
- ldyconst (offs+3);
+ ldyconst (Offs+3);
AddCodeLine ("jsr ldeaxidx");
- if (flags & CF_TEST) {
- g_test (flags);
+ if (Flags & CF_TEST) {
+ g_test (Flags);
}
break;
default:
- typeerror (flags);
+ typeerror (Flags);
}
}