Microcode Editor for Baffa-1 HomebrewCPU Minicomputer System 
This is a microcode editor for Baffa-1 HomebrewCPU Minicomputer - a CPU and Minicomputer made from 74-Series Logic and based on Sol-1 Architecture proposed by Paulo de Tarco Constantino Junior (http://sol-1.org). Microcode Editor in C# is also based on the original concept proposed by Paulo Constantino in Sol-1_Simu (Borland C++ version) - Sol-1_Simu is the original microcode editor for Sol-1 HomebrewCPU Minicomputer.
Baffa-1 emulator is available for testing and debugging at https://baffa-1.baffasoft.com.br.
The emulator source repository is available at https://github.com/abaffa/baffa-1_emulator.





baffa-1_emul: new emulator core
The emulator was rewritten as a C# port of baffa1emu, the schematic-faithful Baffa-1 emulator. Each board of the schematic is one part of Machine (Boards.cs). Time advances by clock edges:
- on the rising edge of BUF_CLK, every register samples the nets at once;
- on ~BUF_CLK, the pipeline loads
ROM[U_AD] and the RD/WR/WE strobes end.
It matches the C++ emulator cycle for cycle. With the original microcode, the BIOS and kernel boot to kernel started in 2,047,658 cycles. The instruction trace of the whole boot and the micro-trace of the first 300,000 cycles are byte-identical to those of baffa1emu.
| File |
Contents |
Microword.cs |
120-bit microword map (IC_RO01…IC_RO15) |
Boards.cs |
Controller, ALU, Registers, Memory/BIOS and Interrupts/Clk boards |
Machine.cs |
state, nets, clock edges, I/O strobes, hazard warnings |
Devices.cs |
UART 16550, IDE/CF (with IDENTIFY), RTC M48T02, timer 8253 |
MicrocodeDebugger.cs |
single-step/instruction debugger used by the editor |
MicrowordText.cs |
readable description of a microword (same text as tools/mkdesc.py) |
Program.cs, HostConsole.cs |
command line and interactive terminal (ANSI) |
baffa-1_emul --roms ROMS_DIR --bios bios.obj --disk data.dsk [--escape1] [--trace-micro|--trace-instr] [--until TEXT] [--stats]
--escape1 connects U_ESCAPE_1 (ROM10 bit 7) to IC_SEQ_03 pin 11, as drawn in the schematic. The assembled board does not have this wire. The Z80 microcode (RomWBW) needs it; the original microcode and the 8080 microcode do not. In interactive mode, Ctrl-] quits and Ctrl-R presses RESET.
Microcode editor changes in Version 2.0
- The Debugger tab now runs the emulator above.
- Step runs one micro-cycle and shows the step description.
- Run runs up to the next opcode dispatch and stops on micro-loops (HALT or waiting for an interrupt).
- Load writes the hex input to the BIOS and resets.
- Settings → U_ESCAPE_1 wired applies
--escape1 to the debugger.
- ROM14 is no longer lost.
- Copy/paste/shift now include ROM14. Its bits are named
nmi_ack and ic2_2..8.
- ROM12 bits 2–5 are named
ic6_3..6.
- Combo lists now match the schematic. 3-bit fields that read values the old lists did not have used to crash the editor; these fields now have all 8 entries:
- CF and OF sources: GND;
- shift-in: VCC;
- ALU carry-in: all 8 combinations;
- Y source: values 0–3 are all immediate;
- conditions 14 and 15: IC_CMP2 D6/D7.
- The ALU operation list shows all 32 functions of the 74181 (mode × S).
- The offset is shown signed (-64…63).
- Tools → Describe Current Step from Bits (Ctrl+D) and Describe Steps without Description write the step text from the microword itself. The old text is kept as a
; comment.
- Files:
- opening any
romN opens the whole set;
- ROM files of 16K or 64K are both accepted;
- a missing description file starts empty;
- descriptions are cut at 255 bytes, so a long text no longer shifts every later entry of the
rom file;
- paths use
Path.Combine;
config.ini is read and written in managed code instead of kernel32.
- File-name case was fixed (
FrmCpuArchitecture.cs, FrmAbout.resx), so the solution also builds on case-sensitive file systems.
The rom description file
| Offset |
Contents |
(IR*64 + step) * 256 |
step description: Latin-1 text, CR/LF between lines, terminated by 0 |
0x400000 + IR * 256 |
opcode name; a vertical bar (|) separates the FD-escaped instruction |
The microcode sets for the original Baffa-1, the 8080 (CP/M 2.2) and the Z80 (RomWBW) all ship with this file.
-----BEGIN LICENSE NOTICE-----
Microcode Editor for Baffa-1 HomebrewCPU Minicomputer System
Copyright © 2021 Augusto Baffa, (baffa-1.baffasoft.com.br)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
-----END LICENSE NOTICE-----
评论