Dr. José M. Reyes Álamo 1.  An assembly language that is easier to understand that regular assembly  Borrow some features from high-level languages.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
Fabián E. Bustamante, Spring 2007 Machine-Level Programming II: Control Flow Today Condition codes Control flow structures Next time Procedures.
Goal: Write Programs in Assembly
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
CECS 341 – Computer Design Primer.1(c) R. W. Allison.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
The Analytical Engine Module 6 Program Translation.
Introduction to Microprocessors Number Systems and Conversions No /6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
1 Assembly Language Professor Jennifer Rexford COS 217.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
CS1104 Assembly Language: Part 1
Compiler Construction
1 Assembly Language: Overview. 2 If you’re a computer, What’s the fastest way to multiply by 5? What’s the fastest way to divide by 5?
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2:
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Dr. José M. Reyes Álamo 1.  Course website  Syllabus posted.
Machine-Level Programming 3 Control Flow Topics Control Flow Switch Statements Jump Tables.
SE 435 – Distributed Systems Marshalling – Background Principles Version 2.0 Clark Elliott DePaul University.
ACOE2511 ACOE251/AEEC335 -Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Chapter 1: Basic Concepts
Assembly Questions תרגול 12.
Goals: To gain an understanding of assembly To get your hands dirty in GDB.
CMPE 511 Computer Architecture A Faster Optimal Register Allocator Betül Demiröz.
CPU Internal memory I/O interface circuit System bus
Languages and the Machine Chapter 5 CS221. Topics The Compilation Process The Assembly Process Linking and Loading Macros We will skip –Case Study: Extensions.
Positional Number Systems
CSCE 212 Review for Exam 1 Instructor: Jason D. Bakos.
Introduction to Computer and Programing Thanachat Thanomkulabut.
Introduction to Computer and Programing Thanachat Thanomkulabut.
Machine-Level Programming 3 Control Flow Topics Control Flow Switch Statements Jump Tables.
Derived from "x86 Assembly Registers and the Stack" by Rodney BeedeRodney Beede x86 Assembly Registers and the Stack Nov 2009.
ACOE2511 Assembly Language for the 80X86/Pentium Intel Microprocessors Lecturer: Dr. Konstantinos Tatas.
Hexadecimal Data Representation. Objectives  Know how the Hexadecimal counting system works  Be able to convert between denary, binary & hexadecimal.
IFT 201: Unit 1 Lecture 1.3: Processor Architecture-3
CET 3510 Microcomputer Systems Tech. Lecture 3 Professor: Dr. José M. Reyes Álamo.
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
Introduction to Computer and Programing Thanachat Thanomkulabut.
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
CSE 351 Number Representation. Number Bases Any numerical value can be represented as a linear combination of powers of n, where n is an integer greater.
Introduction to Computer and Programing Thanachat Thanomkulabut.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Operating Systems A Biswas, Dept. of Information Technology.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
Computer Organization Exam Review CS345 David Monismith.
Machine-Level Programming 2 Control Flow
Data in Memory variables have multiple attributes symbolic name
Credits and Disclaimers
IA32 Processors Evolutionary Design
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Conditional Branch Example
Homework Reading Labs PAL, pp
Microprocessor and Assembly Language
Assembly Language Programming V: In-line Assembly Code
Machine-Level Programming 2 Control Flow
Machine-Level Programming 2 Control Flow
CET 3510 – Lecture 11 Bit Manipulation in a High-Level Programming Language Dr. José M. Reyes Álamo.
3.
C021TV-I3-S1.
Understand the interaction between computer hardware and software
CS 286 Computer Organization and Architecture
Chapter 6 Programming the basic computer
Machine-Level Programming I: Basics Comp 21000: Introduction to Computer Organization & Systems Instructor: John Barr * Modified slides from the book.
Credits and Disclaimers
Credits and Disclaimers
Compiler Construction CS 606 Sohail Aslam Lecture 1.
Dr. Clincy Professor of CS
Presentation transcript:

Dr. José M. Reyes Álamo 1

 An assembly language that is easier to understand that regular assembly  Borrow some features from high-level languages without being a high-level programming language  Supported in multiple platforms 2

 No “sugary” commands such as if, while, for.  Only jump statements and labels are available to do decisions and loops.  It is understood by the processor.  Programs execute faster but are harder to write.

 Under Linux, to compile a C program into assembly use the following command: ◦ gcc –S myProgram.c  The gcc compiler works for both C programs (extension.c) and assembly programs (extension.s)

CAssembly main() { int x = 5; } Assembly:.file"cases.c".text.globl main: pushl%ebp movl%esp, %ebp subl$16, %esp movl$5, -4(%ebp) leave ret.sizemain,.-main.ident"GCC: (Ubuntu/Linaro ubuntu5) 4.4.5".section.note.GNU-

CAssembly main() { int x = 5; if(x < 0) { x++; }.file"cases.c".text.globl main: pushl%ebp movl%esp, %ebp subl$16, %esp movl$5, -4(%ebp) cmpl$0, -4(%ebp) jns.L4 addl$1, -4(%ebp).L4: leave ret.sizemain,.-main.ident"GCC: (Ubuntu/Linaro ubuntu5)

CAssembly main() { int x = 5; if(x < 0) { x++; } else { x--; }.file"cases.c".text.globl main: pushl%ebp movl%esp, %ebp subl$16, %esp movl$5, -4(%ebp) cmpl$0, -4(%ebp) jns.L2 addl$1, -4(%ebp) jmp.L5.L2: subl$1, -4(%ebp).L5: leave ret.sizemain,.-main.ident"GCC: (Ubuntu/Linaro ubuntu5)

CAssembly main() { int x = 5; while (x < 10){ x++; }.file"cases.c".text.globl main: pushl%ebp movl%esp, %ebp subl$16, %esp movl$5, -4(%ebp) jmp.L2.L3: addl$1, -4(%ebp).L2: cmpl$9, -4(%ebp) jle.L3 leave ret.sizemain,.-main.ident"GCC: (Ubuntu/Linaro ubuntu5)

CAssembly #include main() { printf("Hello World \n"); }.file"cases.c".section.rodata.LC0:.string"Hello World ".text.globl main: pushl%ebp movl%esp, %ebp andl$-16, %esp subl$16, %esp movl$.LC0, (%esp) callputs leave ret.sizemain,.-main.ident"GCC: (Ubuntu/Linaro ubuntu5)

 Write a few simple programs C programs  Write the same program in HLA  Compile the C program into Real Assembly  gcc –S myProgram.c  Compare all 3  Try to understand especially how C code is translated to Assembly

 Computer and Processor Architecture: ◦ Components of computers ◦ Memory limits, register size etc. ◦ Data organizations (bits, nibble, word, etc.)

 HLA Syntax: ◦ Commands ◦ Data types ◦ Standard libraries (stdlib.hhf) ◦ Differences with Real Assembly Language ◦ Differences with High-Level programming languages such as C++ ◦ Be able to read and write HLA code ◦ Labels and jumps

 Number Systems (Binary, Decimal, Hexadecimal) Arithmetic ◦ Conversion to/from different bases ◦ Two’s complement binary ◦ Representation in Hex

 Logical Operations ◦ AND ◦ NOT ◦ OR ◦ XOR ◦ How to use these to manipulate, insert and clear bits