+ 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
+ ;
+ ; store into near/idata space
+ ;
+ mov @r0,a ; 1
+ dataptrrestore$:
+ mov r0,dph ; restore r0 ; 2
+ mov dph,#0 ; restore dph ; 2
+
+ codeptr$:
+ ret ; 1
+ ;
+ ; store into external stack/pdata space
+ ;
+ pdataptr$:
+ movx @r0,a ; 1
+ sjmp dataptrrestore$ ; 2
+ ;
+ ; store into far space
+ ;
+ xdataptr$:
+ mov _P3,b ; 3
+
+ movx @dptr,a ; 1
+ ret ; 1
+
+ ;===
+ ;27 bytes
+ __endasm;
+}
+
+#elif defined DSDCC_MODEL_MEDIUM
+
+void
+_gptrput (char *gptr, char c) __naked
+{
+/* This is the non-banked version with pointers up to 14 bits.
+ Assumes B is free to be used */
+
+ gptr; c; /* hush the compiler */
+
+ __asm
+ ;
+ ; depending on the pointer type according to SDCCsymt.h
+ ;
+ mov b,dph ; 3
+ jb _B_7,codeptr$ ; >0x80 code ; 3
+ jnb _B_6,xdataptr$ ; <0x40 far ; 3
+
+ mov b,r0 ; save r0 independant of regbank ; 2
+ mov r0,dpl ; use only low order address ; 2
+
+ jb _B_5,pdataptr$ ; >0x60 pdata ; 3
+ ;
+ ; store into near/idata space
+ ;
+ mov @r0,a ; 1
+ dataptrrestore$:
+ mov r0,b ; restore r0 ; 2
+
+ codeptr$:
+ ret ; 1
+ ;
+ ; store into external stack/pdata space
+ ;
+ pdataptr$:
+ movx @r0,a ; 1
+ sjmp dataptrrestore$ ; 2
+ ;
+ ; store into far space, max 14 bits
+ ;
+ xdataptr$:
+ ; 0 <= dptr <= 0x3FFF
+ movx @dptr,a ; 1
+ ret ; 1
+ ;===
+ ;25 bytes
+ __endasm;
+}