Compare commits

...

2 Commits

Author SHA1 Message Date
~d6 e1714aceff improve name: abs -> abs-sign 2023-12-29 16:35:39 -05:00
~d6 1010f8c00c add alderwick's uxnbot 2023-12-29 15:48:26 -05:00
2 changed files with 127 additions and 115 deletions

View File

@ -66,11 +66,11 @@ Other instructions will not handle "negative" integers correctly:
way to handle this is to make both values non-negative, do unsigned
division (i.e. DIV) and then set the correct sign at the end.
@abs ( x^ -- abs-x^ sign^ )
@abs-sign ( x^ -- abs-x^ sign^ )
DUP #7f GTH #fe MUL INC STHk MUL STHr JMP2r
@signed-div ( x^ y^ -- x/y^ )
abs STH SWP abs STH SWP DIV MULr STHr MUL JMP2r
abs-sign STH SWP abs-sign STH SWP DIV MULr STHr MUL JMP2r
Be careful! The smallest negative value (-128 for bytes, -32768 for shorts)
has no corresponding positive value. This means that some operations will

View File

@ -93,19 +93,19 @@ load_source = function(u, s)
end
local u = Uxn()
local asma_rom = {
160, 12, 215, 160, 7, 120, 53, 160, 3, 177, 46, 160, 7, 76, 160, 5, 93, 53,
160, 12, 215, 160, 7, 119, 53, 160, 3, 177, 46, 160, 7, 75, 160, 5, 93, 53,
160, 240, 0, 160, 224, 0, 185, 160, 4, 195, 46, 34, 34, 160, 5, 99, 52, 29,
128, 48, 13, 0, 160, 3, 230, 46, 160, 240, 0, 160, 224, 0, 185, 160, 4,
195, 46, 34, 34, 160, 5, 99, 52, 29, 128, 22, 13, 128, 79, 128, 24, 23,
128, 75, 128, 24, 23, 160, 7, 74, 52, 4, 128, 24, 23, 128, 24, 23, 0, 160,
128, 75, 128, 24, 23, 160, 7, 73, 52, 4, 128, 24, 23, 128, 24, 23, 0, 160,
5, 99, 52, 160, 3, 108, 46, 128, 58, 128, 25, 23, 128, 32, 128, 25, 23,
160, 5, 87, 52, 160, 3, 108, 46, 128, 46, 128, 25, 23, 0, 0, 128, 1, 128,
167, 23, 38, 128, 168, 55, 128, 1, 128, 166, 23, 160, 5, 97, 53, 160, 5,
95, 53, 160, 3, 177, 46, 160, 7, 76, 160, 5, 93, 53, 160, 5, 95, 52, 160,
4, 57, 46, 160, 5, 99, 52, 29, 128, 71, 13, 160, 3, 230, 46, 160, 7, 78,
160, 5, 93, 53, 160, 5, 97, 52, 29, 128, 7, 13, 160, 7, 95, 160, 5, 93, 53,
95, 53, 160, 3, 177, 46, 160, 7, 75, 160, 5, 93, 53, 160, 5, 95, 52, 160,
4, 57, 46, 160, 5, 99, 52, 29, 128, 71, 13, 160, 3, 230, 46, 160, 7, 77,
160, 5, 93, 53, 160, 5, 97, 52, 29, 128, 7, 13, 160, 7, 94, 160, 5, 93, 53,
160, 5, 95, 52, 160, 4, 57, 46, 160, 5, 99, 52, 29, 128, 29, 13, 160, 7,
74, 52, 160, 240, 0, 57, 160, 5, 93, 52, 46, 160, 5, 102, 160, 3, 12, 46,
73, 52, 160, 240, 0, 57, 160, 5, 93, 52, 46, 160, 5, 102, 160, 3, 12, 46,
160, 2, 65, 46, 160, 2, 118, 46, 108, 160, 1, 245, 46, 108, 128, 168, 54,
160, 3, 108, 46, 160, 2, 58, 160, 3, 108, 46, 160, 5, 78, 52, 160, 3, 123,
46, 128, 58, 128, 25, 23, 128, 32, 128, 25, 23, 160, 5, 99, 52, 160, 3,
@ -115,8 +115,8 @@ local asma_rom = {
5, 80, 52, 160, 3, 123, 46, 160, 2, 94, 160, 3, 108, 46, 108, 32, 108, 105,
110, 101, 115, 32, 111, 102, 32, 115, 111, 117, 114, 99, 101, 32, 99, 111,
100, 101, 46, 10, 0, 160, 5, 101, 20, 128, 8, 28, 128, 0, 8, 128, 38, 13,
160, 7, 120, 52, 160, 12, 215, 57, 160, 3, 123, 46, 160, 2, 170, 160, 3,
108, 46, 160, 224, 0, 160, 7, 120, 52, 57, 160, 3, 123, 46, 160, 2, 192,
160, 7, 119, 52, 160, 12, 215, 57, 160, 3, 123, 46, 160, 2, 170, 160, 3,
108, 46, 160, 224, 0, 160, 7, 119, 52, 57, 160, 3, 123, 46, 160, 2, 192,
160, 3, 108, 46, 108, 32, 98, 121, 116, 101, 115, 32, 111, 102, 32, 104,
101, 97, 112, 32, 117, 115, 101, 100, 44, 32, 0, 32, 98, 121, 116, 101,
115, 32, 102, 114, 101, 101, 46, 10, 0, 52, 157, 128, 2, 13, 34, 108, 38,
@ -132,11 +132,11 @@ local asma_rom = {
23, 33, 128, 241, 12, 128, 48, 128, 25, 23, 128, 120, 128, 25, 23, 7, 128,
4, 31, 128, 20, 14, 4, 128, 15, 28, 128, 13, 14, 6, 128, 4, 31, 128, 6, 14,
128, 15, 28, 128, 0, 12, 128, 48, 24, 6, 128, 58, 11, 128, 3, 13, 128, 39,
24, 128, 25, 23, 108, 160, 34, 2, 30, 160, 6, 193, 21, 160, 66, 2, 30, 160,
6, 207, 21, 160, 130, 2, 30, 160, 6, 219, 21, 128, 255, 160, 5, 76, 21,
24, 128, 25, 23, 108, 160, 34, 2, 30, 160, 6, 192, 21, 160, 66, 2, 30, 160,
6, 206, 21, 160, 130, 2, 30, 160, 6, 218, 21, 128, 255, 160, 5, 76, 21,
160, 0, 0, 166, 160, 5, 99, 53, 160, 5, 102, 53, 160, 5, 104, 53, 160, 11,
215, 160, 5, 106, 53, 160, 5, 76, 20, 1, 160, 5, 76, 21, 160, 240, 0, 160,
7, 74, 53, 160, 1, 0, 6, 38, 160, 5, 89, 53, 160, 5, 77, 21, 160, 5, 91,
7, 73, 53, 160, 1, 0, 38, 6, 160, 5, 77, 21, 160, 5, 89, 53, 160, 5, 91,
53, 160, 4, 57, 160, 4, 21, 185, 160, 4, 195, 46, 34, 34, 108, 37, 66, 82,
75, 32, 123, 32, 48, 48, 32, 125, 32, 37, 91, 32, 123, 32, 125, 32, 37, 93,
32, 123, 32, 125, 32, 64, 111, 110, 45, 114, 101, 115, 101, 116, 32, 160,
@ -159,109 +159,109 @@ local asma_rom = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
38, 160, 5, 85, 53, 38, 160, 5, 87, 53, 148, 128, 2, 13, 34, 108, 33, 175,
212, 175, 192, 0, 47, 85, 128, 0, 160, 5, 77, 20, 153, 28, 38, 160, 5, 171,
56, 160, 6, 67, 46, 85, 128, 8, 13, 111, 160, 5, 85, 53, 35, 52, 44, 34,
98, 160, 5, 177, 56, 52, 44, 11, 151, 11, 47, 11, 71, 9, 242, 7, 193, 8,
56, 6, 128, 58, 11, 128, 8, 13, 6, 128, 96, 10, 128, 5, 13, 108, 128, 48,
25, 108, 128, 87, 25, 108, 15, 160, 5, 85, 52, 38, 128, 93, 14, 6, 79, 28,
128, 61, 13, 38, 160, 0, 4, 42, 128, 53, 13, 157, 128, 0, 8, 128, 46, 13,
160, 0, 2, 42, 5, 5, 224, 0, 0, 148, 6, 128, 9, 13, 2, 34, 111, 5, 1, 134,
24, 24, 108, 128, 177, 14, 6, 128, 240, 28, 128, 12, 13, 192, 64, 127, 128,
0, 15, 15, 120, 33, 128, 220, 12, 98, 34, 34, 128, 0, 108, 47, 128, 7, 12,
25, 128, 10, 141, 34, 33, 97, 148, 212, 79, 157, 128, 242, 13, 111, 36,
108, 224, 0, 0, 128, 2, 12, 33, 97, 148, 128, 250, 13, 34, 111, 108, 160,
5, 85, 52, 47, 180, 29, 128, 4, 13, 98, 128, 1, 108, 52, 38, 160, 0, 4, 56,
239, 128, 196, 14, 128, 8, 13, 2, 34, 33, 35, 98, 128, 0, 108, 128, 128,
28, 128, 6, 31, 128, 0, 4, 47, 34, 34, 111, 56, 128, 209, 12, 160, 5, 85,
52, 38, 128, 181, 14, 160, 0, 3, 43, 128, 91, 13, 160, 0, 3, 56, 175, 212,
175, 192, 0, 47, 85, 160, 5, 106, 160, 6, 67, 46, 85, 128, 68, 13, 160, 11,
219, 57, 128, 3, 63, 6, 128, 0, 8, 128, 48, 13, 212, 79, 224, 0, 1, 120, 6,
128, 4, 13, 2, 98, 4, 108, 6, 128, 50, 9, 128, 7, 13, 2, 128, 0, 29, 128,
228, 12, 6, 128, 114, 9, 128, 7, 13, 2, 128, 0, 29, 128, 214, 12, 128, 107,
9, 128, 6, 13, 128, 0, 29, 128, 202, 12, 98, 34, 128, 1, 108, 128, 128,
128, 17, 14, 128, 14, 14, 108, 160, 5, 89, 180, 37, 56, 36, 53, 108, 4,
128, 0, 14, 160, 5, 89, 52, 160, 5, 91, 52, 171, 128, 13, 13, 168, 128, 20,
13, 128, 0, 128, 26, 14, 33, 128, 243, 12, 160, 10, 237, 160, 5, 99, 53,
34, 34, 2, 108, 34, 33, 38, 160, 5, 89, 53, 160, 5, 91, 53, 128, 29, 50,
38, 160, 255, 255, 40, 128, 8, 13, 175, 21, 111, 33, 128, 14, 51, 108, 160,
56, 160, 6, 66, 46, 85, 128, 8, 13, 111, 160, 5, 85, 53, 35, 52, 44, 34,
98, 160, 5, 177, 56, 52, 44, 11, 127, 11, 7, 11, 31, 10, 18, 7, 192, 8, 52,
6, 128, 58, 11, 128, 8, 13, 6, 128, 96, 10, 128, 5, 13, 108, 128, 48, 25,
108, 128, 87, 25, 108, 15, 160, 5, 85, 52, 38, 128, 92, 14, 6, 79, 28, 128,
60, 13, 38, 160, 0, 4, 42, 128, 52, 13, 157, 128, 0, 8, 128, 45, 13, 160,
0, 2, 42, 5, 5, 224, 0, 0, 148, 6, 128, 9, 13, 2, 34, 111, 5, 1, 134, 24,
24, 108, 128, 177, 14, 6, 128, 240, 28, 128, 11, 13, 192, 64, 127, 192, 0,
15, 120, 33, 128, 221, 12, 98, 34, 34, 128, 0, 108, 47, 128, 7, 12, 25,
128, 10, 141, 34, 33, 97, 148, 212, 79, 157, 128, 242, 13, 111, 36, 108,
224, 0, 0, 128, 2, 12, 33, 97, 148, 128, 250, 13, 34, 111, 108, 160, 5, 85,
52, 47, 180, 29, 128, 4, 13, 98, 128, 1, 108, 52, 38, 160, 0, 4, 56, 239,
128, 196, 14, 128, 8, 13, 2, 34, 33, 35, 98, 128, 0, 108, 128, 128, 28,
128, 6, 31, 128, 0, 4, 47, 34, 34, 111, 56, 128, 209, 12, 160, 5, 85, 52,
38, 128, 181, 14, 160, 0, 3, 43, 128, 91, 13, 160, 0, 3, 56, 175, 212, 175,
192, 0, 47, 85, 160, 5, 106, 160, 6, 66, 46, 85, 128, 68, 13, 160, 11, 219,
57, 128, 3, 63, 6, 128, 0, 8, 128, 48, 13, 212, 79, 224, 0, 1, 120, 6, 128,
4, 13, 2, 98, 4, 108, 6, 128, 50, 9, 128, 7, 13, 2, 128, 0, 29, 128, 228,
12, 6, 128, 114, 9, 128, 7, 13, 2, 128, 0, 29, 128, 214, 12, 128, 107, 9,
128, 6, 13, 128, 0, 29, 128, 202, 12, 98, 34, 128, 1, 108, 128, 128, 128,
17, 14, 128, 14, 14, 108, 160, 5, 89, 180, 37, 56, 36, 53, 108, 4, 128, 0,
14, 160, 5, 89, 52, 160, 5, 91, 52, 171, 128, 13, 13, 168, 128, 20, 13,
128, 0, 128, 26, 14, 33, 128, 243, 12, 160, 10, 222, 160, 5, 99, 53, 34,
34, 2, 108, 34, 33, 38, 160, 5, 89, 53, 160, 5, 91, 53, 128, 29, 50, 38,
160, 255, 255, 40, 128, 8, 13, 175, 21, 111, 33, 128, 14, 51, 108, 160,
240, 0, 185, 160, 5, 93, 52, 46, 35, 128, 235, 12, 0, 0, 34, 108, 128, 170,
55, 160, 5, 97, 52, 128, 168, 55, 160, 240, 0, 128, 174, 55, 108, 157, 128,
2, 13, 34, 108, 160, 240, 0, 38, 37, 56, 36, 148, 128, 24, 23, 33, 170,
128, 247, 13, 34, 34, 108, 0, 0, 128, 251, 50, 161, 128, 247, 51, 21, 108,
128, 242, 50, 161, 33, 128, 237, 51, 53, 108, 47, 128, 231, 50, 128, 1, 12,
97, 212, 70, 175, 85, 33, 192, 247, 77, 98, 128, 215, 51, 108, 160, 5, 85,
52, 160, 6, 52, 46, 29, 128, 19, 13, 160, 5, 84, 148, 1, 5, 5, 21, 128, 2,
160, 5, 77, 20, 29, 160, 5, 77, 21, 108, 160, 5, 85, 52, 160, 6, 52, 46,
52, 160, 6, 51, 46, 29, 128, 19, 13, 160, 5, 84, 148, 1, 5, 5, 21, 160, 5,
77, 20, 128, 2, 29, 160, 5, 77, 21, 108, 160, 5, 85, 52, 160, 6, 51, 46,
29, 128, 243, 13, 160, 5, 84, 148, 128, 1, 25, 6, 36, 21, 128, 230, 13,
128, 2, 128, 255, 30, 160, 5, 77, 20, 28, 160, 5, 77, 21, 108, 160, 5, 76,
20, 128, 59, 13, 160, 5, 104, 160, 6, 67, 46, 128, 9, 13, 34, 160, 10, 216,
160, 5, 99, 53, 108, 160, 7, 120, 52, 36, 53, 160, 0, 0, 160, 7, 131, 46,
160, 0, 0, 160, 7, 131, 46, 160, 5, 85, 52, 160, 7, 141, 46, 128, 4, 160,
5, 77, 20, 29, 160, 5, 77, 21, 108, 128, 20, 160, 5, 77, 20, 29, 160, 5,
77, 21, 108, 160, 5, 77, 20, 128, 16, 28, 128, 8, 13, 160, 5, 85, 52, 160,
7, 141, 46, 108, 128, 0, 160, 7, 122, 46, 128, 20, 128, 255, 30, 160, 5,
77, 20, 28, 160, 5, 77, 21, 108, 160, 5, 102, 128, 29, 14, 128, 7, 13, 160,
0, 0, 160, 7, 131, 46, 160, 0, 2, 56, 160, 5, 108, 53, 108, 160, 5, 108,
52, 128, 3, 14, 2, 34, 108, 160, 6, 67, 46, 128, 19, 13, 180, 160, 5, 89,
52, 40, 128, 7, 13, 160, 11, 23, 160, 5, 99, 53, 128, 1, 108, 160, 7, 120,
52, 36, 53, 160, 0, 0, 160, 7, 131, 46, 160, 0, 0, 160, 7, 131, 46, 160, 5,
85, 52, 160, 7, 141, 46, 160, 7, 120, 52, 160, 5, 89, 52, 160, 7, 131, 46,
128, 0, 108, 160, 0, 0, 160, 5, 89, 53, 128, 0, 160, 5, 206, 46, 128, 8,
13, 160, 10, 114, 160, 5, 99, 53, 108, 160, 6, 238, 44, 160, 5, 85, 52,
148, 6, 128, 3, 13, 2, 34, 108, 160, 6, 251, 46, 33, 128, 240, 12, 128,
160, 160, 6, 251, 46, 128, 82, 14, 160, 6, 247, 44, 128, 75, 14, 160, 6,
229, 46, 128, 1, 13, 108, 160, 5, 76, 20, 128, 0, 8, 160, 5, 99, 52, 29,
29, 128, 7, 13, 160, 10, 134, 160, 5, 99, 53, 108, 128, 40, 14, 160, 5, 89,
52, 57, 160, 0, 3, 57, 38, 160, 0, 128, 43, 15, 38, 160, 255, 127, 42, 79,
29, 128, 9, 13, 34, 160, 10, 159, 160, 5, 99, 53, 108, 160, 6, 229, 46, 2,
108, 160, 5, 85, 52, 148, 128, 38, 9, 128, 12, 13, 33, 160, 5, 85, 53, 160,
5, 108, 52, 128, 57, 12, 148, 6, 128, 8, 13, 2, 34, 160, 5, 102, 128, 44,
12, 128, 47, 8, 128, 4, 13, 33, 128, 233, 12, 38, 128, 0, 5, 5, 21, 160, 5,
102, 160, 6, 67, 46, 15, 36, 38, 128, 47, 5, 5, 21, 79, 128, 18, 13, 33,
160, 5, 85, 53, 160, 0, 2, 56, 160, 6, 67, 46, 128, 3, 13, 52, 108, 34, 34,
160, 5, 76, 20, 128, 0, 8, 128, 7, 13, 160, 10, 181, 160, 5, 99, 53, 160,
160, 5, 77, 20, 128, 12, 28, 160, 5, 77, 21, 108, 160, 5, 76, 20, 128, 59,
13, 160, 5, 104, 160, 6, 66, 46, 128, 9, 13, 34, 160, 10, 201, 160, 5, 99,
53, 108, 160, 7, 119, 52, 36, 53, 160, 0, 0, 160, 7, 130, 46, 160, 0, 0,
160, 7, 130, 46, 160, 5, 85, 52, 160, 7, 140, 46, 160, 5, 77, 20, 128, 4,
29, 160, 5, 77, 21, 108, 160, 5, 77, 20, 128, 12, 29, 160, 5, 77, 21, 108,
160, 5, 77, 20, 128, 8, 28, 128, 8, 13, 160, 5, 85, 52, 160, 7, 140, 46,
108, 128, 0, 160, 7, 121, 46, 160, 5, 77, 20, 128, 2, 28, 160, 5, 77, 21,
108, 160, 5, 102, 128, 29, 14, 128, 7, 13, 160, 0, 0, 160, 7, 130, 46, 160,
0, 2, 56, 160, 5, 108, 53, 108, 160, 5, 108, 52, 128, 3, 14, 2, 34, 108,
160, 6, 66, 46, 128, 19, 13, 180, 160, 5, 89, 52, 40, 128, 7, 13, 160, 10,
239, 160, 5, 99, 53, 128, 1, 108, 160, 7, 119, 52, 36, 53, 160, 0, 0, 160,
7, 130, 46, 160, 0, 0, 160, 7, 130, 46, 160, 5, 85, 52, 160, 7, 140, 46,
160, 7, 119, 52, 160, 5, 89, 52, 160, 7, 130, 46, 128, 0, 108, 160, 0, 0,
160, 5, 89, 53, 128, 0, 160, 5, 206, 46, 128, 8, 13, 160, 10, 118, 160, 5,
99, 53, 108, 160, 6, 237, 44, 160, 5, 85, 52, 148, 6, 128, 3, 13, 2, 34,
108, 160, 6, 250, 46, 33, 128, 240, 12, 128, 160, 160, 6, 250, 46, 128,
121, 14, 160, 6, 246, 44, 128, 128, 160, 6, 250, 46, 128, 108, 14, 160, 6,
250, 46, 128, 1, 13, 108, 160, 5, 76, 20, 128, 0, 8, 160, 5, 99, 52, 29,
29, 128, 7, 13, 160, 10, 138, 160, 5, 99, 53, 108, 128, 32, 128, 2, 12,
128, 64, 160, 6, 250, 46, 128, 62, 14, 160, 5, 89, 52, 57, 160, 0, 2, 57,
160, 6, 246, 44, 128, 128, 160, 6, 250, 46, 128, 40, 14, 160, 5, 89, 52,
57, 160, 0, 2, 57, 38, 160, 0, 128, 43, 15, 38, 160, 255, 127, 42, 79, 29,
128, 9, 13, 34, 160, 10, 163, 160, 5, 99, 53, 108, 160, 6, 250, 46, 2, 108,
160, 5, 85, 52, 148, 128, 38, 9, 128, 12, 13, 33, 160, 5, 85, 53, 160, 5,
108, 52, 128, 57, 12, 148, 6, 128, 8, 13, 2, 34, 160, 5, 102, 128, 44, 12,
128, 47, 8, 128, 4, 13, 33, 128, 233, 12, 38, 128, 0, 5, 5, 21, 160, 5,
102, 160, 6, 66, 46, 15, 36, 38, 128, 47, 5, 5, 21, 79, 128, 18, 13, 33,
160, 5, 85, 53, 160, 0, 2, 56, 160, 6, 66, 46, 128, 3, 13, 52, 108, 34, 34,
160, 5, 76, 20, 128, 0, 8, 128, 7, 13, 160, 10, 185, 160, 5, 99, 53, 160,
5, 89, 52, 108, 128, 1, 160, 5, 206, 46, 12, 128, 6, 12, 128, 11, 12, 128,
20, 12, 160, 10, 114, 160, 5, 99, 53, 108, 160, 6, 229, 46, 2, 108, 160, 6,
251, 46, 2, 108, 128, 160, 160, 6, 251, 46, 160, 6, 247, 44, 160, 6, 119,
46, 128, 4, 13, 160, 6, 251, 44, 128, 1, 160, 5, 206, 46, 12, 128, 6, 12,
128, 216, 12, 128, 225, 12, 128, 3, 22, 128, 224, 10, 128, 50, 13, 160, 5,
104, 160, 6, 67, 46, 128, 31, 13, 148, 128, 2, 13, 34, 108, 166, 160, 6,
52, 46, 33, 56, 36, 160, 5, 110, 46, 160, 5, 99, 52, 29, 128, 3, 13, 128,
227, 12, 34, 108, 34, 160, 10, 197, 160, 5, 99, 53, 108, 160, 10, 254, 160,
5, 99, 53, 108, 128, 3, 22, 128, 224, 10, 128, 239, 13, 160, 7, 120, 52,
160, 5, 85, 52, 160, 7, 141, 46, 160, 4, 57, 46, 160, 5, 82, 148, 1, 5, 5,
21, 108, 73, 110, 118, 97, 108, 105, 100, 32, 104, 101, 120, 97, 100, 101,
99, 105, 109, 97, 108, 0, 65, 100, 100, 114, 101, 115, 115, 32, 110, 111,
116, 32, 105, 110, 32, 122, 101, 114, 111, 32, 112, 97, 103, 101, 0, 65,
100, 100, 114, 101, 115, 115, 32, 111, 117, 116, 115, 105, 100, 101, 32,
114, 97, 110, 103, 101, 0, 76, 97, 98, 101, 108, 32, 110, 111, 116, 32,
102, 111, 117, 110, 100, 0, 85, 110, 114, 101, 99, 111, 103, 110, 105, 115,
101, 100, 32, 116, 111, 107, 101, 110, 0, 77, 97, 99, 114, 111, 32, 97,
108, 114, 101, 97, 100, 121, 32, 101, 120, 105, 115, 116, 115, 0, 77, 101,
109, 111, 114, 121, 32, 111, 118, 101, 114, 119, 114, 105, 116, 101, 0, 82,
101, 99, 117, 114, 115, 105, 111, 110, 32, 108, 101, 118, 101, 108, 32,
116, 111, 111, 32, 100, 101, 101, 112, 0, 76, 97, 98, 101, 108, 32, 114,
101, 100, 101, 102, 105, 110, 101, 100, 0, 0, 0, 0, 0, 40, 0, 7, 162, 11,
39, 0, 0, 41, 0, 7, 194, 0, 0, 0, 0, 40, 0, 7, 174, 11, 55, 0, 0, 41, 0, 7,
219, 11, 63, 11, 79, 123, 0, 7, 193, 0, 0, 0, 0, 125, 0, 8, 75, 0, 0, 0, 0,
34, 0, 8, 228, 11, 87, 0, 0, 35, 0, 9, 196, 11, 95, 11, 111, 36, 0, 8, 207,
0, 0, 0, 0, 37, 0, 7, 234, 11, 103, 11, 135, 38, 0, 8, 121, 0, 0, 0, 0, 40,
0, 7, 174, 11, 127, 11, 143, 41, 0, 7, 219, 0, 0, 0, 0, 44, 0, 9, 40, 11,
119, 11, 183, 46, 0, 9, 5, 0, 0, 0, 0, 58, 0, 8, 254, 11, 159, 11, 175, 59,
0, 8, 248, 0, 0, 0, 0, 64, 0, 8, 96, 11, 167, 11, 199, 123, 0, 7, 193, 0,
0, 0, 0, 124, 0, 8, 200, 11, 191, 11, 207, 125, 0, 7, 193, 0, 0, 0, 0, 126,
0, 10, 80, 12, 39, 11, 255, 76, 73, 84, 0, 0, 0, 0, 0, 73, 78, 67, 0, 0, 0,
0, 0, 80, 79, 80, 0, 12, 167, 12, 15, 78, 73, 80, 0, 0, 0, 0, 0, 83, 87,
80, 0, 11, 239, 12, 111, 82, 79, 84, 0, 0, 0, 0, 0, 68, 85, 80, 0, 12, 191,
11, 231, 79, 86, 82, 0, 0, 0, 0, 0, 69, 81, 85, 0, 0, 0, 0, 0, 78, 69, 81,
0, 12, 175, 12, 71, 71, 84, 72, 0, 0, 0, 0, 0, 76, 84, 72, 0, 0, 0, 0, 0,
74, 77, 80, 0, 11, 223, 12, 55, 74, 67, 78, 0, 12, 63, 12, 103, 74, 83, 82,
0, 0, 0, 0, 0, 83, 84, 72, 0, 0, 0, 0, 0, 76, 68, 90, 0, 0, 0, 0, 0, 83,
84, 90, 0, 12, 119, 12, 87, 76, 68, 82, 0, 12, 127, 12, 159, 83, 84, 82, 0,
0, 0, 0, 0, 76, 68, 65, 0, 12, 207, 12, 79, 83, 84, 65, 0, 12, 183, 12,
143, 68, 69, 73, 0, 0, 0, 0, 0, 68, 69, 79, 0, 0, 0, 0, 0, 65, 68, 68, 0,
12, 95, 11, 247, 83, 85, 66, 0, 12, 47, 12, 31, 77, 85, 76, 0, 12, 135, 12,
199, 68, 73, 86, 0, 12, 151, 0, 0, 65, 78, 68, 0, 0, 0, 0, 0, 79, 82, 65,
0, 12, 7, 12, 23, 69, 79, 82, 0, 0, 0, 0, 0, 83, 70, 84, 0
20, 12, 160, 10, 118, 160, 5, 99, 53, 108, 160, 6, 228, 46, 2, 108, 160, 6,
250, 46, 2, 108, 128, 160, 160, 6, 250, 46, 160, 6, 246, 44, 160, 6, 118,
46, 128, 4, 13, 160, 6, 250, 44, 128, 1, 160, 5, 206, 46, 12, 128, 6, 12,
128, 216, 12, 128, 225, 12, 160, 5, 104, 160, 6, 66, 46, 128, 31, 13, 148,
128, 2, 13, 34, 108, 166, 160, 6, 51, 46, 33, 56, 36, 160, 5, 110, 46, 160,
5, 99, 52, 29, 128, 3, 13, 128, 227, 12, 34, 108, 34, 128, 96, 160, 9, 46,
44, 160, 7, 119, 52, 160, 5, 85, 52, 160, 7, 140, 46, 160, 4, 57, 46, 160,
5, 82, 148, 1, 5, 5, 21, 108, 73, 110, 118, 97, 108, 105, 100, 32, 104,
101, 120, 97, 100, 101, 99, 105, 109, 97, 108, 0, 65, 100, 100, 114, 101,
115, 115, 32, 110, 111, 116, 32, 105, 110, 32, 122, 101, 114, 111, 32, 112,
97, 103, 101, 0, 65, 100, 100, 114, 101, 115, 115, 32, 111, 117, 116, 115,
105, 100, 101, 32, 114, 97, 110, 103, 101, 0, 76, 97, 98, 101, 108, 32,
110, 111, 116, 32, 102, 111, 117, 110, 100, 0, 77, 97, 99, 114, 111, 32,
97, 108, 114, 101, 97, 100, 121, 32, 101, 120, 105, 115, 116, 115, 0, 77,
101, 109, 111, 114, 121, 32, 111, 118, 101, 114, 119, 114, 105, 116, 101,
0, 76, 97, 98, 101, 108, 32, 114, 101, 100, 101, 102, 105, 110, 101, 100,
0, 0, 0, 0, 0, 40, 0, 7, 161, 10, 255, 0, 0, 41, 0, 7, 193, 0, 0, 0, 0, 40,
0, 7, 173, 11, 15, 0, 0, 41, 0, 7, 218, 11, 23, 11, 39, 123, 0, 7, 192, 0,
0, 0, 0, 125, 0, 8, 71, 0, 0, 0, 0, 33, 0, 9, 44, 11, 47, 0, 0, 34, 0, 8,
221, 11, 55, 11, 79, 35, 0, 9, 228, 0, 0, 0, 0, 36, 0, 8, 200, 11, 71, 0,
0, 37, 0, 7, 230, 11, 63, 11, 111, 38, 0, 8, 114, 0, 0, 0, 0, 40, 0, 7,
173, 11, 95, 0, 0, 41, 0, 7, 218, 11, 103, 11, 119, 44, 0, 9, 66, 0, 0, 0,
0, 45, 0, 9, 4, 11, 87, 11, 175, 46, 0, 8, 254, 0, 0, 0, 0, 58, 0, 8, 247,
11, 135, 0, 0, 59, 0, 8, 241, 11, 143, 11, 167, 61, 0, 8, 247, 0, 0, 0, 0,
63, 0, 9, 39, 11, 159, 0, 0, 64, 0, 8, 89, 11, 151, 11, 199, 95, 0, 9, 72,
0, 0, 0, 0, 123, 0, 7, 192, 11, 183, 0, 0, 124, 0, 8, 193, 11, 191, 11,
207, 125, 0, 7, 192, 0, 0, 0, 0, 126, 0, 10, 93, 12, 39, 11, 255, 76, 73,
84, 0, 0, 0, 0, 0, 73, 78, 67, 0, 0, 0, 0, 0, 80, 79, 80, 0, 12, 167, 12,
15, 78, 73, 80, 0, 0, 0, 0, 0, 83, 87, 80, 0, 11, 239, 12, 111, 82, 79, 84,
0, 0, 0, 0, 0, 68, 85, 80, 0, 12, 191, 11, 231, 79, 86, 82, 0, 0, 0, 0, 0,
69, 81, 85, 0, 0, 0, 0, 0, 78, 69, 81, 0, 12, 175, 12, 71, 71, 84, 72, 0,
0, 0, 0, 0, 76, 84, 72, 0, 0, 0, 0, 0, 74, 77, 80, 0, 11, 223, 12, 55, 74,
67, 78, 0, 12, 63, 12, 103, 74, 83, 82, 0, 0, 0, 0, 0, 83, 84, 72, 0, 0, 0,
0, 0, 76, 68, 90, 0, 0, 0, 0, 0, 83, 84, 90, 0, 12, 119, 12, 87, 76, 68,
82, 0, 12, 127, 12, 159, 83, 84, 82, 0, 0, 0, 0, 0, 76, 68, 65, 0, 12, 207,
12, 79, 83, 84, 65, 0, 12, 183, 12, 143, 68, 69, 73, 0, 0, 0, 0, 0, 68, 69,
79, 0, 0, 0, 0, 0, 65, 68, 68, 0, 12, 95, 11, 247, 83, 85, 66, 0, 12, 47,
12, 31, 77, 85, 76, 0, 12, 135, 12, 199, 68, 73, 86, 0, 12, 151, 0, 0, 65,
78, 68, 0, 0, 0, 0, 0, 79, 82, 65, 0, 12, 7, 12, 23, 69, 79, 82, 0, 0, 0,
0, 0, 83, 70, 84, 0
}
local run
run = function(u)
@ -848,17 +848,28 @@ local opNames = {
local opTable = {
-- STACK
--
-- 0x00 BRK/LIT
-- 0x00 JCI/JMI/JSI/LIT
function(self, k, r, s)
local value
if s then
value = bytes_to_short(self.memory[self.ip], self.memory[self.ip+1])
if k then -- LIT2?r?
if s then
value = bytes_to_short(self.memory[self.ip], self.memory[self.ip+1])
else
value = self.memory[self.ip]
end
if self.PRINT then print("Push "..(s and "short" or "byte").." value = ",bit.tohex(value)) end
self:push(value, k, r, s)
self.ip = self.ip + (s and 2 or 1)
else
value = self.memory[self.ip]
value = bytes_to_short(self.memory[self.ip], self.memory[self.ip+1])
self.ip = self.ip + 2
if not r then -- JCI
if self:pop(false, false, false) == 0 then return end
elseif r and s then -- JSI
self:push(self.ip, false, true, true)
end
self.ip = self.ip + value
end
if self.PRINT then print("Push "..(s and "short" or "byte").." value = ",bit.tohex(value)) end
self:push(value, k, r, s)
self.ip = self.ip + (s and 2 or 1)
end,
-- 0x01 INC
@ -1176,6 +1187,7 @@ function Uxn:runUntilBreak()
-- Reset the peek offset so consective calls to :pop maintain state
if k then self.peek_offset = 0 end
opTable[opcode+1](self, k, r, s)
self.ip = self.ip % 0x10000
count = count + 1
if count > 1000000 then