Presentation is loading. Please wait.

Presentation is loading. Please wait.

COE 205 - 3 Computer Organization & Assembly Language Introduction HLL vs. Assembly Programming Languages.

Similar presentations


Presentation on theme: "COE 205 - 3 Computer Organization & Assembly Language Introduction HLL vs. Assembly Programming Languages."— Presentation transcript:

1 COE 205 - 3 Computer Organization & Assembly Language Introduction HLL vs. Assembly Programming Languages

2 Term 042 COE 205 Dr.Talal AlKharobi 2 Programming Language  Computers only understand programs in their own machine language.  It is extremely impractical to ask programmers to write their programs in machine language.  So what is the solution to this dilemma?  The answer is in what are called programming languages  Programming language can be a High-level languages (HLL) or a low level language (assembly)

3 Term 042 COE 205 Dr.Talal AlKharobi 3 High-Level Languages (HLL)  HLLs are programming languages that look like natural language text.  They make programming easier and more abstract, i.e. the programmer does not need to come up with the detailed machine instructions  HLL programs are machine independent. They can be run on different hardware platforms (i.e. different computers with different instruction sets)  To run a HLL program on a specific machine, it has to be translated to its machine language  This is done through the use of a compiler: a program that translates a HLL program to a machine language program of a specific platform  The Machine language program produced by the compiler is usually referred to as the executable program  Hence by using the appropriate compiler we can execute HLL programs on any platform

4 Term 042 COE 205 Dr.Talal AlKharobi 4 Mapping Between HLL and Machine Language  Translating HLL programs to machine language programs is not a one-to-one mapping  A HLL instruction (usually called a statement) will be translated to one or more machine language instructions  The number of mapped machine instructions depends on the efficiency of the compiler in producing optimized machine language programs from the HLL programs  Usually, machine language programs produced by compilers are not efficient (i.e. they contain many unnecessary instructions that increase processing and slow down execution).

5 Term 042 COE 205 Dr.Talal AlKharobi 5 Data Type in HLL vs Machine Language  High-Level Language supports many primitive data types such as  integers & real numbers  strings & characters  Boolean  HLL allows the programmer to define new and complex data types using the primitive data types  HLL compilers strictly enforce data typing, preventing the programmer from making mistakes.  Machine Language just operate on binary numbers and dose not enforce any data typing.

6 Term 042 COE 205 Dr.Talal AlKharobi 6 Assembly Language  The assembly language is a programming language that uses symbolic names to represent operations, registers and memory locations.  Programs are written in a natural language style.  Each assembly language instruction (or statement) would correspond to a single machine language instruction.  This makes it easier for the programmer to produce efficient machine language programs.

7 Term 042 COE 205 Dr.Talal AlKharobi 7 Why Learn Assembly Language?  Writing assembly programs gives the computer designer the needed deep understanding of the instruction set and how to design one  To be able to write compilers for HLLs, we need to be expert with the machine language. Assembly programming provide this experience  Sometimes very efficient machine codes are required to do some specific functions and these can not be produced by HLL and compilers. In this case assembly language has to be used  Sometimes we want to access specific memory addresses or I/O ports. This is very difficult to do using HLLs. In these cases Assembly language would be the better choice  Embeded-controllers that find numerous applications nowadays usually contain special-purpose processors. Assembly programming is usually the only practical way to program these processors.

8 Term 042 COE 205 Dr.Talal AlKharobi 8 Mapping Between Assembly Language and HLL  The mapping between HLL constructs and Assembly language instructions is many-to-many, as it was between HLL and machine language.  The table shows some examples of mapping between some HLL instructions and 8086 assembly language instructions Instruction Class HLLAssembly Language Data Movement a = 5MOV a, 5 Arithmeticb = a + 5MOV ax, a ADD ax, 5 MOV b, ax Control FlowGoto LBLJMP LBL logicalB=B or CMOV ax, C Or B, ax

9 Term 042 COE 205 Dr.Talal AlKharobi 9 The Assembler & Linker  The program that translates from assembly language to machine language is called an Assembler  It allows the programmer to specify the memory locations for his data and programs and symbolically refer to them in his assembly code.  It will translate these symbolic addresses to actual (physical) addresses in the produced machine code.  The linker is the program that is used to link together separately assembled/compiled programs into a single executable code.  It allows the programmers to develop different parts of a large program separately (some in HLL and others in Assembly depending on the best choice for that part), test them separately and ‘freeze’ them for future use.  This produces modular programs and greatly enables the management of large programming projects.

10 Term 042 COE 205 Dr.Talal AlKharobi 10 Debugger & Monitor  Tools that allow the assembly programmers to:  Display and alter the contents of memory and registers while running their code,  Perform disassembly of their machine code (show the assembly language equivalent)  Permit them to run their programs, stop (or halt) them, run them step-by-step or insert break points


Download ppt "COE 205 - 3 Computer Organization & Assembly Language Introduction HLL vs. Assembly Programming Languages."

Similar presentations


Ads by Google