X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=asminc%2Fo65.inc;h=6e0caa76b001cf9912cda73d2d181e3901d1de68;hb=2af76c7cffb08af3a6f7ca87c90132aa3e365f76;hp=1cc83b07f7a48f0aa7fbe06e13438dc4500cab35;hpb=6556d25662de8c8c274f4f9b9473f1c75e319fcf;p=cc65 diff --git a/asminc/o65.inc b/asminc/o65.inc index 1cc83b07f..6e0caa76b 100644 --- a/asminc/o65.inc +++ b/asminc/o65.inc @@ -1,15 +1,15 @@ ;*****************************************************************************/ ;* */ -;* o65.inc */ +;* o65.inc */ ;* */ -;* Definitions for the o65 file format */ +;* Definitions for the o65 file format */ ;* */ ;* */ ;* */ -;* (C) 2002 Ullrich von Bassewitz */ -;* Wacholderweg 14 */ -;* D-70597 Stuttgart */ -;* EMail: uz@musoftware.de */ +;* (C) 2002-2009, Ullrich von Bassewitz */ +;* Roemerstrasse 52 */ +;* D-70794 Filderstadt */ +;* EMail: uz@cc65.org */ ;* */ ;* */ ;* This software is provided 'as-is', without any expressed or implied */ @@ -38,24 +38,33 @@ -; Offsets into the o65 header structure (6502 format) -O65_HDR_MARKER = 0 ; Non-C64 marker -O65_HDR_MAGIC = 2 ; o65 magic -O65_HDR_VERSION = 5 ; Version number -O65_HDR_MODE = 6 ; Mode word -O65_HDR_TBASE = 8 ; Original text (code) segment address -O65_HDR_TLEN = 10 ; Size of text (code) segment -O65_HDR_DBASE = 12 ; Original data segment address -O65_HDR_DLEN = 14 ; Size of data segment -O65_HDR_BBASE = 16 ; Original bss segment address -O65_HDR_BLEN = 18 ; Size of bss segment -O65_HDR_ZBASE = 20 ; Original zp segment address -O65_HDR_ZLEN = 22 ; Size of zp segment -O65_HDR_STACK = 24 ; Stacksize needed -O65_HDR_SIZE = 26 ; Size of header structure +; The o65 header structure (6502 format) +.struct O65_HDR + MARKER .byte 2 ; Non-C64 marker: $01 $00 + MAGIC .byte 3 ; o65 magic: "o65" + VERSION .byte 1 ; Version number + MODE .word ; Mode word + TBASE .word ; Original text (code) segment address + TLEN .word ; Size of text (code) segment + DBASE .word ; Original data segment address + DLEN .word ; Size of data segment + BBASE .word ; Original bss segment address + BLEN .word ; Size of bss segment + ZBASE .word ; Original zp segment address + ZLEN .word ; Size of zp segment + STACK .word ; Stacksize needed +.endstruct + +; Marker, magic and version number +O65_MARKER_0 = $01 +O65_MARKER_1 = $00 +O65_MAGIC_0 = $6F ; 'o' +O65_MAGIC_1 = $36 ; '6' +O65_MAGIC_2 = $35 ; '5' +O65_VERSION = $00 ; Defines for the mode word -O65_CPU_65816 = $8000 ; Executable is for 65816 +O65_CPU_65816 = $8000 ; Executable is for 65816 O65_CPU_6502 = $0000 ; Executable is for the 6502 O65_CPU_MASK = $8000 ; Mask to extract CPU type @@ -67,19 +76,37 @@ O65_SIZE_32BIT = $2000 ; All size words are 32bit O65_SIZE_16BIT = $0000 ; All size words are 16bit O65_SIZE_MASK = $2000 ; Mask to extract size +O65_FTYPE_OBJ = $1000 ; Object file +O65_FTYPE_EXE = $0000 ; Executable file +O65_FTYPE_MASK = $1000 ; Mask to extract type + +O65_ADDR_SIMPLE = $0800 ; Simple addressing +O65_ADDR_DEFAULT = $0000 ; Default addressing +O65_ADDR_MASK = $0800 ; Mask to extract addressing + +O65_CHAIN = $0400 ; Chained file, another one follows +O65_CHAIN_MASK = $0400 ; Mask to extract chain flag + +O65_BSSZERO = $0200 ; BSS segment must be zeroed +O65_BSSZERO_MASK = $0200 ; Mask to extract bss zero flag + +; The following is used if O65_CPU == 6502 +O65_CPU2_6502 = $0000 ; Executable is for 6502 +O65_CPU2_65C02 = $0010 ; Executable is for 65C02 +O65_CPU2_65SC02 = $0020 ; Executable is for 65SC02 +O65_CPU2_65CE02 = $0030 ; Executable is for 65CE02 +O65_CPU2_6502X = $0040 ; Executable is for NMOS 6502 +O65_CPU2_65816_EMU = $0050 ; Executable is for 65816 in emul mode +O65_CPU2_MASK = $00F0 ; Mask to extract CPU2 field + O65_ALIGN_1 = $0000 ; Bytewise alignment O65_ALIGN_2 = $0001 ; Align words O65_ALIGN_4 = $0002 ; Align longwords O65_ALIGN_256 = $0003 ; Align pages (256 bytes) O65_ALIGN_MASK = $0003 ; Mask to extract alignment -; The o65 segment types -O65_SEG_UNDEF = $00 -O65_SEG_ABS = $01 -O65_SEG_TEXT = $02 -O65_SEG_DATA = $03 -O65_SEG_BSS = $04 -O65_SEG_ZP = $05 +; The mode word as generated by the ld65 linker +O65_MODE_CC65 = O65_CPU_6502 | O65_RELOC_BYTE | O65_SIZE_16BIT | O65_FTYPE_EXE | O65_ADDR_SIMPLE | O65_ALIGN_1 ; Relocation type codes O65_RTYPE_WORD = $80 @@ -100,15 +127,16 @@ O65_SEGID_MASK = $07 ; Option tags O65_OPT_FILENAME = 0 -O65_OPT_OS = 1 -O65_OPT_ASM = 2 -O65_OPT_AUTHOR = 3 -O65_OPT_TIMESTAMP = 4 +O65_OPT_OS = 1 +O65_OPT_ASM = 2 +O65_OPT_AUTHOR = 3 +O65_OPT_TIMESTAMP = 4 ; Operating system codes for O65_OPT_OS -O65_OS_OSA65 = 1 -O65_OS_LUNIX = 2 -O65_OS_CC65_MODULE = 3 +O65_OS_OSA65 = 1 +O65_OS_LUNIX = 2 +O65_OS_CC65 = 3 +O65_OS_OPENCBM = 4 ; Load errors O65_LOAD_OK = 0 ; Module load successful