1/*****************************************************************************/
2/* */
3/* labels.h */
4/* */
5/* Label management for da65 */
6/* */
7/* */
8/* */
9/* (C) 2006 Ullrich von Bassewitz */
10/* Roemerstrasse 52 */
11/* D-70794 Filderstadt */
12/* EMail: uz@cc65.org */
13/* */
14/* */
15/* This software is provided 'as-is', without any expressed or implied */
16/* warranty. In no event will the authors be held liable for any damages */
17/* arising from the use of this software. */
18/* */
19/* Permission is granted to anyone to use this software for any purpose, */
20/* including commercial applications, and to alter it and redistribute it */
21/* freely, subject to the following restrictions: */
22/* */
23/* 1. The origin of this software must not be misrepresented; you must not */
24/* claim that you wrote the original software. If you use this software */
25/* in a product, an acknowledgment in the product documentation would be */
26/* appreciated but is not required. */
27/* 2. Altered source versions must be plainly marked as such, and must not */
28/* be misrepresented as being the original software. */
29/* 3. This notice may not be removed or altered from any source */
30/* distribution. */
31/* */
32/*****************************************************************************/
33
34
35
36#ifndef LABELS_H
37#define LABELS_H
38
39
40
41#include "attrtab.h"
42
43
44
45/*****************************************************************************/
46/* Code */
47/*****************************************************************************/
48
49
50
51void AddIntLabel (unsigned Addr);
52/* Add an internal label using the address to generate the name. */
53
54void AddExtLabel (unsigned Addr, const char* Name);
55/* Add an external label */
56
57void AddUnnamedLabel (unsigned Addr);
58/* Add an unnamed label */
59
60void AddDepLabel (unsigned Addr, attr_t Attr, const char* BaseName, unsigned Offs);
61/* Add a dependent label at the given address using "base name+Offs" as the new
62** name.
63*/
64
65void AddIntLabelRange (unsigned Addr, const char* Name, unsigned Count);
66/* Add an internal label for a range. The first entry gets the label "Name"
67** while the others get "Name+offs".
68*/
69
70void AddExtLabelRange (unsigned Addr, const char* Name, unsigned Count);
71/* Add an external label for a range. The first entry gets the label "Name"
72** while the others get "Name+offs".
73*/
74
75int HaveLabel (unsigned Addr);
76/* Check if there is a label for the given address */
77
78int MustDefLabel (unsigned Addr);
79/* Return true if we must define a label for this address, that is, if there
80** is a label at this address, and it is an external or internal label.
81*/
82
83const char* GetLabelName (unsigned Addr);
84/* Return the label name for an address */
85
86const char* GetLabel (unsigned Addr, unsigned RefFrom);
87/* Return the label name for an address, as it is used in a label reference.
88** RefFrom is the address the label is referenced from. This is needed in case
89** of unnamed labels, to determine the name.
90*/
91
92void ForwardLabel (unsigned Offs);
93/* If necessary, output a forward label, one that is within the next few
94** bytes and is therefore output as "label = * + x".
95*/
96
97void DefOutOfRangeLabels (void);
98/* Output any labels that are out of the loaded code range */
99
100
101
102/* End of labels.h */
103
104#endif
105