]> git.sur5r.net Git - cc65/blobdiff - src/ca65/condasm.c
Added assembler pseudo commands .P4510 and .IFP4510 together with docs and testcase
[cc65] / src / ca65 / condasm.c
index c9506c316ec6068a9099ab9164960dbacd8ff039..b8bda4c7d836cedd0e21d9efbbe735a13d2f1eda 100644 (file)
@@ -104,9 +104,9 @@ static int GetOverallIfCond (void)
 /* Get the overall condition based on all conditions on the stack. */
 {
     /* Since the last entry contains the overall condition of the parent, we
-     * must check it in combination of the current condition. If there is no
-     * last entry, the overall condition is true.
-     */
+    ** must check it in combination of the current condition. If there is no
+    ** last entry, the overall condition is true.
+    */
     return (IfCount == 0) ||
            ((IfStack[IfCount-1].Flags & (ifCond | ifParentCond)) == (ifCond | ifParentCond));
 }
@@ -114,7 +114,7 @@ static int GetOverallIfCond (void)
 
 
 static void CalcOverallIfCond (void)
-/* Caclulate the overall condition based on all conditions on the stack. */
+/* Calculate the overall condition, based on all conditions on the stack. */
 {
     IfCond = GetOverallIfCond ();
 }
@@ -256,9 +256,9 @@ void DoConditionals (void)
                 NextTok ();
 
                 /* Ignore the new condition if we are inside a false .ELSE
-                 * branch. This way we won't get any errors about undefined
-                 * symbols or similar...
-                 */
+                ** branch. This way we won't get any errors about undefined
+                ** symbols or similar...
+                */
                 if (IfCond) {
                     SetIfCond (D, ConstExpression ());
                     ExpectSep ();
@@ -273,8 +273,8 @@ void DoConditionals (void)
                 FreeIf ();
 
                 /* Be sure not to read the next token until the .IF stack
-                 * has been cleanup up, since we may be at end of file.
-                 */
+                ** has been cleanup up, since we may be at end of file.
+                */
                 NextTok ();
                 ExpectSep ();
 
@@ -386,6 +386,16 @@ void DoConditionals (void)
                 CalcOverallIfCond ();
                 break;
 
+            case TOK_IFP4510:
+                D = AllocIf (".IFP4510", 1);
+                NextTok ();
+                if (IfCond) {
+                    SetIfCond (D, GetCPU() == CPU_4510);
+                }
+                ExpectSep ();
+                CalcOverallIfCond ();
+                break;
+
             case TOK_IFP816:
                 D = AllocIf (".IFP816", 1);
                 NextTok ();
@@ -440,9 +450,9 @@ void DoConditionals (void)
 
 int CheckConditionals (void)
 /* Check if the current token is one that starts a conditional directive, and
- * call DoConditionals if so. Return true if a conditional directive was found,
- * return false otherwise.
- */
+** call DoConditionals if so. Return true if a conditional directive was found,
+** return false otherwise.
+*/
 {
     switch (CurTok.Tok) {
         case TOK_ELSE:
@@ -457,6 +467,7 @@ int CheckConditionals (void)
         case TOK_IFNDEF:
         case TOK_IFNREF:
         case TOK_IFP02:
+        case TOK_IFP4510:
         case TOK_IFP816:
         case TOK_IFPC02:
         case TOK_IFPSC02:
@@ -473,15 +484,15 @@ int CheckConditionals (void)
 
 void CheckOpenIfs (void)
 /* Called from the scanner before closing an input file. Will check for any
- * open .ifs in this file.
- */
+** open .ifs in this file.
+*/
 {
     const LineInfo* LI;
 
     while (1) {
         /* Get the current file number and check if the topmost entry on the
-         * .IF stack was inserted with this file number
-         */
+        ** .IF stack was inserted with this file number
+        */
         IfDesc* D = GetCurrentIf ();
         if (D == 0) {
             /* There are no open .IFs */