$ fcc -O3 -m6800 9040-float.c
/opt/fcc//lib/6800/crt0.o: Unknown symbol '_exit'.
9040-float.o: Unknown symbol '__boolf'.
9040-float.o: Unknown symbol '__notf'.
When the compiler calls boolf or notf, it pushes the arguments onto the stack.
This is different from the behavior of integer types (integers are passed with hireg,D).
I created a helper to match the behavior of the compiler, but I cannot confirm whether it is correct.
.export __boolf
.export __notf
.code
;
; if the 32bit float is 0.0 returns 1. otherwise Returns 0.
; 32bit float: sign 1bit, exp 8bit, mantissa 23bit.
; when 0.0: sign=0 or 1 (+0 or -0), exp=0, mantissa=0
; => 0x000000 or 0x800000
;
; return address 0-2,x
; arg 3-6,x
;
__boolf:
tsx
ldaa 3,x
anda #$7F
oraa 4,x
oraa 5,x
oraa 6,x
bne true
jmp __false4
true:
jmp __true4
;
__notf:
tsx
ldaa 3,x
anda #$7F
oraa 4,x
oraa 5,x
oraa 6,x
beq true
jmp __false4
sample program:
When the compiler calls boolf or notf, it pushes the arguments onto the stack. This is different from the behavior of integer types (integers are passed with hireg,D). I created a helper to match the behavior of the compiler, but I cannot confirm whether it is correct.