]> git.gag.com Git - fw/sdcc/commitdiff
P2 not used any more (related to #850747, #785979)
authorfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 28 Nov 2003 21:03:10 +0000 (21:03 +0000)
committerfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 28 Nov 2003 21:03:10 +0000 (21:03 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3032 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/lib/_gptrget.c
device/lib/_gptrput.c

index 3f2cb922fe502cc059c7b3e2c3c0005a1b9d8ef6..f0a4ab89988e2de035140f9cb8930bd3af1cbba3 100644 (file)
@@ -23,6 +23,7 @@
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
+#define P2_PAGES_PDATA 0 /* not all devices use P2 to page pdata memory */
 
 /* the  return value is expected to be in acc, and not in the standard
  * location dpl. Therefore we choose return type void here: */
@@ -43,7 +44,7 @@ _gptrget (char *gptr)
         dec     a
         jz      00003$ ; 2 code
        dec     a
-       jz      00004$
+       jz      00004$  ; 3 pdata
        dec     a       ; 4 skip generic pointer
        dec     a
        jz      00001$  ; 5 idata
@@ -78,11 +79,19 @@ _gptrget (char *gptr)
         movc    a,@a+dptr
         sjmp    00005$
 ;
-;   pointer to xternal stack
+;   pointer to xternal stack or pdata
 ;
  00004$:
+#if P2_PAGES_PDATA
         mov     dph,p2          ; p2 holds high byte for pdata access
         movx    a,@dptr
+#else
+       push    ar0
+       mov     r0,dpl
+        movx    a,@r0
+       pop     ar0
+#endif 
+       
 ;
 ;   return
 ;
@@ -109,7 +118,7 @@ _gptrgetWord (unsigned *gptr)
         dec     a
         jz      00003$ ; 2 code
        dec     a
-       jz      00004$
+       jz      00004$  ; 3 pdata
        dec     a       ; 4 skip generic pointer
        dec     a
        jz      00001$  ; 5 idata
index 3b9affc56ac32cf2bca16c34fadae4ea031e59e8..65e99abcf63a95cdcc8b7dc8766c6743278fc7b1 100644 (file)
@@ -23,8 +23,8 @@
    what you give them.   Help stamp out software-hoarding!  
 -------------------------------------------------------------------------*/
 
-/* the  return value is expected to be in acc, and not in the standard
- * location dpl. Therefore we choose return type void here: */
+#define P2_PAGES_PDATA 0 /* not all devices use P2 to page pdata memory */
+
 void
 _gptrput (char *gptr, char c)
 {
@@ -67,9 +67,18 @@ _gptrput (char *gptr, char c)
        sjmp    00005$
 
  00004$:
+#if P2_PAGES_PDATA
        pop     acc
-       mov     dph,p2
+       mov     dph,p2          ; p2 holds high byte for pdata access
        movx    @dptr,a
+#else
+       pop     acc
+       push    ar0
+       mov     r0,dpl
+        movx    @r0,a
+       pop     ar0
+#endif 
+
  00005$:
 _endasm;
 }
@@ -90,7 +99,7 @@ _gptrputWord ()
         dec     a
         jz      00013$ ; 2 code
         dec     a
-        jz      00014$
+        jz      00014$  ; 3 pdata
        dec     a       ; 4 skip generic pointer
        dec     a
        jz      00011$  ; 5 idata