How does the floating point math package in BASIC work?
Posted: Mon Jul 07, 2014 2:04 pm
I still try to bugfix my Emulator: viewtopic.php?f=5&t=4308&p=11316#p11316
There is a bug somewhere related with the BASIC09 "floating point math package"...
So i try to understand how it works. I find a article "Floating Point Math" by "Steven R. Broadwater" in the The Rainbow Magazine (Radio Shack Color Computer) (February 1985) -> https://archive.org/details/rainbowmagazine-1985-02
It helps a little, but hey this is hardcore stuff for me
I would like to try some simple function from the math package, as descried in the article.
I used the Simple6809 ROM. There are some equal addresses:
Floating Point Accu 0 is also stored in $0050-$0053
FPA0 Exponent in $004f and FPA Sign in $0054
FPA1 stored in $005c-$0061
I found two interesting Routines in ROM:
$e777 = CONVERT THE VALUE IN ACCB INTO A FP NUMBER IN FPA0
$e778 = CONVERT THE VALUE IN ACCD INTO A FLOATING POINT NUMBER IN FPA0
So i try to store the number "6" into FPA0 via CPU accu B:
The ASCII Number 6 is $36 so i try this:
The result is:
are this the right values?
There is a bug somewhere related with the BASIC09 "floating point math package"...
So i try to understand how it works. I find a article "Floating Point Math" by "Steven R. Broadwater" in the The Rainbow Magazine (Radio Shack Color Computer) (February 1985) -> https://archive.org/details/rainbowmagazine-1985-02
It helps a little, but hey this is hardcore stuff for me
I would like to try some simple function from the math package, as descried in the article.
I used the Simple6809 ROM. There are some equal addresses:
Floating Point Accu 0 is also stored in $0050-$0053
FPA0 Exponent in $004f and FPA Sign in $0054
FPA1 stored in $005c-$0061
I found two interesting Routines in ROM:
$e777 = CONVERT THE VALUE IN ACCB INTO A FP NUMBER IN FPA0
$e778 = CONVERT THE VALUE IN ACCD INTO A FLOATING POINT NUMBER IN FPA0
So i try to store the number "6" into FPA0 via CPU accu B:
The ASCII Number 6 is $36 so i try this:
Code: Select all
0000 C6 36 LDB #$36
0002 BD E7 77 JSR $e777
Code: Select all
Memory dump from $004f to $0054:
$004f: $86 (dez: 134) | $4f: *PV FLOATING POINT ACCUMULATOR #0 FPA0 EXPONENT
$0050: $d8 (dez: 216) | $50: *PV FLOAT.ACCU #0 FPA0 MANTISSA MS Most Significant Byte
$0051: $00 (dez: 0) | $51: *PV FLOAT.ACCU #0 FPA0 MANTISSA NMS Next Most Significant Byte
$0052: $00 (dez: 0) | $52: *PV FLOAT.ACCU #0 FPA0 MANTISSA NLS Next Least Significant Byte
$0053: $00 (dez: 0) | $53: *PV FLOAT.ACCU #0 FPA0 MANTISSA LS Least Significant Byte
$0054: $00 (dez: 0) | $54: *PV FLOATING POINT ACCUMULATOR #0 FPA0 SIGN