From 13c67aba9a3ed72326cfa308b7c3e77e3e9934ed Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Sun, 2 Apr 2023 21:37:28 +0000 Subject: [PATCH] add more commands --- asm/creole.py | 10 +++++++++- creole.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- creole.h | 8 ++++++++ upsilon_creole.h | 9 +++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/asm/creole.py b/asm/creole.py index 34f8a63..60cb968 100644 --- a/asm/creole.py +++ b/asm/creole.py @@ -218,9 +218,17 @@ class Instruction(Enum): CLOOP_WRITE = 17, "_render_default", ArgType.VAL, ArgType.VAL, ArgType.VAL WF_LOAD = 18, "_render_default", ArgType.VAL, ArgType.DAT 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 + WF_DISARM = 22, "_render_default", ArgType.VAL + TAKE_ADC = 23, "_render_default", ArgType.VAL, ArgType.VAL + RELEASE_ADC = 24, "_render_default", ArgType.VAL + TAKE_DAC = 25, "_render_default", ArgType.VAL, ArgType.VAL + RELEASE_DAC = 26, "_render_default", ArgType.VAL + TAKE_WF = 27, "_render_default", ArgType.VAL, ArgType.VAL + RELEASE_WF = 28, "_render_default", ArgType.VAL + TAKE_CLOOP = 29, "_render_default", ArgType.VAL + RELEASE_CLOOP = 30, "_render_default" def __int__(self): """ Returns the opcode associated with the Instruction. diff --git a/creole.c b/creole.c index d5994cb..000fa0d 100644 --- a/creole.c +++ b/creole.c @@ -65,7 +65,15 @@ static const struct { 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(WF_DISARM, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE) + defop(WF_DISARM, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), + defop(TAKE_ADC, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE), + defop(RELEASE_ADC, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), + defop(TAKE_DAC, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE), + defop(RELEASE_DAC, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), + defop(TAKE_WF, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE), + defop(RELEASE_WF, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), + defop(TAKE_CLOOP, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE), + defop(RELEASE_CLOOP, 0, TYPE_NONE, TYPE_NONE, TYPE_NONE) }; /************************************************************************* @@ -687,7 +695,7 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc) break; case CREOLE_WF_DISARM: check(read_val(env, &ins, 0, &a0)); - upsilon_arm_waveform(a0); + upsilon_disarm_waveform(a0); break; case CREOLE_SENDVAL: check(read_val(env, &ins, 0, &a0)); @@ -697,6 +705,40 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc) check(read_val(env, &ins, 0, &a0)); upsilon_senddat(env, a0); break; + case CREOLE_TAKE_ADC: + check(read_val(env, &ins, 0, &a0)); + check(read_val(env, &ins, 0, &a1)); + upsilon_take_adc(a0, a1); + break; + case CREOLE_RELEASE_ADC: + check(read_val(env, &ins, 0, &a0)); + upsilon_release_adc(a0); + break; + case CREOLE_TAKE_DAC: + check(read_val(env, &ins, 0, &a0)); + check(read_val(env, &ins, 0, &a1)); + upsilon_take_dac(a0, a1); + break; + case CREOLE_RELEASE_DAC: + check(read_val(env, &ins, 0, &a0)); + upsilon_release_dac(a0); + break; + case CREOLE_TAKE_WF: + check(read_val(env, &ins, 0, &a0)); + check(read_val(env, &ins, 0, &a1)); + upsilon_take_wf(a0, a1); + break; + case CREOLE_RELEASE_WF: + check(read_val(env, &ins, 0, &a0)); + upsilon_release_wf(a0); + break; + case CREOLE_TAKE_CLOOP: + check(read_val(env, &ins, 0, &a0)); + upsilon_take_cloop(a0); + break; + case CREOLE_RELEASE_CLOOP: + upsilon_release_cloop(); + break; default: rcode = CREOLE_STEP_UNKNOWN_OPCODE; } diff --git a/creole.h b/creole.h index 7e234d1..1e1e381 100644 --- a/creole.h +++ b/creole.h @@ -57,6 +57,14 @@ enum creole_opcode { CREOLE_SENDVAL = 20, CREOLE_SENDDAT = 21, CREOLE_WF_DISARM = 22, + CREOLE_TAKE_ADC = 23, + CREOLE_RELEASE_ADC = 24, + CREOLE_TAKE_DAC = 25, + CREOLE_RELEASE_DAC = 26, + CREOLE_TAKE_WF = 27, + CREOLE_RELEASE_WF = 28, + CREOLE_TAKE_CLOOP = 29, + CREOLE_RELEASE_CLOOP = 30, CREOLE_OPCODE_LEN }; diff --git a/upsilon_creole.h b/upsilon_creole.h index 242d14f..9c9777b 100644 --- a/upsilon_creole.h +++ b/upsilon_creole.h @@ -30,3 +30,12 @@ creole_word upsilon_arm_waveform(creole_word slot, creole_word dac, 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); + +creole_word upsilon_take_adc(creole_word slot, creole_word timeout); +creole_word upsilon_release_adc(creole_word slot); +creole_word upsilon_take_dac(creole_word slot, creole_word timeout); +creole_word upsilon_release_dac(creole_word slot); +creole_word upsilon_take_wf(creole_word slot, creole_word timeout); +creole_word upsilon_release_wf(creole_word slot); +creole_word upsilon_take_cloop(creole_word timeout); +creole_word upsilon_release_cloop(void);