Re: unsigned to float

From: Anders Carlsson <anders.carlsson_at_sfks.se>
Date: Mon, 14 Oct 2019 22:24:51 +0200
Message-ID: <d9afdd4d-1900-6f1a-97eb-44a407deef8d_at_sfks.se>
Clever!

By the way, the routine at $B391 which Patryk already tried to use, 
essentially does the same except that it jumps to $BC44 instead of $BC49 
so it sets the carry flag for values > 32767.

Best regards

Anders Carlsson

Den 2019-10-14 kl. 21:46, skrev Spiro Trikaliotis:
> Hello Patryk,
>
> * On Mon, Oct 14, 2019 at 07:05:38PM +0200 silverdr_at_wfmh.org.pl wrote:
>> 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.
> tested many, many years ago, and I think it actually worked (addresses
> of a C64):
>
>          LDY #low
>          LDA #high
>          STY $63
>          STA $62
>          LDX #$90
>          SEC
>          JSR $BC49
>
> Taken From:
> Lothar English, Das Maschinensprache Buch für Fortgeschrittene zum
> Commodore 64, Data Becker 1984, p. 23.
>
> There are also examples for converting 1, 2, 3 or 4 byte values signed
> or unsigned to FP.
>
> Regards,
> Spiro.
>
Received on 2020-05-29 23:08:08

Archive generated by hypermail 2.3.0.