Use smart mode, allow more CPUs, fix CPU dependent code, use address sizes

for functions.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2694 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-29 07:40:41 +00:00
parent b520b182d0
commit 05f3f154a9
6 changed files with 35 additions and 22 deletions

View File

@@ -165,10 +165,17 @@ void g_preamble (void)
VER_MAJOR, VER_MINOR, VER_PATCH);
/* If we're producing code for some other CPU, switch the command set */
if (CPU == CPU_65C02) {
AddTextLine ("\t.setcpu\t\t\"65C02\"");
switch (CPU) {
case CPU_6502: AddTextLine ("\t.setcpu\t\t\"6502\""); break;
case CPU_65SC02: AddTextLine ("\t.setcpu\t\t\"65SC02\""); break;
case CPU_65C02: AddTextLine ("\t.setcpu\t\t\"65C02\""); break;
case CPU_65816: AddTextLine ("\t.setcpu\t\t\"65816\""); break;
default: Internal ("Unknown CPU: %d", CPU);
}
/* Use smart mode */
AddTextLine ("\t.smart\t\ton");
/* Allow auto import for runtime library routines */
AddTextLine ("\t.autoimport\ton");
@@ -283,7 +290,7 @@ unsigned sizeofarg (unsigned flags)
}
int pop (unsigned flags)
/* Pop an argument of the given size */
{
@@ -920,7 +927,7 @@ void g_leasp (int offs)
AddCodeLine ("jsr leaasp"); /* Load effective address */
} else {
unsigned L = GetLocalLabel ();
if (CPU == CPU_65C02 && offs == 1) {
if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && offs == 1) {
AddCodeLine ("lda sp");
AddCodeLine ("ldx sp+1");
AddCodeLine ("ina");
@@ -3247,7 +3254,7 @@ void g_inc (unsigned flags, unsigned long val)
case CF_CHAR:
if (flags & CF_FORCECHAR) {
if (CPU == CPU_65C02 && val <= 2) {
if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && val <= 2) {
while (val--) {
AddCodeLine ("ina");
}
@@ -3260,7 +3267,7 @@ void g_inc (unsigned flags, unsigned long val)
/* FALLTHROUGH */
case CF_INT:
if (CPU == CPU_65C02 && val == 1) {
if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && val == 1) {
unsigned L = GetLocalLabel();
AddCodeLine ("ina");
AddCodeLine ("bne %s", LocalLabelName (L));
@@ -3341,7 +3348,7 @@ void g_dec (unsigned flags, unsigned long val)
case CF_CHAR:
if (flags & CF_FORCECHAR) {
if (CPU == CPU_65C02 && val <= 2) {
if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && val <= 2) {
while (val--) {
AddCodeLine ("dea");
}