8-Bit Software

The BBC and Master Computer Public Domain Library


BASIC IV ROM Routines
Page Last Altered:


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