Fuzix-Compiler-Kit
Fuzix-Compiler-Kit copied to clipboard
support6800/ missing __abx, __adx
I couldn't decide whether it would be better to save A and B on the caller side or on the __abx/adx side. Here, pshb/psha are omitted as they are saved on the caller side.
;
; Adds the value of the accumulator to X.
; messing up D
;
.export __abx
.export __adx
.code
__abx:
stx @tmp ; X where we can manipulate it
addb @tmp+1
adca #0
stab @tmp+1
staa @tmp
ldx @tmp
rts
__adx:
stx @tmp ; X where we can manipulate it
addb @tmp+1
adca @tmp
stab @tmp+1
staa @tmp
ldx @tmp
rts
When compiling a program with a large local array, tracking of A and B fails. I added invalidate_work(), but there must be a better way.
--- ../Fuzix-Compiler-Kit/be-code-6800.c 2024-10-11 05:18:39
+++ be-code-6800.c 2024-10-11 09:28:00
@@ -503,6 +509,7 @@
return rlim;
} else {
/* This case is (thankfully) fairly rare */
+ invalidate_work();
printf("\tpshb\n\tpsha\n");
load_d_const(off);
printf("\tjsr __adx\n");