diff --git a/asm/creole.py b/asm/creole.py index bdf8ea7..0ba4cf0 100644 --- a/asm/creole.py +++ b/asm/creole.py @@ -214,8 +214,8 @@ class Instruction(Enum): READ_DAC = 13, "_render_default", ArgType.VAL, ArgType.REG WRITE_DAC = 14, "_render_default", ArgType.VAL, ArgType.VAL SLEEP = 15, "_render_default", ArgType.VAL - CLOOP_READ = 16, "_render_default", ArgType.VAL, ArgType.REG - CLOOP_WRITE = 17, "_render_default", ArgType.VAL, ArgType.VAL + 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 SENDVAL = 20, "_render_default", ArgType.VAL diff --git a/creole.c b/creole.c index 37c444b..aa80c42 100644 --- a/creole.c +++ b/creole.c @@ -654,13 +654,19 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc) break; case CREOLE_CLOOP_READ: check(read_val(env, &ins, 0, &a0)); - a1 = upsilon_control_loop_read(a0); - check(creole_reg_write(env, ins.w[1], a1)); + check(read_val(env, &ins, 0, &a1)); + check(read_val(env, &ins, 0, &a2)); + if (valid_reglen(env, a1) && valid_reglen(env, a2)) { + upsilon_control_loop_read(env->reg + a1, + env->reg + a2, + a0); + } break; case CREOLE_CLOOP_WRITE: check(read_val(env, &ins, 0, &a0)); - check(read_val(env, &ins, 1, &a1)); - upsilon_control_loop_write(a0, a1); + check(read_val(env, &ins, 0, &a1)); + check(read_val(env, &ins, 0, &a2)); + upsilon_control_loop_write(a0, a1, a2); break; case CREOLE_WF_LOAD: check(read_val(env, &ins, 0, &a0)); diff --git a/upsilon_creole.h b/upsilon_creole.h index cf32c47..eff20a3 100644 --- a/upsilon_creole.h +++ b/upsilon_creole.h @@ -17,8 +17,12 @@ creole_word upsilon_get_adc(creole_word adc); creole_word upsilon_get_dac(creole_word adc); creole_word upsilon_write_dac(creole_word dac, creole_word val); creole_word upsilon_sleep(creole_word usec); -creole_word upsilon_control_loop_read(creole_word reg); -creole_word upsilon_control_loop_write(creole_word reg, creole_word val); +creole_word upsilon_control_loop_read(creole_word *high_reg, + creole_word *low_reg, + creole_word code); +creole_word upsilon_control_loop_write(creole_word high_val, + creole_word low_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);