mirror of
https://github.com/irmen/prog8.git
synced 2024-10-19 07:23:56 +00:00
implemented cc for abs()
This commit is contained in:
parent
288d4f08b3
commit
0edd50e956
@ -463,7 +463,7 @@ func_rndf_into_fac1 .proc
|
|||||||
.pend
|
.pend
|
||||||
|
|
||||||
func_sin_into_fac1 .proc
|
func_sin_into_fac1 .proc
|
||||||
jsr pop_float_fac1
|
jsr MOVFM
|
||||||
stx P8ZP_SCRATCH_REG
|
stx P8ZP_SCRATCH_REG
|
||||||
jsr SIN
|
jsr SIN
|
||||||
ldx P8ZP_SCRATCH_REG
|
ldx P8ZP_SCRATCH_REG
|
||||||
|
110
examples/test.p8
110
examples/test.p8
@ -3,8 +3,10 @@
|
|||||||
%import syslib
|
%import syslib
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
|
; builtin functions converted to new call convention:
|
||||||
|
; abs (int + float)
|
||||||
|
|
||||||
|
|
||||||
; Note: this program is compatible with C64 and CX16.
|
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
@ -14,32 +16,114 @@ main {
|
|||||||
ubyte ubb
|
ubyte ubb
|
||||||
ubyte zerobb
|
ubyte zerobb
|
||||||
uword zeroww
|
uword zeroww
|
||||||
|
uword uww
|
||||||
|
word ww
|
||||||
|
float fl
|
||||||
|
float fzero=0.0
|
||||||
|
float rr=0.0
|
||||||
|
|
||||||
for ubb in 0 to 255 {
|
rr = -4.0
|
||||||
txt.print_uw(sin16u(ubb)+zerobb)
|
for ubb in 0 to 20 {
|
||||||
txt.chrout(' ')
|
floats.print_f(abs(rr))
|
||||||
|
txt.chrout('\n')
|
||||||
|
rr += 0.5
|
||||||
}
|
}
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
for ubb in 0 to 255 {
|
|
||||||
txt.print_uw(cos16u(ubb)+zerobb)
|
rr = -2.0
|
||||||
txt.chrout(' ')
|
for ubb in 0 to 20 {
|
||||||
|
floats.print_f(abs(rr)+fzero)
|
||||||
|
txt.chrout('\n')
|
||||||
|
rr += 0.5
|
||||||
}
|
}
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
for ubb in 0 to 255 {
|
|
||||||
txt.print_w(sin16(ubb)+zerobb)
|
for ubb in 0 to 20 {
|
||||||
txt.chrout(' ')
|
txt.print_ub(abs(ubb))
|
||||||
|
txt.chrout('\n')
|
||||||
}
|
}
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
txt.chrout('\n')
|
txt.chrout('\n')
|
||||||
for ubb in 0 to 255 {
|
|
||||||
txt.print_w(cos16(ubb)+zerobb)
|
for ubb in 0 to 20 {
|
||||||
txt.chrout(' ')
|
txt.print_ub(abs(ubb)+zerobb)
|
||||||
|
txt.chrout('\n')
|
||||||
}
|
}
|
||||||
txt.chrout('\n')
|
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()
|
testX()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user