🔊
SpinCAD Designer
  • Welcome to SpinCAD Designer!
  • Tutorials
    • Getting Started
    • The User Interface
    • Creating a patch
  • Menus
    • File
    • Edit
    • Loop
  • Blocks
    • I/O Mix
    • Wave Shaper
    • Dynamics
      • RMS Lim/Exp
    • Controls
      • Introduction to control signals and blocks
      • Two-stage
      • Invert, Power, Two-Stage, and Vee
      • Ratio
      • Scale/Offset
      • Clip and Tremolizer
      • Envelope
      • Slicer and Smoother
      • Tap Tempo
    • Pitch
      • The Pitch Offset Blocks
  • Design Concepts
    • Basic LFOs in SpinCAD Designer
    • Deep dive into the Three-Tap Delay block
      • Deep dive into the ThreeTap Delay, part 1
      • Deep dive into the ThreeTap delay, part 2
      • Deep dive into the ThreeTap Delay, part 3
    • Analyzing the Spin auto-wah peak detector
      • The Spin auto-wah peak detector, part I
      • The Spin auto-wah peak detector, part II
      • The Spin auto-wah peak detector, part III
    • Intro to the "Dattorro" reverb structure
    • Analyzing the Spin Mini Reverb
      • Analyzing the Spin "Mini Reverb" part 1
      • Analyzing the Spin "Mini Reverb" part 2
      • Analyzing the Spin "Mini Reverb" part 3
  • Patches
    • Making a tremolo patch
    • Making a vibrato/chorus patch
    • Making a pitch shifting delay
    • Multi-head "drum/tape" delay
    • 4-phase LFO driven mixer
  • Tips and Tricks
    • Editing tips for fast patch creation
    • Programming the FV-1 EEPROM with your code
    • Optimizing FV-1 assembly code generated by SpinCAD Designer
  • Beneath the Hood
    • How SpinCAD Builder works
    • Analyzing a simple SpinCAD Builder file
Powered by GitBook
On this page
  1. Beneath the Hood

Analyzing a simple SpinCAD Builder file

PreviousHow SpinCAD Builder works

Last updated 1 year ago

We'll start with an easy one. The "Absolute Value" block has only one instruction, "absa".

We'll go one line at a time.

@name AbsoluteValue

@name sets the name of the block.

@color "0xf2f224"

@color sets the 24-bit value for the block's color.

@controlInput input Input

@controlInput defines a register variable name and displayed pin name for a control input. Control inputs are located on the left side of a block.

@controlOutput output1 Output

@controlOutput defines a register variable name and displayed pin name for a control input. Control outputs are located on the right side of a block.

equ output1 reg0

This is the first Spin ASM statement. We have to a to the very least, declare a register for each output pin, whether audio or control, in the block. Note that the actual register that will be used will depend on the other blocks being used and how many registers were allocated prior to this one.

The input pin variable is reserved to be replaced by a register value from the previous block in the model after the blocks are sorted into a model.

@isPinConnected Input

@isPinConnected lets you control blocks of code generation depending on whether certain pins are connected. In this case, there is only one input pin, so we see if that's connected. If not, we don't generate any code at all. Note that there are also @else (optional) and @endif statements which you will have to line up to be sure about what is or isn't going to be generated.

rdax input,1 ;read input signal

here we get the value from the previous block into the ACC.

absa

Oh, hooray! absa to the rescue!

wrax output1,0

Write the result in the ACC to the output register. I left out the comment in the actual source code as it's obviously left over from something else and makes no sense!

@setOutputPin Output output1

@setOutputPin does something special, I'm sure. I just don't remember exactly what it is. The graphical editor does need to distinguish input and output pins so as to only allow a connection between one of each. No input-input or output-output. So that might be it.

@endif

@endif is the matching conditional for the @isPinConnected Input statement above.

So, that's it! This example has no control panel.

It's trivial examples like this one that highlight the overhead of SpinCAD generated code. We really probably only needed one instruction but got three and used up an extra register. Larger blocks suffer less proportionately, as it's still just an instruction to read an input, one to write the output, and a register per output. That said, if needed, those things are not that hard to optimize by hand.

Source code can be found .

here