Renamed some stuff. Write out the segment size as var, not 32 bit.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5233 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
607aa871e6
commit
1e20489ee1
5 changed files with 34 additions and 26 deletions
|
@ -867,7 +867,7 @@ int main (int argc, char* argv [])
|
||||||
InitIncludePaths ();
|
InitIncludePaths ();
|
||||||
|
|
||||||
/* Create the predefined segments */
|
/* Create the predefined segments */
|
||||||
InitSegments ();
|
SegInit ();
|
||||||
|
|
||||||
/* Enter the base lexical level. We must do that here, since we may
|
/* Enter the base lexical level. We must do that here, since we may
|
||||||
* define symbols using -D.
|
* define symbols using -D.
|
||||||
|
@ -1013,7 +1013,7 @@ int main (int argc, char* argv [])
|
||||||
|
|
||||||
/* If we didn't have any errors, check and cleanup the unnamed labels */
|
/* If we didn't have any errors, check and cleanup the unnamed labels */
|
||||||
if (ErrorCount == 0) {
|
if (ErrorCount == 0) {
|
||||||
ULabDone ();
|
ULabDone ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't have any errors, check the symbol table */
|
/* If we didn't have any errors, check the symbol table */
|
||||||
|
@ -1028,7 +1028,7 @@ int main (int argc, char* argv [])
|
||||||
|
|
||||||
/* If we didn't have any errors, check and resolve the segment data */
|
/* If we didn't have any errors, check and resolve the segment data */
|
||||||
if (ErrorCount == 0) {
|
if (ErrorCount == 0) {
|
||||||
SegCheck ();
|
SegDone ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't have any errors, check the assertions */
|
/* If we didn't have any errors, check the assertions */
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "objcode.h"
|
#include "objcode.h"
|
||||||
#include "objfile.h"
|
#include "objfile.h"
|
||||||
#include "segment.h"
|
#include "segment.h"
|
||||||
|
#include "span.h"
|
||||||
#include "spool.h"
|
#include "spool.h"
|
||||||
#include "studyexpr.h"
|
#include "studyexpr.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
|
@ -325,8 +326,8 @@ unsigned char GetSegAddrSize (unsigned SegNum)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SegCheck (void)
|
void SegDone (void)
|
||||||
/* Check the segments for range and other errors */
|
/* Check the segments for range and other errors. Do cleanup. */
|
||||||
{
|
{
|
||||||
static const unsigned long U_Hi[4] = {
|
static const unsigned long U_Hi[4] = {
|
||||||
0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL
|
0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL
|
||||||
|
@ -453,7 +454,7 @@ void SegDump (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InitSegments (void)
|
void SegInit (void)
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
{
|
{
|
||||||
/* Create the predefined segments. Code segment is active */
|
/* Create the predefined segments. Code segment is active */
|
||||||
|
@ -512,7 +513,7 @@ static void WriteOneSeg (Segment* Seg)
|
||||||
|
|
||||||
/* Write the segment data */
|
/* Write the segment data */
|
||||||
ObjWriteVar (GetStringId (Seg->Def->Name)); /* Name of the segment */
|
ObjWriteVar (GetStringId (Seg->Def->Name)); /* Name of the segment */
|
||||||
ObjWrite32 (Seg->PC); /* Size */
|
ObjWriteVar (Seg->PC); /* Size */
|
||||||
ObjWrite8 (Seg->Align); /* Segment alignment */
|
ObjWrite8 (Seg->Align); /* Segment alignment */
|
||||||
ObjWrite8 (Seg->Def->AddrSize); /* Address size of the segment */
|
ObjWrite8 (Seg->Def->AddrSize); /* Address size of the segment */
|
||||||
ObjWriteVar (Seg->FragCount); /* Number of fragments */
|
ObjWriteVar (Seg->FragCount); /* Number of fragments */
|
||||||
|
|
|
@ -153,13 +153,13 @@ void EnterRelocMode (void);
|
||||||
* switch the mode globally or for the current segment.
|
* switch the mode globally or for the current segment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void SegCheck (void);
|
void SegDone (void);
|
||||||
/* Check the segments for range and other errors */
|
/* Check the segments for range and other errors. Do cleanup. */
|
||||||
|
|
||||||
void SegDump (void);
|
void SegDump (void);
|
||||||
/* Dump the contents of all segments */
|
/* Dump the contents of all segments */
|
||||||
|
|
||||||
void InitSegments (void);
|
void SegInit (void);
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
|
|
||||||
void SetSegmentSizes (void);
|
void SetSegmentSizes (void);
|
||||||
|
|
|
@ -151,6 +151,23 @@ void CloseSpans (Collection* Spans)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void WriteSpan (const Span* S)
|
||||||
|
/* Write one span to the output file */
|
||||||
|
{
|
||||||
|
/* Done accept empty spans */
|
||||||
|
CHECK (S->End > S->Start);
|
||||||
|
|
||||||
|
/* Write data for the span We will write the size instead of the end
|
||||||
|
* offset to save some bytes, since most spans are expected to be
|
||||||
|
* rather small.
|
||||||
|
*/
|
||||||
|
ObjWriteVar (S->Seg->Num);
|
||||||
|
ObjWriteVar (S->Start);
|
||||||
|
ObjWriteVar (S->End - S->Start);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void WriteSpans (const Collection* Spans)
|
void WriteSpans (const Collection* Spans)
|
||||||
/* Write a list of spans to the output file */
|
/* Write a list of spans to the output file */
|
||||||
{
|
{
|
||||||
|
@ -161,22 +178,10 @@ void WriteSpans (const Collection* Spans)
|
||||||
|
|
||||||
/* Write the spans */
|
/* Write the spans */
|
||||||
for (I = 0; I < CollCount (Spans); ++I) {
|
for (I = 0; I < CollCount (Spans); ++I) {
|
||||||
|
/* Write the next span */
|
||||||
/* Get next range */
|
WriteSpan (CollConstAt (Spans, I));
|
||||||
const Span* S = CollConstAt (Spans, I);
|
|
||||||
|
|
||||||
CHECK (S->End > S->Start);
|
|
||||||
|
|
||||||
/* Write data for the span We will write the size instead of the end
|
|
||||||
* offset to save some bytes, since most spans are expected to be
|
|
||||||
* rather small.
|
|
||||||
*/
|
|
||||||
ObjWriteVar (S->Seg->Num);
|
|
||||||
ObjWriteVar (S->Start);
|
|
||||||
ObjWriteVar (S->End - S->Start);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Forwards */
|
||||||
|
struct Segment;
|
||||||
|
|
||||||
/* Span definition */
|
/* Span definition */
|
||||||
typedef struct Span Span;
|
typedef struct Span Span;
|
||||||
struct Span{
|
struct Span{
|
||||||
unsigned Id; /* Span id */
|
|
||||||
struct Segment* Seg; /* Pointer to segment */
|
struct Segment* Seg; /* Pointer to segment */
|
||||||
unsigned long Start; /* Start of range */
|
unsigned long Start; /* Start of range */
|
||||||
unsigned long End; /* End of range */
|
unsigned long End; /* End of range */
|
||||||
|
@ -62,7 +64,7 @@ struct Span{
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Code */
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue