1 | /*****************************************************************************/ |
2 | /* */ |
3 | /* listing.h */ |
4 | /* */ |
5 | /* Listing support for the ca65 crossassembler */ |
6 | /* */ |
7 | /* */ |
8 | /* */ |
9 | /* (C) 2000-2011, 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 LISTING_H |
37 | #define LISTING_H |
38 | |
39 | |
40 | |
41 | /* ca65 */ |
42 | #include "fragment.h" |
43 | |
44 | |
45 | |
46 | /*****************************************************************************/ |
47 | /* Forwards */ |
48 | /*****************************************************************************/ |
49 | |
50 | |
51 | |
52 | struct StrBuf; |
53 | |
54 | |
55 | |
56 | /*****************************************************************************/ |
57 | /* Data */ |
58 | /*****************************************************************************/ |
59 | |
60 | |
61 | |
62 | /* Length of the header of a listing line */ |
63 | #define 24 |
64 | |
65 | /* One listing line as it is stored in memory */ |
66 | typedef struct ListLine ListLine; |
67 | struct ListLine { |
68 | ListLine* Next; /* Pointer to next line */ |
69 | Fragment* FragList; /* List of fragments for this line */ |
70 | Fragment* FragLast; /* Last entry in fragment list */ |
71 | unsigned long PC; /* Program counter for this line */ |
72 | unsigned char Reloc; /* Relocatable mode? */ |
73 | unsigned char File; /* From which file is the line? */ |
74 | unsigned char Depth; /* Include depth */ |
75 | unsigned char Output; /* Should we output this line? */ |
76 | unsigned char ListBytes; /* How many bytes at max? */ |
77 | char Line[1]; /* Line with dynamic length */ |
78 | }; |
79 | |
80 | /* Single linked list of lines */ |
81 | extern ListLine* LineList; /* List of listing lines */ |
82 | extern ListLine* LineCur; /* Current listing line */ |
83 | extern ListLine* LineLast; /* Last listing line */ |
84 | |
85 | /* Page formatting */ |
86 | #define MIN_PAGE_LEN 32 |
87 | #define MAX_PAGE_LEN 127 |
88 | extern int PageLength; /* Length of a listing page */ |
89 | |
90 | /* Byte for one listing line */ |
91 | #define MIN_LIST_BYTES 4 |
92 | #define MAX_LIST_BYTES 255 |
93 | |
94 | |
95 | |
96 | /*****************************************************************************/ |
97 | /* Code */ |
98 | /*****************************************************************************/ |
99 | |
100 | |
101 | |
102 | void NewListingLine (const struct StrBuf* Line, unsigned char File, |
103 | unsigned char Depth); |
104 | /* Create a new ListLine struct */ |
105 | |
106 | void EnableListing (void); |
107 | /* Enable output of lines to the listing */ |
108 | |
109 | void DisableListing (void); |
110 | /* Disable output of lines to the listing */ |
111 | |
112 | void SetListBytes (int Bytes); |
113 | /* Set the maximum number of bytes listed for one line */ |
114 | |
115 | void InitListingLine (void); |
116 | /* Initialize the current listing line */ |
117 | |
118 | void CreateListing (void); |
119 | /* Create the listing */ |
120 | |
121 | |
122 | |
123 | /* End of listing.h */ |
124 | |
125 | #endif |
126 | |