77 lines
3.1 KiB
Plaintext
77 lines
3.1 KiB
Plaintext
NOTES: Slightly out of date -- I haven't added the Imm mov mode or the ix register yet
|
|
|
|
Registers:
|
|
$a0..9: Corresponds to input 0 through 9
|
|
$l0..9: "Locals" 0..9
|
|
$z0..9: Corresponds to output 0 through 9
|
|
$r0..255: Auxiliary uint64_ts
|
|
|
|
$ix: Index base
|
|
|
|
Channels:
|
|
A channel is a vector of samples with a known "formal range" --
|
|
this formal range includes its start (relative to the whole song)
|
|
and its basic length.
|
|
|
|
You can use outputs that aren't exposed as part of your device.
|
|
This can be a good place to hide wavetables and stuff.
|
|
They just won't be returned.
|
|
|
|
Memory model:
|
|
$a0..9, $l0..9, and $z0..9 correspond to arrays
|
|
When you read $a0, it reads channel a0 at $ix+a0.formal_start+a0.loop_start
|
|
When you write $z0, it writes channel z0 at $ix+z0.formal_start+z0.loop_start
|
|
|
|
Unknown positions are 0.
|
|
|
|
A channel has an informal_start and an informal_length which initially match
|
|
formal_start and formal_length.
|
|
|
|
Writing to a position outside of informal_start..informal_start+informal_length
|
|
extends the bounds.
|
|
|
|
In looped mode, then the ultimate indices are wrapped to
|
|
(formal_start+loop_start..formal_start+loop_start+loop_length)
|
|
and all other behavior remains the same as above.
|
|
|
|
Instructions:
|
|
mov|add|xor ($l0..9, $z0..9, $r0..255), ($a0..9, $l0..9, $z0..9, $r0..255)
|
|
Copy value, add value, or xor value.
|
|
|
|
range ($a0..9, $l0..9, $z0..9), loop_start, loop_length
|
|
Start and length are immediate values.
|
|
If length is nonzero, the channel is in "looped" mode.
|
|
|
|
inp ($a0..9, $l0..9, $z0..9)
|
|
Push a copy of the channel to the stack for "invoke".
|
|
The channel will be sliced:
|
|
- if loop_start is zero and loop_length is zero:
|
|
The formal range runs from formal_start to formal_start+formal_length.
|
|
The informal range runs from informal_start to informal_start+informal_length.
|
|
- if loop_start is nonzero and loop_length is zero:
|
|
The formal range runs from formal_start+loop_start to formal_start+formal_length
|
|
The informal range runs from formal_start+loop_start to informal_start+informal_length
|
|
- if loop_length is nonzero:
|
|
The formal range runs from formal_start+loop_start to formal_start+loop_start+loop_length
|
|
The informal range is the same as the formal range.
|
|
|
|
dup
|
|
Duplicate an item from the invoke stack.
|
|
|
|
oup (mov|add|xor) ($l0..9, $z0..9)
|
|
Pop an output from the invoke stack and write it to an output channel or local.
|
|
|
|
All indexes from informal_start to informal_start+informal_length are written.
|
|
|
|
The instruction used to write can be mov, add, or xor
|
|
|
|
invoke device, n_inputs, n_outputs
|
|
Invoke the device by name (an immediate string)
|
|
Asserts that the device takes n_inputs inputs (an immediate integer) and n_outputs outputs (an immediate integer)
|
|
Asserts that there are actually n_inputs inputs on the stack.
|
|
After invoke, there will be n_outputs outputs on the stack.
|
|
They will be ordered such that the first call to oup produces the first output, the second produces the second,
|
|
and so on
|
|
|
|
exit
|
|
Exit the current procedure. |