]> git.sur5r.net Git - cc65/commitdiff
New directory for (globally used) assembler includes.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 21 Apr 2002 14:20:42 +0000 (14:20 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 21 Apr 2002 14:20:42 +0000 (14:20 +0000)
Moved the includes from libsrc/common here.
New includes: modload.inc, o65.inc

git-svn-id: svn://svn.cc65.org/cc65/trunk@1250 b7a2c559-68d2-44c3-8de9-860c34a00d81

asminc/_file.inc [new file with mode: 0644]
asminc/ctype.inc [new file with mode: 0644]
asminc/errno.inc [new file with mode: 0644]
asminc/fmode.inc [new file with mode: 0644]
asminc/modload.inc [new file with mode: 0644]
asminc/o65.inc [new file with mode: 0644]
asminc/rs232.inc [new file with mode: 0644]

diff --git a/asminc/_file.inc b/asminc/_file.inc
new file mode 100644 (file)
index 0000000..14a9412
--- /dev/null
@@ -0,0 +1,27 @@
+;
+; _file.inc
+;
+; (C) Copyright 2002 Ullrich von Bassewitz (uz@cc65.org)
+;
+
+; Assembler include file that makes the constants and structures in _file.h
+; available for asm code.
+
+; Struct _FILE offsets and size
+_FILE_f_fd      = $00
+_FILE_f_flags   = $01
+_FILE_size      = $02
+
+; Flags field 
+_FCLOSED        = $00
+_FOPEN          = $01
+_FEOF           = $02
+_FERROR         = $04
+_FPUSHBACK      = $08
+                     
+; Maximum number of open files (size of table)
+FOPEN_MAX       = 8
+
+; File table
+.global         __filetab
+
diff --git a/asminc/ctype.inc b/asminc/ctype.inc
new file mode 100644 (file)
index 0000000..e8a41da
--- /dev/null
@@ -0,0 +1,28 @@
+;
+; Definitions for the character type tables
+;
+; Ullrich von Bassewitz, 08.09.2001
+;
+
+; Make the __ctype table an exported/imported symbol
+
+        .global           __ctype
+
+; Define bitmapped constants for the table entries
+
+CT_LOWER       = $01           ; 0 - Lower case char
+CT_UPPER       = $02           ; 1 - Upper case char
+CT_DIGIT       = $04           ; 2 - Numeric digit
+CT_XDIGIT      = $08           ; 3 - Hex digit (both, lower and upper)
+CT_CTRL                = $10           ; 4 - Control character
+CT_SPACE       = $20           ; 5 - The space character itself
+CT_OTHER_WS    = $40           ; 6 - Other whitespace ('\f', '\n', '\r', '\t' and '\v')
+CT_SPACE_TAB   = $80           ; 7 - Space or tab character
+
+; Combined stuff
+CT_ALNUM       = (CT_LOWER | CT_UPPER | CT_DIGIT)
+CT_ALPHA       = (CT_LOWER | CT_UPPER)
+CT_CTRL_SPACE  = (CT_CTRL | CT_SPACE)
+CT_NOT_PUNCT   = (CT_SPACE | CT_CTRL | CT_DIGIT | CT_UPPER | CT_LOWER)
+
+
diff --git a/asminc/errno.inc b/asminc/errno.inc
new file mode 100644 (file)
index 0000000..197a355
--- /dev/null
@@ -0,0 +1,24 @@
+;
+; Ullrich von Bassewitz, 16.05.2000
+;
+
+; Error codes, must match the values in the C headers
+
+ENOENT         =       1       ; No such file or directory
+ENOMEM         =       2       ; Out of memory
+EACCES         =       3       ; Permission denied
+ENODEV         =       4       ; No such device
+EMFILE         =       5       ; Too many open files
+EBUSY          =       6       ; Device or resource busy
+EINVAL         =       7       ; Invalid argument
+ENOSPC         =       8       ; No space left on device
+EEXIST         =       9       ; File exists
+EAGAIN         =       10      ; Try again
+EIO            =       11      ; I/O error
+EINTR          =       12      ; Interrupted system call
+ENOSYS         =       13      ; Function not implemented
+ESPIPE         =       14      ; Illegal seek
+EUNKNOWN               =       15      ; Unknown OS specific error - must be last!
+
+EMAX           =       15      ; Highest error code
+
diff --git a/asminc/fmode.inc b/asminc/fmode.inc
new file mode 100644 (file)
index 0000000..2ec1090
--- /dev/null
@@ -0,0 +1,15 @@
+;
+; Ullrich von Bassewitz, 05.06.1999
+;
+
+; File mode constants, must match the values in the C headers
+
+
+O_RDONLY       = $01
+O_WRONLY       = $02
+O_RDWR         = $03
+O_CREAT                = $04
+O_TRUNC                = $10
+O_APPEND       = $20
+
+
diff --git a/asminc/modload.inc b/asminc/modload.inc
new file mode 100644 (file)
index 0000000..b11bc75
--- /dev/null
@@ -0,0 +1,78 @@
+;*****************************************************************************/
+;*                                                                           */
+;*                                  modload.inc                              */
+;*                                                                           */
+;*                     o65 module loader interface for cc65                  */
+;*                                                                           */
+;*                                                                           */
+;*                                                                           */
+;* (C) 2002      Ullrich von Bassewitz                                       */
+;*               Wacholderweg 14                                             */
+;*               D-70597 Stuttgart                                           */
+;* EMail:        uz@musoftware.de                                            */
+;*                                                                           */
+;*                                                                           */
+;* This software is provided 'as-is', without any expressed or implied       */
+;* warranty.  In no event will the authors be held liable for any damages    */
+;* arising from the use of this software.                                    */
+;*                                                                           */
+;* Permission is granted to anyone to use this software for any purpose,     */
+;* including commercial applications, and to alter it and redistribute it    */
+;* freely, subject to the following restrictions:                            */
+;*                                                                           */
+;* 1. The origin of this software must not be misrepresented; you must not   */
+;*    claim that you wrote the original software. If you use this software   */
+;*    in a product, an acknowledgment in the product documentation would be  */
+;*    appreciated but is not required.                                       */
+;* 2. Altered source versions must be plainly marked as such, and must not   */
+;*    be misrepresented as being the original software.                      */
+;* 3. This notice may not be removed or altered from any source              */
+;*    distribution.                                                          */
+;*                                                                           */
+;*****************************************************************************/
+
+
+
+; Exports structures and functions to load relocatable o65 modules at
+; runtime.
+
+
+
+; Offsets for the mod_ctrl struct. This struct is passed to the module loader.
+; It contains stuff, the loader needs to work, and another area where the
+; loader will place informational data if it was successful. You will have to
+; check the return code of mod_load before accessing any of these additional
+; struct members.
+MODCTRL_READ            =       0
+MODCTRL_CALLERDATA      =       2
+MODCTRL_MODULE          =       4       ; Pointer to module data
+MODCTRL_MODULE_SIZE     =       6       ; Total size of loaded module
+MODCTRL_CODE            =       8       ; Pointer to code segment
+MODCTRL_CODE_SIZE       =      10       ; Size of code segment
+MODCTRL_DATA            =      12       ; Pointer to data segment
+MODCTRL_DATA_SIZE       =      14       ; Size of data segment
+MODCTRL_BSS             =      16       ; Pointer to bss segment
+MODCTRL_BSS_SIZE        =      18       ; Size of bss segment
+MODCTRL_SIZE            =      20       ; Total size of struct
+
+
+; unsigned char mod_load (struct mod_ctrl* ctrl);
+; /* Load a module into memory and relocate it. The function will return an
+;  * error code (see below). If MLOAD_OK is returned, the outgoing fields in
+;  * the passed mod_ctrl struct contain information about the module just
+;  * loaded.
+;  */
+.global         _mod_load
+
+
+
+; Errors
+MLOAD_OK                =       0       ; Module load successful
+MLOAD_ERR_READ          =       1       ; Read error
+MLOAD_ERR_HDR           =       2       ; Header error
+MLOAD_ERR_OS            =       3       ; Wrong OS
+MLOAD_ERR_FMT           =       4       ; Data format error
+MLOAD_ERR_MEM           =       5       ; Not enough memory
+
+
+
diff --git a/asminc/o65.inc b/asminc/o65.inc
new file mode 100644 (file)
index 0000000..1cc83b0
--- /dev/null
@@ -0,0 +1,122 @@
+;*****************************************************************************/
+;*                                                                           */
+;*                                         o65.inc                                  */
+;*                                                                           */
+;*                   Definitions for the o65 file format                    */
+;*                                                                           */
+;*                                                                           */
+;*                                                                           */
+;* (C) 2002      Ullrich von Bassewitz                                       */
+;*               Wacholderweg 14                                             */
+;*               D-70597 Stuttgart                                           */
+;* EMail:        uz@musoftware.de                                            */
+;*                                                                           */
+;*                                                                           */
+;* This software is provided 'as-is', without any expressed or implied       */
+;* warranty.  In no event will the authors be held liable for any damages    */
+;* arising from the use of this software.                                    */
+;*                                                                           */
+;* Permission is granted to anyone to use this software for any purpose,     */
+;* including commercial applications, and to alter it and redistribute it    */
+;* freely, subject to the following restrictions:                            */
+;*                                                                           */
+;* 1. The origin of this software must not be misrepresented; you must not   */
+;*    claim that you wrote the original software. If you use this software   */
+;*    in a product, an acknowledgment in the product documentation would be  */
+;*    appreciated but is not required.                                       */
+;* 2. Altered source versions must be plainly marked as such, and must not   */
+;*    be misrepresented as being the original software.                      */
+;* 3. This notice may not be removed or altered from any source              */
+;*    distribution.                                                          */
+;*                                                                           */
+;*****************************************************************************/
+
+
+
+; This files exports structures and constants to handle the o65 relocatable
+; file format as defined by Andre Fachat.
+
+
+
+; 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
+
+; Defines for the mode word
+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
+
+O65_RELOC_PAGE          =       $4000   ; Page wise relocation
+O65_RELOC_BYTE          =       $0000   ; Byte wise relocation
+O65_RELOC_MASK          =       $4000   ; Mask to extract relocation type
+
+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_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
+
+; Relocation type codes
+O65_RTYPE_WORD          =       $80
+O65_RTYPE_HIGH          =       $40
+O65_RTYPE_LOW           =       $20
+O65_RTYPE_SEGADDR       =       $C0
+O65_RTYPE_SEG           =       $A0
+O65_RTYPE_MASK          =       $E0
+
+; Segment IDs
+O65_SEGID_UNDEF         =       $00
+O65_SEGID_ABS           =       $01
+O65_SEGID_TEXT          =       $02
+O65_SEGID_DATA          =       $03
+O65_SEGID_BSS           =       $04
+O65_SEGID_ZP            =       $05
+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
+
+; Operating system codes for O65_OPT_OS
+O65_OS_OSA65                   =       1
+O65_OS_LUNIX                   =       2
+O65_OS_CC65_MODULE      =       3
+
+; Load errors
+O65_LOAD_OK             =       0       ; Module load successful
+O65_LOAD_ERR_READ       =       1       ; Read error
+O65_LOAD_ERR_HDR        =       2       ; Header error
+O65_LOAD_ERR_OS         =       3       ; Wrong OS
+O65_LOAD_ERR_FMT        =       4       ; Data format error
+O65_LOAD_ERR_MEM        =       5       ; Not enough memory
+
+
+
diff --git a/asminc/rs232.inc b/asminc/rs232.inc
new file mode 100644 (file)
index 0000000..fa0089a
--- /dev/null
@@ -0,0 +1,21 @@
+;
+; rs232.inc
+;
+; (C) Copyright 2002 Ullrich von Bassewitz (uz@cc65.org)
+;
+
+; Assembler include file that makes the constants and structures from rs232.h
+; available for asm code.
+
+
+
+; Error codes returned by all functions
+RS_ERR_OK                              = $00   ; Not an error - relax
+RS_ERR_NOT_INITIALIZED                 = $01   ; Module not initialized
+RS_ERR_BAUD_TOO_FAST                   = $02   ; Cannot handle baud rate
+RS_ERR_BAUD_NOT_AVAIL                  = $03   ; Baud rate not available
+RS_ERR_NO_DATA                         = $04   ; Nothing to read
+RS_ERR_OVERFLOW                        = $05   ; No room in send buffer
+
+
+