More AVR stuff
[fw/sdcc] / src / z80 / main.c
index 27026e499c5646c4edf9243145b4069ff409730a..bad1c014aa8aec75353aa60881854e915f4d9d30 100644 (file)
@@ -1,14 +1,38 @@
-#include "common.h"
-#include "ralloc.h"
+#include "z80.h"
 
 static char _defaultRules[] =
 {
 #include "peeph.rul"
+#include "peeph-z80.rul"
 };
 
+Z80_OPTS z80_opts;
+
 static char *_z80_keywords[] = { NULL };
 
-void z80_assignRegisters (eBBlock **ebbs, int count);
+static void _z80_init(void)
+{
+    z80_opts.sub = SUB_Z80;
+}
+
+static int regParmFlg = 0; /* determine if we can register a parameter */
+
+static void _z80_reset_regparm()
+{
+    regParmFlg = 0;
+}
+
+static int _z80_reg_parm(link *l)
+{
+        /* for this processor it is simple
+       can pass only the first parameter in a register */
+    if (regParmFlg)
+       return 0;
+
+    regParmFlg = 1;
+    return 1;
+
+}
 
 static bool _z80_parseOptions(int *pargc, char **argv, int *i)
 {
@@ -17,6 +41,8 @@ static bool _z80_parseOptions(int *pargc, char **argv, int *i)
 
 static void _z80_finaliseOptions(void)
 {
+    port->mem.default_local_map = data;
+    port->mem.default_globl_map = data;
 }
 
 static void _z80_setDefaultOptions(void)
@@ -64,6 +90,9 @@ static const char *_asmCmd[] = {
 PORT z80_port = {
     "z80",
     "Zilog Z80",               /* Target name */
+    {
+       FALSE,
+    },
     {  
        _asmCmd,
        "-plosgff",             /* Options with debug */
@@ -89,7 +118,11 @@ PORT z80_port = {
        "_BSEG",
        "_RSEG",
        "_GSINIT",
-       "_OVERLAY"
+       "_OVERLAY",
+       "_GSFINAL",
+       NULL,
+       NULL,
+       1
     },
     { 
        -1, 0, 0, 8, 0
@@ -98,6 +131,7 @@ PORT z80_port = {
     {  
        0
     },
+    _z80_init,
     _z80_parseOptions,
     _z80_finaliseOptions,
     _z80_setDefaultOptions,
@@ -106,5 +140,7 @@ PORT z80_port = {
     _z80_keywords,
     0, /* no assembler preamble */
     0, /* no local IVT generation code */
+    _z80_reset_regparm,
+    _z80_reg_parm
 };