* src/pic16/device.c (pic16_dump_gsection,
[fw/sdcc] / device / lib / pic16 / libsdcc / gptr / gptrget3.c
index 3b4eb25ab3173fb5767dece568b7b40308b34b98..932b96f384015bf0bf461d12c6e7158bf64d8438 100644 (file)
@@ -30,7 +30,7 @@
 */
 
 /* the return value is expected to be in WREG:PRODL:PRODH, therefore we choose return
- * type void here. Generic pointer is expected to be in WREG:FSR0H:FSR0L,
+ * type void here. Generic pointer is expected to be in WREG:PRODL:FSR0L,
  * so function arguments are void, too */
 
 extern POSTINC0;
@@ -55,10 +55,12 @@ void _gptrget3(void) _naked
      * 11 -> unimplemented
      */
     btfss      _WREG, 7
-    goto       _lab_01_
+    bra                _lab_01_
     
     /* data pointer  */
     /* data are already in FSR0 */
+    movff      _PRODL, _FSR0H
+    
     movf       _POSTINC0, w
     movff      _POSTINC0, _PRODL
     movff      _POSTINC0, _PRODH
@@ -69,12 +71,12 @@ void _gptrget3(void) _naked
 _lab_01_:
     /* code or eeprom */
     btfsc      _WREG, 6
-    goto       _lab_02_
+    bra                _lab_02_
     
     ; code pointer
-    movwf      _TBLPTRU
     movff      _FSR0L, _TBLPTRL    
-    movff      _FSR0H, _TBLPTRH
+    movff      _PRODL, _TBLPTRH
+    movwf      _TBLPTRU
     
     /* fetch first byte */
     TBLRD*+