prog8/examples/test.p8

57 lines
1.2 KiB
Plaintext
Raw Normal View History

%import textio
%zeropage basicsafe
2022-03-13 11:52:12 +00:00
; NOTE: meant to test to virtual machine output target (use -target vitual)
2021-10-30 13:15:11 +00:00
main {
2022-03-27 19:59:46 +00:00
2022-04-03 13:25:32 +00:00
sub func1(ubyte arg1) -> uword {
return arg1 * 3
2022-04-02 17:01:18 +00:00
}
2022-04-03 13:25:32 +00:00
sub func2(uword arg1) -> uword {
return arg1+1000
}
2022-03-27 12:23:01 +00:00
2022-04-03 13:25:32 +00:00
sub func3(uword arg1) {
txt.print_uw(arg1+2000)
2022-04-02 17:01:18 +00:00
txt.nl()
2022-04-03 13:25:32 +00:00
}
sub start() {
ubyte source = 99
uword result = func2(func1(cos8u(sin8u(source))))
txt.print_uw(result) ; 1043
2022-04-02 17:01:18 +00:00
txt.nl()
2022-04-03 13:25:32 +00:00
result = source |> sin8u() |> cos8u() |> func1() |> func2()
txt.print_uw(result) ; 1043
2022-04-02 17:01:18 +00:00
txt.nl()
2022-04-03 13:25:32 +00:00
source |> sin8u() |> cos8u() |> func1() |> func3() ; 2043
2022-04-02 15:53:24 +00:00
; a "pixelshader":
; syscall1(8, 0) ; enable lo res creen
; ubyte shifter
;
; shifter >>= 1
;
; repeat {
; uword xx
; uword yy = 0
; repeat 240 {
; xx = 0
; repeat 320 {
; syscall3(10, xx, yy, xx*yy + shifter) ; plot pixel
; xx++
; }
; yy++
; }
; shifter+=4
;
; txt.print_ub(shifter)
; txt.nl()
; }
2022-03-04 21:26:46 +00:00
}
2022-02-17 23:40:31 +00:00
}