2020-11-05 00:26:45 +00:00
|
|
|
; --- floating point builtin functions
|
|
|
|
|
|
|
|
|
|
|
|
func_sign_f_into_A .proc
|
|
|
|
jsr MOVFM
|
|
|
|
jmp SIGN
|
|
|
|
.pend
|
|
|
|
|
|
|
|
|
|
|
|
a_times_5 .proc
|
|
|
|
sta P8ZP_SCRATCH_B1
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
clc
|
|
|
|
adc P8ZP_SCRATCH_B1
|
|
|
|
rts
|
|
|
|
.pend
|
|
|
|
|
2023-04-29 20:11:26 +00:00
|
|
|
func_abs_f_into_FAC1 .proc
|
|
|
|
jsr MOVFM
|
2023-07-15 13:18:26 +00:00
|
|
|
jmp ABS
|
2023-04-29 20:11:26 +00:00
|
|
|
.pend
|
2023-04-29 20:35:41 +00:00
|
|
|
|
|
|
|
func_sqrt_into_FAC1 .proc
|
|
|
|
jsr MOVFM
|
2023-07-15 13:18:26 +00:00
|
|
|
jmp SQR
|
2023-04-29 20:35:41 +00:00
|
|
|
.pend
|
2024-01-14 12:20:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
containment_floatarray .proc
|
|
|
|
; -- check if a value exists in a float array.
|
|
|
|
; parameters: FAC1: value to check, P8ZP_SCRATCH_W1: address of the word array, Y = length of array (>=1).
|
|
|
|
; returns boolean 0/1 in A.
|
|
|
|
sty P8ZP_SCRATCH_REG
|
|
|
|
ldx #<floats.floats_temp_var
|
|
|
|
ldy #>floats.floats_temp_var
|
|
|
|
jsr floats.MOVMF
|
|
|
|
ldx P8ZP_SCRATCH_REG
|
|
|
|
ldy #0
|
|
|
|
- lda floats.floats_temp_var
|
|
|
|
cmp (P8ZP_SCRATCH_W1),y
|
|
|
|
bne _firstmiss
|
|
|
|
iny
|
|
|
|
lda floats.floats_temp_var+1
|
|
|
|
cmp (P8ZP_SCRATCH_W1),y
|
|
|
|
bne _secondmiss
|
|
|
|
iny
|
|
|
|
lda floats.floats_temp_var+2
|
|
|
|
cmp (P8ZP_SCRATCH_W1),y
|
|
|
|
bne _thirdmiss
|
|
|
|
iny
|
|
|
|
lda floats.floats_temp_var+3
|
|
|
|
cmp (P8ZP_SCRATCH_W1),y
|
|
|
|
bne _fourthmiss
|
|
|
|
iny
|
|
|
|
lda floats.floats_temp_var+4
|
|
|
|
cmp (P8ZP_SCRATCH_W1),y
|
|
|
|
bne _fifthmiss
|
|
|
|
lda #1
|
|
|
|
rts
|
|
|
|
|
|
|
|
_firstmiss
|
|
|
|
iny
|
|
|
|
_secondmiss
|
|
|
|
iny
|
|
|
|
_thirdmiss
|
|
|
|
iny
|
|
|
|
_fourthmiss
|
|
|
|
iny
|
|
|
|
_fifthmiss
|
|
|
|
iny
|
|
|
|
dex
|
|
|
|
bne -
|
|
|
|
lda #0
|
|
|
|
rts
|
|
|
|
|
|
|
|
.pend
|