From 30d901e29d4015b0d2889c88808f9c31675658f9 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Sat, 13 Aug 2022 23:39:45 +0300 Subject: [PATCH] Implemented Y instruction for task loading --- equi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/equi.c b/equi.c index 2e2bfc5..0d9401d 100644 --- a/equi.c +++ b/equi.c @@ -426,7 +426,7 @@ struct EquiCtx* equi_find_next_task() { } /* Task loader method */ -struct EquiCtx* equi_load_task(ushort progStart, ushort len) { +struct EquiCtx* equi_load_task(ushort len, ushort progStart) { ushort tid = equi_find_free_task_slot(); struct EquiCtx *taskptr = &ram.tasks[tid]; /* refer to the next available entry */ taskptr->msp = taskptr->rsp = taskptr->lsp = taskptr->cltp = 0; /* init stacks and CLT */ @@ -658,7 +658,7 @@ 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 -- ) */ + case INS_TASKLOAD: /* ( addr len -- ) */ newtaskptr = equi_load_task(popMain(), popMain()); newtaskptr->active = 1; break; @@ -743,7 +743,7 @@ int main(int argc, char* argv[]) { cputc(LF); /* echo LF */ } ram.cmdbuf[++ram.ibp] = INS_QUIT; /* end program with INS_QUIT */ - curtask = equi_load_task((ushort)ram.cmd_start, ram.ibp + 1); /* load the code as task 0 */ + curtask = equi_load_task(ram.ibp+1, (ushort)ram.cmd_start); /* load the code as task 0 */ ram.taskid = curtask->id; /* actualize the current task id */ curtask->active = 1; /*activate the current task */ equi_main_loop(); /* and run the interpreter loop */