;; ;; Copyright (c) 2019 Marco Granati ;; ;; Permission to use, copy, modify, and distribute this software for any ;; purpose with or without fee is hereby granted, provided that the above ;; copyright notice and this permission notice appear in all copies. ;; ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;; ;; name: dp02.inc ;; rev.: 2019/04/01 ;; o.s. 65C816 version v1.0 .LIST on dp02 .equ $0200 dp03 .equ $0300 ; direct page for floating point unit dirp02: .SECTION page0, common, ref_only, offset 0 ;dp $0200 MNTBITS .EQU (16*8) ; significand bits + guard bits MANTSIZ .EQU 16 ; significand size FREGSIZ .EQU 20 ; floating point register size tm .DS 16 ; temp. mantissa fsubnf .DB ; subnormal flag used by fac2dec atncode .EQU fsubnf ; fatanyx octant sgncmp .DB ; sign comparison: fac vs. arg ; floating Point accumulator (fac) facm .DS 16 ; guard bits (15 bits)+significand (113 bits) facexp .DW ; fac biased exponent facsgn .DB ; fac mantissa sign facst .DB ; fac status for floating point ; <7>: 1 if fac is invalid (nan or inf) ; <6>: 1 if fac=inf (with <7>=1) ; 0 if fac=nan (with <7>=1) ; <6>: 1 if fac=0 (with <7>=0) ; <5>: always '0' ; fac status for long integer ; <7>: 1 if facm will be regarded as 'signed' ; <6>: 1 if facm = 0 ; <5>: always '1' ; <0>: overflow indicator fexph .DW ; unbiased fac exponent sign extension facext .DW ; fac guard bits extension wftmp2 .EQU facext isize .equ facexp ; integer only: integer size in bytes eisize .equ facexp+1 ; effective (minimum) integer size - 1 ; floating point operand (arg) argm .DS 16 ; guard bits (15 bits)+significand (113 bits) argexp .DW ; arg biased exponent argsgn .DB ; arg mantissa sign argst .DB ; arg status for floating point ; <7>: 1 if arg is invalid (nan or inf) ; <6>: 1 if arg=inf (with <7>=1) ; 0 if arg=nan (with <7>=1) ; <6>: 1 if arg=0 (with <7>=0) ; arg status for long integer ; <7>: 1 if argm will be regarded as 'signed' ; <6>: 1 if argm = 0 ; <5>: always '1' aexph .DW ; unbiased arg exponent sign extension argext .DW wftmp .EQU aexph ; temp. word (int2dec, fpadd, fpsub) argsiz .EQU argsgn ; integer only: size in bytes fcp .ds 3 ; long pointer to float constants scsgn .DB ; scaling sign scexp .DW ; scaling value dexp .DW ; decimal exponent dsgn .DB ; decimal float sign pdeg .DB ; polyn. degree powfg .EQU pdeg ; flag used by fpowxy tlp .ds 3 ; string long pointer fpidx .DB ; string index tfr0 .DS 20 ; temp. float reg. 0 tfr1 .DS 20 ; temp. float reg. 1 tfr2 .DS 20 ; temp. float reg. 2 tfr3 .DS 20 ; temp. float reg. 3 tfr4 .DS 20 ; temp. float reg. 4 tfr5 .DS 20 ; temp. float reg. 5 .DS 4 ; used by xcvt: doesn't change XCVTEND .EQU ($ - 1) ; last byte of xcvt buffer ; buffer used by decimal conversion (overlap tfr0&tfr1: 40 bytes) fpstr .EQU tfr0 ; 40 bytes buffer ; buffer used to format a decimal string xcvt .EQU tfr2 ; 84 bytes buffer fcpc0 .EQU tfr5 ; constants pointer for exp. function fcpc1 .EQU tfr5+2 fcpc2 .EQU tfr5+4 fcpp .EQU tfr5+6 fcpq .EQU tfr5+8 fcpd .EQU tfr5+10 fcqd .EQU tfr5+11 fcpolf .EQU tfr5+12 ; polynomial flag tmdot .EQU tfr5 ; digit count after decimal dot tmpa .EQU tfr5+2 ; temp: save A&Y tmpy .EQU tfr5+3 tmsgn .EQU tfr5+4 ; temp.: significand sign tmpx .EQU tfr5+4 ; temp: save x tmcnt .EQU tfr5+5 ; temp.: significand digits count tesgn .EQU tfr5+6 ; temp.: exponent sign tecnt .EQU tfr5+7 ; temp.: exponent digits count mcand1 .EQU tfr5+8 ; multiplicand's mcand2 .EQU tfr5+10 mcsgn .EQU tfr5+12 dvsor .EQU tfr5+14 quot .EQU tfr5+16 fpprec .DW ; precision fpfmt .DB ; format fpaltf .DB ; alternate format fpcap .DB ; adding for lower case fpstyle .DB ; flag 'F' style fpdot .EQU pdeg ; decimal dot flag fpoct .EQU fpfmt ; octant (circular func's) fpcsgn .EQU fpaltf ; circular func's: argument sign fpcot .EQU fpcap ; cotangent flag fpasin .EQU fpcap ; asin flag iext .db ; extension count endptr .ds 3 ; end ptr for conversion str -> int resp .ds 3 ; conversion result buffer pointer srcopy .db ; copy of status reg. fendp .db ; end ptr not null flag ibase .db ; integer base conversion icopy .db ; bytes to copy after conversion ffrmv .equ iext ; flag: move fac to fr# fumov .db ; flag: move fac unpacked to memory dummy .DB .ENDS .LIST off