MIDI/80 is a MIDI Sound & MIDI Interface card for the TRS-80 Model 1, III, and 4.

MIDI/80 Model 1

TRS-80 Model with Expansion Interface, MIDI/80, and Orchestra 85 replica:

MIDI/80 Model 1

TRS-80 Model III with MIDI/80 and FreHD HD emulator connected to the MIDI/80 expansion port pass-through edge connector:

MIDI/80 Model III

MIDI/80 on a TRS-80 Model 4 with TRS-IO++:

MIDI/80 Model 4

Features

MIDI/80 offers:

Technical Details

Demo Videos

You can get a better understanding of MIDI/80's capabilities and features by watching some of these YouTube demo videos:

Overview & Usage

Connect the IDC box header at the bottom to your TRS-80 Model.

IDC Box Header Connector

Use the pass-through edge connector to connect other hardware (e.g., the Model 1 Expansion Interface, or a FreHD) to MIDI/80.

MIDI/80 requires a dedicated external 5V standard center-positive "wall wart" power supply (1A is sufficient).

It is recommended to power-on MIDI/80 before the other TRS-80 equipment.

Installation Notes

Short Cable Short Cable

MIDI/80 Model III b

Moreover, it is important that expansion cards connected to MIDI/80's pass-through connector use a fully connected 50pin ribbon cable! This is necessary in order to avoid crosstalk, as every other strand of the 50pin ribbon cable is GND. It was found that the 50pin card edge connector of an Orchestra 90 replica board using only a 40pin ribbon cable (hence, 10 pins of the 50pin card edge connector were left non-connected to MIDI/80's pass-through connector, as Orchestra 90 doesn't require these signals for operations) resulted in MIDI/80 databus read failures. Switching to a fully connected 50pin ribbon cable fully resolved the issue.

Operating MIDI/80

MIDI/80 is equipped with a RESET button

Reset Button BluePill

a 4-position DIP switch, and 5 activity / status LEDs:

Five LEDS

Please note the following:

  1. The RESET button is on the BluePill microcontroller.

    Use the RESET button at any time; the TRS-80 is not affected by a reset. A push to the RESET button will also reset the on-board Waveblaster module and clear (turn off) any potentially stuck notes.

  2. The five activity & status LEDs indicate the following:

    • Upon RESET / Power On, the LEDs are tested for function and then briefly display the current DIP switch setting.

      This is useful for testing proper operation of the DIP switch (i.e., that all switches are working). The default DIP SWITCH setting is ON-ON-OFF-ON.

    • At runtime, the LEDs have the following function:

      • DATA-IN: Data is received from the TRS-80 via IO port 8.
      • MIDI-IN: MIDI data is received via the MIDI IN DIN socket.
      • DATA-OUT: Data is sent from the BluePill microcontroller to the TRS-80. The repective IO ports are 8 and 9 (see below).
      • S2-OUT: MIDI data is sent from the BluePill microcontroller to the internal Waveblaster connector.
      • MIDI-OUT: MIDI data is sent from the BluePill microcontroller over the MIDI OUT DIN socket.
  3. The four DIP switches are used for selecting the operating mode of MIDI/80.

    From left to right, the switches 1 to 4 have the following functions (note that there are also small labels under the buttons on the PCB silkscreen). In the following, x is either M1 (for the Model 1 version), or M3 (for the Model III, Model 4 version):

    • x --> S2: Determines if data received over IO port 8 from the TSR-80 is forwarded to the internal Waveblaster plugin module. Default setting is on.

    • x --> OUT: Determines if data received over IO port 8 from the TSR-80 is forwarded to the MIDI OUT DIN socket. Default setting is on.

    • IN --> S2: MIDI/80 standalone GM expander mode. Determines if data received over the MIDI IN DIN socket is automatically forwarded to the Waveblaster plugin module. Default setting is off.

      This is a function of the MIDI/80 firmware, i.e., the BluePill is doing this autonomously, without TRS-80 involvement. You only need a 5V power supply and an external amplifier, and can use MIDI/80 as a very capabale GM expander module for your Waveblaster sound module with this mode.

    • IN --> OUT: Determines if data received over the MIDI IN DIN socket is automatically forwarded to the MIDI OUT DIN socket.

      This, again, is a function of the MIDI/80 firmware, i.e., the BluePill is doing this autonomously, without TRS-80 involvement. It basically implements a MIDI THRU function; note that this function is not exclusive to the MIDI OUT socket. The TRS-80 can also still send out data over it.

Note: After a change to the DIP switch, a RESET is required in order for the change to become effective (use the RESET button on the BluePill).

Operating System Notes

On all systems, LDOS 5.3.1 is the default operating system for which the software is developed. Model 4 users must configure their machine via SYSTEM (SLOW) for MIDI/80.

The MIDI/80 programming examples in BASIC are written in LBASIC (LDOS BASIC) and are not guaranteed to work with the other BASIC dialects.

All other programs are written in Z80 assembly using George Phillips' Zmac assembler and trs80gp emulator as development toolchain.

Theory of Operation

MIDI/80 implements a FIFO queue with a capacity of 256 bytes for buffering incoming MIDI messages which are received over the MIDI IN DIN socket. The status of this buffer can be queried by reading from IO port 9 - a 1 indicates MIDI bytes are queued for retrieval from the buffer, and a 0 indicates an empty buffer. MIDI bytes can then be retrieved from the FIFO by reading from IO port 8.

If the standalone mode is turned on, i.e., DIP switch 3 is set to on, then all MIDI data bytes received over MIDI IN are also automatically forwarded to the Waveblaster module.

If MIDI THRU is turned on, i.e., DIP switch 4 is set to on, then MIDI data bytes received over MIDI IN are also automatically forwarded to the MIDI OUT DIN socket.

MIDI data bytes received by MIDI/80 from the TRS-80 via port 8 will not be buffered, but, depending on the settings of DIP switches 1 and 2, immediately be forwarded to either the Waveblaster pluging module, and/or the MIDI OUT DIN socket, or both or none. Both routes can be turned on or off individually, and independendly of each other.

MIDI/80 is implemented using 4 ISR (Interrupt Service Routines). There is a pair of ISRs for handling reads and write to TRS-80 IO port 8, and one ISR for handling IO port 9 reads. Another ISR is responsible for putting MIDI bytes received via the MIDI IN socket into the FIFO buffer. The MIDI ISR has priority over the ISRs serving the TRS-80 IO - the Z80 CPU may be put into WAIT state in case these events happen concurrently.

The BluePill does the heavy lifting, but requires some help from three additional glue logic support chips in order to meet the strict bus timing constraints of the TRS-80 with a "not quite fast enough" microcontroller such as the BluePill @ 72 MHz:

In combination, the 74LS244 and 74LS374 greatly relax the timing constraints on the BluePill ISRs. Without them, the design would not work.

MIDI/80 Software for the TRS-80

Note that many of these programs are demonstrated on the YouTube MIDI/80 channel (see above).

There is a set of MIDI/80 song disks containing GM songs for playback, simply for listening pleasure. These also serve as standalone demos. See below for info on how to make your own songs for MIDI/80. The software is under development, and there might be frequent or infrequent updates in the future.

The programs on the MIDI80.DSK, MIDI80_DSK.HFE Model III disk images are:

There is also some software that was written by George Phillips that requires an Orchestra 85 (Model 1) or Orchestra 90 (Model III, Model 4) soundcard:

Creating Your Own Songs for MIDI/80 Playback

Use the .MID to .BIN file converter. The converter is written in Python, and provided as a Windows executable here.

MID Converter 1

MID Converter 2

There are a few MIDI files here you can start with.

The converter will convert a MIDI .MID file into a set of 16 KB .BIN fragments. A fully expanded Model 1 allows you to fit about ~43 KBs of song data into memory.

In order to create your own MYSONG/CMD file, proceed as follows.

  1. Edit the CANYON.ASM Zmac assembly program as a blueprint. First, make a copy, give it a reasonable name, e.g., MYSONG.ASM.

    Then, change the line

    `title2        defb  '    CANYON.MID', ENTER` 
  • by replacing CANYON.MID with your song title, e.g., MYSONG.MID

  • Include as many of the the generated .BIN fragments of your song as possible by replacing the following lines

    incbin "./canyon0.BIN"
    incbin "./canyon1.BIN"
    incbin "./canyon2.BIN"      
  • with the proper file names for your song:

    incbin "./mysong0.BIN"
    incbin "./mysong1.BIN"
    ...
    

    Next, download and install Zmac as well as trs80gp, and assemble the program from the command line as follows:

    zmac$ ./zmac maysong.asm 

    Then, test the generated CMD / program in the trs80gp emulator:

    zmac$ ./trs80gp -ld zout/mysong.cmd
    
    1. Note that the playback program display RAM region occupied by the binary song data:

      RAM Region

      The song data must stay below $FFFF; if the value of the display end address is smaller than the start address, then the memory "wrapped around" and the song data did not fit. LDOS will not allow loading the program in this case (as it would need to overwrite the ROM, which is impossible).

    Note: You can use TRSTOOLS to add the generated MYSONG.CMD to a DSK image, and convert this DSK image into HFE format using HxC.

    MIDI/80 Programming

    Have a look at the LBASIC demo programs on the DSK images, and the DRUMS/CMD assembly program.

    MIDI/80 Hardware

    This section provides all necessary files and information for a DIY build of MIDI/80. Costs are in the ~35 USD range (without a Waveblaster module; add another ~40 USD for the S2, but prices vary).

    Schematics

    Model 1 Version (PDF)

    Schematics M1

    Model III / 4 Version (PDF)

    Schematics M1

    Bill of Material (BOM)

    PCB Gerbers

    The PCB Gerbers are contained in Zip archives and can directly be send-off to major PCB manufacturers (PCBWay, Seeed, OshPark, JLCPCB):

    Model 1 PCB

    Model III / 4 PCB

    Assembly Notes

    Note the proper IDC header orientation, i.e., the position of the "notch" differs between Model 1 and Model III / 4 version!

    IDC Box Header Notch Position

    Firmware

    Here are the required firmware files for the GAL16V8 and BluePill microcontroller.

    Model 1 Version:

    Model III / 4 Version:

    Installation of the STM32 FreRTOS and GCC development toolchain is explained in Warren Gay's book "Beginning STM32 - Developing with FreRTOS, libopencm3 and GCC", which I can recommend.

    With the development toolchain installed and configured correctly, and an ST-Link V2 USB programmer connected, the BluePill firmware can be compiled and uploaded onto the BluePill simply by executing

    make clean
    make
    make flash 

    from the command line. I am using Linux for this, even though CYGWIN is mentioned as a possibilty in the aforementioned book.

    Acknowledgements