From 1c3e74a1480a57f8726d433943d1f0e46873e673 Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 21 Apr 2002 14:30:40 +0000 Subject: [PATCH] Add new o65 operating system git-svn-id: svn://svn.cc65.org/cc65/trunk@1253 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/config.c | 31 ++++++++++++++++++------------- src/ld65/o65.c | 11 ++++++++--- src/ld65/o65.h | 3 ++- src/ld65/scanner.h | 1 + 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/ld65/config.c b/src/ld65/config.c index fc4fc04e7..fb0a581de 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -802,18 +802,19 @@ static void ParseO65 (void) /* Parse the o65 format section */ { static const IdentTok Attributes [] = { - { "EXPORT", CFGTOK_EXPORT }, - { "IMPORT", CFGTOK_IMPORT }, - { "TYPE", CFGTOK_TYPE }, - { "OS", CFGTOK_OS }, + { "EXPORT", CFGTOK_EXPORT }, + { "IMPORT", CFGTOK_IMPORT }, + { "TYPE", CFGTOK_TYPE }, + { "OS", CFGTOK_OS }, }; static const IdentTok Types [] = { - { "SMALL", CFGTOK_SMALL }, - { "LARGE", CFGTOK_LARGE }, + { "SMALL", CFGTOK_SMALL }, + { "LARGE", CFGTOK_LARGE }, }; static const IdentTok OperatingSystems [] = { - { "LUNIX", CFGTOK_LUNIX }, - { "OSA65", CFGTOK_OSA65 }, + { "LUNIX", CFGTOK_LUNIX }, + { "OSA65", CFGTOK_OSA65 }, + { "CC65", CFGTOK_CC65 }, }; while (CfgTok == CFGTOK_IDENT) { @@ -878,7 +879,7 @@ static void ParseO65 (void) break; case CFGTOK_LARGE: - O65SetLargeModel (O65FmtDesc); + O65SetLargeModel (O65FmtDesc); break; default: @@ -894,12 +895,16 @@ static void ParseO65 (void) switch (CfgTok) { case CFGTOK_LUNIX: - O65SetOS (O65FmtDesc, O65OS_LUNIX); - break; + O65SetOS (O65FmtDesc, O65OS_LUNIX); + break; case CFGTOK_OSA65: - O65SetOS (O65FmtDesc, O65OS_OSA65); - break; + O65SetOS (O65FmtDesc, O65OS_OSA65); + break; + + case CFGTOK_CC65: + O65SetOS (O65FmtDesc, O65OS_CC65); + break; default: CfgError ("Unexpected OS token"); diff --git a/src/ld65/o65.c b/src/ld65/o65.c index 123bad624..fc8265890 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -90,9 +90,9 @@ #define O65RELOC_WORD 0x80 #define O65RELOC_HIGH 0x40 #define O65RELOC_LOW 0x20 -#define O65RELOC_SEGADR 0xc0 -#define O65RELOC_SEG 0xa0 -#define O65RELOC_MASK 0xc0 +#define O65RELOC_SEGADR 0xC0 +#define O65RELOC_SEG 0xA0 +#define O65RELOC_MASK 0xE0 /* O65 executable file header */ typedef struct O65Header O65Header; @@ -1013,6 +1013,7 @@ void O65SetOS (O65Desc* D, unsigned OS) { static const unsigned char OSA65 [2] = { O65OS_OSA65, 0 }; static const unsigned char Lunix [2] = { O65OS_LUNIX, 0 }; + static const unsigned char CC65 [4] = { O65OS_CC65, 0, 0, 0 }; /* Write the correct option */ switch (OS) { @@ -1025,6 +1026,10 @@ void O65SetOS (O65Desc* D, unsigned OS) O65SetOption (D, O65OPT_OS, Lunix, sizeof (Lunix)); break; + case O65OS_CC65: + O65SetOption (D, O65OPT_OS, CC65, sizeof (CC65)); + break; + default: Internal ("Trying to set invalid O65 operating system: %u", OS); diff --git a/src/ld65/o65.h b/src/ld65/o65.h index 58a8d9a5e..85f3c269d 100644 --- a/src/ld65/o65.h +++ b/src/ld65/o65.h @@ -64,6 +64,7 @@ typedef struct O65Desc O65Desc; /* Operating system codes for O65OPT_OS */ #define O65OS_OSA65 1 #define O65OS_LUNIX 2 +#define O65OS_CC65 3 @@ -82,7 +83,7 @@ void FreeO65Desc (O65Desc* D); void O65Set6502 (O65Desc* D); /* Enable 6502 mode */ -void O65Set65816 (O65Desc* D); +void O65Set65816 (O65Desc* D); /* Enable 816 mode */ void O65SetSmallModel (O65Desc* D); diff --git a/src/ld65/scanner.h b/src/ld65/scanner.h index 8b385478d..5971c2be3 100644 --- a/src/ld65/scanner.h +++ b/src/ld65/scanner.h @@ -101,6 +101,7 @@ typedef enum { CFGTOK_LUNIX, CFGTOK_OSA65, + CFGTOK_CC65, CFGTOK_CONDES, CFGTOK_SEGMENT, -- 2.39.5