Files
cc65/src/da65/labels.h
Kugel Fuhr 4c81eacefe Added -d/--debug and -m/--multi-pass switches to the disassembler. The latter
will make the disassembler run multiple preparation passes to find all
addresses where labels must be placed. Without -m some label addresses are
found in the final pass, where the disassembler cannot make use of them.
2025-06-23 14:50:40 +02:00

111 lines
4.6 KiB
C

/*****************************************************************************/
/* */
/* labels.h */
/* */
/* Label management for da65 */
/* */
/* */
/* */
/* (C) 2006 Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef LABELS_H
#define LABELS_H
#include <stdint.h>
/* da65 */
#include "attrtab.h"
/*****************************************************************************/
/* Code */
/*****************************************************************************/
void AddIntLabel (uint32_t Addr);
/* Add an internal label using the address to generate the name. */
void AddExtLabel (uint32_t Addr, const char* Name);
/* Add an external label */
void AddUnnamedLabel (uint32_t Addr);
/* Add an unnamed label */
void AddDepLabel (uint32_t Addr, attr_t Attr, const char* BaseName, unsigned Offs);
/* Add a dependent label at the given address using "base name+Offs" as the new
** name.
*/
void AddIntLabelRange (uint32_t Addr, const char* Name, unsigned Count);
/* Add an internal label for a range. The first entry gets the label "Name"
** while the others get "Name+offs".
*/
void AddExtLabelRange (uint32_t Addr, const char* Name, unsigned Count);
/* Add an external label for a range. The first entry gets the label "Name"
** while the others get "Name+offs".
*/
int HaveLabel (uint32_t Addr);
/* Check if there is a label for the given address */
int MustDefLabel (uint32_t Addr);
/* Return true if we must define a label for this address, that is, if there
** is a label at this address, and it is an external or internal label.
*/
const char* GetLabelName (uint32_t Addr);
/* Return the label name for an address */
const char* GetLabel (uint32_t Addr, uint32_t RefFrom);
/* Return the label name for an address, as it is used in a label reference.
** RefFrom is the address the label is referenced from. This is needed in case
** of unnamed labels, to determine the name.
*/
void ForwardLabel (unsigned Offs);
/* If necessary, output a forward label, one that is within the next few
** bytes and is therefore output as "label = * + x".
*/
void DefOutOfRangeLabels (void);
/* Output any labels that are out of the loaded code range */
unsigned long GetLabelCount (void);
/* Return the total number of labels defined so far */
/* End of labels.h */
#endif