src/SDCCglue.c, src/mcs51/main.c: improved implementation of --acall-ajmp
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 28 Jul 2007 07:35:54 +0000 (07:35 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 28 Jul 2007 07:35:54 +0000 (07:35 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4889 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglue.c
src/mcs51/main.c

index 7c54412473beae273f2908681e9fe6748d054f19..244ea51983e0392ea5947313ad4f83ea1d27b7c0 100644 (file)
@@ -1894,10 +1894,10 @@ glue (void)
               fprintf (asmFile, "\tmov\tsp,#__start__stack - 1\n");     /* MOF */
             }
 
-          fprintf (asmFile, "\tlcall\t__sdcc_external_startup\n");
+          fprintf (asmFile, "\t%ccall\t__sdcc_external_startup\n", options.acall_ajmp?'a':'l');
           fprintf (asmFile, "\tmov\ta,dpl\n");
           fprintf (asmFile, "\tjz\t__sdcc_init_data\n");
-          fprintf (asmFile, "\tljmp\t__sdcc_program_startup\n");
+          fprintf (asmFile, "\t%cjmp\t__sdcc_program_startup\n", options.acall_ajmp?'a':'l');
           fprintf (asmFile, "__sdcc_init_data:\n");
 
           // if the port can copy the XINIT segment to XISEG
@@ -1916,7 +1916,7 @@ glue (void)
        * by the ugly shucking and jiving about 20 lines ago.
        */
       tfprintf (asmFile, "\t!area\n", port->mem.post_static_name);
-      fprintf (asmFile, "\tljmp\t__sdcc_program_startup\n");
+      fprintf (asmFile, "\t%cjmp\t__sdcc_program_startup\n", options.acall_ajmp?'a':'l');
     }
 
   fprintf (asmFile,
@@ -1934,12 +1934,12 @@ glue (void)
       /* put in jump or call to main */
       if (options.mainreturn)
         {
-          fprintf (asmFile, "\tljmp\t_main\n");   /* needed? */
+          fprintf (asmFile, "\t%cjmp\t_main\n", options.acall_ajmp?'a':'l');   /* needed? */
           fprintf (asmFile, ";\treturn from main will return to caller\n");
         }
       else
         {
-          fprintf (asmFile, "\tlcall\t_main\n");
+          fprintf (asmFile, "\t%ccall\t_main\n", options.acall_ajmp?'a':'l');
           fprintf (asmFile, ";\treturn from main will lock up\n");
           fprintf (asmFile, "\tsjmp .\n");
         }
index 5f378965e9976fb07f1cdfbfc097134af1525cf6..eeef4b25aecb83a377a4e42ba084d3086cb50c0f 100644 (file)
@@ -192,16 +192,17 @@ _mcs51_genIVT (struct dbuf_s * oBuf, symbol ** interrupts, int maxInterrupts)
 {
   int i;
 
-  dbuf_printf (oBuf, "\tljmp\t__sdcc_gsinit_startup\n");
+  dbuf_printf (oBuf, "\t%cjmp\t__sdcc_gsinit_startup\n", options.acall_ajmp?'a':'l');
+  if((options.acall_ajmp)&&(maxInterrupts)) dbuf_printf (oBuf, "\t.ds\t1\n");
 
   /* now for the other interrupts */
   for (i = 0; i < maxInterrupts; i++)
     {
       if (interrupts[i])
         {
-          dbuf_printf (oBuf, "\tljmp\t%s\n", interrupts[i]->rname);
+          dbuf_printf (oBuf, "\t%cjmp\t%s\n", options.acall_ajmp?'a':'l', interrupts[i]->rname);
           if ( i != maxInterrupts - 1 )
-            dbuf_printf (oBuf, "\t.ds\t5\n");
+            dbuf_printf (oBuf, "\t.ds\t%d\n", options.acall_ajmp?6:5);
         }
       else
         {