tuxanci2-engine
Game engine for tuxanci2
Log | Files | Refs | README | LICENSE
commit 0400a14d7f47e6f43dfbeb3b74f1dd3fa2d3eb62
parent d90dad8876457c8d86e8eff69fe25aa56cc3f077
Author: Connor Thomson <connor@gnufault.org>
Date: Sun, 25 Oct 2026 16:42:10 -0700
Add back the yield syscall
Diffstat:
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/include/ta_mod.h b/include/ta_mod.h
@@ -14,7 +14,6 @@
#define TA_SYS_EXIT 0
#define TA_SYS_YIELD 1
-#define TA_SYS_CLEAR 2
extern ta_bool ta_mod_running;
diff --git a/include/ta_vm.h b/include/ta_vm.h
@@ -6,6 +6,7 @@
typedef enum {
TA_VM_RUNNING,
TA_VM_HALTED,
+ TA_VM_YIELDED,
TA_VM_FAULT_ILLEGAL,
TA_VM_FAULT_MEMORY,
TA_VM_FAULT_MISALIGNED,
diff --git a/src/ta_mod.c b/src/ta_mod.c
@@ -22,16 +22,10 @@ static ta_vm_status mod_ecall(ta_vm *machine, void *user) {
return TA_VM_HALTED;
}
- case TA_SYS_CLEAR: {
- if (ta_display->sprite_mode) {
- ta_display_sprites_clear();
- } else {
- ta_fb_clear(ta_display);
- }
+ case TA_SYS_YIELD: {
+ machine->pc += 4;
- r[TA_VM_REG_A0] = 0;
-
- return TA_VM_RUNNING;
+ return TA_VM_YIELDED;
}
default: {
return TA_VM_FAULT_ILLEGAL;
@@ -85,6 +79,11 @@ ta_bool ta_mod_update(void) {
}
status = ta_vm_run(&vm, TA_MOD_STEPS_PER_FRAME);
+
+ if (status == TA_VM_YIELDED) {
+ status = TA_VM_RUNNING;
+ }
+
ta_mod_running = loaded && (status == TA_VM_RUNNING);
return ta_mod_running;