* src/pic16/pcode.c (pBlockRemoveUnusedLabels,pic16_pBlockAddInval,
[fw/sdcc] / device / lib / _gptrget.c
index beb11aa228ea55d80bf759140a2979d520608d64..d7711e4319caa5e46e37cf78c3edb3aad1137846 100644 (file)
@@ -38,14 +38,14 @@ __sbit __at (0xF5) B_5;
  * location dpl. Therefore we choose return type void here: */
 #if defined DSDCC_MODEL_HUGE
 void
-_gptrget (char *gptr) _naked
+_gptrget (char *gptr) __naked
 {
 /* This is the banked version with pointers up to 23 bits.
    B cannot be trashed */
 
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -60,6 +60,7 @@ _gptrget (char *gptr) _naked
     ;   Pointer to data space
     ;
         mov     a,@r0                                   ; 1
+ dataptrrestore$:
         mov     r0,dph ; restore r0                     ; 2
         mov     dph,#0 ; restore dph                    ; 2
         ret                                             ; 1
@@ -68,9 +69,7 @@ _gptrget (char *gptr) _naked
     ;
  pdataptr$:
         movx    a,@r0                                   ; 1
-        mov     r0,dph ; restore r0                     ; 2
-        mov     dph,#0 ; restore dph                    ; 2
-        ret                                             ; 1
+        sjmp    dataptrrestore$                         ; 2
     ;
     ;   pointer to code area
     ;
@@ -97,21 +96,21 @@ _gptrget (char *gptr) _naked
         movx    a,@dptr                                 ; 1
         ret                                             ; 1
                                                         ;===
-                                                        ;47 bytes
-     _endasm ;
+                                                        ;44 bytes
+     __endasm;
 }
 
 #elif defined DSDCC_MODEL_MEDIUM
 
 void
-_gptrget (char *gptr) _naked
+_gptrget (char *gptr) __naked
 {
 /* This is the non-banked version with pointers up to 15 bits.
    Assumes B is free to be used */
 
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -156,20 +155,20 @@ _gptrget (char *gptr) _naked
         ret                                             ; 1
                                                         ;===
                                                         ;35 bytes
-     _endasm ;
+     __endasm;
 }
 
 #elif 1
 
 void
-_gptrget (char *gptr) _naked
+_gptrget (char *gptr) __naked
 {
 /* This is the new version with pointers up to 16 bits.
    B cannot be trashed */
 
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -184,6 +183,7 @@ _gptrget (char *gptr) _naked
     ;   Pointer to data space
     ;
         mov     a,@r0                                   ; 1
+ dataptrrestore$:
         mov     r0,dph ; restore r0                     ; 2
         mov     dph,#0 ; restore dph                    ; 2
         ret                                             ; 1
@@ -192,9 +192,7 @@ _gptrget (char *gptr) _naked
     ;
  pdataptr$:
         movx    a,@r0                                   ; 1
-        mov     r0,dph ; restore r0                     ; 2
-        mov     dph,#0 ; restore dph                    ; 2
-        ret                                             ; 1
+        sjmp    dataptrrestore$                         ; 2
     ;
     ;   pointer to code area, max 16 bits
     ;
@@ -209,20 +207,20 @@ _gptrget (char *gptr) _naked
         movx    a,@dptr                                 ; 1
         ret                                             ; 1
                                                         ;===
-                                                        ;30 bytes
-     _endasm ;
+                                                        ;27 bytes
+     __endasm;
 }
 
 #else
 
 void
-_gptrget (char *gptr) _naked
+_gptrget (char *gptr) __naked
 {
 /* This is the old version with pointers up to 16 bits. */
 
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -283,7 +281,7 @@ _gptrget (char *gptr) _naked
         ret                                             ; 1
                                                         ;===
                                                         ;40 bytes
-     _endasm ;
+     __endasm;
 }
 #endif
 
@@ -299,7 +297,7 @@ _gptrgetWord (unsigned *gptr)
 /* This is the new version */
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -354,7 +352,7 @@ _gptrgetWord (unsigned *gptr)
         mov     r0,dph ; restore r0
         mov     dph,#0 ; restore dph
  00006$:
-    _endasm ;
+    __endasm;
 
 }
 
@@ -365,7 +363,7 @@ _gptrgetWord (unsigned *gptr)
 {
     gptr; /* hush the compiler */
 
-    _asm
+    __asm
     ;
     ;   depending on the pointer type acc. to SDCCsymt.h
     ;
@@ -433,7 +431,7 @@ _gptrgetWord (unsigned *gptr)
 00005$:
         pop ar0
 00006$:
-    _endasm ;
+    __endasm;
 
 }
 #endif