×   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

Floating-Point Compliment

Submitted by Steve Fewell

Routine: acomp
Name: Floating-Point Compliment
Starting Address: &ACCA
Entry criteria: The FWA contains a floating-point number.
Exit: FWA has been complimented (FWA = zero - FWA)

Description:
If the FWA Mantissa byte 1 (Most significant byte) contains zero - indicating that the current number in the FWA is zero, then exit as no further operation required.

Otherwise, Exclusive-OR the FWA Sign Byte with 10000000 (&80). This reverses the Most significant Bit of the Sign Byte (so 0 becomes 1, and 1 becomes 0). Then exit with A = 255 (&FF) indicating that a Floating-Point value has just been processed.

 

Disassembly for the Floating-Point Compliment routine

ACCA 1 165 049 A5 31 LDA &31
ACCC   240 006 F0 06 BEQ 6 --> &ACD4
ACCE . 165 046 A5 2E LDA &2E
ACD0 I 073 128 49 80 EOR#&80
ACD2 . 133 046 85 2E STA &2E
ACD4   169 255 A9 FF LDA#&FF
ACD6 ` 096 60 RTS

 


 Back to 8BS
Or