]> git.sur5r.net Git - cc65/commitdiff
Inline shifts in g_asl as is already the case in g_scale.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 30 Jul 2009 19:41:25 +0000 (19:41 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 30 Jul 2009 19:41:25 +0000 (19:41 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3987 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/codegen.c

index 4f58ce0157912c726385a6095297e94a1adb2047..dc0fd520d0b282167b8fd674cc4fe8c8c17ac482 100644 (file)
@@ -387,8 +387,8 @@ void g_defimport (const char* Name, int ZP)
 
 void g_importstartup (void)
 /* Forced import of the startup segment */
-{   
-#if 0 
+{
+#if 0
     AddTextLine ("\t.forceimport\t__STARTUP_RUN__");
 #endif
 }
@@ -3119,11 +3119,20 @@ void g_asl (unsigned flags, unsigned long val)
                     /* Done */
                     return;
                 } else if (val >= 1 && val <= 4) {
-                    if (flags & CF_UNSIGNED) {
-                               AddCodeLine ("jsr shlax%ld", val);
-                    } else {
-                       AddCodeLine ("jsr aslax%ld", val);
-                    }
+                    if (IS_Get (&CodeSizeFactor) >= (long) (val+1)*130) {
+                       AddCodeLine ("stx tmp1");
+                       while (val--) {
+                           AddCodeLine ("asl a");
+                           AddCodeLine ("rol tmp1");
+                       }
+                       AddCodeLine ("ldx tmp1");
+                   } else {
+                       if (flags & CF_UNSIGNED) {
+                           AddCodeLine ("jsr shlax%ld", val);
+                       } else {
+                           AddCodeLine ("jsr aslax%ld", val);
+                       }
+                   }
                     return;
                 }
                 break;