1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 05:29:30 +00:00

correctly sign extend for 16bit->float conversion

This commit is contained in:
mrdudz 2022-09-17 16:53:28 +02:00
parent 13dd4e296f
commit 1f4f408572

View File

@ -1,17 +1,32 @@
.importzp sreg, tmp1
.import _int32_to_float32 .import _int32_to_float32
;------------------------------------------------------------------------------
; conversions: to float
; 16bit signed -> float ; 16bit signed -> float
.export axfloat .export axfloat
axfloat: axfloat:
; FIXME ; FIXME
; sign extend to 32bit
ldy #$ff
cpx #$80
bcs @sk
ldy #$00
@sk:
sty sreg
sty sreg+1
jmp _int32_to_float32 jmp _int32_to_float32
; 16bit unsigned -> float ; 16bit unsigned -> float
.export axufloat .export axufloat
axufloat: axufloat:
; FIXME ; FIXME
ldy #0
sty sreg
sty sreg+1
jmp _int32_to_float32 jmp _int32_to_float32
; 32bit signed -> float ; 32bit signed -> float