Introduction to Computer organization Assembly Language fengtwrku ac
Introduction to Computer organization & Assembly Language ����������� fengtwr@ku. ac. th
������ Hardware Software
Computer Components Secondary Memory Main Memory HD CPU Input Devices Output Devices
�������� �� l There are 3 kind of programming languages • Machine language (0’s and 1’s) • Assembly language (mov, and, or, etc…) • High-level language (nearly like human word) l Computer itself understands only Machine language.
The translation Process Source Program Compiler /Interpreter Executable Program
Language translator Interpreter / Compiler Program hello; Begin writeln(“Hello world!”); End. High-level language …… main: pushl movl subl andl movl subl pushl ……. . Assembler %ebp %esp, %ebp $8, %esp $-16, %esp $0, %eax, %esp $8, %esp $. LC 0 Assembly language Hello World! _ …. 000110001110101111 000111110001 11011100001011011 …… Machine language
Compiler l l Read all program at a time. Translate into executable file (machine language( library …. writeln(‘a’); writeln(‘b’); writeln(‘c’); …. Source Compiler a b c object file …. 0100100101. . . Linker Exe file
Interpreter l Read high-level language , translate , and then execute one command at a time. …. writeln(‘a’); writeln(‘b’); writeln(‘c’); …. Source Interpreter 0100100101 0100110 a b c
Assembler l l … mov add sub push … Turns assembly symbols into machine instructions Process this step in microprocessor A, B B, A A, B A Assembler …. 0100100101. . . a b c
������ Microprocessor l l l l Intel 4004 8080 8086, 8088 80286 i 386 i 486 Pentium Zilog Motorolla Z 80000 Z 80180 68040 68000 6802 68030
������ Intel Microprocessor
������� 10 2 10 1 10 0 492. 1 10 -1 12. 34 = (1 x 101) + (2 x 100) + (3 x 10 -1) + (4 x 10 -2) = 10 + 2 + 0. 3 + 0. 04 101. 012 = (1 x 22) + (0 x 21) + (1 x 20) + (0 x 2 -1) + (1 x 2 -2) = 4 + 0 + 1 + 0. 25 = 5. 25
��������� v ������ 1011. 1012 ��� 110. 011 2 v ������� 1. 01 x 101. 1101 110. 011 + 000. 0100 1 v ���� 1001. 11 ��� 101. 1 11. 1001 01. 101 10. 001 10. 1 1. 01 x 10. 10 1 01 00 0 101 11. 0 01
�������� 2, 8, 16 l l l l l ����������� 0 000000 1 100011 2 200102 3 300113 4 401004 5 501015 6 601106 7 701117 8 1010008 9 1110019 12101010 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F
2’s complement ������ 2 (1’s complement) ������ 10 ������ 2 (1’s complement) ��� 10 1111 0 0000 0 1111 1110 1 0000 -1 1111 1101 2 0010 0000 -2 1111 1100 3 0011 0000 -3 1111 1011 4 0000 0100 -4 0 0000 1 0000 -1 1111 2 0010 0000 -2 1111 1110 3 0011 0000 -3 1111 1101 4 0000 0100 -4 1111 1100 ������ 2 (2’s complement) ������ 10 10 ������ 2 (2’s complement)
Question ?
- Slides: 24