#RetroChallenge @RetroChallenge Update 5

A project log for A Retro-Authentic Microtronic Emulator

Compute like its 1981 - hex on a 6digit 7segment LED bubble display! @RetroChallenge 2021/10 MIDI DRUMS Project

Michael WesselMichael Wessel 10/21/2021 at 18:440 Comments

In this episode, we are making the drum computer 3-channel polyphonic!

This requires some major rewrite and additional op-code side effect extensions. The 2x 16 registers obviously aren't enough for a 3-channel polyphonic 16 step sequencer, so we added some extra 3x16 array memory to the emulator. The registers R0 and R1 are used as index / address registers for the array memory. In fact, R0 would have been sufficient for 16 positions, but the array memory could be larger if I only had more SRAM available, at least conceptually ;-) 

To work with the new array memory, I equipped a number of vacuous ANDI op-codes (3Fx) with extra side-effects to provide R0, R1 index increment, load from the array at the current index into Microtronic registers, and store Microtronic registers back into the array memory at the current index positions. Three registers are loaded / stored at the same time with one instruction (the array has shape 3x16).

Note that the official effect of the 3Fx op-code is to perform a bit-wise AND of 0xF with register x, which is idempotent for 4bit registers, so no program would ever use any of these 3Fx op-codes.

The new side-effects for ANDI with F are:

Drum computer code:

# 3 voice polyphonic drum computer 

00 022
01 3f1
02 f44

# r0, r1 are array memory index registers (currently, only r0 matters - 16 steps)  
# reset index to 00 
03 101 
04 100
# use r4 to display current index on display (copy from r0) 
05 104

# load current array memory content at r0, r1 index into r5, r6, r7
06 3f5 
# DIN input into rE - put HI on DIN 1, 2, 3 for channel select! 
07 fde  

# channel 1? 
08 91e 
09 e0f
# channel 2? 
0a 92e 
0b e14 
# channel 3? 
0c 94e 
0d e17     
0e c18

# input channel 1 -> non-blocking KIN into r5
# use NOPs so that all branches take equal number of clock cycles 
0f ff5
10 f01
11 f01
12 f01
13 c18

# input channel 2 -> r6
14 ff6
15 f01
16 c18

# input channel 3 -> r7
17 ff7

# output r5, r6, r7 MIDI drum numbers to MIDI output 
18 055
19 066
1a 077   

# store current r5, r6, r7 values back into array memory 
1b 3f6 
# increment array memory index / address (r0, r1) 
1c 3f2 
# output r0 index to DOT 
1d fe0 
# copy r0 index to R4 so that we can see it on the display 
1e 004 
# loop 
1f c06

Here is a video of the drum computer in action: