EtchedPixels / Fuzix-Compiler-Kit

Fuzix C Compiler Project
Other
45 stars 11 forks source link

support6800/cleanup.s, be-func-6800.c Cleanup for functions with many arguments was not done correctly. This caused wtest/input028.c to fail. #138

Open zu2 opened 3 hours ago

zu2 commented 3 hours ago
--- ../Fuzix-Compiler-Kit/support6800/cleanup.s 2024-10-13 22:57:57
+++ support6800/cleanup.s   2024-10-27 14:16:52
@@ -1,4 +1,4 @@
-.export __cleanup
+   .export __cleanup
    .export __cleanupb
    .export __cleanup1
    .export __cleanup2
@@ -43,6 +43,8 @@
    ins
    ins
    ins
+   ins
+   ins
    jmp 0,x 
 __cleanup4:            ; 4 is common, 3 is not
    tsx
@@ -77,9 +79,9 @@
    tsx
    ldx 0,x
    ldab 1,x
+   ins
+   ins
    tsx
-   inx
-   inx
    ldx 0,x
 __cleanupbs:           ; FIXME: could be very slow in extreme cases
    ins
zu2 commented 3 hours ago
--- ../Fuzix-Compiler-Kit/be-func-6800.c    2024-10-24 17:13:18
+++ be-func-6800.c  2024-10-27 13:59:34
@@ -96,7 +96,7 @@
    else {
        /* Icky - can we do better remembering AB is live for
           non void funcs */
-       printf("\t%s __cleanup\n\t.word %u\n", jmp_op, argsize);
+       printf("\t%s __cleanupb\n\t.word %u\n", jsr_op, argsize);
    }
    unreachable = 1;
 }