Don't use SF_TRAMPOLINE, change symbol references instead.

In smart mode, use RTL instead of RTS if the enclosing .PROC is far.
More address size changes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2696 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-29 07:53:26 +00:00
parent 05f3f154a9
commit c5cc4e1536
12 changed files with 365 additions and 390 deletions

View File

@@ -38,7 +38,9 @@
#include <ctype.h>
/* common */
#include "addrsize.h"
#include "assertdefs.h"
#include "attrib.h"
#include "bitops.h"
#include "check.h"
@@ -69,7 +71,8 @@ static void PutBlockMove (const InsDesc* Ins);
static void PutBitBranch (const InsDesc* Ins);
static void PutREP (const InsDesc* Ins);
static void PutSEP (const InsDesc* Ins);
static void PutJmp (const InsDesc* Ins);
static void PutJMP (const InsDesc* Ins);
static void PutRTS (const InsDesc* Ins);
static void PutAll (const InsDesc* Ins);
@@ -109,7 +112,7 @@ static const struct {
{ "INC", 0x000006c, 0x00, 4, PutAll },
{ "INX", 0x0000001, 0xe8, 0, PutAll },
{ "INY", 0x0000001, 0xc8, 0, PutAll },
{ "JMP", 0x0000808, 0x4c, 6, PutJmp },
{ "JMP", 0x0000808, 0x4c, 6, PutJMP },
{ "JSR", 0x0000008, 0x20, 7, PutAll },
{ "LDA", 0x080A26C, 0xa0, 0, PutAll },
{ "LDX", 0x080030C, 0xa2, 1, PutAll },
@@ -403,7 +406,7 @@ static const struct {
{ "ROR", 0x000006F, 0x62, 1, PutAll },
{ "RTI", 0x0000001, 0x40, 0, PutAll },
{ "RTL", 0x0000001, 0x6b, 0, PutAll },
{ "RTS", 0x0000001, 0x60, 0, PutAll },
{ "RTS", 0x0000001, 0x60, 0, PutRTS },
{ "SBC", 0x0b8f6fc, 0xe0, 0, PutAll },
{ "SEC", 0x0000001, 0x38, 0, PutAll },
{ "SED", 0x0000001, 0xf8, 0, PutAll },
@@ -788,7 +791,7 @@ static void PutSEP (const InsDesc* Ins)
static void PutJmp (const InsDesc* Ins)
static void PutJMP (const InsDesc* Ins)
/* Handle the jump instruction for the 6502. Problem is that these chips have
* a bug: If the address crosses a page, the upper byte gets not corrected and
* the instruction will fail. The PutJmp function will add a linker assertion
@@ -823,6 +826,20 @@ static void PutJmp (const InsDesc* Ins)
static void PutRTS (const InsDesc* Ins attribute ((unused)))
/* Handle the RTS instruction for the 816. In smart mode emit a RTL opcode if
* the enclosing scope is FAR.
*/
{
if (SmartMode && CurrentScope->AddrSize == ADDR_SIZE_FAR) {
Emit0 (0x6B); /* RTL */
} else {
Emit0 (0x60); /* RTS */
}
}
static void PutAll (const InsDesc* Ins)
/* Handle all other instructions */
{