Bob Burns
Published © GPL3+

Assembly Language For Kids - Mikode

Learn Assembly Language and teach your kids to blink an LED while playing Snake!

EasyWork in progress1 hour1,431
Assembly Language For Kids - Mikode

Things used in this project

Hardware components

Raspberry Pi 1 Model B+
Raspberry Pi 1 Model B+
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1

Software apps and online services

mikode

Story

Read more

Schematics

Basic Pi circuit

Simple example of blinking an LED and pressing a button with Mikode
Pi button interface raspberry pi circuit diagram cgkr3c4ked

Code

Blink

Assembly x86
This program will blink an LED and read the input from a Pi gpio 26 and put an X on the screen if it's pressed.
; blinking an led and reading gpio 26
;
; special rom address
; screen rom 0xc000
;
; 0xe100 output register
; 0xe101 direction register
; 0xe102 input register
;
; pin mappings
; b0 - gpio 6
; b1 - gpio 13
; b2 - gpio 19
; b3 - gpio 26
; b4 - gpio 12
; b5 - gpio 16
; b6 - gpio 20
; b7 - gpio 21
;
; defs
.def temp = r9
        LoadImm         r10,0x08
        StoreDirect     0xe101,r10 ; toggle pin to set input
        LoadImm         r10,0x00
        StoreDirect     0xe101,r10 ; set direction input gpio26
        LoadImm         r10,0x04
        StoreDirect     0xe101,r10 ; set direction output gpio19
loop:   
        LoadImm         temp,0x04
        StoreDirect     0xe100,temp
        Call            delay
        LoadImm         temp,0x00
        StoreDirect     0xe100,temp
        Call            delay
        Jump            loop
delay:
        LoadImm         r0,0x40
dlp:
        Call            read
        Decrement       r0
        BranchNotEqu    dlp 
        Return
read:
        LoadDirect      temp,0xe102 ;read pin during delay loop
        AndImm          temp,0x08   ; test b3 (gpio 26)
        BranchEqu       putx
        LoadImm         temp,' '
        Jump            cont
putx:
        LoadImm         temp,'X'
cont:   StoreDirect     0xc540,temp ; should be middle of the screen
        Return

Credits

Bob Burns

Bob Burns

1 project • 4 followers
Started programming again after 25? years.

Comments