* src/SDCCmain.c (linkEdit): Added support for passing a legacy command line through...
[fw/sdcc] / src / z80 / mappings.i
index 92eacf591d9ee9c4e0dd9f7e343667f0c55d0fd1..319afdd1190fe44d3e1a0878911cc15601fc7d86 100644 (file)
@@ -3,6 +3,7 @@ static const ASM_MAPPING _asxxxx_gb_mapping[] = {
     { "area", ".area _%s" },
     { "areacode", ".area _%s" },
     { "areadata", ".area _%s" },
+    { "areahome", ".area _%s" },
     { "functionlabeldef", "%s:" },
     { "*hl", "(hl)" },
     { "di", "di" },
@@ -11,18 +12,22 @@ static const ASM_MAPPING _asxxxx_gb_mapping[] = {
     { "ldaspsp", "lda sp,%d(sp)" },
     { "*pair", "(%s)" },
     { "shortjp", "jr" },
-    { "enter", "push bc" },
+    { "enter", "" },
     { "enterx", 
-      "push bc\n"
-      "\tlda sp,-%d(sp)" },
-    { "leave", 
-      "pop bc\n"
-      "\tret"
+      "lda sp,-%d(sp)" },
+    { "enterxl",
+                "ld hl,#-%d\n"
+                "\tadd\thl,sp\n"
+                "\tld\tsp,hl"
     },
-    { "leavex", 
-      "lda sp,%d(sp)\n"
-      "\tpop bc\n"
-      "\tret"
+    { "leave", ""
+    },
+    { "leavex", "lda sp,%d(sp)"
+    },
+    { "leavexl",
+                "ld hl,#%d\n"
+                "\tadd\thl,sp\n"
+                "\tld\tsp,hl"
     },
     { "pusha", 
       "push af\n"
@@ -31,6 +36,15 @@ static const ASM_MAPPING _asxxxx_gb_mapping[] = {
       "\tpush hl"
     },
     { "adjustsp", "lda sp,-%d(sp)" },
+    { "fileprelude", "" },
+    { "profileenter",
+                "ld a,#3\n"
+                "\trst\t0x08"
+    },
+    { "profileexit",
+                "ld a,#4\n"
+                "\trst\t0x08"
+    },
     { NULL, NULL }
 };
 
@@ -39,6 +53,7 @@ static const ASM_MAPPING _asxxxx_z80_mapping[] = {
     { "area", ".area _%s" },
     { "areacode", ".area _%s" },
     { "areadata", ".area _%s" },
+    { "areahome", ".area _%s" },
     { "*ixx", "%d(ix)" },
     { "*iyx", "%d(iy)" },
     { "*hl", "(hl)" },
@@ -56,32 +71,23 @@ static const ASM_MAPPING _asxxxx_z80_mapping[] = {
     { "*pair", "(%s)" },
     { "shortjp", "jp" },
     { "enter", 
-               "push bc\n"
-               "\tpush\tde\n"
-               "\tpush\tix\n"
+               "push\tix\n"
                "\tld\tix,#0\n"
                "\tadd\tix,sp" },
     { "enterx", 
-               "push bc\n"
-               "\tpush\tde\n"
-               "\tpush\tix\n"
+               "push\tix\n"
                "\tld\tix,#0\n"
                "\tadd\tix,sp\n"
                "\tld\thl,#-%d\n"
                "\tadd\thl,sp\n"
-               "\tld\tsp,hl" },
+               "\tld\tsp,hl\n" 
+        },
     { "leave", 
                "pop\tix\n"
-               "\tpop\tde\n"
-               "\tpop\tbc\n"
-               "\tret"
     },
     { "leavex", 
                "ld sp,ix\n"
                "\tpop\tix\n"
-               "\tpop\tde\n"
-               "\tpop\tbc\n"
-               "\tret"
     },
     { "pusha", 
                "push af\n"
@@ -90,6 +96,14 @@ static const ASM_MAPPING _asxxxx_z80_mapping[] = {
                "\tpush\thl"
     },
     { "adjustsp", "lda sp,-%d(sp)" },
+    { "profileenter",
+                "ld a,#3\n"
+                "\trst\t0x08"
+    },
+    { "profileexit",
+                "ld a,#4\n"
+                "\trst\t0x08"
+    },
     { NULL, NULL }
 };
 
@@ -113,7 +127,12 @@ static const ASM_MAPPING _rgbds_mapping[] = {
       "\tGLOBAL __modschar\n"
       "\tGLOBAL __moduchar\n"
       "\tGLOBAL __modsint\n"
-      "\tGLOBAL __moduint"
+      "\tGLOBAL __moduint\n"
+      "\tGLOBAL __mulslong\n"  
+      "\tGLOBAL __modslong\n"  
+      "\tGLOBAL __divslong\n"  
+      "\tGLOBAL banked_call\n"
+      "\tGLOBAL banked_ret\n"
     },
     { "functionheader", 
       "; ---------------------------------\n"
@@ -123,14 +142,15 @@ static const ASM_MAPPING _rgbds_mapping[] = {
     { "functionlabeldef", "%s:" },
     { "zero", "$00" },
     { "one", "$01" },
-    { "area", "SECTION \"%s\",%C" },
-    { "areacode", "SECTION \"CODE\",%C" },
-    { "areadata", "SECTION \"DATA\",BSS" },
+    { "area", "SECTION \"%s\",CODE" },
+    { "areadata", "SECTION \"%F_%s\",BSS" },
+    { "areacode", "SECTION \"%F_CODE\",%s" }, 
+    { "areahome", "SECTION \"%F_HOME\",HOME" },
     { "ascii", "DB \"%s\"" },
     { "ds", "DS %d" },
-    { "db", "DB %d" },
+    { "db", "DB" },
     { "dbs", "DB %s" },
-    { "dw", "DW %d" },
+    { "dw", "DW" },
     { "dws", "DW %s" },
     { "immed", "" },
     { "constbyte", "$%02X" },
@@ -140,6 +160,7 @@ static const ASM_MAPPING _rgbds_mapping[] = {
     { "hashedstr", "%s" },
     { "lsbimmeds", "%s & $FF" },
     { "msbimmeds", "%s >> 8" },
+    { "bankimmeds", "BANK(%s)" },
     { "module", "; MODULE %s" },
     { NULL, NULL }
 };
@@ -153,19 +174,12 @@ static const ASM_MAPPING _rgbds_gb_mapping[] = {
     },
     { "di", "di" },
     { "adjustsp", "add sp,-%d" },
-    { "enter", "push bc" },
-    { "enterx", 
-      "push bc\n"
-      "\tadd sp,-%d"
+    { "enter", "" },
+    { "enterx", "add sp,-%d"
     },
-    { "leave", 
-      "pop bc\n"
-      "\tret"
+    { "leave", ""
     },
-    { "leavex", 
-      "add sp,%d\n"
-      "\tpop bc\n"
-      "\tret"
+    { "leavex", "add sp,%d"
     },
     { "ldahli", "ld a,[hl+]" },
     { "*hl", "[hl]" },
@@ -201,7 +215,9 @@ static const ASM_MAPPING _isas_mapping[] = {
       "\tGLOBAL __modschar\n"
       "\tGLOBAL __moduchar\n"
       "\tGLOBAL __modsint\n"
-      "\tGLOBAL __moduint"
+      "\tGLOBAL __moduint\n"
+      "\tGLOBAL banked_call\n"
+      "\tGLOBAL banked_ret\n"
     },
     { "functionheader", 
       "; ---------------------------------\n"
@@ -214,11 +230,12 @@ static const ASM_MAPPING _isas_mapping[] = {
     { "area", "%s\tGROUP" },
     { "areacode", "_CODE\tGROUP" },
     { "areadata", "_DATA\tGROUP" },
+    { "areahome", "_CODE\tGROUP" },
     { "ascii", "DB \"%s\"" },
     { "ds", "DS %d" },
-    { "db", "DB %d" },
+    { "db", "DB" },
     { "dbs", "DB %s" },
-    { "dw", "DW %d" },
+    { "dw", "DW" },
     { "dws", "DW %s" },
     { "immed", "" },
     { "constbyte", "0x%02X" },
@@ -228,6 +245,7 @@ static const ASM_MAPPING _isas_mapping[] = {
     { "hashedstr", "%s" },
     { "lsbimmeds", "%s & 0xFF" },
     { "msbimmeds", "%s >> 8" },
+    { "bankimmeds", "!%s" },
     { "module", "; MODULE %s" },
     { NULL, NULL }
 };
@@ -241,20 +259,12 @@ static const ASM_MAPPING _isas_gb_mapping[] = {
     },
     { "di", "di" },
     { "adjustsp", "add sp,-%d" },
-    { "enter", "push bc" },
-    { "enterx", 
-      "push bc\n"
-      "\tadd sp,-%d"
-    },
-    { "leave", 
-      "pop bc\n"
-      "\tret"
+    { "enter", "" },
+    { "enterx", "add sp,-%d"
     },
-    { "leavex", 
-      "add sp,%d\n"
-      "\tpop bc\n"
-      "\tret"
+    { "leave", ""
     },
+    { "leavex", "add sp,%d\n" },
     { "ldahli", "ld a,(hli)" },
     { "*hl", "(hl)" },
     { "ldahlsp", "ldhl sp,%d" },