Fixed addresses crossing 0x10000

git-svn-id: svn://svn.cc65.org/cc65/trunk@2365 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-08-18 20:14:31 +00:00
parent 2af86784a9
commit da8739609d
3 changed files with 14 additions and 14 deletions

View File

@@ -69,7 +69,7 @@ static const char* SymTab [0x10000];
void AddrCheck (unsigned Addr) static void AddrCheck (unsigned Addr)
/* Check if the given address has a valid range */ /* Check if the given address has a valid range */
{ {
if (Addr >= 0x10000) { if (Addr >= 0x10000) {
@@ -112,7 +112,7 @@ void MarkAddr (unsigned Addr, attr_t Attr)
const char* MakeLabelName (unsigned Addr) const char* MakeLabelName (unsigned Addr)
/* Make the default label name from the given address and return it in a /* Make the default label name from the given address and return it in a
* static buffer. * static buffer.
*/ */
{ {
static char LabelBuf [32]; static char LabelBuf [32];
xsprintf (LabelBuf, sizeof (LabelBuf), "L%04X", Addr); xsprintf (LabelBuf, sizeof (LabelBuf), "L%04X", Addr);

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000 Ullrich von Bassewitz */ /* (C) 2000-2003 Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* R<EFBFBD>merstrasse 52 */
/* D-70597 Stuttgart */ /* D-70794 Filderstadt */
/* EMail: uz@musoftware.de */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -226,7 +226,7 @@ unsigned RtsTable (void)
while (BytesLeft > 0) { while (BytesLeft > 0) {
/* Get the address */ /* Get the address */
unsigned Addr = GetCodeWord (PC) + 1; unsigned Addr = (GetCodeWord (PC) + 1) & 0xFFFF;
/* In pass 1, define a label, in pass 2 output the line */ /* In pass 1, define a label, in pass 2 output the line */
if (Pass == 1) { if (Pass == 1) {
@@ -315,7 +315,7 @@ unsigned TextTable (void)
Count = 0; Count = 0;
while (Count < BytesLeft && Count < BytesPerLine) { while (Count < BytesLeft && Count < BytesPerLine) {
unsigned char C = GetCodeByte (PC + Count); unsigned char C = GetCodeByte (PC + Count);
if (C < 0x20 || C > 0x7E || C == '\"') { if (C < 0x20 || C > 0x7E || C == '\"') {
++Count; ++Count;
} else { } else {
break; break;

View File

@@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000 Ullrich von Bassewitz */ /* (C) 2000-2003 Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* R<EFBFBD>merstrasse 52 */
/* D-70597 Stuttgart */ /* D-70794 Filderstadt */
/* EMail: uz@musoftware.de */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -265,7 +265,7 @@ void OH_Relative (const OpcDesc* D)
signed char Offs = GetCodeByte (PC+1); signed char Offs = GetCodeByte (PC+1);
/* Calculate the target address */ /* Calculate the target address */
unsigned Addr = (unsigned) (((int) PC+2) + Offs); unsigned Addr = (((int) PC+2) + Offs) & 0xFFFF;
/* Generate a label in pass 1 */ /* Generate a label in pass 1 */
GenerateLabel (D->Flags, Addr); GenerateLabel (D->Flags, Addr);
@@ -346,7 +346,7 @@ void OH_BitBranch (const OpcDesc* D)
signed char BranchOffs = GetCodeByte (PC+2); signed char BranchOffs = GetCodeByte (PC+2);
/* Calculate the target address for the branch */ /* Calculate the target address for the branch */
unsigned BranchAddr = (unsigned) (((int) PC+3) + BranchOffs); unsigned BranchAddr = (((int) PC+3) + BranchOffs) & 0xFFFF;
/* Generate labels in pass 1. The bit branch codes are special in that /* Generate labels in pass 1. The bit branch codes are special in that
* they don't really match the remainder of the 6502 instruction set (they * they don't really match the remainder of the 6502 instruction set (they