mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 16:23:02 +00:00
Swapped return and short flags in advance of uxn.c refactoring
This commit is contained in:
parent
8988f536be
commit
4d535ebb46
5 changed files with 1087 additions and 1080 deletions
|
@ -204,9 +204,9 @@ for l in assert(io.lines('src/uxn.c')) do
|
|||
},
|
||||
body = dump(ops[op], 'u->wst', 'u->rst')
|
||||
}
|
||||
allops[i + 0x40 + 1] = {
|
||||
allops[i + 0x20 + 1] = {
|
||||
n = {
|
||||
i + 0x40
|
||||
i + 0x20
|
||||
},
|
||||
body = dump(ops[op], 'u->rst', 'u->wst')
|
||||
}
|
||||
|
@ -216,13 +216,16 @@ for l in assert(io.lines('src/uxn.c')) do
|
|||
},
|
||||
body = dump(ops['keep_' .. op], 'u->wst', 'u->rst')
|
||||
}
|
||||
allops[i + 0xc0 + 1] = {
|
||||
allops[i + 0xa0 + 1] = {
|
||||
n = {
|
||||
i + 0xc0
|
||||
i + 0xa0
|
||||
},
|
||||
body = dump(ops['keep_' .. op], 'u->rst', 'u->wst')
|
||||
}
|
||||
i = i + 1
|
||||
if i == 0x20 then
|
||||
i = i + 0x20
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -237,12 +240,12 @@ for l in assert(io.lines('src/uxnasm.c')) do
|
|||
for op in l:gmatch('"(...)"') do
|
||||
i = i + 1
|
||||
allops[i + 0x00].name = op
|
||||
allops[i + 0x20].name = op .. '2'
|
||||
allops[i + 0x40].name = op .. 'r'
|
||||
allops[i + 0x20].name = op .. 'r'
|
||||
allops[i + 0x40].name = op .. '2'
|
||||
allops[i + 0x60].name = op .. '2r'
|
||||
allops[i + 0x80].name = op .. 'k'
|
||||
allops[i + 0xa0].name = op .. '2k'
|
||||
allops[i + 0xc0].name = op .. 'kr'
|
||||
allops[i + 0xa0].name = op .. 'kr'
|
||||
allops[i + 0xc0].name = op .. '2k'
|
||||
allops[i + 0xe0].name = op .. '2kr'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -158,10 +158,12 @@ for l in assert io.lines 'src/uxn.c'
|
|||
if not ops[op]
|
||||
error 'missing ' .. op
|
||||
allops[i + 0x00 + 1] = { n: { i + 0x00 }, body: dump ops[op], 'u->wst', 'u->rst' }
|
||||
allops[i + 0x40 + 1] = { n: { i + 0x40 }, body: dump ops[op], 'u->rst', 'u->wst' }
|
||||
allops[i + 0x20 + 1] = { n: { i + 0x20 }, body: dump ops[op], 'u->rst', 'u->wst' }
|
||||
allops[i + 0x80 + 1] = { n: { i + 0x80 }, body: dump ops['keep_' .. op], 'u->wst', 'u->rst' }
|
||||
allops[i + 0xc0 + 1] = { n: { i + 0xc0 }, body: dump ops['keep_' .. op], 'u->rst', 'u->wst' }
|
||||
allops[i + 0xa0 + 1] = { n: { i + 0xa0 }, body: dump ops['keep_' .. op], 'u->rst', 'u->wst' }
|
||||
i += 1
|
||||
if i == 0x20
|
||||
i += 0x20
|
||||
|
||||
i = 0
|
||||
wanted = false
|
||||
|
@ -174,12 +176,12 @@ for l in assert io.lines 'src/uxnasm.c'
|
|||
for op in l\gmatch '"(...)"'
|
||||
i += 1
|
||||
allops[i + 0x00].name = op
|
||||
allops[i + 0x20].name = op .. '2'
|
||||
allops[i + 0x40].name = op .. 'r'
|
||||
allops[i + 0x20].name = op .. 'r'
|
||||
allops[i + 0x40].name = op .. '2'
|
||||
allops[i + 0x60].name = op .. '2r'
|
||||
allops[i + 0x80].name = op .. 'k'
|
||||
allops[i + 0xa0].name = op .. '2k'
|
||||
allops[i + 0xc0].name = op .. 'kr'
|
||||
allops[i + 0xa0].name = op .. 'kr'
|
||||
allops[i + 0xc0].name = op .. '2k'
|
||||
allops[i + 0xe0].name = op .. '2kr'
|
||||
|
||||
for i = 1, 256
|
||||
|
|
2121
src/uxn-fast.c
2121
src/uxn-fast.c
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,8 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
WITH REGARD TO THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define MODE_RETURN 0x40
|
||||
#define MODE_RETURN 0x20
|
||||
#define MODE_SHORT 0x40
|
||||
#define MODE_KEEP 0x80
|
||||
|
||||
#pragma mark - Operations
|
||||
|
@ -145,7 +146,7 @@ uxn_eval(Uxn *u, Uint16 vec)
|
|||
} else {
|
||||
pop8 = pop8_nokeep;
|
||||
}
|
||||
(*ops[instr & 0x3f])(u);
|
||||
(*ops[(instr & 0x1f) | ((instr & MODE_SHORT) >> 1)])(u);
|
||||
if(u->wst.error)
|
||||
return uxn_halt(u, u->wst.error, "Working-stack", instr);
|
||||
if(u->rst.error)
|
||||
|
|
|
@ -88,10 +88,10 @@ findopcode(char *s)
|
|||
if(!scmp(ops[i], s, 3))
|
||||
continue;
|
||||
while(s[3 + m]) {
|
||||
if(s[3 + m] == '2')
|
||||
i |= (1 << 5); /* mode: short */
|
||||
else if(s[3 + m] == 'r')
|
||||
i |= (1 << 6); /* mode: return */
|
||||
if(s[3 + m] == 'r')
|
||||
i |= (1 << 5); /* mode: return */
|
||||
else if(s[3 + m] == '2')
|
||||
i |= (1 << 6); /* mode: short */
|
||||
else if(s[3 + m] == 'k')
|
||||
i |= (1 << 7); /* mode: keep */
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue