commit 30d901e29d4015b0d2889c88808f9c31675658f9
parent f46e21f7e7546a934e8224b107dc4325209f3908
Author: Luxferre <lux@ferre>
Date: Sat, 13 Aug 2022 23:39:45 +0300
Implemented Y instruction for task loading
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git 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 */