Teach da65 about table units
This commit is contained in:
@@ -71,6 +71,9 @@ typedef enum attr_t {
|
||||
atSegmentEnd = 0x0200, /* Segment end */
|
||||
atSegmentStart = 0x0400, /* Segment start */
|
||||
|
||||
/* Table unit separator */
|
||||
atTableUnit = 0x0800,
|
||||
|
||||
/* 65816 addressing mode */
|
||||
atMem8 = 0x1000, /* M flag enabled, 8-bit */
|
||||
atMem16 = 0x2000, /* M flag disabled, 16-bit */
|
||||
@@ -79,7 +82,7 @@ typedef enum attr_t {
|
||||
|
||||
atStyleMask = 0x000F, /* Output style */
|
||||
atLabelMask = 0x00F0, /* Label information */
|
||||
atSegmentMask = 0x0F00, /* Segment information */
|
||||
atSegmentMask = 0x0700, /* Segment information */
|
||||
at65816Mask = 0xF000, /* 65816 information */
|
||||
|
||||
} attr_t;
|
||||
|
||||
@@ -70,7 +70,7 @@ static unsigned GetSpan (attr_t Style)
|
||||
if ((Attr & atStyleMask) != Style) {
|
||||
break;
|
||||
}
|
||||
if ((Attr & (atSegmentStart | atSegmentEnd))) {
|
||||
if ((Attr & (atSegmentStart | atSegmentEnd | atTableUnit))) {
|
||||
break;
|
||||
}
|
||||
++Count;
|
||||
|
||||
@@ -528,6 +528,7 @@ static void RangeSection (void)
|
||||
{ "START", INFOTOK_START },
|
||||
{ "TYPE", INFOTOK_TYPE },
|
||||
{ "ADDRMODE", INFOTOK_ADDRMODE },
|
||||
{ "UNIT", INFOTOK_UNIT },
|
||||
};
|
||||
|
||||
static const IdentTok TypeDefs[] = {
|
||||
@@ -552,6 +553,7 @@ static void RangeSection (void)
|
||||
tName = 0x08,
|
||||
tComment = 0x10,
|
||||
tAddrMode = 0x20,
|
||||
tUnit = 0x40,
|
||||
tNeeded = (tStart | tEnd | tType)
|
||||
};
|
||||
unsigned Attributes = tNone;
|
||||
@@ -564,6 +566,7 @@ static void RangeSection (void)
|
||||
char* Name = 0;
|
||||
char* Comment = 0;
|
||||
unsigned MemberSize = 0;
|
||||
unsigned Unit = 0;
|
||||
|
||||
|
||||
/* Skip the token */
|
||||
@@ -682,6 +685,15 @@ static void RangeSection (void)
|
||||
InfoNextTok ();
|
||||
break;
|
||||
|
||||
case INFOTOK_UNIT:
|
||||
AddAttr ("UNIT", &Attributes, tUnit);
|
||||
InfoNextTok ();
|
||||
InfoAssureInt ();
|
||||
InfoRangeCheck (0x0002, 0xFFFF);
|
||||
Unit = InfoIVal;
|
||||
InfoNextTok ();
|
||||
break;
|
||||
|
||||
default:
|
||||
Internal ("Unexpected token: %u", InfoTok);
|
||||
}
|
||||
@@ -705,6 +717,26 @@ static void RangeSection (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Only tables support unit sizes */
|
||||
if ((Attributes & tUnit) &&
|
||||
Type != atAddrTab &&
|
||||
Type != atByteTab &&
|
||||
Type != atDByteTab &&
|
||||
Type != atDWordTab &&
|
||||
Type != atRtsTab &&
|
||||
Type != atTextTab &&
|
||||
Type != atWordTab) {
|
||||
InfoError ("Only table types support unit size");
|
||||
}
|
||||
|
||||
/* Mark each unit separator */
|
||||
if (Attributes & tUnit) {
|
||||
unsigned i;
|
||||
for (i = Start; i < End; i += Unit) {
|
||||
MarkAddr(i, atTableUnit);
|
||||
}
|
||||
}
|
||||
|
||||
/* Start must be less than end */
|
||||
if (Start > End) {
|
||||
InfoError ("Start value must not be greater than end value");
|
||||
|
||||
@@ -91,6 +91,7 @@ typedef enum token_t {
|
||||
INFOTOK_END,
|
||||
INFOTOK_TYPE,
|
||||
INFOTOK_ADDRMODE,
|
||||
INFOTOK_UNIT,
|
||||
|
||||
INFOTOK_CODE,
|
||||
INFOTOK_BYTETAB,
|
||||
|
||||
Reference in New Issue
Block a user