Added special POPk/NIPk modes
This commit is contained in:
parent
e191a164ea
commit
ae61e92585
|
@ -61,10 +61,10 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
/* ALU */
|
/* ALU */
|
||||||
case 0x01: /* INC */ t=T; SET(1, 0) PUT(0, t + 1) break;
|
case 0x01: /* INC */ t=T; SET(1, 0) PUT(0, t + 1) break;
|
||||||
case 0x21: t=T2; SET(2, 0) PUT2(0, t + 1) break;
|
case 0x21: t=T2; SET(2, 0) PUT2(0, t + 1) break;
|
||||||
case 0x02: /* POP */ SET(1,-1) break;
|
case 0x02: /* POP */ SET(1,-1) if(k) PUT(0, 0) break;
|
||||||
case 0x22: SET(2,-2) break;
|
case 0x22: SET(2,-2) if(k) PUT2(0, 0) break;
|
||||||
case 0x03: /* NIP */ t=T; SET(2,-1) PUT(0, t) break;
|
case 0x03: /* NIP */ t=T; SET(2,-1) PUT(0, t) if(k) PUT(1, 0) break;
|
||||||
case 0x23: t=T2; SET(4,-2) PUT2(0, t) break;
|
case 0x23: t=T2; SET(4,-2) PUT2(0, t) if(k) PUT2(2, 0) break;
|
||||||
case 0x04: /* SWP */ t=T;n=N; SET(2, 0) PUT(0, n) PUT(1, t) break;
|
case 0x04: /* SWP */ t=T;n=N; SET(2, 0) PUT(0, n) PUT(1, t) break;
|
||||||
case 0x24: t=T2;n=N2; SET(4, 0) PUT2(0, n) PUT2(2, t) break;
|
case 0x24: t=T2;n=N2; SET(4, 0) PUT2(0, n) PUT2(2, t) break;
|
||||||
case 0x05: /* ROT */ t=T;n=N;l=L; SET(3, 0) PUT(0, l) PUT(1, t) PUT(2, n) break;
|
case 0x05: /* ROT */ t=T;n=N;l=L; SET(3, 0) PUT(0, l) PUT(1, t) PUT(2, n) break;
|
||||||
|
|
21
src/uxncli.c
21
src/uxncli.c
|
@ -53,16 +53,17 @@ main(int argc, char **argv)
|
||||||
if(!system_load(&u, argv[i++]))
|
if(!system_load(&u, argv[i++]))
|
||||||
return system_error("Load", "Failed");
|
return system_error("Load", "Failed");
|
||||||
u.dev[0x17] = argc - i;
|
u.dev[0x17] = argc - i;
|
||||||
if(!uxn_eval(&u, PAGE_PROGRAM))
|
if(uxn_eval(&u, PAGE_PROGRAM)) {
|
||||||
return u.dev[0x0f] & 0x7f;
|
for(; i < argc; i++) {
|
||||||
for(; i < argc; i++) {
|
char *p = argv[i];
|
||||||
char *p = argv[i];
|
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
||||||
while(*p) console_input(&u, *p++, CONSOLE_ARG);
|
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
||||||
console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA);
|
}
|
||||||
}
|
while(!u.dev[0x0f]) {
|
||||||
while(!u.dev[0x0f]) {
|
int c = fgetc(stdin);
|
||||||
int c = fgetc(stdin);
|
if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD);
|
||||||
if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD);
|
}
|
||||||
}
|
}
|
||||||
|
free(u.ram);
|
||||||
return u.dev[0x0f] & 0x7f;
|
return u.dev[0x0f] & 0x7f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue