Re: unsigned to float

From: Anders Carlsson <anders.carlsson_at_sfks.se>
Date: Mon, 14 Oct 2019 19:33:00 +0200
Message-ID: <a80f2866-0dc8-c32a-00cf-190de942ee7a_at_sfks.se>
Hello,

Here is a possibly inefficient way to do it:

LDA #$01
LDY #$00
JSR $B391 ; Store a constant $0100 into FAC
JSR $BC0C ; Transfer to AFAC
LDY #high_byte
JSR $B3A2 ; Store Y 0-255 into FAC
JSR $BA30 ; Multiply FAC by AFAC, store in FAC
JSR $BC0C
LDY #low_byte
JSR $B3A2
JSR $B86A ; Add FAC with AFAC, store in FAC
JSR $AABC ; Print FAC (for verify that the routine works)
RTS

Best regards

Anders Carlsson

Den 2019-10-14 kl. 19:05, skrev silverdr_at_wfmh.org.pl:
> I need to do some FP calculations (one division, several multiplications) and wanted to use available BASIC routines. There's for example the GIVAYF routine that converts from 16 bit ints into FAC float format. Things work fine as long as I have "signed" ints on the input. What I need is "unsigned" so that I could use the whole 16 bit range. Suggestions appreciated.
>
Received on 2020-05-29 23:07:20

Archive generated by hypermail 2.3.0.