| 1 | Buchla 700 Hardware Emulator
|
|---|
| 2 | ----------------------------
|
|---|
| 3 |
|
|---|
| 4 | This repository, buchla-emu.git, contains a software emulation of the
|
|---|
| 5 | Buchla 700's hardware.
|
|---|
| 6 |
|
|---|
| 7 | It is minimalistic; it emulates just enough of the hardware to be able
|
|---|
| 8 | to run the firmware from the companion repository, buchla-68k.git.
|
|---|
| 9 |
|
|---|
| 10 | We don't have access to original hardware, so this is our best guess
|
|---|
| 11 | based on the firmware source code published by Lynx Crowe - the
|
|---|
| 12 | firmware's developer - via Aaron Lanterman:
|
|---|
| 13 |
|
|---|
| 14 | http://lanterman.ece.gatech.edu/buchla700/
|
|---|
| 15 |
|
|---|
| 16 | See the buchla-68k.git repository for the firmware source code.
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 | Building the emulator
|
|---|
| 20 | ---------------------
|
|---|
| 21 |
|
|---|
| 22 | The emulator uses SDL2, an abstraction layer for low-level machine
|
|---|
| 23 | access on Linux, OS X, and Windows. It can be obtained from the
|
|---|
| 24 | project's website:
|
|---|
| 25 |
|
|---|
| 26 | https://libsdl.org/
|
|---|
| 27 |
|
|---|
| 28 | The SDL2 website also hosts the SDL2_net and SDL2_ttf projects, which
|
|---|
| 29 | add support for networking and TrueType fonts to SDL2
|
|---|
| 30 |
|
|---|
| 31 | SDL2_ttf, in turn, requires the FreeType library, which is available
|
|---|
| 32 | from the FreeType website:
|
|---|
| 33 |
|
|---|
| 34 | https://www.freetype.org/
|
|---|
| 35 |
|
|---|
| 36 | Currently, we build the emulator natively on Linux and OS X. The
|
|---|
| 37 | Windows version is cross-compiled on Linux using a x86_64-w64-mingw32
|
|---|
| 38 | cross-toolchain.
|
|---|
| 39 |
|
|---|
| 40 | For Linux and OS X, our Makefile expects all of the above libraries to
|
|---|
| 41 | reside in /opt/sdl2. This is how we typically install them:
|
|---|
| 42 |
|
|---|
| 43 | # Build and install FreeType first
|
|---|
| 44 |
|
|---|
| 45 | tar zxvf freetype-2.7.1.tar.gz
|
|---|
| 46 | cd freetype-2.7.1
|
|---|
| 47 | mkdir build
|
|---|
| 48 | cd build
|
|---|
| 49 |
|
|---|
| 50 | # Skip the optional features (compressed fonts, etc.) that would
|
|---|
| 51 | # create more dependencies
|
|---|
| 52 |
|
|---|
| 53 | ../configure --prefix=/opt/sdl2 \
|
|---|
| 54 | --without-zlib --without-bzip2 --without-png --without-harfbuzz
|
|---|
| 55 |
|
|---|
| 56 | make
|
|---|
| 57 | make install
|
|---|
| 58 |
|
|---|
| 59 | # Then build and install SDL2
|
|---|
| 60 |
|
|---|
| 61 | tar zxvf SDL2-2.0.5.tar.gz
|
|---|
| 62 | cd SDL2-2.0.5
|
|---|
| 63 | mkdir build
|
|---|
| 64 | cd build
|
|---|
| 65 |
|
|---|
| 66 | ../configure --prefix=/opt/sdl2
|
|---|
| 67 |
|
|---|
| 68 | make
|
|---|
| 69 | make install
|
|---|
| 70 |
|
|---|
| 71 | # Build and install SDL2_ttf, now that we have FreeType and SDL2
|
|---|
| 72 |
|
|---|
| 73 | tar zxvf SDL2_ttf-2.0.14.tar.gz
|
|---|
| 74 | cd SDL2_ttf-2.0.14
|
|---|
| 75 | mkdir build
|
|---|
| 76 | cd build
|
|---|
| 77 |
|
|---|
| 78 | ../configure --prefix=/opt/sdl2 \
|
|---|
| 79 | --with-sdl-prefix=/opt/sdl2 --with-freetype-prefix=/opt/sdl2
|
|---|
| 80 |
|
|---|
| 81 | make
|
|---|
| 82 | make install
|
|---|
| 83 |
|
|---|
| 84 | # Build and install SDL2_net last
|
|---|
| 85 |
|
|---|
| 86 | tar zxvf SDL2_net-2.0.1.tar.gz
|
|---|
| 87 | cd SDL2_net-2.0.1
|
|---|
| 88 | mkdir build
|
|---|
| 89 | cd build
|
|---|
| 90 |
|
|---|
| 91 | ../configure --prefix=/opt/sdl2 --with-sdl-prefix=/opt/sdl2
|
|---|
| 92 |
|
|---|
| 93 | make
|
|---|
| 94 | make install
|
|---|
| 95 |
|
|---|
| 96 | # Build and install rtmidi
|
|---|
| 97 |
|
|---|
| 98 | tar zxvf rtmidi-3.0.0.tar.gz
|
|---|
| 99 | cd rtmidi-3.0.0
|
|---|
| 100 | mkdir build
|
|---|
| 101 | cd build
|
|---|
| 102 |
|
|---|
| 103 | ../configure --prefix=/opt/rtmidi
|
|---|
| 104 |
|
|---|
| 105 | make
|
|---|
| 106 | make install
|
|---|
| 107 |
|
|---|
| 108 | Now that we have everything in place, invoke
|
|---|
| 109 |
|
|---|
| 110 | make buchla
|
|---|
| 111 |
|
|---|
| 112 | from the top-level directory of this repository to build the emulator.
|
|---|
| 113 |
|
|---|
| 114 | The cross-build for Windows is done similarly, with the following
|
|---|
| 115 | differences when configuring the libraries:
|
|---|
| 116 |
|
|---|
| 117 | * We use "--prefix=/opt/sdl2-win" instead of "--prefix=/opt/sdl2",
|
|---|
| 118 | so that the Windows versions of the libraries go to a different
|
|---|
| 119 | directory. That's where our Makefile expects to find them when
|
|---|
| 120 | cross-building.
|
|---|
| 121 |
|
|---|
| 122 | * We additionally specify "--host=x86_64-w64-mingw32" to enable
|
|---|
| 123 | cross-compilation.
|
|---|
| 124 |
|
|---|
| 125 | Then, to cross-build the emulator, invoke
|
|---|
| 126 |
|
|---|
| 127 | make buchla.exe WIN=1
|
|---|
| 128 |
|
|---|
| 129 | from the top-level directory of this repository. Defining the "WIN"
|
|---|
| 130 | variable selects the cross-toolchain and "/opt/sdl2-win" as the
|
|---|
| 131 | library directory.
|
|---|
| 132 |
|
|---|
| 133 | In addition to the emulator, we need to build the mkdisk utility,
|
|---|
| 134 | which we'll use to create a 720-KiB floppy disk image that can be read
|
|---|
| 135 | by the Buchla firmware.
|
|---|
| 136 |
|
|---|
| 137 | Building mkdisk works pretty much like building the emulator. On Linux
|
|---|
| 138 | and OS X, invoke
|
|---|
| 139 |
|
|---|
| 140 | make mkdisk
|
|---|
| 141 |
|
|---|
| 142 | from the top-level directory of this repository. To cross-build the
|
|---|
| 143 | Windows version, invoke
|
|---|
| 144 |
|
|---|
| 145 | make mkdisk.exe WIN=1
|
|---|
| 146 |
|
|---|
| 147 | instead.
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 | Running the emulator
|
|---|
| 151 | --------------------
|
|---|
| 152 |
|
|---|
| 153 | This is where this repository, buchla-emu, meets its companion
|
|---|
| 154 | repository, buchla-68k. We assume that you built the following files
|
|---|
| 155 | according to the instructions in the buchla-68k repository:
|
|---|
| 156 |
|
|---|
| 157 | bios.abs
|
|---|
| 158 | midas.abs
|
|---|
| 159 |
|
|---|
| 160 | Please copy (or symlink) them into the top-level directory of this
|
|---|
| 161 | repository, buchla-emu.
|
|---|
| 162 |
|
|---|
| 163 | bios.abs contains the Buchla 700's BIOS code. The file is loaded by
|
|---|
| 164 | the emulator directly to emulate the BIOS PROM.
|
|---|
| 165 |
|
|---|
| 166 | midas.abs is the MIDAS VII software. Unlike the BIOS, which resides in
|
|---|
| 167 | a PROM, it is loaded from a floppy disk. To create this floppy disk,
|
|---|
| 168 | we need the mkdisk utility.
|
|---|
| 169 |
|
|---|
| 170 | mkdisk expects to be run from inside the directory that contains
|
|---|
| 171 | midas.abs and produces a disk image file, buchla.disk in the same
|
|---|
| 172 | directory. For example, on Linux:
|
|---|
| 173 |
|
|---|
| 174 | ~/buchla-emu$ ls -l midas.abs
|
|---|
| 175 | lrwxrwxrwx 1 emu emu 23 Jul 30 18:07 midas.abs -> ../buchla-68k/midas.abs
|
|---|
| 176 | ~/buchla-emu$ ./mkdisk
|
|---|
| 177 | ~/buchla-emu$ ls -l buchla.disk
|
|---|
| 178 | -rw-r--r-- 1 emu emu 737280 Aug 6 09:44 buchla.disk
|
|---|
| 179 |
|
|---|
| 180 | Now we have everything in place to run the emulator. On Linux and OS X
|
|---|
| 181 | you can invoke it directly from the top-level directory of this
|
|---|
| 182 | repository:
|
|---|
| 183 |
|
|---|
| 184 | ~/buchla-emu$ ./buchla
|
|---|
| 185 |
|
|---|
| 186 | If you prefer to install the emulator elsewhere, be sure to copy the
|
|---|
| 187 | following files:
|
|---|
| 188 |
|
|---|
| 189 | buchla | buchla.exe emulator executable (.exe for Windows)
|
|---|
| 190 | ttf/vera-sans-mono.ttf emulator font
|
|---|
| 191 | bios.abs BIOS code
|
|---|
| 192 | buchla.disk disk image
|
|---|
| 193 |
|
|---|
| 194 | This also applies to copying the cross-compiled Windows emulator to a
|
|---|
| 195 | Windows machine.
|
|---|
| 196 |
|
|---|
| 197 | If you would like to keep the BIOS code, disk image, and font separate
|
|---|
| 198 | from the emulator executable, check out the emulator's -b, -d, and -f
|
|---|
| 199 | command line options. Use -h for an overview of all available options.
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 | Cross-debugging the firmware
|
|---|
| 203 | ----------------------------
|
|---|
| 204 |
|
|---|
| 205 | While the emulator is running, it listens on TCP port 12053 for
|
|---|
| 206 | incoming connections from a GDB cross-debugger. This allows for
|
|---|
| 207 | comfortable source-level debugging of the cross-compiled BIOS and
|
|---|
| 208 | MIDAS VII code, while it runs in the emulator.
|
|---|
| 209 |
|
|---|
| 210 | We assume that you have a GCC cross-toolchain in /opt/cross-m68k, as
|
|---|
| 211 | described in the buchla-68k repository. Based on that, we build a
|
|---|
| 212 | GDB cross-debugger:
|
|---|
| 213 |
|
|---|
| 214 | # If you haven't yet done so, add the cross-toolchain to your
|
|---|
| 215 | # PATH, so that the GDB build can find it.
|
|---|
| 216 |
|
|---|
| 217 | export PATH="/opt/cross-m68k/bin:${PATH}"
|
|---|
| 218 |
|
|---|
| 219 | tar zxvf gdb-7.12.tar.gz
|
|---|
| 220 | cd gdb-7.12
|
|---|
| 221 |
|
|---|
| 222 | mkdir build
|
|---|
| 223 | cd build
|
|---|
| 224 |
|
|---|
| 225 | ../configure --prefix=/opt/cross-m68k --target=m68k-none-elf
|
|---|
| 226 |
|
|---|
| 227 | make -j2
|
|---|
| 228 | make install
|
|---|
| 229 |
|
|---|
| 230 | The Buchla firmware uses its own (Atari-like) object and executable
|
|---|
| 231 | file format. However, the cross-toolchain and the cross-debugger
|
|---|
| 232 | support the ELF standard.
|
|---|
| 233 |
|
|---|
| 234 | When you built the BIOS and MIDAS VII software, you ended up with two
|
|---|
| 235 | files in the Buchla's executable file format, bios.abs and midas.abs.
|
|---|
| 236 | However, the cross-build process also produces matching ELF files,
|
|---|
| 237 | bios.elf and midas.elf, suitable for the cross-debugger.
|
|---|
| 238 |
|
|---|
| 239 | Depending on whether you would like to cross-debug the BIOS or MIDAS
|
|---|
| 240 | VII, you'd specify either bios.elf or midas.elf when invoking the
|
|---|
| 241 | cross-debugger.
|
|---|
| 242 |
|
|---|
| 243 | To follow along the following example, copy (or symlink) bios.elf and
|
|---|
| 244 | midas.elf from the buchla-68k repository into the top-level directory
|
|---|
| 245 | of this repository.
|
|---|
| 246 |
|
|---|
| 247 | In order to open a debug session for the BIOS, run the cross-debugger
|
|---|
| 248 | with bios.abs and connect it to the running emulator using GDB's
|
|---|
| 249 |
|
|---|
| 250 | target remote :12053
|
|---|
| 251 |
|
|---|
| 252 | command. 12053 is the port on which the emulator listens for incoming
|
|---|
| 253 | GDB connections.
|
|---|
| 254 |
|
|---|
| 255 | host:~/buchla-emu$ m68k-none-elf-gdb ./bios.elf
|
|---|
| 256 | GNU gdb (GDB) 7.12
|
|---|
| 257 | Copyright (C) 2016 Free Software Foundation, Inc.
|
|---|
| 258 | [...]
|
|---|
| 259 | (gdb) target remote :12053
|
|---|
| 260 | Remote debugging using :12053
|
|---|
| 261 | trwzsup () at rom/bios.s:832
|
|---|
| 262 | 832 move.l 0(a0,d0),d0 | Get routine address
|
|---|
| 263 | (gdb)
|
|---|
| 264 |
|
|---|
| 265 | From here on, everything is pretty much standard GDB, for example:
|
|---|
| 266 |
|
|---|
| 267 | (gdb) break pscan
|
|---|
| 268 | Breakpoint 1 at 0x105a64: file rom/romp.c, line 3403.
|
|---|
| 269 | (gdb) cont
|
|---|
| 270 | [...]
|
|---|
| 271 | (gdb) bt
|
|---|
| 272 | #0 pscan () at rom/romp.c:3403
|
|---|
| 273 | #1 0x00105e96 in main () at rom/romp.c:3587
|
|---|
| 274 | #2 0x00105fd6 in Croot (cp=0x0) at prolog/croot.c:141
|
|---|
| 275 | #3 0x00105f52 in start1 () at prolog/fsmain.s:59
|
|---|
| 276 | (gdb)
|
|---|
| 277 |
|
|---|
| 278 | In order to debug MIDAS VII, run the cross-debugger with midas.elf,
|
|---|
| 279 | instead:
|
|---|
| 280 |
|
|---|
| 281 | host:~/buchla-emu$ m68k-none-elf-gdb ./midas.elf
|
|---|
| 282 | GNU gdb (GDB) 7.12
|
|---|
| 283 | Copyright (C) 2016 Free Software Foundation, Inc.
|
|---|
| 284 | [...]
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 | Emulated hardware
|
|---|
| 288 | -----------------
|
|---|
| 289 |
|
|---|
| 290 | Here's what we emulate:
|
|---|
| 291 |
|
|---|
| 292 | * Motorola 68000 CPU. This is actually the Musashi CPU emulator by
|
|---|
| 293 | Karl Stenerud:
|
|---|
| 294 |
|
|---|
| 295 | https://github.com/kstenerud/Musashi
|
|---|
| 296 |
|
|---|
| 297 | * Motorola MC6840: Timers.
|
|---|
| 298 |
|
|---|
| 299 | * Rockwell R65C52: Serial console and MIDI ports.
|
|---|
| 300 |
|
|---|
| 301 | * Epson SED1335: LCD controller.
|
|---|
| 302 |
|
|---|
| 303 | * Intel 82716: Video chip.
|
|---|
| 304 |
|
|---|
| 305 | * National Semiconductor LMC835: Equalizer.
|
|---|
| 306 |
|
|---|
| 307 | * General Instrument AY-3-8910: A sound chip, which is not used for
|
|---|
| 308 | sound generation, but only for its I/O ports. It connects the CPU
|
|---|
| 309 | to the above equalizer chip.
|
|---|
| 310 |
|
|---|
| 311 | * Western Digital WD1772: Floppy disk controller.
|
|---|
| 312 |
|
|---|
| 313 | * A few LEDs.
|
|---|
| 314 |
|
|---|
| 315 | * Item X: A program running on a microcontroller. It converts the
|
|---|
| 316 | analog signals from the Buchla's controller pads to digital
|
|---|
| 317 | values.
|
|---|
| 318 |
|
|---|
| 319 | Neither the program, nor the microcontroller are known, but the
|
|---|
| 320 | protocol (known from the firmware source code) is pretty simple
|
|---|
| 321 | and self-explanatory.
|
|---|
| 322 |
|
|---|
| 323 | * Item Y: The actual sound generator, referred to by the firmware
|
|---|
| 324 | source code as "the FPU." This could actually be two chips:
|
|---|
| 325 |
|
|---|
| 326 | 1. One chip, maybe a DSP, for generating the 15 different
|
|---|
| 327 | parameter envelopes for each of the 12 voices:
|
|---|
| 328 |
|
|---|
| 329 | - 4x FM modulator (oscillator) frequency.
|
|---|
| 330 |
|
|---|
| 331 | - 6x FM modulator (oscillator) envelope.
|
|---|
| 332 |
|
|---|
| 333 | - 1x Output signal amplitude envelope.
|
|---|
| 334 |
|
|---|
| 335 | - 1x Output signal filter envelope.
|
|---|
| 336 |
|
|---|
| 337 | - 1x Output signal filter resonance envelope.
|
|---|
| 338 |
|
|---|
| 339 | - 1x Output signal stereo location.
|
|---|
| 340 |
|
|---|
| 341 | - 1x "Dynamics." (TBD - currently not emulated.)
|
|---|
| 342 |
|
|---|
| 343 | Over time, the chip interpolates between the points of the
|
|---|
| 344 | envelopes drawn in the MIDAS VII instrument editor.
|
|---|
| 345 |
|
|---|
| 346 | 2. A second chip for the actual sound generation. This is likely
|
|---|
| 347 | a DSP.
|
|---|
| 348 |
|
|---|
| 349 | XXX - Details to be filled in.
|
|---|
| 350 |
|
|---|
| 351 | We don't know how many of the envelopes not related to FM
|
|---|
| 352 | (e.g., the filter) are actually used digitally. At least some
|
|---|
| 353 | of the envelopes probably control analog circuits.
|
|---|
| 354 |
|
|---|
| 355 | Obviously, the emulator does everything digitally.
|
|---|
| 356 |
|
|---|
| 357 | This "two chip" hypothesis would be in line with the "four
|
|---|
| 358 | computers" marketing claim from the Buchla 700 marketing copy. The
|
|---|
| 359 | four "computers" would be the Motorola 68000, the microcontroller
|
|---|
| 360 | that does the A/D conversion of the pad inputs, plus the two CPUs
|
|---|
| 361 | that constitute "the FPU."
|
|---|
| 362 |
|
|---|
| 363 | If you have access to an actual Buchla 700, please do contact us. It
|
|---|
| 364 | would be great to be able to compare the emulation to real hardware.
|
|---|
| 365 |
|
|---|
| 366 | If your Buchla is non-functional, this is also fine. We might be able
|
|---|
| 367 | to gain some insights from reading out the FPU microcode PROMs.
|
|---|