This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
3
src/common/.cvsignore
Normal file
3
src/common/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.depend
|
||||
common.o
|
||||
common.lib
|
||||
128
src/common/bitops.c
Normal file
128
src/common/bitops.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* bitops.c */
|
||||
/* */
|
||||
/* Single bit operations */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "bitops.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned BitFind (unsigned long Val)
|
||||
/* Find the first bit that is set in Val. Val must *not* be zero */
|
||||
{
|
||||
unsigned long Mask;
|
||||
unsigned Bit;
|
||||
|
||||
/* Search for the bits */
|
||||
Mask = 1;
|
||||
Bit = 0;
|
||||
while (1) {
|
||||
if (Val & Mask) {
|
||||
return Bit;
|
||||
}
|
||||
Mask <<= 1;
|
||||
++Bit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BitSet (void* Data, unsigned Bit)
|
||||
/* Set a bit in a char array */
|
||||
{
|
||||
/* Make a char pointer */
|
||||
unsigned char* D = Data;
|
||||
|
||||
/* Set the bit */
|
||||
D [Bit / 8] |= 0x01 << (Bit % 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BitReset (void* Data, unsigned Bit)
|
||||
/* Reset a bit in a char array */
|
||||
{
|
||||
/* Make a char pointer */
|
||||
unsigned char* D = Data;
|
||||
|
||||
/* Set the bit */
|
||||
D [Bit / 8] &= ~(0x01 << (Bit % 8));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int BitIsSet (void* Data, unsigned Bit)
|
||||
/* Check if a bit is set in a char array */
|
||||
{
|
||||
/* Make a char pointer */
|
||||
unsigned char* D = Data;
|
||||
|
||||
/* Check the bit state */
|
||||
return (D [Bit / 8] & (0x01 << (Bit % 8))) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int BitIsReset (void* Data, unsigned Bit)
|
||||
/* Check if a bit is reset in a char array */
|
||||
{
|
||||
/* Make a char pointer */
|
||||
unsigned char* D = Data;
|
||||
|
||||
/* Check the bit state */
|
||||
return (D [Bit / 8] & (0x01 << (Bit % 8))) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BitMerge (void* Target, const void* Source, unsigned Size)
|
||||
/* Merge the bits of two char arrays (that is, do an or for the full array) */
|
||||
{
|
||||
/* Make char arrays */
|
||||
unsigned char* T = Target;
|
||||
const unsigned char* S = Source;
|
||||
|
||||
/* Merge the arrays */
|
||||
while (Size--) {
|
||||
*T++ |= *S++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
72
src/common/bitops.h
Normal file
72
src/common/bitops.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* bitops.h */
|
||||
/* */
|
||||
/* Single bit operations */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef BITOPS_H
|
||||
#define BITOPS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned BitFind (unsigned long Val);
|
||||
/* Find the first bit that is set in Val. Val must *not* be zero */
|
||||
|
||||
void BitSet (void* Data, unsigned Bit);
|
||||
/* Set a bit in a char array */
|
||||
|
||||
void BitReset (void* Data, unsigned Bit);
|
||||
/* Reset a bit in a char array */
|
||||
|
||||
int BitIsSet (void* Data, unsigned Bit);
|
||||
/* Check if a bit is set in a char array */
|
||||
|
||||
int BitIsReset (void* Data, unsigned Bit);
|
||||
/* Check if a bit is reset in a char array */
|
||||
|
||||
void BitMerge (void* Target, const void* Source, unsigned Size);
|
||||
/* Merge the bits of two char arrays (that is, do an or for the full array) */
|
||||
|
||||
|
||||
|
||||
/* End of bitops.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
124
src/common/exprdefs.h
Normal file
124
src/common/exprdefs.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* exprdefs.h */
|
||||
/* */
|
||||
/* Expression tree definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef EXPRDEFS_H
|
||||
#define EXPRDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Expression type masks */
|
||||
#define EXPR_TYPEMASK 0xC0
|
||||
#define EXPR_BINARYNODE 0x00
|
||||
#define EXPR_UNARYNODE 0x40
|
||||
#define EXPR_LEAFNODE 0x80
|
||||
|
||||
/* Type of expression nodes */
|
||||
#define EXPR_NULL 0x00 /* Internal error or NULL node */
|
||||
|
||||
/* Leaf node codes */
|
||||
#define EXPR_LITERAL (EXPR_LEAFNODE | 0x01)
|
||||
#define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02)
|
||||
#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x03)
|
||||
#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x04) /* Linker only */
|
||||
#define EXPR_ULABEL (EXPR_LEAFNODE | 0x05) /* Assembler only */
|
||||
|
||||
/* Binary operations, left and right hand sides are valid */
|
||||
#define EXPR_PLUS (EXPR_BINARYNODE | 0x01)
|
||||
#define EXPR_MINUS (EXPR_BINARYNODE | 0x02)
|
||||
#define EXPR_MUL (EXPR_BINARYNODE | 0x03)
|
||||
#define EXPR_DIV (EXPR_BINARYNODE | 0x04)
|
||||
#define EXPR_MOD (EXPR_BINARYNODE | 0x05)
|
||||
#define EXPR_OR (EXPR_BINARYNODE | 0x06)
|
||||
#define EXPR_XOR (EXPR_BINARYNODE | 0x07)
|
||||
#define EXPR_AND (EXPR_BINARYNODE | 0x08)
|
||||
#define EXPR_SHL (EXPR_BINARYNODE | 0x09)
|
||||
#define EXPR_SHR (EXPR_BINARYNODE | 0x0A)
|
||||
#define EXPR_EQ (EXPR_BINARYNODE | 0x0B)
|
||||
#define EXPR_NE (EXPR_BINARYNODE | 0x0C)
|
||||
#define EXPR_LT (EXPR_BINARYNODE | 0x0D)
|
||||
#define EXPR_GT (EXPR_BINARYNODE | 0x0E)
|
||||
#define EXPR_LE (EXPR_BINARYNODE | 0x0F)
|
||||
#define EXPR_GE (EXPR_BINARYNODE | 0x10)
|
||||
#define EXPR_BAND (EXPR_BINARYNODE | 0x11)
|
||||
#define EXPR_BOR (EXPR_BINARYNODE | 0x12)
|
||||
#define EXPR_BXOR (EXPR_BINARYNODE | 0x13)
|
||||
|
||||
/* Unary operations, right hand side is empty */
|
||||
#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01)
|
||||
#define EXPR_NOT (EXPR_UNARYNODE | 0x02)
|
||||
#define EXPR_LOBYTE (EXPR_UNARYNODE | 0x03)
|
||||
#define EXPR_HIBYTE (EXPR_UNARYNODE | 0x04)
|
||||
#define EXPR_SWAP (EXPR_UNARYNODE | 0x05)
|
||||
#define EXPR_BNOT (EXPR_UNARYNODE | 0x06)
|
||||
|
||||
|
||||
|
||||
/* The expression node itself */
|
||||
typedef struct ExprNode_ ExprNode;
|
||||
struct ExprNode_ {
|
||||
unsigned char Op; /* Operand/Type */
|
||||
ExprNode* Left; /* Left leaf */
|
||||
ExprNode* Right; /* Right leaf */
|
||||
struct ObjData_* Obj; /* Object file reference (linker) */
|
||||
union {
|
||||
long Val; /* If this is a value */
|
||||
struct SymEntry_* Sym; /* If this is a symbol */
|
||||
unsigned SegNum; /* If this is a segment */
|
||||
unsigned ImpNum; /* If this is an import */
|
||||
struct Memory_* MemArea; /* If this is a memory area */
|
||||
} V;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Macros to determine the expression type */
|
||||
#define EXPR_IS_LEAF(Op) (((Op) & EXPR_TYPEMASK) == EXPR_LEAFNODE)
|
||||
#define EXPR_IS_UNARY(Op) (((Op) & EXPR_TYPEMASK) == EXPR_UNARYNODE)
|
||||
#define EXPR_IS_BINARY(OP) (((Op) & EXPR_TYPEMASK) == EXPR_BINARYNODE)
|
||||
|
||||
|
||||
|
||||
/* End of exprdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
65
src/common/filepos.h
Normal file
65
src/common/filepos.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* filepos.h */
|
||||
/* */
|
||||
/* File position data structure */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef FILEPOS_H
|
||||
#define FILEPOS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Size of position in file */
|
||||
#define POS_SIZE 5
|
||||
|
||||
/* Type of a file position */
|
||||
typedef struct FilePos_ FilePos;
|
||||
struct FilePos_ {
|
||||
unsigned long Line; /* Line */
|
||||
unsigned char Col; /* Column */
|
||||
unsigned char Name; /* File */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* End of filepos.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
56
src/common/hashstr.c
Normal file
56
src/common/hashstr.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* hashstr.c */
|
||||
/* */
|
||||
/* Hash function for strings */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned HashStr (const char* S)
|
||||
/* Return a hash value for the given string */
|
||||
{
|
||||
unsigned L, H;
|
||||
|
||||
/* Do the hash */
|
||||
H = L = 0;
|
||||
while (*S) {
|
||||
H = ((H << 3) ^ ((unsigned char) *S++)) + L++;
|
||||
}
|
||||
return H;
|
||||
}
|
||||
|
||||
|
||||
|
||||
57
src/common/hashstr.h
Normal file
57
src/common/hashstr.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* hashstr.h */
|
||||
/* */
|
||||
/* Hash function for strings */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef HASHSTR_H
|
||||
#define HASHSTR_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned HashStr (const char* S);
|
||||
/* Return a hash value for the given string */
|
||||
|
||||
|
||||
|
||||
/* End of hashstr.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
72
src/common/libdefs.h
Normal file
72
src/common/libdefs.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* libdefs.h */
|
||||
/* */
|
||||
/* Library file definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef LIBDEFS_H
|
||||
#define LIBDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Defines for magic and version */
|
||||
#define LIB_MAGIC 0x7A55616E
|
||||
#define LIB_VERSION 0x0004
|
||||
|
||||
/* Size of an library file header */
|
||||
#define LIB_HDR_SIZE 12
|
||||
|
||||
|
||||
|
||||
/* Header structure for the library */
|
||||
typedef struct LibHeader_ LibHeader;
|
||||
struct LibHeader_ {
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long IndexOffs; /* 32: Offset to directory */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* End of libdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
48
src/common/make/gcc.mak
Normal file
48
src/common/make/gcc.mak
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# gcc Makefile for the binutils common stuff
|
||||
#
|
||||
|
||||
CFLAGS = -g -O2 -Wall
|
||||
CC = gcc
|
||||
LDFLAGS =
|
||||
LIB = common.a
|
||||
|
||||
|
||||
|
||||
OBJS = bitops.o \
|
||||
hashstr.o
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Dummy targets
|
||||
|
||||
.PHONY: all
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
all: lib
|
||||
include .depend
|
||||
else
|
||||
all: depend
|
||||
@$(MAKE) -f make/gcc.mak all
|
||||
endif
|
||||
|
||||
.PHONY: lib
|
||||
lib: $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) rs $(LIB) $?
|
||||
|
||||
clean:
|
||||
rm -f *~ core *.map
|
||||
|
||||
zap: clean
|
||||
rm -f *.o $(LIB) .depend
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Make the dependencies
|
||||
|
||||
.PHONY: depend dep
|
||||
depend dep: $(OBJS:.o=.c)
|
||||
@echo "Creating dependency information"
|
||||
$(CC) -MM $^ > .depend
|
||||
|
||||
|
||||
92
src/common/make/watcom.mak
Normal file
92
src/common/make/watcom.mak
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# CC65 Makefile for the Watcom compiler
|
||||
#
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Generic stuff
|
||||
|
||||
.AUTODEPEND
|
||||
.SUFFIXES .ASM .C .CC .CPP
|
||||
.SWAP
|
||||
|
||||
AR = WLIB
|
||||
LD = WLINK
|
||||
|
||||
LIB = common.lib
|
||||
|
||||
!if !$d(TARGET)
|
||||
!if $d(__OS2__)
|
||||
TARGET = OS2
|
||||
!else
|
||||
TARGET = NT
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# target specific macros.
|
||||
!if $(TARGET)==OS2
|
||||
|
||||
# --------------------- OS2 ---------------------
|
||||
SYSTEM = os2v2
|
||||
CC = WCC386
|
||||
CCCFG = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
|
||||
|
||||
!elif $(TARGET)==DOS32
|
||||
|
||||
# -------------------- DOS4G --------------------
|
||||
SYSTEM = dos4g
|
||||
CC = WCC386
|
||||
CCCFG = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
|
||||
|
||||
!elif $(TARGET)==DOS
|
||||
|
||||
# --------------------- DOS ---------------------
|
||||
SYSTEM = dos
|
||||
CC = WCC
|
||||
CCCFG = -bt=$(TARGET) -d1 -onatx -zp2 -2 -ml -zq -w2
|
||||
|
||||
!elif $(TARGET)==NT
|
||||
|
||||
# --------------------- NT ----------------------
|
||||
SYSTEM = nt
|
||||
CC = WCC386
|
||||
CCCFG = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
|
||||
|
||||
!else
|
||||
!error
|
||||
!endif
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Implicit rules
|
||||
|
||||
.c.obj:
|
||||
$(CC) $(CCCFG) $<
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# All library OBJ files
|
||||
|
||||
OBJS = bitops.obj \
|
||||
hashstr.obj \
|
||||
wildargv.obj
|
||||
|
||||
|
||||
.PRECIOUS $(OBJS:.obj=.cc) $(LIB)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Main targets
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
@echo Creating library...
|
||||
&@$(AR) -q -b -P=32 $(LIB) +-$?
|
||||
@echo Done!
|
||||
|
||||
clean:
|
||||
@if exist *.obj del *.obj
|
||||
@if exist $(LIB) del $(LIB)
|
||||
|
||||
|
||||
|
||||
86
src/common/objdefs.h
Normal file
86
src/common/objdefs.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* objdefs.h */
|
||||
/* */
|
||||
/* Object file definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef OBJDEFS_H
|
||||
#define OBJDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Defines for magic and version */
|
||||
#define OBJ_MAGIC 0x616E7A55
|
||||
#define OBJ_VERSION 0x0005
|
||||
|
||||
/* Size of an object file header */
|
||||
#define OBJ_HDR_SIZE 56
|
||||
|
||||
/* Flag bits */
|
||||
#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */
|
||||
|
||||
|
||||
|
||||
/* Header structure */
|
||||
typedef struct ObjHeader_ ObjHeader;
|
||||
struct ObjHeader_ {
|
||||
unsigned long Magic; /* 32: Magic number */
|
||||
unsigned Version; /* 16: Version number */
|
||||
unsigned Flags; /* 16: flags */
|
||||
unsigned long OptionOffs; /* 32: Offset to option table */
|
||||
unsigned long OptionSize; /* 32: Size of options */
|
||||
unsigned long FileOffs; /* 32: Offset to file table */
|
||||
unsigned long FileSize; /* 32: Size of files */
|
||||
unsigned long SegOffs; /* 32: Offset to segment table */
|
||||
unsigned long SegSize; /* 32: Size of segment table */
|
||||
unsigned long ImportOffs; /* 32: Offset to import list */
|
||||
unsigned long ImportSize; /* 32: Size of import list */
|
||||
unsigned long ExportOffs; /* 32: Offset to export list */
|
||||
unsigned long ExportSize; /* 32: Size of export list */
|
||||
unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */
|
||||
unsigned long DbgSymSize; /* 32: Size of debug symbols */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* End of objdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
80
src/common/optdefs.h
Normal file
80
src/common/optdefs.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* optdefs.h */
|
||||
/* */
|
||||
/* Definitions for object file options */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef OPTDEFS_H
|
||||
#define OPTDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Type of options */
|
||||
#define OPT_ARGMASK 0xC0 /* Mask for argument */
|
||||
#define OPT_ARGSTR 0x00 /* String argument */
|
||||
#define OPT_ARGNUM 0x40 /* Numerical argument */
|
||||
|
||||
#define OPT_COMMENT (OPT_ARGSTR+0) /* Generic comment */
|
||||
#define OPT_AUTHOR (OPT_ARGSTR+1) /* Author specification */
|
||||
#define OPT_TRANSLATOR (OPT_ARGSTR+2) /* Translator specification */
|
||||
#define OPT_COMPILER (OPT_ARGSTR+3) /* Compiler specification */
|
||||
#define OPT_OS (OPT_ARGSTR+4) /* Operating system specification */
|
||||
|
||||
#define OPT_DATETIME (OPT_ARGNUM+0) /* Date/time of translation */
|
||||
|
||||
|
||||
|
||||
/* Structure to encode options */
|
||||
typedef struct Option_ Option;
|
||||
struct Option_ {
|
||||
Option* Next; /* For list of options */
|
||||
unsigned char Type; /* Type of option */
|
||||
union {
|
||||
const char* Str; /* String attribute */
|
||||
unsigned long Val; /* Value attribute */
|
||||
} V;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* End of optdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
83
src/common/segdefs.h
Normal file
83
src/common/segdefs.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* segdefs.h */
|
||||
/* */
|
||||
/* Segment definitions for the bin65 binary utils */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SEGDEFS_H
|
||||
#define SEGDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Available segment types */
|
||||
#define SEGTYPE_DEFAULT 0
|
||||
#define SEGTYPE_ABS 1
|
||||
#define SEGTYPE_ZP 2
|
||||
#define SEGTYPE_FAR 3
|
||||
|
||||
/* Fragment types in the object file */
|
||||
#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */
|
||||
#define FRAG_BYTEMASK 0x07 /* Mask for byte count */
|
||||
|
||||
#define FRAG_LITERAL 0x00 /* Literal data */
|
||||
#define FRAG_LITERAL8 0x01 /* Literal data with 8 bit length */
|
||||
#define FRAG_LITERAL16 0x02 /* Literal data with 16 bit length */
|
||||
#define FRAG_LITERAL24 0x03 /* Literal data with 24 bit length */
|
||||
#define FRAG_LITERAL32 0x04 /* Literal data with 32 bit length */
|
||||
|
||||
#define FRAG_EXPR 0x08 /* Expression */
|
||||
#define FRAG_EXPR8 0x09 /* 8 bit expression */
|
||||
#define FRAG_EXPR16 0x0A /* 16 bit expression */
|
||||
#define FRAG_EXPR24 0x0B /* 24 bit expression */
|
||||
#define FRAG_EXPR32 0x0C /* 32 bit expression */
|
||||
|
||||
#define FRAG_SEXPR 0x10 /* Signed expression */
|
||||
#define FRAG_SEXPR8 0x11 /* 8 bit signed expression */
|
||||
#define FRAG_SEXPR16 0x12 /* 16 bit signed expression */
|
||||
#define FRAG_SEXPR24 0x13 /* 24 bit signed expression */
|
||||
#define FRAG_SEXPR32 0x14 /* 32 bit signed expression */
|
||||
|
||||
#define FRAG_FILL 0x20 /* Fill bytes */
|
||||
|
||||
|
||||
/* End of segdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
63
src/common/symdefs.h
Normal file
63
src/common/symdefs.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* symdefs.h */
|
||||
/* */
|
||||
/* Symbol definitions for the bin65 binary utils */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SYMDEFS_H
|
||||
#define SYMDEFS_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Object file tags for imports and exports */
|
||||
#define IMP_ABS 0x00 /* Import as normal value */
|
||||
#define IMP_ZP 0x01 /* Import as zero page symbol */
|
||||
|
||||
#define EXP_ABS 0x00 /* Export as normal value */
|
||||
#define EXP_ZP 0x01 /* Export as zero page value */
|
||||
#define EXP_CONST 0x00 /* Mask bit for const values */
|
||||
#define EXP_EXPR 0x02 /* Mask bit for expr values */
|
||||
|
||||
|
||||
|
||||
/* End of symdefs.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
58
src/common/version.h
Normal file
58
src/common/version.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* version.h */
|
||||
/* */
|
||||
/* Version information for the cc65 compiler package */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 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. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define VER_MAJOR 2U
|
||||
#define VER_MINOR 4U
|
||||
#define VER_PATCH 4U
|
||||
|
||||
|
||||
|
||||
/* End of version.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user