Chapter 3 Machine Language and Assembly Language.

Slides:



Advertisements
Similar presentations
Instruction Set Design
Advertisements

EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
CPU Review and Programming Models CT101 – Computing Systems.
Cpe 252: Computer Organization1 Lo’ai Tawalbeh Programming The Basic Computer Chapter 6:
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
The Assembly Language Level
The assembler is the system program that translate source code written in assembly language to object code( Machine Language) and other information for.
Chapter 6: Machine dependent Assembler Features
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Introduction to a Programming Environment
Names and Bindings Introduction Names Variables The concept of binding Chapter 5-a.
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Chapter 2 Software Tools and Assembly Language Syntax.
1 Chapter-01 Introduction to Computers and C++ Programming.
CPS120: Introduction to Computer Science
Fortran 1- Basics Chapters 1-2 in your Fortran book.
A Simple Two-Pass Assembler
1/2002JNM1 Basic Elements of Assembly Language Integer Constants –If no radix is given, the integer is assumed to be decimal. Int 21h  Int 21 –A hexadecimal.
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
Machine Instruction Characteristics
ASSEMBLY LANGUAGE. Assembler and Compiler Pascal A Program Compiler Version A Assembly Language Versiion A Machine Code Actual version that will be executed.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Assemblers.
Ass. Prof. Dr Masri Ayob TK 6123 Lecture 13: Assembly Language Level (Level 4)
PROGRAMMING LANGUAGES
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Programming Languages
Chapter 7: Low-Level Programming Languages Chapter 7 Low-Level Programming Languages Page 66 In order to execute instructions on a CPU, those instructions.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
A LECTURE NOTE. Introduction to Programming languages.
Computer Science 210 Computer Organization
Assembler, Compiler, MIPS simulator
Assembly language.
Machine dependent Assembler Features
Addressing Modes in Microprocessors
Operating System Interface between a user and the computer hardware
CSCI-235 Micro-Computer Applications
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
Assembly Language Ms. V.Anitha AP/CSE SCT
Morgan Kaufmann Publishers
C Language VIVA Questions with Answers
Chapter 3 Machine Language and Assembly Language.
C language IT-1 (Batch-A) Name: EnNo: Arshad Muthalif
INTRODUCTION ABOUT ASSEMBLY
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
Computer Programming Machine and Assembly.
CISC AND RISC SYSTEM Based on instruction set, we broadly classify Computer/microprocessor/microcontroller into CISC and RISC. CISC SYSTEM: COMPLEX INSTRUCTION.
Computer Architecture
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
MIPS Instruction Encoding
Computer Science 210 Computer Organization
68000 Architecture, Data Types and Addressing Modes
Chapter 4 –Requirements for coding in Assembly Language
What time is it?. What time is it? Major Concepts: a data structure model: basic representation of data, such as integers, logic values, and characters.
A Simple Two-Pass Assembler
Chapter 7 Assembly Language
MARIE: An Introduction to a Simple Computer
Requirements for coding in Assembly Language
Assembler Directives end label end of program, label is entry point
Chapter 1 Introduction.
Chapter 6 Programming the basic computer
Introduction to 8086 Assembly Language
Presentation transcript:

Chapter 3 Machine Language and Assembly Language

Generation of programming language.

Machine Language Consisting of strings of 1’s and 0’s and stored as binary numbers. Also known as machine code or object code. To solve this problem; mnemonics (Assembly language).

Fields In Machine Language Contain of two fields: Operation code (Op-Code) What operation must done by processor Operand Contain of memory address or data address.

Assembly Language Is a symbolic representation of machine code (mnemonic). Easy to programmer. To write a program, a programmer must know how many register and internal structure of CPU.

Relationship between machine and assembly language

Advantages & Disadvantages of Machine Language Efficient - making optimum use of both computer memory and processing time. Do not use any translator. Disadvantages Difficult to write, read and understand. Easy to make a mistake.

Advantages & Disadvantages of Assembly Language Easy to write, read and understand. Disadvantages Must be translated into machine code by a separate program called an assembler.

Why Use Assembly Language? Low level control When you need to change the flags, or the control registers of the processor, as when entering protected mode. Speed Programs written in machine language execute fast!. It can execute 10-100 times the speed of BASIC, and about twice as fast as a program written in C or Pascal.

Why Use Assembly Language?… Time critical code Critical sections of programs written in higher level languages can be written in assembly to speed up sections. Small program size. When you write a TSR for example this is very useful. Writing interrupt handlers is where assembly language shines. Assembly language is very flexible and powerful; anything that the hardware of the computer is capable of doing can be done in assembly.

Three type of instruction Executable statements Assembler Directives (Pseudo-Instruction) Macro Instruction

1. Executable statements One of the processor’s valid instructions which can be translated into machine code by the assembler Example: MOVE ADD ADDA ADDI CMP SUB MOVE.L #4, D2 ;Tells the CPU to put the value of 4 in register 2.

2. Assembler Directives (Pseudo-Instruction) Assembler directives cannot be translated into machine code; they simply tell the assembler things it needs to know about the program and its environment. Link symbolic names to actual values. Set up predefined constants. Allocate storage for memory. Control the assembly process.

Example of Assembler Directives Mostly the same as for our generic CPU, but with the size specify (.B, .W or .L) added for DC & DS

3. Macro Instruction A macro instruction is a program which are codified only once and can be used as many times as necessary. Macro instruction is a module with specific function which can be used by different programs. It’s very useful for the programmer in writing program (Do not write many times). It is found in many other high-level languages, such as C.

Assembly language format Contain of 4 fields [Label:] Op Code [Operand/s] [;Comments] The symbol [ ] is optional Every field must at least 1 blank space.

Label It is an optional field. If this field is exist, so it must start in first column. Although there is no limit on length for this field but the assembler just consider only 8 characters to be significant. The characters can be Letter (a-z, A-Z) Digits (0-9) Special characters like $(dollar), .(dot) and _(underscore)

Label… Cannot put blank space in the label. It cannot begin with a digit. The assembler is not a case-sensitive Eg: Value1 and value1 is same Exercise: X, 4DATA, ORG, .Value1

Op Code Sometime it also call as ‘pseudo op’. This field is in mnemonics form. This is important field – (must have). The assembler will translated the mnemonics to machine code. Eg: MOVE, ADD, SUB, BNE If this field contain of assembler directive it will not translated to machine code. Eg: ORG, END, DC, DS

Operand/s The operand will use the data that can be executed. General format: <source>,<destination> The statement can be 0,1 or 2 operand. When two or more operand subfields appear within a statement, they must be separated by a comma. Eg: ADD.L D1,D2 2 operand CLR.B D4 1 operand RTS 0 operand

Comment The comment start with symbol (;). The assembler will ignore after this symbol. Example: MOVE.L #4,D3; Move the value (4) of data to register 3 ; all this line is a comment.

Reference Language level Finaly the real CPU Level of programming languages http://www.play-hookey.com/computers/language_levels.html Macro Instruction http://thsun1.jinr.ru/~alvadim/man/asm.html