-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtickle.scratch
144 lines (134 loc) · 4.38 KB
/
tickle.scratch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
define XOR (a) (b)
set [res v] to []
set [bit v] to [1]
repeat (length of (a::custom)::operators)
set [res v] to (join (res) (item ((join [0x] (join (letter (bit) of (a::custom)) (letter (bit) of (b::custom)))) + (1)) of [xor_lookup_table v]))
change [bit v] by (1)
end
define AND (a) (b)
set [res v] to []
set [bit v] to [1]
repeat (length of (a::custom)::operators)
set [res v] to (join (res) (item ((join [0x] (join (letter (bit) of (a::custom)) (letter (bit) of (b::custom)))) + (1)) of [and_lookup_table v]))
change [bit v] by (1)
end
define OR (a) (b)
set [res v] to []
set [bit v] to [1]
repeat (length of (a::custom)::operators)
set [res v] to (join (res) (item ((join [0x] (join (letter (bit) of (a::custom)) (letter (bit) of (b::custom)))) + (1)) of [or_lookup_table v]))
change [bit v] by (1)
end
when [space v] key pressed::event
go to x: (-171) y: (-132)
erase all
set instrument to [(6\\\) Bass v]
play note (58) for (0.0625) beats
say [Hello!]
set [pc v] to [255]
OPC [a0]::custom
define uxn_init
delete all of [wst v]
set [wst_ptr v] to [1]
delete all of [rst v]
set [rst_ptr v] to [1]
delete all of [dev v]
delete all of [ram v]
repeat (256)
add [0] to [wst v]
add [0] to [rst v]
add [0] to [dev v]
end
repeat (65536)
add [0] to [ram v]
end
define dei (addr)
set [res v] to (item (addr::custom) of [dev v])
define deo (addr) (value)
replace item (addr::custom) of [dev v] with (value::custom)
define varavara_init
delete all of [dev v]
repeat (256)
add [0] to [dev v]
end
define OPC (opc)
OR [00] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0x00]
set [_2 v] to [0]
set [_r v] to [0]
set [s v] to (wst::list)
set [sp v] to (wst_ptr)
else
OR [20] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0x20]
set [_2 v] to [1]
set [_r v] to [0]
set [s v] to (wst::list)
set [sp v] to (wst_ptr)
else
OR [40] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0x40]
set [_2 v] to [0]
set [_r v] to [1]
set [s v] to (rst::list)
set [sp v] to (rst_ptr)
else
OR [60] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0x60]
set [_2 v] to [1]
set [_r v] to [1]
set [s v] to (rst::list)
set [sp v] to (rst_ptr)
else
OR [80] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0x80]
set [_2 v] to [0]
set [_r v] to [0]
set [s v] to (wst::list)
set [kp v] to (wst_ptr)
set [sp v] to (kp)
else
OR [a0] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0xa0]
set [_2 v] to [1]
set [_r v] to [0]
set [s v] to (wst::list)
set [kp v] to (wst_ptr)
set [sp v] to (kp)
else
OR [c0] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0xc0]
set [_2 v] to [0]
set [_r v] to [1]
set [s v] to (rst::list)
set [kp v] to (rst_ptr)
set [sp v] to (kp)
else
OR [e0] (opc::custom)::custom
if <(res) = (item ((pc) + (1)) of [ram v])> then
think [0xe0]
set [_2 v] to [1]
set [_r v] to [1]
set [s v] to (rst::list)
set [kp v] to (rst_ptr)
set [sp v] to (kp)
end
end
end
end
end
end
end
end
define dec (n)
hex (n::custom)::custom
set [res v] to ((res) * (1))
define hex (n)
set [res v] to (join [0x] (n::custom))