From: frief Date: Fri, 28 Nov 2003 21:03:10 +0000 (+0000) Subject: P2 not used any more (related to #850747, #785979) X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=b1f6e5190c3b0e5522ab7d7551c51546935a3c0e;p=fw%2Fsdcc P2 not used any more (related to #850747, #785979) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3032 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/lib/_gptrget.c b/device/lib/_gptrget.c index 3f2cb922..f0a4ab89 100644 --- a/device/lib/_gptrget.c +++ b/device/lib/_gptrget.c @@ -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 diff --git a/device/lib/_gptrput.c b/device/lib/_gptrput.c index 3b9affc5..65e99abc 100644 --- a/device/lib/_gptrput.c +++ b/device/lib/_gptrput.c @@ -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