Assign values. MOV destination, source Load data into register Store data from register to variable Push value on top of stack Call function
MOV a, = ‘3’
NOTES
LOD R1, a
not to be used with R, only if permitted by the target machine architecture must use with R
STO RI, T1
must use with R
PUSH a CALL println
Compare between two values
not to be used with R not to be used with direct numbers
ARITHMETIC ARITHM ETIC OPERAT OPERATION ION ADD SUB
MUL
DIV
Add numbers
ADD R1, b
must use with R
Subtract numbers Multiply numbers Divide numbers
SUB R1, b
must use with R
MUL R1, b
must use with R
DIV R1, b
must use with R
BRANCH OPERATION B
Unconditional branch Conditional branch
B L2
BH
Branch if higher Branch if lower Branch if higher or even Branch if lower or even Label a place
BH L3
BL
BHE
BLE
L
BL L3 BHE L3 BLE L3 L2
1. if-else
��� ���� � �� ������ � �� ��
����
��
����
2. while
��
��� ���� � �� ������ � ��
��
exit if not
���� ������ � ��
��
loop
exit
3. for initialisation
���
���
Boolean
��� ��
��� ���� � �� ������ � ��
��
���� ��� � ��� ������ � ��
��
exit if not
increment (i++)/decrement (i--) loop
exit
Examples of operations: 5. if ( a > b) a = a+1 1. c = a + b; LOD R1, a ADD R1, b STO R1, c 2. a = 14; b = 12; println(a-b); MOV a, = ‘14’ MOV b, = ‘12’ LOD R1, a SUB R1, b STO R1, T1 PUSH T1 CALL PRINTLN
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.