Computers only know them binary machine language using just 0(off) and 1(on).
How do we make binary number sequence? It's depends on computers.
"RUN the Arm machine language on IchigoJam RPi after 1.2b16 (Raspberry Pi 2)"
The computer of IchigoJam understands 16 bit words (0 or 1 x 16).
This machine language means to add 1 to R0 register. (resisters are kind of memories in the computer)
First 5 bit means "to add", next 3 bit means the resister number, last 8 bit means number to add.
00110 000 00000001
Let's write to RAM using POKE command of IchigoJam BASIC. (*IchigoJam BASIC reference ver 1.2)
#700 is position of RAM. Number starts with ` means binary number. (# for hexadecimal number)
To write last 8 bit in the first is a rule of this computer. (little-endian)
You need an other machine language word to work, "return" to IchigoJam BASIC.
Write this word to RAM in the same way.
You are ready to run!
Did you get a number 2 as a right result?
USR command needs an start address of the machine languages and a number as a parameter.
Please check using 100 as a parameter.
Try to make to add 5 program using the machine language.
You did it!
Speed is the greatest advantage of using the machine language.
The disadvantage is wrong machine language program doesn't protect your system.
So, please save before run if you make long program with machine language.
IchigoJam will stop if you write wrong machine languages.
Try to freeze your IchigoJam.
Computers work with some machine language words such them.
CPU of IchigoJam (LPC1114 Arm Cortex-M0) knows only 56 words Arm Thumb machine language.
It's very simple to understand!
If you use IchigoJam RPi after 1.2b16 (Raspberry Pi2/3 Arm Cortex-A7/A53), it knows more words.
It's a sample code to use SIMD(single instruction multiple data) machine language.
QADD8 can calculate 4 number as parallel during just 1 CPU cycle.
*It can calculate 8bit x 4 numbers but variables of IchigoJam BASIC are 16bit.
To be continued!
- Cortex-M0 Technical Reference Manual - Instruction set summary / ARM Information Center
- Cortex-A7 MPCore Technical Reference Manual - About the programmers model / ARM Information Center
links (now in Japanese)
- asm15 - simple Arm assembly language and machine language table
- asm15 assembler for IchigoJam
- series of "My First Arm Assembly language"