2022-05-22 15:34:08 +00:00
|
|
|
%import textio
|
2022-06-04 15:18:24 +00:00
|
|
|
%zeropage basicsafe
|
2022-03-13 11:52:12 +00:00
|
|
|
|
2022-06-27 19:44:52 +00:00
|
|
|
; NOTE: meant to test to virtual machine output target (use -target virtual)
|
2022-03-24 23:17:41 +00:00
|
|
|
|
2022-06-08 21:57:01 +00:00
|
|
|
main {
|
2022-06-08 19:05:03 +00:00
|
|
|
|
2022-06-12 20:55:23 +00:00
|
|
|
sub funcFalse() -> ubyte {
|
|
|
|
txt.print("false() ")
|
|
|
|
return false
|
2022-06-12 14:59:28 +00:00
|
|
|
}
|
|
|
|
|
2022-06-12 20:55:23 +00:00
|
|
|
sub funcFalseWord() -> uword {
|
2022-06-27 19:40:48 +00:00
|
|
|
txt.print("falseword() ")
|
2022-06-12 20:55:23 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
sub funcTrue() -> ubyte {
|
|
|
|
txt.print("ftrue() ")
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
sub func1(ubyte a1) -> ubyte {
|
|
|
|
txt.print("func1() ")
|
|
|
|
return a1>1
|
|
|
|
}
|
|
|
|
|
|
|
|
sub func2(ubyte a1) -> ubyte {
|
|
|
|
txt.print("func2() ")
|
|
|
|
return a1>2
|
|
|
|
}
|
|
|
|
|
|
|
|
sub func3(ubyte a1) -> ubyte {
|
|
|
|
txt.print("func3() ")
|
|
|
|
return a1>3
|
|
|
|
}
|
|
|
|
|
|
|
|
sub func4(ubyte a1) -> ubyte {
|
|
|
|
txt.print("func4() ")
|
|
|
|
return a1>4
|
|
|
|
}
|
|
|
|
|
|
|
|
sub funcw() -> uword {
|
|
|
|
txt.print("funcw() ")
|
|
|
|
return 9999
|
2022-06-12 14:59:28 +00:00
|
|
|
}
|
|
|
|
|
2022-06-06 11:21:45 +00:00
|
|
|
sub start() {
|
2022-06-12 20:55:23 +00:00
|
|
|
ubyte value
|
|
|
|
uword wvalue
|
2022-06-23 23:51:54 +00:00
|
|
|
|
2022-06-26 21:55:34 +00:00
|
|
|
ubyte ub1 = 11
|
|
|
|
ubyte ub2 = 22
|
|
|
|
ubyte ub3 = 33
|
|
|
|
ubyte ub4 = 44
|
|
|
|
ubyte ub5 = 55
|
|
|
|
|
2022-06-27 19:40:48 +00:00
|
|
|
ub4 = 0
|
2022-06-26 21:55:34 +00:00
|
|
|
txt.print("and with bytes: ")
|
2022-06-27 19:40:48 +00:00
|
|
|
ub5 = ub1 and ub2 and ub3 and ub4 and ub5
|
2022-06-26 21:55:34 +00:00
|
|
|
txt.print_ub(ub5)
|
|
|
|
txt.nl()
|
|
|
|
|
2022-06-27 19:40:48 +00:00
|
|
|
ub4 = 0
|
2022-06-26 21:55:34 +00:00
|
|
|
txt.print("or with bytes: ")
|
2022-06-27 19:40:48 +00:00
|
|
|
ub5 = ub1 or ub2 or ub3 or ub4 or ub5
|
2022-06-26 21:55:34 +00:00
|
|
|
txt.print_ub(ub5)
|
|
|
|
txt.nl()
|
2022-06-08 19:05:03 +00:00
|
|
|
|
2022-06-23 22:28:51 +00:00
|
|
|
txt.print("short and with false (word): ")
|
|
|
|
wvalue = funcw() and funcFalseWord() and funcw() and funcw()
|
|
|
|
txt.print_uw(wvalue)
|
|
|
|
txt.nl()
|
2022-06-12 20:55:23 +00:00
|
|
|
|
|
|
|
txt.print("short and with false: ")
|
|
|
|
value = func1(25) and funcFalse()
|
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("short or with true: ")
|
|
|
|
value = func1(25) or funcTrue()
|
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("short xor with false: ")
|
|
|
|
value = func1(25) xor funcFalse()
|
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
|
|
|
|
txt.print("and with false: ")
|
2022-06-27 19:40:48 +00:00
|
|
|
value = func1(25) and func2(25) and funcFalse() and func3(25) and func4(25)
|
2022-06-12 20:55:23 +00:00
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("and with true: ")
|
|
|
|
value = func1(25) and func2(25) and funcTrue() and func3(25) and func4(25)
|
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("or with false: ")
|
2022-06-27 19:40:48 +00:00
|
|
|
value = func1(0) or func2(0) or funcFalse() or func3(25) or func4(25)
|
2022-06-12 20:55:23 +00:00
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("or with true: ")
|
2022-06-27 19:40:48 +00:00
|
|
|
value = func1(0) or func2(0) or funcTrue() or func3(25) or func4(25)
|
2022-06-12 20:55:23 +00:00
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("xor with false: ")
|
|
|
|
value = func1(25) xor func2(25) xor funcFalse() xor func3(25) xor func4(25)
|
|
|
|
txt.print_ub(value)
|
|
|
|
txt.nl()
|
|
|
|
txt.print("xor with true: ")
|
|
|
|
value = func1(25) xor func2(25) xor funcTrue() xor func3(25) xor func4(25)
|
|
|
|
txt.print_ub(value)
|
2022-06-12 14:59:28 +00:00
|
|
|
txt.nl()
|
2022-06-04 19:10:48 +00:00
|
|
|
|
2022-06-27 19:40:48 +00:00
|
|
|
txt.print("\nif and with false: [nothing]: ")
|
|
|
|
if func1(25) and func2(25) and funcFalse() and func3(25) and func4(25)
|
|
|
|
txt.print("failure!")
|
|
|
|
txt.print("\nif and with true: [ok]: ")
|
|
|
|
if func1(25) and func2(25) and funcTrue() and func3(25) and func4(25)
|
|
|
|
txt.print("ok!")
|
|
|
|
txt.print("\nif or with false: [ok]: ")
|
|
|
|
if func1(0) or func2(0) or funcFalse() or func3(25) or func4(25)
|
|
|
|
txt.print("ok!")
|
|
|
|
txt.print("\nif or with true: [ok]: ")
|
|
|
|
if func1(0) or func2(0) or funcTrue() or func3(25) or func4(25)
|
|
|
|
txt.print("ok!")
|
|
|
|
txt.print("\nif xor with false: [nothing]: ")
|
|
|
|
if func1(25) xor func2(25) xor funcFalse() xor func3(25) xor func4(25)
|
|
|
|
txt.print("failure!")
|
|
|
|
txt.print("\nif xor with true: [ok]: ")
|
|
|
|
if func1(25) xor func2(25) xor funcTrue() xor func3(25) xor func4(25)
|
|
|
|
txt.print("ok!")
|
|
|
|
txt.nl()
|
2022-06-14 20:31:13 +00:00
|
|
|
|
2022-06-12 14:15:08 +00:00
|
|
|
; a "pixelshader":
|
2022-06-12 14:59:28 +00:00
|
|
|
; sys.gfx_enable(0) ; enable lo res screen
|
|
|
|
; ubyte shifter
|
|
|
|
;
|
|
|
|
; repeat {
|
|
|
|
; uword xx
|
|
|
|
; uword yy = 0
|
|
|
|
; repeat 240 {
|
|
|
|
; xx = 0
|
|
|
|
; repeat 320 {
|
|
|
|
; sys.gfx_plot(xx, yy, xx*yy + shifter as ubyte)
|
|
|
|
; xx++
|
|
|
|
; }
|
|
|
|
; yy++
|
|
|
|
; }
|
|
|
|
; shifter+=4
|
|
|
|
; }
|
2022-03-04 21:26:46 +00:00
|
|
|
}
|
2022-02-17 23:40:31 +00:00
|
|
|
}
|