commit f46e21f7e7546a934e8224b107dc4325209f3908
parent 03f413becc8fe04d50d00b3b8d180f92e2179223
Author: Luxferre <lux@ferre>
Date: Sat, 13 Aug 2022 23:37:51 +0300
Implemented Y instruction for task loading
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/equi.c b/equi.c
@@ -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);
}