Implemented Y instruction for task loading

This commit is contained in:
Luxferre
2022-08-13 23:37:51 +03:00
parent 03f413becc
commit f46e21f7e7
+6
View File
@@ -248,6 +248,7 @@ enum EquiInstructions {
INS_PORTIO='P',
INS_PERSIST_WRITE='}',
INS_PERSIST_READ='{',
INS_TASKLOAD='Y', /* run and activate a new task */
INS_QUIT='Q'
};
@@ -442,6 +443,7 @@ struct EquiCtx* equi_load_task(ushort progStart, ushort len) {
void equi_main_loop() {
uchar instr;
ushort lhash, pbuf, pbuf2;
struct EquiCtx *newtaskptr;
/* try to open the persistent sandbox file */
FILE *pfd = fopen(PERSIST_FILE, "r+b");
while(1) { /* iterate over the instructions in the command buffer */
@@ -656,6 +658,10 @@ void equi_main_loop() {
case INS_PERSIST_WRITE: /* ( blk len maddr -- status) */
pushMain(persistOp(pfd, popMain(), popMain(), popMain(), 1));
break;
case INS_TASKLOAD: /* ( len addr -- ) */
newtaskptr = equi_load_task(popMain(), popMain());
newtaskptr->active = 1;
break;
default: /* all characters not processed before are invalid instructions */
trapout(INVALID_INSTRUCTION);
}