]> git.sur5r.net Git - cc65/blob - asminc/o65.inc
New o65 defines
[cc65] / asminc / o65.inc
1 ;*****************************************************************************/
2 ;*                                                                           */
3 ;*                                  o65.inc                                  */
4 ;*                                                                           */
5 ;*                    Definitions for the o65 file format                    */
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 ; This files exports structures and constants to handle the o65 relocatable
37 ; file format as defined by Andre Fachat.
38
39
40
41 ; Offsets into the o65 header structure (6502 format)
42 O65_HDR_MARKER          =       0       ; Non-C64 marker
43 O65_HDR_MAGIC           =       2       ; o65 magic
44 O65_HDR_VERSION         =       5       ; Version number
45 O65_HDR_MODE            =       6       ; Mode word
46 O65_HDR_TBASE           =       8       ; Original text (code) segment address
47 O65_HDR_TLEN            =      10       ; Size of text (code) segment
48 O65_HDR_DBASE           =      12       ; Original data segment address
49 O65_HDR_DLEN            =      14       ; Size of data segment
50 O65_HDR_BBASE           =      16       ; Original bss segment address
51 O65_HDR_BLEN            =      18       ; Size of bss segment
52 O65_HDR_ZBASE           =      20       ; Original zp segment address
53 O65_HDR_ZLEN            =      22       ; Size of zp segment
54 O65_HDR_STACK           =      24       ; Stacksize needed
55 O65_HDR_SIZE            =      26       ; Size of header structure
56
57 ; Defines for the mode word
58 O65_CPU_65816           =       $8000   ; Executable is for 65816
59 O65_CPU_6502            =       $0000   ; Executable is for the 6502
60 O65_CPU_MASK            =       $8000   ; Mask to extract CPU type
61
62 O65_RELOC_PAGE          =       $4000   ; Page wise relocation
63 O65_RELOC_BYTE          =       $0000   ; Byte wise relocation
64 O65_RELOC_MASK          =       $4000   ; Mask to extract relocation type
65
66 O65_SIZE_32BIT          =       $2000   ; All size words are 32bit
67 O65_SIZE_16BIT          =       $0000   ; All size words are 16bit
68 O65_SIZE_MASK           =       $2000   ; Mask to extract size
69
70 O65_FTYPE_OBJ           =       $1000   ; Object file
71 O65_FTYPE_EXE           =       $0000   ; Executable file
72 O65_FTYPE_MASK          =       $1000   ; Mask to extract type
73
74 O65_ADDR_SIMPLE         =       $0800   ; Simple addressing
75 O65_ADDR_DEFAULT        =       $0000   ; Default addressing
76 O65_ADDR_MASK           =       $0800   ; Mask to extract addressing
77
78 O65_ALIGN_1             =       $0000   ; Bytewise alignment
79 O65_ALIGN_2             =       $0001   ; Align words
80 O65_ALIGN_4             =       $0002   ; Align longwords
81 O65_ALIGN_256           =       $0003   ; Align pages (256 bytes)
82 O65_ALIGN_MASK          =       $0003   ; Mask to extract alignment
83
84 ; Relocation type codes
85 O65_RTYPE_WORD          =       $80
86 O65_RTYPE_HIGH          =       $40
87 O65_RTYPE_LOW           =       $20
88 O65_RTYPE_SEGADDR       =       $C0
89 O65_RTYPE_SEG           =       $A0
90 O65_RTYPE_MASK          =       $E0
91
92 ; Segment IDs
93 O65_SEGID_UNDEF         =       $00
94 O65_SEGID_ABS           =       $01
95 O65_SEGID_TEXT          =       $02
96 O65_SEGID_DATA          =       $03
97 O65_SEGID_BSS           =       $04
98 O65_SEGID_ZP            =       $05
99 O65_SEGID_MASK          =       $07
100
101 ; Option tags
102 O65_OPT_FILENAME        =       0
103 O65_OPT_OS              =       1
104 O65_OPT_ASM             =       2
105 O65_OPT_AUTHOR          =       3
106 O65_OPT_TIMESTAMP       =       4
107
108 ; Operating system codes for O65_OPT_OS
109 O65_OS_OSA65            =       1
110 O65_OS_LUNIX            =       2
111 O65_OS_CC65_MODULE      =       3
112
113 ; Load errors
114 O65_LOAD_OK             =       0       ; Module load successful
115 O65_LOAD_ERR_READ       =       1       ; Read error
116 O65_LOAD_ERR_HDR        =       2       ; Header error
117 O65_LOAD_ERR_OS         =       3       ; Wrong OS
118 O65_LOAD_ERR_FMT        =       4       ; Data format error
119 O65_LOAD_ERR_MEM        =       5       ; Not enough memory
120
121
122