So I have a five year old now, and I'd like to someday teach her something useful that I know. Volunteering in Kindergarten class has got me thinking, maybe I could put together a short presentation on Assembly language and binary logic. I know, Kindergarten is way too early to learn binary math, but probably by the time I finish writing the tutorials, she'l be in High School. :)
To ease some of the frustration of Assembly and Machine language coding, I wrote a C program that parses and compiles a faux Assembly language that is a little easier to read and understand. The program will execute the binary code and emulate monitor ROM as well as Raspberry Pi GPIO registers.
To get started playing around with it, get the code from the github link in the Software Apps section or download the package directly at https://people.ucsc.edu/~reburns/downloads/
https://github.com/bobburns/mikode/releases/
At the command line:
## if you do not have ncurses
$ sudo apt install libncurses-dev
## then
$ wget https://people.ucsc.edu/~reburns/downloads/mikode-1.2.2.tar.gz
$ gzip -cd mikode-1.2.2.tar.gz | tar xf -
$ cd mikode-1.2.2
$ ./configure
$ make all check
$ sudo make install
You can play around with the snake game example that is in examples/snake.asm, or set up breadboard with an led and a button and compile and run the example below.
To get something running quickly, wire up a breadboard like the below schematic and then:
$ cd examples
$ mikode example1.asm
...
pass 1...
pass 2...
writeing example1 ...
success!
$ sudo mikode -rg example1
Press F3 to quit F1 to see the registers, F4 stop/start F5 step
The instruction set is based off of the Atmel AVR 8 bit instruction set, which I think is great to learn for embedded projects. You can see all of the instructions here: https://github.com/BobBurns/mikode/wiki
I will hopefully have a full Assembly Language for Kids tutorial up soon.
Please feel free to contact me if you find bugs or have any suggestions. Or see https://github.com/BobBurns/mikode
<reburns@protonmail.com>
Update 12/11/17:
New version 1.1.1 fixed SubtractImm bug and added new demo code examples/shootit.asm
Also, tested on the PocketChip today. Hoping to map GPIO to that device to play with it
Update 12/14/17: Adding step functionality. Press F5 to step through code
Update 12/19/17 Added PocketChip functionality. Beta release:
Update 12/21/17: Better faster gpio execution
https://github.com/BobBurns/mikode/releases
Update 12/24/17: patch 1.2.2. I didn't quite catch all of the define changes for HAVE__BCM_H . Sorry if you could not compile for Pi yesterday.
Comments