diff src/vars.s @ 80:bb50ac9fdf37

Checkpoint with very basic integer and floating point arithmetic, untested This commit has implementations for floating point add, subtract, multiply, and divide, along with 32 bit signed integer equivalents. These can probably be optimized and they are untested.
author William Astle <lost@l-w.ca>
date Sat, 07 Oct 2023 02:56:59 -0600
parents 2d52cd154ed1
children 663d8e77b579
line wrap: on
line diff
--- a/src/vars.s	Sun Sep 10 23:18:17 2023 -0600
+++ b/src/vars.s	Sat Oct 07 02:56:59 2023 -0600
@@ -39,8 +39,29 @@
 tok_kwnum       rmb 1                           ; the actual token number
 tok_kwmatchl    rmb 1                           ; the length of the best match during lookup
 tok_kwmatch     rmb 2                           ; the current best matched token number
-val0            rmb val.size                    ; value accumulator 0
-val1            rmb val.size                    ; value accumulator 1
+; General value accumulators used during expression evaluation
+val0            rmb val.size                    ; value accumulator 0 - current expression value
+val1            rmb val.size                    ; value accumulator 1 - usually left operand of binary operator
+; The fpa0 and fpa1 areas are used for scratch work during floating point operations. They are only used
+; by floating point operations. This saves a fair fiew clock cycles over simply working off the index register
+; pointers passed into the routines and it also allows for being able to leave the input operands for the
+; routines unmodified, or to overlap the input and output operands. These floating point accumulators can hold
+; the maximum precision floating point values used by the system.
+fpa0            rmb fpa.size                    ; floating point accumulator 1
+fpa1            rmb fpa.size                    ; floating point accumulator 1
+fpa0extra       rmb 1                           ; "extra" bytes for calculations
+fpa0extra1      rmb 1
+fpa0extra2      rmb 1
+fpa0extra3      rmb 1
+fpa0extra4      rmb 1
+fpa0extra5      rmb 1
+fpa0extra6      rmb 1
+fpa0extra7      rmb 1
+fpa0extra8      rmb 1
+fpa0extra9      rmb 1
+fpa0extra10     rmb 1
+fpa0extra11     rmb 1
+fpa0extra12     rmb 1
                 rmb 0x71-*                      ; align RSTFLG/RSTVEC for stock ROM compatibility
 RSTFLG          rmb 1                           ; 0x55 if RSTVEC is valid
 RSTVEC          rmb 2                           ; points to warm start routine (must start with NOP)