From 9330f3dc6abe714112b9160c0bdcb90bd56eb336 Mon Sep 17 00:00:00 2001 From: cuz Date: Sun, 4 May 2003 21:25:55 +0000 Subject: [PATCH] Added a new .MACPACK CBM git-svn-id: svn://svn.cc65.org/cc65/trunk@2142 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/macpack.c | 33 +++++++++++++++++++++++++++++---- src/ca65/macpack.h | 1 + src/ca65/pseudo.c | 5 +++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/ca65/macpack.c b/src/ca65/macpack.c index 02875d0b3..d22d9cc6c 100644 --- a/src/ca65/macpack.c +++ b/src/ca65/macpack.c @@ -50,7 +50,9 @@ /* Predefined packages */ -static char MacGeneric [] = /* Generic macros */ + +/* Generic macros */ +static char MacGeneric[] = ".macro add Arg1, Arg2\n" " clc\n" " .if .paramcount = 2\n" @@ -68,9 +70,8 @@ static char MacGeneric [] = /* Generic macros */ " .endif\n" ".endmacro\n"; - - -static char MacLongBranch [] = /* Long branch macros */ +/* Long branch macros */ +static char MacLongBranch[] = ".macro jeq Target\n" " .if .match(Target, 0)\n" " bne *+5\n" @@ -160,12 +161,36 @@ static char MacLongBranch [] = /* Long branch macros */ " .endif\n" ".endmacro\n"; +/* Commodore specific macros */ +static char MacCBM[] = + ".macro scrcode str\n" + " .repeat .strlen(str), i\n" + " .if (.strat(str, i) >= '@' .and .strat(str, i) <= 'z')\n" + " .byte .strat(str, i) - '@'\n" + " .elseif (.strat(str, i) >= 'A' .and .strat(str, i) <= 'Z')\n" + " .byte .strat(str, i) - 'A' + 65\n" + " .elseif (.strat(str, i) = '[')\n" + " .byte 27\n" + " .elseif (.strat(str, i) = ']')\n" + " .byte 29\n" + " .elseif (.strat(str, i) = '^')\n" + " .byte 30\n" + " .elseif (.strat(str, i) = '_')\n" + " .byte 31\n" + " .else\n" + " .byte .strat(str, i)\n" + " .endif\n" + " .endrepeat\n" + ".endmacro\n"; + + /* Table with pointers to the different packages */ static char* MacPackages [] = { MacGeneric, MacLongBranch, + MacCBM }; diff --git a/src/ca65/macpack.h b/src/ca65/macpack.h index e29292259..ee62ac1be 100644 --- a/src/ca65/macpack.h +++ b/src/ca65/macpack.h @@ -47,6 +47,7 @@ /* Constants for the predefined packages */ #define MAC_GENERIC 0 #define MAC_LONGBRANCH 1 +#define MAC_CBM 2 diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 14d692a98..d3918ec62 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1052,8 +1052,9 @@ static void DoMacPack (void) { /* Macro package names */ static const char* Keys [] = { - "GENERIC", + "GENERIC", "LONGBRANCH", + "CBM" }; int Package; @@ -1077,7 +1078,7 @@ static void DoMacPack (void) /* Insert the package */ InsertMacPack (Package); -} +} -- 2.39.5