]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codegen.c
Adjust SP on gotos between blocks with local variables.
[cc65] / src / cc65 / codegen.c
index 9e510272813172c61533f77179cde7fde890d91b..c878c7bf698ead8d79e27f91e90d07b25f08966d 100644 (file)
@@ -2425,6 +2425,19 @@ void g_falsejump (unsigned flags attribute ((unused)), unsigned label)
 }
 
 
+void g_lateadjustSP (unsigned label)
+{
+/* Adjust stack based on non-immediate data */
+    AddCodeLine ("pha");
+    AddCodeLine ("lda %s", LocalLabelName (label));
+    AddCodeLine ("clc");
+    AddCodeLine ("adc sp");
+    AddCodeLine ("sta sp");
+    AddCodeLine ("lda %s+1", LocalLabelName (label));
+    AddCodeLine ("adc sp+1");
+    AddCodeLine ("sta sp+1");
+    AddCodeLine ("pla");
+}
 
 void g_drop (unsigned Space)
 /* Drop space allocated on the stack */