/*****************************************************************************/
/* */
-/* attrtab.c */
+/* attrtab.c */
/* */
-/* Disassembler attribute table */
+/* Disassembler attribute table */
/* */
/* */
/* */
-/* (C) 2000-2006 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2000-2014, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/*****************************************************************************/
-/* Data */
+/* Data */
/*****************************************************************************/
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
/* Check if the given address has a valid range */
{
if (Addr >= 0x10000) {
- Error ("Address out of range: %08X", Addr);
+ Error ("Address out of range: %08X", Addr);
}
}
+attr_t GetAttr (unsigned Addr)
+/* Return the attribute for the given address */
+{
+ /* Check the given address */
+ AddrCheck (Addr);
+
+ /* Return the attribute */
+ return AttrTab[Addr];
+}
+
+
+
+int SegmentDefined (unsigned Start, unsigned End)
+/* Return true if the atSegment bit is set somewhere in the given range */
+{
+ while (Start <= End) {
+ if (AttrTab[Start++] & atSegment) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+
+int IsSegmentEnd (unsigned Addr)
+/* Return true if a segment ends at the given address */
+{
+ return (GetAttr (Addr) & atSegmentEnd) != 0x0000;
+}
+
+
+
+int IsSegmentStart (unsigned Addr)
+/* Return true if a segment starts at the given address */
+{
+ return (GetAttr (Addr) & atSegmentStart) != 0x0000;
+}
+
+
+
unsigned GetGranularity (attr_t Style)
/* Get the granularity for the given style */
{
switch (Style) {
- case atDefault: return 1;
- case atCode: return 1;
- case atIllegal: return 1;
- case atByteTab: return 1;
- case atDByteTab: return 2;
- case atWordTab: return 2;
- case atDWordTab: return 4;
- case atAddrTab: return 2;
- case atRtsTab: return 2;
- case atTextTab: return 1;
-
- case atSkip:
- default:
- Internal ("GetGraularity called for style = %d", Style);
- return 0;
+ case atDefault: return 1;
+ case atCode: return 1;
+ case atIllegal: return 1;
+ case atByteTab: return 1;
+ case atDByteTab: return 2;
+ case atWordTab: return 2;
+ case atDWordTab: return 4;
+ case atAddrTab: return 2;
+ case atRtsTab: return 2;
+ case atTextTab: return 1;
+
+ case atSkip:
+ default:
+ Internal ("GetGraularity called for style = %d", Style);
+ return 0;
}
}
{
/* Do it easy here... */
while (Start <= End) {
- MarkAddr (Start++, Attr);
+ MarkAddr (Start++, Attr);
}
}
/* We must not have more than one style bit */
if (Attr & atStyleMask) {
- if (AttrTab[Addr] & atStyleMask) {
- Error ("Duplicate style for address %04X", Addr);
- }
+ if (AttrTab[Addr] & atStyleMask) {
+ Error ("Duplicate style for address %04X", Addr);
+ }
}
/* Set the style */
/* Return the attribute */
return (AttrTab[Addr] & atLabelMask);
}
-
-
-