From c18db4be57214903f2b1f6d5a7943eb40f644024 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Thu, 23 Mar 2023 20:41:52 +0000 Subject: [PATCH] add waveform disarm --- asm/creole.py | 3 ++- creole.c | 14 ++++++++++---- creole.h | 3 ++- upsilon_creole.h | 4 +++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/asm/creole.py b/asm/creole.py index 0ba4cf0..34f8a63 100644 --- a/asm/creole.py +++ b/asm/creole.py @@ -217,7 +217,8 @@ class Instruction(Enum): CLOOP_READ = 16, "_render_default", ArgType.VAL, ArgType.REG, ArgType.REG CLOOP_WRITE = 17, "_render_default", ArgType.VAL, ArgType.VAL, ArgType.VAL WF_LOAD = 18, "_render_default", ArgType.VAL, ArgType.DAT - WF_EXEC = 19, "_render_default", ArgType.VAL, ArgType.VAL + WF_ARM = 19, "_render_default", ArgType.VAL, ArgType.VAL, ArgType.VAL + WF_DISARM = 22, "_render_default", ArgType.VAL SENDVAL = 20, "_render_default", ArgType.VAL SENDDAT = 21, "_render_default", ArgType.DAT diff --git a/creole.c b/creole.c index 0d5c27d..d5994cb 100644 --- a/creole.c +++ b/creole.c @@ -62,9 +62,10 @@ static const struct { defop(CLOOP_READ, 2, TYPE_VAL, TYPE_REG, TYPE_NONE), defop(CLOOP_WRITE, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE), defop(WF_LOAD, 2, TYPE_VAL, TYPE_IMM, TYPE_NONE), - defop(WF_EXEC, 3, TYPE_VAL, TYPE_VAL, TYPE_NONE), + defop(WF_EXEC, 3, TYPE_VAL, TYPE_VAL, TYPE_VAL), defop(SENDVAL, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), - defop(SENDDAT, 1, TYPE_IMM, TYPE_NONE, TYPE_NONE) + defop(SENDDAT, 1, TYPE_IMM, TYPE_NONE, TYPE_NONE), + defop(WF_DISARM, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE) }; /************************************************************************* @@ -678,10 +679,15 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc) check(read_val(env, &ins, 1, &a1)); upsilon_load_waveform(env, a0, a1); break; - case CREOLE_WF_EXEC: + case CREOLE_WF_ARM: check(read_val(env, &ins, 0, &a0)); check(read_val(env, &ins, 1, &a1)); - upsilon_exec_waveform(a0, a1); + check(read_val(env, &ins, 2, &a2)); + upsilon_arm_waveform(a0, a1, a2); + break; + case CREOLE_WF_DISARM: + check(read_val(env, &ins, 0, &a0)); + upsilon_arm_waveform(a0); break; case CREOLE_SENDVAL: check(read_val(env, &ins, 0, &a0)); diff --git a/creole.h b/creole.h index 4f8256d..7e234d1 100644 --- a/creole.h +++ b/creole.h @@ -53,9 +53,10 @@ enum creole_opcode { CREOLE_CLOOP_READ = 16, CREOLE_CLOOP_WRITE = 17, CREOLE_WF_LOAD = 18, - CREOLE_WF_EXEC = 19, + CREOLE_WF_ARM = 19, CREOLE_SENDVAL = 20, CREOLE_SENDDAT = 21, + CREOLE_WF_DISARM = 22, CREOLE_OPCODE_LEN }; diff --git a/upsilon_creole.h b/upsilon_creole.h index eff20a3..242d14f 100644 --- a/upsilon_creole.h +++ b/upsilon_creole.h @@ -25,6 +25,8 @@ creole_word upsilon_control_loop_write(creole_word high_val, creole_word code); creole_word upsilon_load_waveform(struct creole_env *env, creole_word slot, creole_word db); -creole_word upsilon_exec_waveform(creole_word slot, creole_word dac); +creole_word upsilon_arm_waveform(creole_word slot, creole_word dac, + creole_word wait); +creole_word upsilon_disarm_waveform(creole_word slot); creole_word upsilon_sendval(creole_word num); creole_word upsilon_senddat(struct creole_env *env, creole_word db);