* doc/sdccman.lyx: documented sfr16/sfr32,
authormaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 30 Jun 2005 18:03:33 +0000 (18:03 +0000)
committermaartenbrock <maartenbrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 30 Jun 2005 18:03:33 +0000 (18:03 +0000)
  added example for using storage class with function pointers
* src/mcs51/gen.c (genPlusIncr): optimized small offsets from dptr

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3791 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
doc/sdccman.lyx
src/mcs51/gen.c

index e58d4d90f9ca7752f83ba7b25d37332067b4d771..72e64b97210283562838ee9410dd9170d87a3712 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-30 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * doc/sdccman.lyx: documented sfr16/sfr32,
+         added example for using storage class with function pointers
+       * src/mcs51/gen.c (genPlusIncr): optimized small offsets from dptr
+
 2005-06-28 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * device/lib/_gptrget.c: also push/pop _PSBANK, added # to 0x03
index 83becfc4bb5916b8eefe08cc824916dbd2f29dfe..772e52a5f074918bea929580aed27c770476f9b3 100644 (file)
@@ -8934,6 +8934,26 @@ sfr
 
 \begin_inset LatexCommand \index{\_\_sfr}
 
+\end_inset 
+
+ / sfr16
+\begin_inset LatexCommand \index{sfr16}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_sfr16}
+
+\end_inset 
+
+ / sfr32
+\begin_inset LatexCommand \index{sfr32}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_sfr32}
+
 \end_inset 
 
  / sbit
@@ -8946,10 +8966,10 @@ sfr
 
 Like the bit keyword, 
 \emph on 
-sfr / sbit 
+sfr / sfr16 / sfr32 / sbit 
 \emph default 
-signifies both a data-type and storage class, they are used to describe
- the 
+signify both a data-type and storage class, they are used to describe the
 \emph on 
 s
 \emph default 
@@ -8987,6 +9007,23 @@ sfr at
  0x80 P0;\SpecialChar ~
  /* special function register P0 at location 0x80 */
 \newline 
+/* 16 bit special function register combination for timer 0 */
+\newline 
+/* with the high byte at location 0x8C and the low byte at location 0x8A
+ */
+\newline 
+sfr16 at
+\begin_inset LatexCommand \index{at}
+
+\end_inset 
+
+
+\begin_inset LatexCommand \index{\_\_at}
+
+\end_inset 
+
+ 0x8C8A TMR0;
+\newline 
 sbit at 0xd7 CY; /* CY (Carry Flag
 \begin_inset LatexCommand \index{Flags}
 
@@ -9006,6 +9043,19 @@ Special function registers which are located on an address dividable by
  sbit
 \emph default 
  addresses a specific bit within these sfr.
+\newline 
+16 Bit and 32 bit special function register combinations which require a
+ certain access order are better not declared using 
+\emph on 
+sfr16
+\emph default 
+ or 
+\emph on 
+sfr32.
+
+\emph default 
+ Allthough SDCC usually accesses them Least Significant Byte (LSB) first,
+ this is not guaranteed.
 \layout Subsubsection
 
 Pointers
@@ -9063,6 +9113,13 @@ code unsigned char * code p;
  */
 \newline 
 char * xdata p;
+\newline 
+
+\newline 
+/* the following is a function pointer physically located in data space
+ */
+\newline 
+char (* data fp)(void);
 \layout Standard
 
 Well you get the idea.
index ebf6a53260d276eff09e108bd6c9ded094015164..23ac57d78e443298e6de456d2298e930b64cb224 100644 (file)
@@ -3573,6 +3573,29 @@ genPlusIncr (iCode * ic)
       return TRUE;
     }
 
+  /* if result is dptr */
+  if ((AOP_TYPE (IC_RESULT (ic)) == AOP_STR) &&
+      (AOP_SIZE (IC_RESULT (ic)) == 2) &&
+      !strncmp(AOP (IC_RESULT (ic))->aopu.aop_str[0], "dpl", 4) &&
+      !strncmp(AOP (IC_RESULT (ic))->aopu.aop_str[1], "dph", 4))
+    {
+      if (aopGetUsesAcc (IC_LEFT (ic), 0))
+        return FALSE;
+
+      if (icount > 9)
+        return FALSE;
+
+      if ((AOP_TYPE (IC_LEFT (ic)) != AOP_DIR) && (icount > 5))
+        return FALSE;
+
+      aopPut (IC_RESULT (ic), aopGet (IC_LEFT (ic), 0, FALSE, FALSE), 0, FALSE);
+      aopPut (IC_RESULT (ic), aopGet (IC_LEFT (ic), 1, FALSE, FALSE), 1, FALSE);
+      while (icount--)
+        emitcode ("inc", "dptr");
+
+      return TRUE;
+    }
+
   /* if the sizes are greater than 1 then we cannot */
   if (AOP_SIZE (IC_RESULT (ic)) > 1 ||
       AOP_SIZE (IC_LEFT (ic)) > 1)