]> git.sur5r.net Git - cc65/blob - src/sim65/simdata.h
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / src / sim65 / simdata.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 simdata.h                                 */
4 /*                                                                           */
5 /*                 Simulator data passed to the chip plugins                 */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002-2003 Ullrich von Bassewitz                                       */
10 /*               Römerstrasse 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 SIMDATA_H
37 #define SIMDATA_H
38
39
40
41 /*****************************************************************************/
42 /*                                     Data                                  */
43 /*****************************************************************************/
44
45
46
47 /* SimData structure */
48 typedef struct SimData SimData;
49 struct SimData {
50     unsigned    MajorVersion;
51     unsigned    MinorVersion;
52
53     /* -- Callback functions -- */
54
55     void* (*Malloc) (size_t Size);
56     /* Allocate a memory block of the given size */
57
58     void (*Free) (void* Block);
59     /* Free an allocated memory block */
60
61     void (*Warning) (const char* Format, ...);
62     /* Print a warning */
63
64     void (*Error) (const char* Format, ...);
65     /* Print an error and terminate the program */
66
67     void (*Internal) (const char* Format, ...);
68     /* Print an internal program error and terminate */
69
70     int (*GetCfgId) (void* CfgInfo, const char* Name, char** Id);
71     /* Search CfgInfo for an attribute with the given name and type "id". If
72      * found, remove it from the configuration, pass a pointer to a dynamically
73      * allocated string containing the value to Id, and return true. If not
74      * found, return false. The memory passed in Id must be free by a call to
75      * Free();
76      */
77
78     int (*GetCfgStr) (void* CfgInfo, const char* Name, char** S);
79     /* Search CfgInfo for an attribute with the given name and type "string".
80      * If found, remove it from the configuration, pass a pointer to a
81      * dynamically allocated string containing the value to S, and return
82      * true. If not found, return false. The memory passed in S must be free
83      * by a call to Free();
84      */
85
86     int (*GetCfgNum) (void* CfgInfo, const char* Name, long* Val);
87     /* Search CfgInfo for an attribute with the given name and type "number".
88      * If found, remove it from the configuration, copy it into Val and return
89      * true. If not found, return false.
90      */
91
92     unsigned char (*ReadCtrl) (unsigned Addr);
93     /* Read from the given address without triggering any additional action */
94
95     void (*WriteCtrl) (unsigned Addr, unsigned char Val);
96     /* Write to the given address without triggering additional action */
97
98     void (*Break) (const char* Format, ...);
99     /* Stop the CPU and display the given message */
100
101     void (*IRQ) (void);
102     /* Issue an irq request */
103
104     void (*NMI) (void);
105     /* Issue an nmi request */
106
107
108
109 };
110
111
112
113 /* End of simdata.h */
114
115 #endif
116
117
118