]> git.sur5r.net Git - cc65/blob - include/dbg.h
Move _heap.h to the compiler include dir.
[cc65] / include / dbg.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                   dbg.h                                   */
4 /*                                                                           */
5 /*                         Debugger module interface                         */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2000 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
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 /*
37  * This is the interface to the cc65 debugger. Since many of the functions
38  * used for the debugger are quite usable even in another context, they
39  * are declared here.
40  *
41  * To use the debugger, just call DbgStart in your application. This will
42  * clear the screen and startup the debugger with the program counter
43  * pointing to the next instruction after the call to DbgStart. Once DbgStart
44  * has been executed, the debugger will also catch any BRK opcode. Use the
45  * BREAK function declared below to insert additional breakpoints into your
46  * code.
47  *
48  * There are currently a lot of things that cannot be debugged, graphical
49  * applications are an example. The debugger does not save your screen
50  * contents, so even your text screen gets destroyed. However, you can
51  * debug the C and runtime library, even if the debugger is using this
52  * stuff itself.
53  *
54  * Note: When using the debugger, there are some other identifiers with
55  * external linkage, that start with Dbg. Avoid those names if you use the
56  * module.
57  */
58
59
60
61 #ifndef _DBG_H
62 #define _DBG_H
63
64
65
66 /*****************************************************************************/
67 /*                            Utuility functions                             */
68 /*****************************************************************************/
69
70
71
72 unsigned __fastcall__ DbgDisAsm (unsigned Addr, char* Buf, unsigned char Len);
73 /* Disassemble one instruction at address addr into the given buffer.
74  * The resulting line has the format, "AAAA__BB_BB_BB___OPC_OPERAND",
75  * where AAAA is the hexadecimal representation of addr, BB are the
76  * bytes (in hex) that make the instruction, OPC is the mnemonic, and
77  * OPERAND is an operand for the instruction.
78  * The buffer is filled with spaces up to the given length and terminated as
79  * a usual C string. NOTE: Buf must be able to hold Len+1 characters.
80  * The function returns the length of the disassembled instruction, so,
81  * to disassemble the next instruction, add the return value to addr
82  * and call the function again.
83  */
84
85 unsigned __fastcall__ DbgDisAsmLen (unsigned Addr);
86 /* Disassemble one instruction, but do only return the length, do not
87  * create a visible representation. This function is useful when
88  * disassembling backwards, it is much faster than DbgDisAsm.
89  */
90
91 int __fastcall__ DbgIsRAM (unsigned Addr);
92 /* Return true if we can read and write the given address */
93
94 char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len);
95 /* Create a line of a memory dump in the given buffer. The buffer contains
96  * the starting address (4 digits hex), then Len bytes in this format:
97  * "AAAA__XX_YY_ZZ_...". The passed char buffer must hold Len*3+5 bytes
98  * plus a terminator byte.
99  * The function does not work correctly if the created string is longer
100  * than 255 bytes.
101  * The return value is Buf.
102  */
103
104
105
106 /*****************************************************************************/
107 /*                         High level user interface                         */
108 /*****************************************************************************/
109
110
111
112 void __fastcall__ DbgInit (unsigned unused);
113 /* Initialize the debugger. Use 0 as parameter. The debugger will popup on
114  * next brk encountered.
115  */
116
117 #define BREAK()         __asm__ ("\tbrk")
118 /* Use this to insert breakpoints into your code */
119
120
121
122 /* End of dbg.h */
123 #endif
124
125
126