-static void ldaconst (unsigned val)
-/* Load a with a constant */
-{
- AddCodeLine ("lda #$%02X", val & 0xFF);
-}
-
-
-
static void ldxconst (unsigned val)
/* Load x with a constant */
{
} else {
/* We've a stack frame to drop */
while (k > 255) {
- ldyconst (255);
+ AddCodeLine ("ldy #$FF");
AddCodeLine ("jsr addysp");
k -= 255;
}
CheckLocalOffs (StackOffs);
/* Generate code */
+ AddCodeLine ("ldy #$%02X", StackOffs & 0xFF);
if (Bytes == 1) {
if (IS_Get (&CodeSizeFactor) < 165) {
- ldyconst (StackOffs);
- ldxconst (RegOffs);
+ AddCodeLine ("ldx #$%02X", RegOffs & 0xFF);
AddCodeLine ("jsr regswap1");
} else {
- ldyconst (StackOffs);
AddCodeLine ("lda (sp),y");
AddCodeLine ("ldx regbank%+d", RegOffs);
AddCodeLine ("sta regbank%+d", RegOffs);
} else if (Bytes == 2) {
- ldyconst (StackOffs);
- ldxconst (RegOffs);
+ AddCodeLine ("ldx #$%02X", RegOffs & 0xFF);
AddCodeLine ("jsr regswap2");
} else {
- ldyconst (StackOffs);
- ldxconst (RegOffs);
- ldaconst (Bytes);
+ AddCodeLine ("ldx #$%02X", RegOffs & 0xFF);
+ AddCodeLine ("lda #$%02X", Bytes & 0xFF);
AddCodeLine ("jsr regswap");
}
}
case CF_CHAR:
if ((Flags & CF_FORCECHAR) != 0) {
- ldaconst (Val);
+ AddCodeLine ("lda #$%02X", (unsigned char) Val);
break;
}
/* FALL THROUGH */
case CF_INT:
- ldxconst ((Val >> 8) & 0xFF);
- ldaconst (Val & 0xFF);
+ AddCodeLine ("ldx #$%02X", (unsigned char) (Val >> 8));
+ AddCodeLine ("lda #$%02X", (unsigned char) Val);
break;
case CF_LONG:
case CF_INT:
if (Flags & CF_UNSIGNED) {
if (IS_Get (&CodeSizeFactor) >= 200) {
- ldyconst (0);
+ AddCodeLine ("ldy #$00");
AddCodeLine ("sty sreg");
AddCodeLine ("sty sreg+1");
} else {
if ((flags & CF_TYPE) == CF_CHAR && (flags & CF_FORCECHAR)) {
/* Handle as 8 bit value */
- ldaconst (val);
+ AddCodeLine ("lda #$%02X", (unsigned char) val);
AddCodeLine ("jsr pusha");
} else {
case CF_LONG:
if (Val <= 0xFF) {
- ldxconst (0);
+ AddCodeLine ("ldx #$00");
AddCodeLine ("stx sreg+1");
AddCodeLine ("stx sreg");
if ((Val & 0xFF) != 0xFF) {
}
return;
} else if (Val == 0xFF00) {
- ldaconst (0);
+ AddCodeLine ("lda #$00");
AddCodeLine ("sta sreg+1");
AddCodeLine ("sta sreg");
return;
if (val <= 8) {
AddCodeLine ("jsr incax%lu", val);
} else if (val <= 255) {
- ldyconst (val);
+ AddCodeLine ("ldy #$%02X", (unsigned char) val);
AddCodeLine ("jsr incaxy");
} else {
g_add (flags | CF_CONST, val);
case CF_LONG:
if (val <= 255) {
- ldyconst (val);
+ AddCodeLine ("ldy #$%02X", (unsigned char) val);
AddCodeLine ("jsr inceaxy");
} else {
g_add (flags | CF_CONST, val);
if (val <= 8) {
AddCodeLine ("jsr decax%d", (int) val);
} else if (val <= 255) {
- ldyconst (val);
+ AddCodeLine ("ldy #$%02X", (unsigned char) val);
AddCodeLine ("jsr decaxy");
} else {
g_sub (flags | CF_CONST, val);
case CF_LONG:
if (val <= 255) {
- ldyconst (val);
+ AddCodeLine ("ldy #$%02X", (unsigned char) val);
AddCodeLine ("jsr deceaxy");
} else {
g_sub (flags | CF_CONST, val);
AddCodeLine ("dey");
AddCodeLine ("bpl %s", LocalLabelName (CodeLabel));
} else if (Size <= 256) {
- ldyconst (0);
+ AddCodeLine ("ldy #$00");
g_defcodelabel (CodeLabel);
AddCodeLine ("lda %s,y", GetLabelName (CF_STATIC, Label, 0));
AddCodeLine ("sta (sp),y");
AddCodeLine ("bpl %s", LocalLabelName (CodeLabel));
} else if (Size <= 256) {
unsigned CodeLabel = GetLocalLabel ();
- ldyconst (0);
+ AddCodeLine ("ldy #$00");
g_defcodelabel (CodeLabel);
AddCodeLine ("lda %s,y", GetLabelName (CF_STATIC, InitLabel, 0));
AddCodeLine ("sta %s,y", GetLabelName (CF_STATIC, VarLabel, 0));