prog8/compiler/examples/test.p8

55 lines
1.4 KiB
Plaintext
Raw Normal View History

%import c64utils
%import mathlib
%option enable_floats
2018-10-16 00:26:35 +00:00
~ main {
2018-11-11 17:19:08 +00:00
;c64scr.PLOT(screenx(x), screeny(y)) ; @todo fix argument calculation???!!!
; @todo unify the type cast functions... "wrd(5)" -> "5 as word"
; @todo docs: "integer / int will not result in float but is integer floor division." verify this!
sub toscreenx(float x, float z) -> word {
2018-12-20 14:49:31 +00:00
return 42.w as word
}
asmsub blerp(ubyte x @ A, uword ding @ XY) -> clobbers() -> () {
word qq = A as word
}
2018-12-17 14:52:37 +00:00
sub start() {
2018-12-18 00:43:04 +00:00
word x = toscreenx(1.22, 3.22)
blerp(4, 555)
2018-12-18 00:43:04 +00:00
; const byte width=20
; word w1
; byte b1
; ubyte ub1
; float x = 3.45
; b1 = fintb(x * flt(width)/4.2) + width//2
; c64scr.print_byte(b1)
; c64.CHROUT('\n')
; b1 = fintb(x/4.2 * flt(width)) + width//2
; c64scr.print_byte(b1)
; c64.CHROUT('\n')
; ub1 = b2ub(fintb(x * flt(width)/4.2) + width//2)
; c64scr.print_ubyte(ub1)
; c64.CHROUT('\n')
; ub1 = b2ub(fintb(x/4.2 * flt(width)) + width//2)
; c64scr.print_ubyte(ub1)
; c64.CHROUT('\n')
; w1 = fintw(x * flt(width)/4.2) + width//2
; c64scr.print_word(w1)
; c64.CHROUT('\n')
; w1 = fintw(x/4.2 * flt(width)) + width//2
; c64scr.print_word(w1)
; c64.CHROUT('\n')
;uw1 = w2uw(fintw(x * flt(width)/4.2) + width//2) ; @todo w2uw
2018-12-18 00:43:04 +00:00
}
}
2018-12-12 00:13:13 +00:00