Prev: B862 Up: Map Next: B8D2
B86A: add FAC2 to FAC1
Used by the routines at B853 and BD7E.
B86A D0 03 BNE $B86F branch if FAC1 is not zero
B86C 4C FC BB JMP $BBFC FAC1 was zero so copy FAC2 to FAC1 and return
FAC1 is non zero
B86F A6 70 LDX $70 get FAC1 rounding byte
B871 86 56 STX $56 save as FAC2 rounding byte
B873 A2 69 LDX #$69 set index to FAC2 exponent address
B875 A5 69 LDA $69 get FAC2 exponent
This entry point is used by the routine at BAE2.
B877 A8 TAY copy exponent
B878 F0 CE BEQ $B848 exit if zero
B87A 38 SEC set carry for subtract
B87B E5 61 SBC $61 subtract FAC1 exponent
B87D F0 24 BEQ $B8A3 if equal go add mantissas
B87F 90 12 BCC $B893 if FAC2 < FAC1 then go shift FAC2 right
else FAC2 > FAC1
B881 84 61 STY $61 save FAC1 exponent
B883 A4 6E LDY $6E get FAC2 sign (b7)
B885 84 66 STY $66 save FAC1 sign (b7)
B887 49 FF EOR #$FF complement A
B889 69 00 ADC #$00 +1, twos complement, carry is set
B88B A0 00 LDY #$00 clear Y
B88D 84 56 STY $56 clear FAC2 rounding byte
B88F A2 61 LDX #$61 set index to FAC1 exponent address
B891 D0 04 BNE $B897 branch always
FAC2 < FAC1
B893 A0 00 LDY #$00 clear Y
B895 84 70 STY $70 clear FAC1 rounding byte
B897 C9 F9 CMP #$F9 compare exponent diff with $F9
B899 30 C7 BMI $B862 branch if range $79-$F8
B89B A8 TAY copy exponent difference to Y
B89C A5 70 LDA $70 get FAC1 rounding byte
B89E 56 01 LSR $01,X shift FAC? mantissa 1
B8A0 20 B0 B9 JSR $B9B0 shift FACX Y times right
This entry point is used by the routine at B862.
exponents are equal now do mantissa subtract
B8A3 24 6F BIT $6F test sign compare (FAC1 EOR FAC2)
B8A5 10 57 BPL $B8FE if = add FAC2 mantissa to FAC1 mantissa and return
B8A7 A0 61 LDY #$61 set the Y index to FAC1 exponent address
B8A9 E0 69 CPX #$69 compare X to FAC2 exponent address
B8AB F0 02 BEQ $B8AF if = continue, Y = FAC1, X = FAC2
B8AD A0 69 LDY #$69 else set the Y index to FAC2 exponent address
subtract the smaller from the bigger (take the sign of the bigger)
B8AF 38 SEC set carry for subtract
B8B0 49 FF EOR #$FF ones complement A
B8B2 65 56 ADC $56 add FAC2 rounding byte
B8B4 85 70 STA $70 save FAC1 rounding byte
B8B6 B9 04 00 LDA $0004,Y get FACY mantissa 4
B8B9 F5 04 SBC $04,X subtract FACX mantissa 4
B8BB 85 65 STA $65 save FAC1 mantissa 4
B8BD B9 03 00 LDA $0003,Y get FACY mantissa 3
B8C0 F5 03 SBC $03,X subtract FACX mantissa 3
B8C2 85 64 STA $64 save FAC1 mantissa 3
B8C4 B9 02 00 LDA $0002,Y get FACY mantissa 2
B8C7 F5 02 SBC $02,X subtract FACX mantissa 2
B8C9 85 63 STA $63 save FAC1 mantissa 2
B8CB B9 01 00 LDA $0001,Y get FACY mantissa 1
B8CE F5 01 SBC $01,X subtract FACX mantissa 1
B8D0 85 62 STA $62 save FAC1 mantissa 1
Prev: B862 Up: Map Next: B8D2