Close

#RetroChallenge @RetroChallenge Update 4

A project log for A Retro-Authentic Microtronic Emulator

Compute like its 1981 - hex on a 6digit 7segment LED bubble display! (One of the) RetroChallenge 2021/10 "Winners"

michael-wesselMichael Wessel 10/17/2021 at 16:590 Comments

In this episode, I extend the pattern-based drum computer to full 16 steps / beats (4 bars x 4 beats),  and tailor for real time drum pattern input (like a real drum computer).

This requires inputting data from the keypad using the KIN (Keyboard Input) op-code, whilst playing back the pattern, and hence isn't possible with the standard Microtronic KIN. Thus, I implemented a non-blocking KIN behavior. Utilizing 2 more vacuous op-codes, I can now toggle between the standard blocking KIN input behavior, and the new non-blocking behavior.

The op-codes for determining the KIN mode of operation are 3F0 (blocking KIN mode) and 3F1 (non-blocking KIN mode). By default, the Microtronic only uses blocking KIN. The vacuous op-codes 3F0 and 3F1 are idempotent immediate AND (ANDI) op-codes, i.e., the operand 0xF = 0b1111 = 15 is idempotent for 4bit registers, and hence, no (existing or new) program would ever use them. So it is safe to assign the mode toggling extra side-effect to them.

In general, the following vacuous op-codes are available for side effect extension:

I have used a few of these by now for various side effects (e.g., play the MIDI drum in registers 4 to 7 via 044, 055, 066, 077; enable MIDI output 022, and so on). It is good that I have so many vacuous op-codes available, and it is interesting to find a good "balance" and clever allocation of extra side effect semantics to those that would be most useful for programs. Obviously, this is currently driven by the needs of the drum computer program. But in a future project, these could be used for different purposes (e.g., to drive a text character display, a speech synthesizer, or what have you).

Moreover, given that we now have 16 beats in the drum pattern, we need register memory to store these based on user input, and I am explaining how to utilize the Microtronic's Extra Register Set to help accommodate them.

The Microtronic has 16 foreground and 16 background (or "extra") registers, and they can be exchanged / swapped, similar to the Z80. The designers of the original Microtronic instruction set were very insightful, anticipating the needs of programmers. Since these 32 registers as the only available program-writable memory, good control over these is important.

For the drum computer, I am now using the upper 8 registers (8 to F) from the "normal" and "extra" register sets to store 8 + 8 = 16 steps / beats, exchanging them after 8 beats via the ingenious EXRM (FOE) = "Exchange Most Significant Registers" op-code. Only the upper 8 registers are swapped, hence leaving the lower main program registers untouched (e.g., the registers I am using to store bar and beat number, the scratchpad registers for KIN input, etc.). There are also op-codes that swap the whole register set, or only the lower half (EXRA, EXRL). Ingenious instruction set, and definitely not something you would expect in a "toy" computer from 1981! I really respect the original designers of this instruction set for being so insightful into the needs of the programmers; they certainly ate their own dog food in order to deliver something very useful.

Here is the real time drum computer program:
# 16 Step Pattern-Based Real Time Drum Computre
# RetroChallenge 2021/10 - Michael Wessel 

@ 00 

022 
3f1
f62

# bar 1, count 1

512
113
084
ff4
048
044
b50

# bar 1 & 2, count 2

f01
123
095
ff5
059
055
b50

# bar 1 & 2, count 3

f01
133
0a6
ff6
06a
066
b50

# bar 1 & 2, count 4

f01
143
0b7
ff7
07b
077
b50

# bar 2 & 3, count 1

512
113
0c4
ff4
04c
044
b50

# bar 2 & 3, count 2

f01
123
0d5
ff5
05d
055
b50

# bar 2 & 3, count 3

f01
133
0e6
ff6
06e
066
b50

# bar 2 & 3, count 4

f01
143
0f7
ff7
07f
077
b60

# exchange 8 upper registers <-> extra register set 

f0e

# bar count AND 3  

332

# loop 

c03

# in-between count delays 

@ 50

f01
f01
f07

# after last count delay (shorter because of FOE and AND 3) 

@ 60 

f07 

Discussions