Assembly Language Notes v2

Share Embed Donate


Short Description

compiler degree...

Description

���������� ������ �������� ��������

OPERATION  MOV

LOD

STO

PUSH

CALL CMP

INFORMATION

EXAMPLE

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

3. a + b + c LOD ADD ADD STO

R1, R1, R1, R1,

L1:

L2:

6. for ( a=1; a>=20; a++) y = y + 1

L1:

L2:

a b c T1 L3:

4. while (x
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF