Lecture8 - Assembly Programming Abhishek Bhattacharjee Topics Introduction to Assembly Programming x86 assembly Programming Meets Hardware#include

Lecture8 - Assembly Programming Abhishek Bhattacharjee...

This preview shows page 1 - 13 out of 37 pages.

Abhishek Bhattacharjee Topics square6 Introduction to Assembly Programming circle6 x86 assembly Assembly Programming
Image of page 1
Rutgers University Abhishek Bhattacharjee 2 Programming Meets Hardware High-Level Language Program Assembly Language Program Machine Language Program movl $1, -8(%ebp) movl $2, -12(%ebp) movl -8(%ebp), %eax movl %eax, -16(%ebp) movl -12(%ebp), %eax movl %eax, -8(%ebp) movl -16(%ebp), %eax movl %eax, -12(%ebp) movl -16(%ebp), %eax movl %eax, 12(%esp) movl -12(%ebp), %eax movl %eax, 8(%esp) movl -8(%ebp), %eax movl %eax, 4(%esp) 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 02 00 03 00 01 00 00 00 f0 82 04 08 34 00 00 00 c4 0c 00 00 00 00 00 00 34 00 #include <stdio.h> int main() { int x, y, temp; x=1; y=2; temp =x; x=y; y=temp; printf("%d %d %d\n",x,y,temp); } ISA Compiler Assembler
Image of page 2
Rutgers University Abhishek Bhattacharjee 3 P6 Decoder/Interpreter
Image of page 3
Rutgers University Abhishek Bhattacharjee 4 Assembly Programmer’s View Control Logic (OS code & data) Object Code Program Data Addresses Data Instructions Registers ALU CPU Memory Condition Codes PC
Image of page 4
Rutgers University Abhishek Bhattacharjee 5 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes
Image of page 5
Rutgers University Abhishek Bhattacharjee 6 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes 1
Image of page 6
Rutgers University Abhishek Bhattacharjee 7 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes 1 1 10001000
Image of page 7
Rutgers University Abhishek Bhattacharjee 8 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes 1 1 10001000 + R0 R1 R0: x R1: y
Image of page 8
Rutgers University Abhishek Bhattacharjee 9 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes 1 1 10001000 + R0 R1 x y R0: x R1: y
Image of page 9
Rutgers University Abhishek Bhattacharjee 10 Putting It All Together ALU Control Logic Registers Program Counter (PC) 00101100 10001000 11111111 01010101 01010101 11000001 00000000 11111001 11111000 00110000 00000000 00000000 00000000 11000011 00011001 00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F Memory Addresses Storage CPU Condition Codes 2 1 10001000 + R0 R1 x y z R2: z R0: x R1: y R2
Image of page 10
Rutgers University Abhishek Bhattacharjee 11 Assembly Characteristics Primitive Operations square6 Perform arithmetic function on register or memory data square6 Transfer data between memory and register circle6 Load data from memory into register circle6 Store register data into memory square6 Transfer control circle6 Unconditional jumps to/from procedures circle6 Conditional branches
Image of page 11
Rutgers University Abhishek Bhattacharjee 12 Instruction Format General format: opcode operands Opcode: square6 Short mnemonic for instruction’s purpose circle6 movb,addl, etc.
Image of page 12
Image of page 13

You've reached the end of your free preview.

Want to read all 37 pages?

  • Fall '08
  • Staff
  • Central processing unit, Processor register, Rutgers University, Addressing mode, Abhishek Bhattacharjee, movl movl movl

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes