X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2F_gptrgetc.c;h=1ea7c5b9878e8672864fa2a6b6e65628682ee4cb;hb=4db4740164fed3cb25145cfdaadb986fc0690507;hp=745fe4a4f493099a460c4f9dcc2e0aca7faf445d;hpb=400d6fc15fe2c4c92a0cf55e7a37fc2809549fd4;p=fw%2Fsdcc diff --git a/device/lib/_gptrgetc.c b/device/lib/_gptrgetc.c index 745fe4a4..1ea7c5b9 100644 --- a/device/lib/_gptrgetc.c +++ b/device/lib/_gptrgetc.c @@ -26,6 +26,60 @@ /* the return value is expected to be in acc, and not in the standard * location dpl. Therefore we choose return type void here: */ + +#if 1 + +void +_gptrgetc (char *gptr) _naked +{ +/* This is the new version with pointers up to 16 bits. + B cannot be trashed */ + + gptr; /* hush the compiler */ + + _asm + ; save values passed + ; + ; depending on the pointer type acc. to SDCCsymt.h + ; + jb _B_7,codeptr$ ; >0x80 code ; 3 + jnb _B_6,xdataptr$ ; <0x40 far ; 3 + + mov dph,r0 ; save r0 independant of regbank ; 2 + mov r0,dpl ; use only low order address ; 2 + + jb _B_5,pdataptr$ ; >0x60 pdata ; 3 + ; + ; Pointer to data space + ; + mov a,@r0 ; 1 + mov r0,dph ; restore r0 ; 2 + mov dph,#0 ; restore dph ; 2 + ret ; 1 + ; + ; pointer to external stack or pdata + ; + pdataptr$: + movx a,@r0 ; 1 + mov r0,dph ; restore r0 ; 2 + mov dph,#0 ; restore dph ; 2 + ret ; 1 +; +; pointer to xternal data +; pointer to code area +; + codeptr$: + xdataptr$: + clr a ; 1 + movc a,@a+dptr ; 1 + ret ; 1 + ;=== + ;28 bytes + _endasm ; +} + +#else + void _gptrgetc (char *gptr) _naked { @@ -85,3 +139,4 @@ _gptrgetc (char *gptr) _naked _endasm ; } +#endif