Machine Code Made Simple
By Nick Bild
High-level programming languages simplify software development, but they also hide a lot of what is actually going on inside a computer. Writing a few programs in machine code can go a long way toward developing a better understanding of how computers work, but with the complexity of modern instruction sets, that is not especially easy for a beginner. Electronics hobbyist David Johnson-Davies has come up with a way to make the experience a bit more approachable. His latest creation, called the Pocket MINIL Computer, is a handheld computer with a simplified instruction set and a built-in development environment. Rather than basing the computer on the instruction set of an existing processor, Johnson-Davies dusted off a hypothetical processor architecture that he developed over 10 years ago called MINIL (MINiature Interpreted Language). With just 16 instructions, MINIL is simple enough that one can commit the entire instruction set to memory without too much effort. The processor has eight 16-bit registers and supports basic arithmetic operations, conditional jumps, subroutines, and stack operations. Some care was taken in designing the instruction set to eliminate the need for an assembler. To copy the contents of register R4 into R3, for example, one simply enters the hexadecimal value 0x34. And to make it easier to follow along with what you are doing, the corresponding assembly language instruction is displayed alongside each opcode as it is entered. The hardware was built around an AVR64DD14 microcontroller that runs at 24 MHz and serves as the MINIL interpreter. A 128x64 pixel OLED display has enough room to show eight lines of a program listing. To minimize the number of I/O pins needed to interface with the keypad, Johnson-Davies made use of a resistor ladder that produces a distinct voltage for each keypress at a single analog input. Four colored LEDs were also included to give programmers something to interact with outside of the display. All of these components were installed on the front of a custom PCB. A pair of AAA batteries supplies power to the computer, and the battery holder doubles as a stand. There is no need for a power switch, as the device automatically goes to sleep after 60 seconds of inactivity, at which point it draws just one microamp of current. In addition to setting breakpoints and stepping through a program one instruction at a time, the integrated development environment allows users to run programs in a slow mode that displays the contents of the registers for a second after each instruction. Up to four user-created programs can be saved in EEPROM for later use. Johnson-Davies has published a number of example programs that demonstrate everything from producing patterns with the LEDs to calculating terms in the Fibonacci sequence. If you are looking for a good programming challenge, try implementing some of your favorite algorithms with just 16 instructions at your disposal. The firmware and PCB design files are freely available for anyone who would like to build a Pocket MINIL Computer of their own.The Pocket MINIL Computer (📷: David Johnson-Davies) The computer is programmed in hexadecimal opcodes (📷: David Johnson-Davies) The circuit diagram (📷: David Johnson-Davies)
↑ Back to top
Originally published by
Hackster News ↗
· rebuilt here from its own full-text RSS feed · all rights
remain with the publisher, please read and support them there.