Working on better 65816 support

git-svn-id: svn://svn.cc65.org/cc65/trunk@2619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-07 19:28:37 +00:00
parent 066ad63e35
commit 7e74078801
23 changed files with 558 additions and 460 deletions

View File

@@ -42,6 +42,7 @@
#include <sys/stat.h>
/* common */
#include "addrsize.h"
#include "chartype.h"
#include "check.h"
#include "fname.h"
@@ -1135,6 +1136,41 @@ int GetSubKey (const char** Keys, unsigned Count)
unsigned ParseAddrSize (void)
/* Check if the next token is a keyword that denotes an address size specifier.
* If so, return the corresponding address size constant, otherwise output an
* error message and return ADDR_SIZE_DEFAULT.
*/
{
static const char* Keys[] = {
"DIRECT", "ZEROPAGE", "ZP",
"ABSOLUTE", "ABS", "NEAR",
"FAR",
};
/* Check for an identifier */
if (Tok != TOK_IDENT) {
Error (ERR_ADDR_SIZE_EXPECTED);
return ADDR_SIZE_DEFAULT;
}
/* Search for the attribute */
switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) {
case 0:
case 1:
case 2: return ADDR_SIZE_FAR;
case 3:
case 4:
case 5: return ADDR_SIZE_ABS;
case 6: return ADDR_SIZE_FAR;
default:
Error (ERR_ADDR_SIZE_EXPECTED);
return ADDR_SIZE_DEFAULT;
}
}
void InitScanner (const char* InFile)
/* Initialize the scanner, open the given input file */
{