]> git.sur5r.net Git - cc65/commitdiff
Fixed a bug
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 30 Jun 2005 20:29:18 +0000 (20:29 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 30 Jun 2005 20:29:18 +0000 (20:29 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3524 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/da65/main.c

index ac1511b57f7aa5b4701ad2ea2dd39c213c378e76..1051c7488ec6243d4744e515f856006329cb672e 100644 (file)
@@ -290,11 +290,21 @@ static void OneOpcode (unsigned RemainingBytes)
     switch (Style) {
 
        case atDefault:
-       case atCode:
            D->Handler (D);
            PC += D->Size;
            break;
 
+       case atCode:
+            /* Beware: If we don't have enough bytes left to disassemble the
+             * following insn, fall through to byte mode.
+             */
+            if (D->Size <= RemainingBytes) {
+                D->Handler (D);
+                PC += D->Size;
+                break;
+            }
+            /* FALLTHROUGH */
+
        case atByteTab:
            ByteTable ();
            break;