Skip to content

3. Basics Instructions

Program edited this page Feb 4, 2024 · 3 revisions

MOV Instruction

MOV (means MOVE), it's to give a value to a possible register.

A register is like a variable in current langages programming, but it's limited and there is only 13 registers (R0 to R12).

Format: MOV Re, #Value

Example:

MOV R5, #10

MOV R0, #40

MOV R12, #150

STR Instruction

STR (means Store To Register) place the value of a register in a case of the memory. The register values is now saved in your memory (WARNING: The language is like and emulator, it's not saved in your real memory)

Format: STR Re, Case

Example:

STR R5, 100

STR R0, 195

STR R12, 25

LDR Instruction

LDR (means Load To Register) get the value in a slot of the memory and give it to a register. If the current registers had already a value, the register will have this new value.

Format: LDR Re, Case

Example:

LDR R5, 100

LDR R0, 195

LDR R12, 25

B Instruction

B is a way to jump to another location called label (like in C++ with goto, or you understand this like a 'function' but with no arguments inside).

Format: B label

Example:

B hello
hello:
    MOV R0, #3

HALT Instruction

Force the program to stop, good practice to put in place at the end of the code.

Format: HATL

Example:

B byebye
byebye:
    MOV R0, #3
    HALT

Clone this wiki locally