×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library

81D5 Store 1-byte value in FWA

Submitted by Steve Fewell

Routine:BytetoFWA
Name: Store 1-byte value in FWA
Starting Address: &81D5
Entry criteria: A contains the 1-byte value to store in the FWA.
Exit: The FWA contains the 1-byte value.

Description:

Clear the FWA.
If the value to set the FWA to is positive then Set FWA to the value, Normalise and exit.
If the value to set the FWA to is negative, then Set the FWA Sign byte to Negative
and reverse the bits in the number and add 1 to make the value positive.
Now it is ok to set the FWA to the value, Normalise the FWA and exit.
We set Y to &88 when the Normalise routine is called, to tell the routine that
our FWA value is 8-bits in size, so set the Initial exponent to &80 + 8 (=&88),
so that the '.' is located after the first 8 bits.


Disassembly for the Store 1-byte value in FWA routine

81D5   032 180 166 20 B4 A6 JSR &A6B4 Clear FWA
81D8   168 A8 TAY
81D9   016 005 10 05 BPL 5 --> &81E0 Normalise FWA#2
81DB . 133 046 85 2E STA &2E
81DD I 073 255 49 FF EOR#&FF
81DF   026 1A INC A
81E0   160 136 A0 88 LDY#&88
81E2 ...Normalise FWA#2

 


 Back to 8BS
Or