From 7d72f47fe6fd64168267ed94bd1ad5cde0e77c2c Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 3 Oct 2004 21:25:29 +0000 Subject: [PATCH] Added new CPU SWEET16 git-svn-id: svn://svn.cc65.org/cc65/trunk@3207 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/ea.c | 204 -------------------------------------------------- src/ca65/ea.h | 78 ------------------- 2 files changed, 282 deletions(-) delete mode 100644 src/ca65/ea.c delete mode 100644 src/ca65/ea.h diff --git a/src/ca65/ea.c b/src/ca65/ea.c deleted file mode 100644 index ea19bb271..000000000 --- a/src/ca65/ea.c +++ /dev/null @@ -1,204 +0,0 @@ -/*****************************************************************************/ -/* */ -/* ea.c */ -/* */ -/* Effective address parsing for the ca65 macroassembler */ -/* */ -/* */ -/* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstraße 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ -/* */ -/* */ -/* 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. */ -/* */ -/*****************************************************************************/ - - - -/* ld65 */ -#include "error.h" -#include "expr.h" -#include "instr.h" -#include "nexttok.h" -#include "ea.h" - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -void GetEA (EffAddr* A) -/* Parse an effective address, return the result in A */ -{ - unsigned long Restrictions; - - /* Clear the output struct */ - A->AddrModeSet = 0; - A->Expr = 0; - - /* Handle an addressing size override */ - switch (Tok) { - case TOK_OVERRIDE_ZP: - Restrictions = AM_DIR | AM_DIR_X | AM_DIR_Y; - NextTok (); - break; - - case TOK_OVERRIDE_ABS: - Restrictions = AM_ABS | AM_ABS_X | AM_ABS_Y; - NextTok (); - break; - - case TOK_OVERRIDE_FAR: - Restrictions = AM_ABS_LONG | AM_ABS_LONG_X; - NextTok (); - break; - - default: - Restrictions = ~0UL; /* None */ - break; - } - - /* Parse the effective address */ - if (TokIsSep (Tok)) { - - A->AddrModeSet = AM_IMPLICIT; - - } else if (Tok == TOK_HASH) { - - /* #val */ - NextTok (); - A->Expr = Expression (); - A->AddrModeSet = AM_IMM; - - } else if (Tok == TOK_A) { - - NextTok (); - A->AddrModeSet = AM_ACCU; - - } else if (Tok == TOK_LBRACK) { - - /* [dir] or [dir],y */ - NextTok (); - A->Expr = Expression (); - Consume (TOK_RBRACK, "']' expected"); - if (Tok == TOK_COMMA) { - /* [dir],y */ - NextTok (); - Consume (TOK_Y, "`Y' expected"); - A->AddrModeSet = AM_DIR_IND_LONG_Y; - } else { - /* [dir] */ - A->AddrModeSet = AM_DIR_IND_LONG; - } - - } else if (Tok == TOK_LPAREN) { - - /* One of the indirect modes */ - NextTok (); - A->Expr = Expression (); - - if (Tok == TOK_COMMA) { - - /* (expr,X) or (rel,S),y */ - NextTok (); - if (Tok == TOK_X) { - /* (adr,x) */ - NextTok (); - A->AddrModeSet = AM_ABS_X_IND | AM_DIR_X_IND; - ConsumeRParen (); - } else if (Tok == TOK_S) { - /* (rel,s),y */ - NextTok (); - A->AddrModeSet = AM_STACK_REL_IND_Y; - ConsumeRParen (); - ConsumeComma (); - Consume (TOK_Y, "`Y' expected"); - } else { - Error ("Syntax error"); - } - - } else { - - /* (adr) or (adr),y */ - ConsumeRParen (); - if (Tok == TOK_COMMA) { - /* (adr),y */ - NextTok (); - Consume (TOK_Y, "`Y' expected"); - A->AddrModeSet = AM_DIR_IND_Y; - } else { - /* (adr) */ - A->AddrModeSet = AM_ABS_IND | AM_DIR_IND; - } - } - - } else { - - /* Remaining stuff: - * - * adr - * adr,x - * adr,y - * adr,s - */ - A->Expr = Expression (); - - if (Tok == TOK_COMMA) { - - NextTok (); - switch (Tok) { - - case TOK_X: - A->AddrModeSet = AM_ABS_LONG_X | AM_ABS_X | AM_DIR_X; - NextTok (); - break; - - case TOK_Y: - A->AddrModeSet = AM_ABS_Y | AM_DIR_Y; - NextTok (); - break; - - case TOK_S: - A->AddrModeSet = AM_STACK_REL; - NextTok (); - break; - - default: - Error ("Syntax error"); - - } - - } else { - - A->AddrModeSet = AM_ABS_LONG | AM_ABS | AM_DIR; - - } - } - - /* Apply addressing mode overrides */ - A->AddrModeSet &= Restrictions; -} - - - diff --git a/src/ca65/ea.h b/src/ca65/ea.h deleted file mode 100644 index ae2d37d0f..000000000 --- a/src/ca65/ea.h +++ /dev/null @@ -1,78 +0,0 @@ -/*****************************************************************************/ -/* */ -/* ea.h */ -/* */ -/* Effective address parsing for the ca65 macroassembler */ -/* */ -/* */ -/* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ -/* */ -/* */ -/* 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 EA_H -#define EA_H - - - -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* GetEA result struct */ -typedef struct EffAddr EffAddr; -struct EffAddr { - /* First three fields get filled when calling GetEA */ - unsigned long AddrModeSet; /* Possible addressing modes */ - struct ExprNode* Expr; /* Expression if any (NULL otherwise) */ - - /* The following fields are used inside instr.c */ - unsigned AddrMode; /* Actual addressing mode used */ - unsigned long AddrModeBit; /* Addressing mode as bit mask */ - unsigned char Opcode; /* Opcode */ -}; - - - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - - - -void GetEA (EffAddr* A); -/* Parse an effective address, return the result in A */ - - - -/* End of ea.h */ - -#endif - - - -- 2.39.5