implemented cc for abs()

This commit is contained in:
Irmen de Jong 2020-11-03 23:01:23 +01:00
parent 288d4f08b3
commit 0edd50e956
2 changed files with 98 additions and 14 deletions

View File

@ -463,7 +463,7 @@ func_rndf_into_fac1 .proc
.pend
func_sin_into_fac1 .proc
jsr pop_float_fac1
jsr MOVFM
stx P8ZP_SCRATCH_REG
jsr SIN
ldx P8ZP_SCRATCH_REG

View File

@ -3,8 +3,10 @@
%import syslib
%zeropage basicsafe
; builtin functions converted to new call convention:
; abs (int + float)
; Note: this program is compatible with C64 and CX16.
main {
@ -14,32 +16,114 @@ main {
ubyte ubb
ubyte zerobb
uword zeroww
uword uww
word ww
float fl
float fzero=0.0
float rr=0.0
for ubb in 0 to 255 {
txt.print_uw(sin16u(ubb)+zerobb)
txt.chrout(' ')
rr = -4.0
for ubb in 0 to 20 {
floats.print_f(abs(rr))
txt.chrout('\n')
rr += 0.5
}
txt.chrout('\n')
txt.chrout('\n')
for ubb in 0 to 255 {
txt.print_uw(cos16u(ubb)+zerobb)
txt.chrout(' ')
rr = -2.0
for ubb in 0 to 20 {
floats.print_f(abs(rr)+fzero)
txt.chrout('\n')
rr += 0.5
}
txt.chrout('\n')
txt.chrout('\n')
for ubb in 0 to 255 {
txt.print_w(sin16(ubb)+zerobb)
txt.chrout(' ')
for ubb in 0 to 20 {
txt.print_ub(abs(ubb))
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for ubb in 0 to 255 {
txt.print_w(cos16(ubb)+zerobb)
txt.chrout(' ')
for ubb in 0 to 20 {
txt.print_ub(abs(ubb)+zerobb)
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for bb in -10 to 10 {
txt.print_b(abs(bb))
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for bb in -10 to 10 {
txt.print_b(abs(bb)+zerobb)
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for uww in 0 to 20 {
txt.print_uw(abs(uww))
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for uww in 0 to 20 {
txt.print_uw(abs(uww)+zeroww)
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for ww in -10 to 10 {
txt.print_w(abs(ww))
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
for ww in -10 to 10 {
txt.print_w(abs(ww)+zeroww)
txt.chrout('\n')
}
txt.chrout('\n')
txt.chrout('\n')
; for ubb in 0 to 20 {
; floats.print_f(sin(rr))
; txt.chrout('\n')
; rr += 0.01
; }
; txt.chrout('\n')
; txt.chrout('\n')
; for ubb in 0 to 20 {
; floats.print_f(cos(rr))
; txt.chrout('\n')
; rr += 0.01
; }
; txt.chrout('\n')
; txt.chrout('\n')
; for ubb in 0 to 20 {
; floats.print_f(tan(rr))
; txt.chrout('\n')
; rr += 0.01
; }
; txt.chrout('\n')
; txt.chrout('\n')
; for ubb in 0 to 20 {
; floats.print_f(atan(rr))
; txt.chrout('\n')
; rr += 0.01
; }
testX()
return