Anda di halaman 1dari 1

Automation And Computation Department

Computer Structure Laboratory

2010/2011

C Programs
MAIN PROGRAM

Assembly Programs
MAIN PROGRAM

main()
{ inta,b,c;

...
PUSH b
PUSH a
CALL adder
ADD SP,4
(result is in AX)

c = adder(a,b)
}

SUBROUTINE

SUBROUTINE

adder(inta,b)
{ int z;
z = a + b;
return z;
}

adder: PUSH
MOV
SUB
MOV
ADD
MOV
MOV
POP
RET

BP
BP,SP
SP,2
AX, [BP+4]
AX, [BP+6]
[BP-2], AX
SP,BP
BP

.)1-1( -
:C -1-3-1
2-1 : )Data Types( -1-1-3-1
.


Integer
Character
Float
Double
Short
Long


32 bit
8 bit (0 to 255)
32 bit
64 bit
16 bit
32 bit

.2-1 -
: )Assignment( -2-1-3-1
.
Variable_Type

Variable_Name = Variable_Value

=

:

Int x = 5;
Double r = 3.6039;

2
. :