Commodore 2001-8 User Manual page 96

Table of Contents

Advertisement

EXAMPLE FLOATING POINT NUMBERS
1E38
FF
96
76
99
52
00
4E10
A4
95
02
F9
00
00
2E10
A3
95
02
F9
00
00
1E10
A2
95
02
F9
00
00
1
81
80
00
00
00
00
.5
80
80
00
00
00
00
.25
7F
80
00
00
00
00
1E-4
73
01
67
59
59
00
1E-37
06
88
IC
14
14
00
1E·38
02
09
C7
EE
EE
00
1E-39
00
AO
00
00
00
00
0
00
00
00
00
00
-1
81
80
00
00
00
FF
-10
84
AO
00
00
00
FF
m
0
0
C
m
-
m
m
m
m
E
c
0
0
0
0
m
-
0
0
0
0
0
C
0
- - -
C
c
c
c
c
'"
m
m
m
m
'"
X
E
E
E
E
iii
~
Figure 8.1.Example floating point numbers.
Actual floating point BASIC variables are stored in 5 bytes, rather than 6 bytes as is the floating
accumulator. Upon examination, one will note that the most significant byte of the mantissa is
alway~
set. If we always assure the number will be In this format, we can use that bit to indicate the sign of the
mantissa·· thus freeing the byte used for sign. The sixth byte is used in the floating accumulator to
simplify operations when shifting the mantissa.
The contents of the floating accumulator may be converted to a double byte integer by calling a
subroutine FLPINT which is located at $DOA7. The most significant byte of the integer is returned in $B3
and the least significant byte in $B4.
e.g
10 A
=
USR(2)
contents of FAC after USR call
82 80 00 00 00 00
JSR FLPINT
contents of FAG after conversion
82 00 00
00 02
00 00
integer value
It is not necessary to return a value in the FAG after a USR call. The value of USR can be left as just the
current contents of FAG. An Integer can be converted back to floating by loading the most significant
byte into index register Y then calling INTFLP at $0278.
94

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents