1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-07 18:25:03 +00:00

Check type in emit_dab and emit_daw

Without this the new optimisations can cause invalid code to be emitted.
This commit is contained in:
Steven Flintham
2017-07-28 23:20:52 +01:00
parent 75d5266fba
commit f801d47b1b

View File

@@ -654,19 +654,29 @@ void emit_saw(int tag, int offset, int type)
}
}
void emit_dab(int tag, int offset, int type)
{
if (type)
{
int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type);
printf("\t%s\t$7C\t\t\t; DAB\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
}
else
printf("\t%s\t$7C,$%02X,$%02X\t\t; DAB\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
}
void emit_daw(int tag, int offset, int type)
{
if (type)
{
int fixup = fixup_new(tag, type, FIXUP_WORD);
char *taglbl = tag_string(tag, type);
printf("\t%s\t$7E\t\t\t; DAW\t%s+%d\n", DB, taglbl, offset);
printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset);
}
else
printf("\t%s\t$7E,$%02X,$%02X\t\t; DAW\t%d\n", DB, offset&0xFF,(offset>>8)&0xFF, offset);
}
void emit_localaddr(int index)
{
printf("\t%s\t$28,$%02X\t\t\t; LLA\t[%d]\n", DB, index, index);