“This project is a machine-code monitor that you program from a hexadecimal keypad using a simplified instruction set:
It’s a good project for learning about the fundamentals of machine code, and will also appeal to people who like programming challenges. The simplified machine code, called MINIL, is designed to be easy to learn and understand. It’s similar to the Little Minion Computer  used in some universities to teach students about machine code. The same method could be used to emulate other simple processors, such as the SC/MP, 6800, 8080, or 6502.
In the early days of microprocessors the only way a hobbyist or engineer could try out a chip was to get one of the manufacturer’s evaluation boards that allowed you to program in machine code using a hexadecimal keypad and seven-segment displays. Some early examples were the National Semiconductor SC/MP kit, the Motorola D2 kit for the 6800 , and the KIM-1 board from MOS Technology Inc. for the 6502 . Later some companies produced boards specifically aimed at hobbyists, such as the Science of Cambridge MK14 , and the Acorn System 1 .
Now that powerful processors are available at low cost beginners can go straight to programming in a high-level language such as Python on a board such as an ARM-based Arduino or BBC Micro Bit. However, I sometimes think that they are missing out on the fun and understanding to be gained from programming in assembler or machine code. After all, when running a high-level language program on one of today’s advanced processors it is actually executing machine code at the lowest level, so it’s useful to understand what this means.
One approach to building a machine-code monitor would be to use the machine code of the chip used to build it. However, even the simplest and cheapest chips available nowadays have quite complex instruction sets which would be daunting for a beginner. For example, the ATtiny chips have over 80 instructions, and the simplest chips you can still buy easily are 8051-based, with 44 instructions.
The second option would be to emulate one of the early processors which had much simpler instruction sets; there have been several boards based on emulations of the SC/MP or 6502, either using another processor, or an FPGA.
However both of these options would be quite daunting for a beginner; even the SC/MP and 6502 had many instructions and addressing modes, and using them would require a programming manual open alongside you at the bench.
No assembler required
With most microprocessors the hexadecimal operation codes, or opcodes, used for the instructions are arbitrary, and so it is difficult to remember what opcode you need to write for each instruction. Programmers therefore use assemblers, which allow you to use a mnemonic for each instruction. For example, in the 8051 the jump instruction is 0x73, but using the assembler you can write JMP instead.
I decided to base my machine-code monitor on a hypothetical processor called MINIL (MINiature Interpreted Language) that I developed some time ago . It avoids the need for an assembler by having a very simple set of opcodes that are easy to remember. For example, the instructions to set one register to another are simply the two register numbers, so to set R3 to R4 (mnemonic MOV R3,R4), the opcode is 0x34.
Also, once you type in the opcode the Tiny Machine-Code Monitor displays the assembler statement alongside it on the display, allowing you to check that it’s what you intended. Because you enter the opcodes in hexadecimal it avoids the need for a full alphanumeric keyboard, while giving you the advantage of seeing the assembler program on the display.”