Mercurial > hg > index.cgi
diff src/defs.s @ 85:663d8e77b579
Implmement BCD floating point and update number parsing and printing
Implements a BCD floating point system with 10 decimal digits of precistion
and an exponent range of -63 to +63. Also include parsing integer and
floating point values and printing them out.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 15 Oct 2023 22:15:36 -0600 |
parents | bb50ac9fdf37 |
children | 6db72a92ff7a |
line wrap: on
line diff
--- a/src/defs.s Sun Oct 08 00:17:20 2023 -0600 +++ b/src/defs.s Sun Oct 15 22:15:36 2023 -0600 @@ -43,14 +43,18 @@ ; Value type constants valtype_none equ 0 ; unknown value type valtype_int equ 1 ; integer (32 bit) value (signed) -valtype_float equ 2 ; float type (40 bit) value +valtype_float equ 2 ; BCD float type (48 bit) value valtype_string equ 3 ; string type (16 bit length, 16(32) bit data pointer ; Floating point accumulator structure definitions -fps.exp equ 0 ; single precision exponent -fps.sig equ fps.exp+1 ; single precision significand -fps.sign equ fps.sig+4 ; single precision sign -fps.size equ fps.sign+1 -fpa.size equ fps.size ; use the largest floating point accumulator size +; +; Note: the extra precision bytes are needed for general calculations and need to be at least the same +; size as the significand itself; the exponent will be stored with the bias. The accumulators are +; unpacked. +fpa.exp equ 0 ; exponent - use largest size needed for any precision +fpa.sig equ fpa.exp+1 ; significand - use largest size needed for any precision +fpa.extra equ fpa.sig+5 ; extras; largest size needed for any precision, must follow significand +fpa.sign equ fpa.extra+5 ; sign flag +fpa.size equ fpa.sign+1 ; use the largest floating point accumulator size ; String data definition str.len equ 0 ; string length (2 bytes) str.ptr equ str.len+2 ; string data pointer (3 bytes) @@ -58,13 +62,13 @@ ; Value accumulator structure definitions; note that the actual value data must be first and any ; incidental meta data must follow val.value equ 0 ; offset of the value stored in the accumulator -val.fpsexp equ val.value+fps.exp ; floating point exponent -val.fpssig equ val.value+fps.sig ; floating point significand -val.fpssign equ val.value+fps.sign ; floating point sign +val.fpsexp equ val.value ; floating point exponent +val.fpssig equ val.fpsexp+1 ; floating point significand +val.fpssign equ val.fpssig+5 ; floating point sign val.int equ val.value ; integer offset val.strlen equ val.value+str.len ; string length offset val.strptr equ val.value+str.ptr ; string data pointer (low word) -val.type equ val.value+fps.size ; use the largest of the data types here +val.type equ val.value+val.fpssign+1 ; use the largest of the data types here val.size equ val.type+1 ; size of a value accumulator ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ifdef COCO3