]> git.sur5r.net Git - cc65/blob - asminc/modload.inc
Struct cleanup
[cc65] / asminc / modload.inc
1 ;*****************************************************************************/
2 ;*                                                                           */
3 ;*                                  modload.inc                              */
4 ;*                                                                           */
5 ;*                     o65 module loader interface for cc65                  */
6 ;*                                                                           */
7 ;*                                                                           */
8 ;*                                                                           */
9 ;* (C) 2002      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 ; Exports structures and functions to load relocatable o65 modules at
37 ; runtime.
38
39
40
41 ; Offsets for the mod_ctrl struct. This struct is passed to the module loader.
42 ; It contains stuff, the loader needs to work, and another area where the
43 ; loader will place informational data if it was successful. You will have to
44 ; check the return code of mod_load before accessing any of these additional
45 ; struct members.
46 MODCTRL_READ            =       0
47 MODCTRL_CALLERDATA      =       2
48 MODCTRL_MODULE          =       4       ; Pointer to module data
49 MODCTRL_MODULE_SIZE     =       6       ; Total size of loaded module
50 MODCTRL_MODULE_ID       =       8
51 MODCTRL_SIZE            =      10       ; Total size of struct
52
53
54 ; unsigned char mod_load (struct mod_ctrl* ctrl);
55 ; /* Load a module into memory and relocate it. The function will return an
56 ;  * error code (see below). If MLOAD_OK is returned, the outgoing fields in
57 ;  * the passed mod_ctrl struct contain information about the module just
58 ;  * loaded.
59 ;  */
60 .global         _mod_load
61
62 ; void mod_free (struct mod_ctrl* ctrl);
63 ; /* Free a loaded module. */
64 .global         _mod_free
65
66
67
68 ; Errors
69 MLOAD_OK                =       0       ; Module load successful
70 MLOAD_ERR_READ          =       1       ; Read error
71 MLOAD_ERR_HDR           =       2       ; Header error
72 MLOAD_ERR_OS            =       3       ; Wrong OS
73 MLOAD_ERR_FMT           =       4       ; Data format error
74 MLOAD_ERR_MEM           =       5       ; Not enough memory
75
76
77