160 likes | 401 Views
CEN 226 : Computer Organization & Assembly Language : CSC 225 (Lec#1). By Dr. Syed Noman. Course organization. Course is divided into two sections: Computer organization Assembly language programming Computer organization and assembly language are interrelated.
E N D
CEN 226: Computer Organization & Assembly Language :CSC 225(Lec#1) By Dr. Syed Noman
Course organization • Course is divided into two sections: • Computer organization • Assembly language programming • Computer organization and assembly language are interrelated. • Program in assembly and get better understanding of the machine • Get familiarized with the machine to better program in assembly language. To program in assembly language requires knowledge of the machine.
Course Outline • Introduction to PC hardware. • von Neumann machine • 8086 machine architecture • PC software requirements • Assembly language programmers requirements • Program logical and control • String operations • Arithmetic operations for processing binary data • Assembling linking and executing a program.
Marks Distribution • Lab : 20 Marks • Mid-1: 15 Marks • Mid-2: 15 Marks • Assignment: 6 marks • Quizzes: 2 Marks (best of 2 out of 3) • Attendance: 2 Marks (after 2 absents, 1 mark will be deducted) • Final: 40 Marks
Collection of Programs • Learning Tip: object of the program must be clearly defined. • Program Codes are as follows: • EP#: Example program number • LT#: Lab Task number • QP#: Quiz program number • AP#: Assignment program#
What is Assembly Language? • A low-levelprocessor-specific programming language, designed to match the processor’s machine instruction set • each assembly language instruction matches exactly one machine language instruction • we study here Intel’s 80x86 (and Pentiums)
Why learn Assembly Language? • To learn how high-level language code gets translated into machine language • i.e.: to learn the details hidden in HLL code • To learn the computer’s hardware • by direct access to memory, video controller, sound card, keyboard… • To speed up applications • direct access to hardware (ex: writing directly to I/O ports instead of doing a system call) • good ASM code is faster and smaller: rewrite in ASM the critical areas of code
Table: Comparison of Assembly Language and High-Level Languages
Machine Language • An assembler is a program that converts ASM code into machine language code: • mov al,5 (Assembly Language) • 1011000000000101 (Machine Language) • most significant byte is the opcode for “move into register AL” • the least significant byte is for the operand “5” • Directly programming in machine language offers no advantage (over Assembly)...
Binary Numbers/Storage Size • are used to store both code and data • On Intel’s x86: • byte = 8 bits (smallest addressable unit) • word = 2 bytes • doubleword = 2 words • quadword = 2 doublewords
Data Representation • Even if we know that a block of memory contains data, to obtain its value we need to choose an interpretation • Ex: memory content “0100 0001” can either represent: • the number 2^{6} + 1 = 65 • or the ASCII code of character “A”
Data Representation • Number Systems • Binary/Octal/Decimal/Hexadecimal • Converting between various number systems • Signed/Unsigned Interpretation • Two’s Complement • Addition/Subtraction • Character Storage
Number Systems • A written number is meaningful only with respect to a base • To tell the assembler which base we use: • Hexadecimal 25 is written as 25h • Octal 25 is written as 25o or 25q • Binary 1010 is written as 1010b • Decimal 1010 is written as 1010 or 1010d • You are supposed to know how to convert from one base to another.