prog8/compiler/examples/test.p8

55 lines
1.3 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
c64.TIME_HI=1 ; @todo WARNING about 'free' statements in main
c64.TIME_MID=0
c64.TIME_LO=0
;c64scr.PLOT(screenx(x), screeny(y)) ; @todo fix argument calculation???!!!
sub toscreenx(float x, float z) -> word {
return 42
}
asmsub blerp(ubyte x @ A, uword ding @ XY) -> clobbers() -> () {
}
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