mith College Computer Science CSC231 - Assembly Week #8 Dominique Thiébaut
|
|
- Jack Brooks
- 5 years ago
- Views:
Transcription
1 mith College Computer Science CSC231 - Assembly Week #8 Dominique Thiébaut dthiebaut@smith.edu
2 Can't Sleep
3 Logic Design
4 Logic Design
5 Image from Apple II Motherboard
6 Nasa Computer (Apollo)
7 A Bit of History Claude Shannon 21 years old 1937 MIT Master's Thesis All arithmetic operations on binary numbers can be performed using boolean logic operators
8
9 Designing a 2-bit Adder with Logic
10
11 Processor CU ALU
12 xi yi ALU Compute add x, y carryi sumi
13 x y xn yn x3 y3 x2 y2 x1 y1 x0 y0 zn z3 z2 z1 z0 z
14 y0 x = 0 0 = 0 1 = 0 1 = 1 0 carry z0
15 x0 y0 Carry z
16 x0 y0 Carry z Carry = x0 and y0 z0 = x0 xor y
17 x0 y0 AND XOR carry z0
18 Moral of the Story: Addition is performed by logic operations using natural binary numbers (unsigned arithmetic)
19 NEGATIVE NUMBERS
20 How can we represent signed binary numbers when all we have are bits (0/1)? Whichever system we use should work with the binary adder in the ALU
21 4-bit Nybble Binary Hex Unsigned Decimal A B C D E F 15
22 Sign Bit 4-bit Nybble Binary Hex Unsigned Decimal A B C D E F 15
23 4-bit Nybble Binary Hex Unsigned Decimal A B C D E F 15 Positive Numbers Negative Numbers
24 Signed Magnitude Number System
25 Signed Magnitude Rule: To find the opposite of a number, just flip its MSB (+5) (-5) and vice versa
26 4-bit Nybble Binary Hex Unsigned Decimal Signed Magnitude A B C D E F 15-7
27 Does this System work With the ALU Adder? Binary Hex Unsigned Decimal Signed Magnitud e A B C D E F = = 3
28 1's Complement Number System
29 1's Complement Rule: To find the opposite of a number, just flip all its bits (+5) (-5) and vice versa
30 4-bit Nybble Binary Hex Unsigned Decimal 1's Complement A B C D E F 15-0
31 Does this System work With the ALU Adder? Binary Hex Unsigned Decimal 1's Complement A B C D E F = = = 3
32 2's Complement Number System
33 2's Complement Rule: To find the opposite of a number, just flip all its bits, and add (+5) (-5) and vice versa
34 4-bit Nybble Binary Hex Unsigned Decimal 2's Complement A B C D E F 15-1
35 Does this System work With the ALU Adder? Binary Hex Unsigned Decimal 2's Complement A B C D E F = = = 3
36 Interesting Property What is the binary representation of -1 as a byte? What is the binary representation of -1 as a word? What is the binary representation of -1 as a dword?
37 int x = 0x7fffffff - 5; for ( int i=0; i<10; i++ ) System.out.println( x++ ); getcopy Loop0x7fffffff.java
38 What did you just learn about Java ints?
39 neg neg oprnd neg op8 neg op16 neg op32 op: mem, reg alpha db 1 beta dw 4 x dd 0xF06 neg byte[alpha] mov ax,1234 neg ax To get the 2's complement of an int neg dword[x]
40 Range of 2's Comp't. ints Binary Hex Unsigned Decimal A B C D E F 15
41 Type Minimum Maximum unsigned byte signed byte unsigned short signed short unsigned int signed int # Bytes , ,768 32, ,294,967, ,147,483,648 2,147,483,647 4 signed long 9,223,372,036,854,775,808 9,223,372,036,854,775,807 8
42 We Stopped Here Last Time (and finished first exercise on next slide)
43 watch?v=dtydzkpmfou The 13th Floor
44 The LOOP Instruction
45 loop loop label loop label x dd 1 sum dd 0 mov ecx, 10 addup: mov eax, dword[x] add dword[sum], eax inc dword[x] loop addup ;ecx< ecx-1 ;if ecx!=0, ; goto addup
46 loop loop label loop label x dd 1 sum dd 0 Label mov ecx, 10 addup: mov eax, dword[x] add dword[sum], eax inc dword[x] loop addup ;ecx< ecx-1 ;if ecx!=0, ; goto addup
47 loop loop label loop label ;ecx < ecx-1 ;if ecx!= 0, ; goto label ;else continue x dd 1 sum dd 0 Label mov ecx, 10 addup: mov eax, dword[x] add dword[sum], eax inc dword[x] loop addup ;ecx< ecx-1 ;if ecx!=0, ; goto addup
48 _start: mov eax, 4 Labels for1: for2: mov ecx, 10 loop for1 loop for2 Start with a letter (or a dot) End with a colon (when declared) Represent an address in the code section Must be unique in program
49 Tracing a Code Example
50 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
51 eax ecx? 3 mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
52 eax ecx 1 3 mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
53 1 eax ecx 1 3 mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
54 1 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
55 1 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
56 12 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
57 12 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
58 12 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
59 123 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
60 123 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
61 123 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1 ;if ecx!=0, ; goto for
62 123 eax ecx mov ecx, 3 mov eax, 1 for: call _printdec inc eax loop for ;ecx< ecx-1???? ;if ecx!=0, ; goto for
63 Example 1 Sum of 1..10
64 ; computes sum(1,2, 10) x dd 1 sum dd 0 mov ecx, 10 mov eax, dword[x] addup: add dword[sum], eax inc eax loop addup ;ecx< ecx-1 ;if ecx!=0, ; goto addup mov eax, dword[sum] call _printdec
65 ; computes sum(1,2, 10) x dd 1 sum dd 0 Do we need eax? mov ecx, 10 addup: add dword[sum], ecx loop addup ;ecx< ecx-1 ;if ecx!=0, ; goto addup mov eax, dword[sum] call _printdec
66 Example 2 Fibonaccis
67 ; print the first 10 Fibonacci terms _start: mov eax, 1 ; fibn mov ebx, 1 ; fibn-1 call _printdec call _println mov ecx, 10-1 ; we printed 1, 9 more to go for: mov edx, ebx mov ebx, eax add eax, edx call _printdec call _println loop for getcopy fib.asm
68 Looping Through Arrays
69 LOOP INSTRUCTION Looping Through Arrays INDIRECT ADDRESSING MODE
70 Indirect Addressing Mode The addressing mode refers to the way the operand of an instruction is generated. We already know register mode, immediate mode, and direct mode.
71 Tracing One Example of Indirect Addressing (Base Addressing)
72 ebx??? 0x1104C 0x1104B Memory al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12? 0x1104A 0x x E section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 0x x11046 F0 3 mov ebx, B mov byte[ebx], al 0x
73 ebx??? 0x1104C 0x1104B Memory al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12 'z' 0x1104A 0x x E section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 0x x11046 F0 3 mov ebx, B mov byte[ebx], al 0x
74 0x1104C 0x1104B 0x1104A 0x x x x x11045 Memory E F0 3 1 ebx al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12 section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 mov ebx, B mov byte[ebx], al 'z'
75 0x1104C 0x1104B 0x1104A 0x x x x x11045 Memory E F ebx al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12 section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 mov ebx, B mov byte[ebx], al 'z'
76 0x1104C 0x1104B 0x1104A 0x x x x x11045 Memory E F ebx al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12 section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 mov ebx, B mov byte[ebx], al 1104A 'z'
77 0x1104C 0x1104B 0x1104A 0x x x x x11045 Memory 'z' 56 3E F ebx al section.data A db 1,3,0xF0,0x3E,0x56 B db 0x78,0x33,0x12 section.text _start: mov al, 'z' mov ebx, A mov byte[ebx], 0 mov ebx, B mov byte[ebx], al 1104A 'z'
78 Example 2: Setting an Array to All 0s
79 ; Array Table contains 10 words Table dw 1,2,3,4,5,6 dw 7,8,9,10 mov ecx, ;# of elements mov ebx, ;address of ;Table clear: mov word[ebx], ;value to store add ebx, ;make ebx point ;to next word loop clear ;ecx< ecx-1 ;if ecx!=0, ; goto clear
80 Exercises Problem #1: Store the first 10 Fibonacci terms in an array of ints (32 bits) Problem #2: Given a DNA sequence of 1,000,000 characters stored in an array of bytes, and all characters in uppercase, transform it into its lowercase equivalent. The characters are A, C, G, T and N.
81 We stopped here last time
mith College Computer Science CSC231 Assembly Week #9 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #9 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Looping Through Arrays LOOP INSTRUCTION Looping Through Arrays INDIRECT ADDRESSING MODE Indirect Addressing
More informationmith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A 10
More informationmith College Computer Science CSC231 - Assembly Week #4 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #4 Dominique Thiébaut dthiebaut@smith.edu Homework Solutions Outline Review Hexdump Pentium Data Registers 32-bit, 16-bit and 8-bit quantities (registers
More informationmith College Computer Science CSC231 - Assembly Week #3 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #3 Dominique Thiébaut dthiebaut@smith.edu memory mov add registers hexdump listings number systems Let's Review Last Week's Material section.data
More informationmith College Computer Science CSC231 - Assembly Week #9 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #9 Dominique Thiébaut dthiebaut@smith.edu https://docs.google.com/forms/d/e/1faipqlscgsgjakylraq3zt6rvr-xmksy1zxrpe0myhpanyigp8byjba/viewform 1,000,000
More informationmith College Computer Science CSC231 Assembly Week #11 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #11 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Back to Conditional Jumps Review sub eax, 10 jz there xxx xxx there:yyy yyy Review cmp eax, 10 jz
More informationmith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Dominique Thiébaut
mith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Dominique Thiébaut dthiebaut@smith.edu Reference http://cs.smith.edu/dftwiki/index.php/ CSC231_An_Introduction_to_Fixed-_and_Floating-
More informationmith College Computer Science Fixed & Floating Point Formats CSC231 Fall 2017 Week #15 Dominique Thiébaut
mith College Computer Science Fixed & Floating Point CSC231 Fall 2017 Week #15 Formats Dominique Thiébaut dthiebaut@smith.edu Trick Question for ( double d = 0; d!= 0.3; d += 0.1 ) System.out.println(
More informationmith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut dthiebaut@smith.edu 2 Videos to Watch at a Later Time https://www.youtube.com/watch?v=fdmzngwchdk https://www.youtube.com/watch?v=k2iz1qsx4cm
More informationmith College Computer Science CSC231 Assembly Week #13 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC21 Assembly Week #1 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu for n in 0 1 2 5 ; do echo "n =$n"./hw7b $n echo "" done Pascal Triangle n =0 n =1 1 n =2 1 0 1 1 n
More informationmith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Assembly Language Week #13 Dominique Thiébaut
mith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Assembly Language Week #13 Dominique Thiébaut dthiebaut@smith.edu Reference http://cs.smith.edu/dftwiki/index.php/ CSC231_An_Introduction_to_Fixed-_and_Floating-
More informationmith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Assembly Language Week #14 Dominique Thiébaut
mith College Computer Science Fixed-Point & Floating-Point Number Formats CSC231 Assembly Language Week #14 Dominique Thiébaut dthiebaut@smith.edu Reference http://cs.smith.edu/dftwiki/index.php/ CSC231_An_Introduction_to_Fixed-_and_Floating-
More informationmith College Computer Science Week 14 Fixed & Floating Point Formats CSC231 Fall 2017 Week #14 Dominique Thiébaut
mith College Computer Science Week 14 Fixed & Floating Point CSC231 Fall 2017 Week #14 Formats Dominique Thiébaut dthiebaut@smith.edu Reminder! In C, strings are terminated by a byte containing 0 decimal,
More informationUMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.
Intel Assembly Format of an assembly instruction: LABEL OPCODE OPERANDS COMMENT DATA1 db 00001000b ;Define DATA1 as decimal 8 START: mov eax, ebx ;Copy ebx to eax LABEL: Stores a symbolic name for the
More informationmith College Computer Science CSC231-Assembly Fall 2017 Week #2 Dominique Thiébaut
mith College Computer Science CSC231-Assembly Fall 2017 Week #2 Dominique Thiébaut dthiebaut@smith.edu Outline Labs: emacs, assembly Assembly + Linking Process Object files DB directive: Everything is
More informationmith College Computer Science CSC231 Assembly Week #10 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #10 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu 2 Videos to Start With https://www.youtube.com/watch?v=fdmzngwchdk https://www.youtube.com/watch?v=k2iz1qsx4cm
More informationName: CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1. Question Points I. /34 II. /30 III.
CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1 Name: Question Points I. /34 II. /30 III. /36 TOTAL: /100 Instructions: 1. This is a closed-book, closed-notes exam. 2. You
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 6 Working with memory Why using memory? Registers are limited in number and size Program data Program code etc. The data segment dd 1234 dw 13 db -123 The data segment
More informationADDRESSING MODES. Operands specify the data to be used by an instruction
ADDRESSING MODES Operands specify the data to be used by an instruction An addressing mode refers to the way in which the data is specified by an operand 1. An operand is said to be direct when it specifies
More informationAdding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit
Part 5 Adding Binary Integers Arithmetic Logic Unit = Adding Binary Integers Adding Base Numbers Computer's add binary numbers the same way that we do with decimal Columns are aligned, added, and "'s"
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 2 Assembly Language Fundamentals
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Assembly Language Lab # 2 Assembly Language Fundamentals Assembly Language Lab # 2 Assembly Language Fundamentals
More informationmith College Computer Science CSC231 Assembly Week #12 Thanksgiving 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #12 Thanksgiving 2017 Dominique Thiébaut dthiebaut@smith.edu ;;; FUNCTION SIDE function: ebp ;save old ebp ebp, esp ;make ebp point ;to stack frame Summary
More information2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)
2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction
More informationLAB 5 Arithmetic Operations Simple Calculator
LAB 5 Arithmetic Operations Simple Calculator Objective: Practice arithmetic operation for the 80x86, such as add, subtract, multiple, divide, and mod. When dealing with the multiply, divide, and mod instructions
More informationRepresentation of Information
Representation of Information CS61, Lecture 2 Prof. Stephen Chong September 6, 2011 Announcements Assignment 1 released Posted on http://cs61.seas.harvard.edu/ Due one week from today, Tuesday 13 Sept
More informationCSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs
CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)
More informationBasic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal
Basic Definition REPRESENTING INTEGER DATA Englander Ch. 4 An integer is a number which has no fractional part. Examples: -2022-213 0 1 514 323434565232 Unsigned and -Coded Decimal BCD: -Coded Decimal
More informationCONCORDIA UNIVERSITY Department of Computer Science and Software Engineering COMP 228/4 Section PP Midterm Exam
1 CONCORDIA UNIVERSITY Department of Computer Science and Software Engineering COMP 228/4 Section PP Midterm Exam Instructor: Tadeusz S. Obuchowicz Date: Tuesday, February 28, 2012 Time Allowed: 1 hour
More informationCS 3843 Final Exam Fall 2012
CS 3843 Final Exam Fall 2012 Name (Last), (First) ID Please indicate your session: Morning Afternoon You may use a calculator and two sheets of notes on this exam, but no other materials and no computer.
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationBeginning C Programming for Engineers
Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary
More informationMODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE
EXERCISE 9. Determine the mod bits from Figure 7-24 and write them in Table 7-7. MODE (mod) FIELD CODES mod 00 01 10 DESCRIPTION MEMORY MODE: NO DISPLACEMENT FOLLOWS MEMORY MODE: 8-BIT DISPLACEMENT MEMORY
More informationBasic Assembly Instructions
Basic Assembly Instructions Ned Nedialkov McMaster University Canada SE 3F03 January 2013 Outline Multiplication Division FLAGS register Branch Instructions If statements Loop instructions 2/21 Multiplication
More informationBinary Logic (review)
Binary Logic (review) Basic logical operators: (Chapter 7 expanded) NOT AND outputs 1 only if both inputs are 1 OR outputs 1 if at lest one input is 1 XOR outputs 1 if exactly one input is 1 a not 0 1
More informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationBy: Dalbir Singh, Computer Science Dep't
Assembly language is essentially the native language of your computer. Technically the processor of your machine understands machine code (consisting of ones and zeroes). But in order to write such a machine
More informationreply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000
Declaring Variables in Assembly Language As in Java, variables must be declared before they can be used Unlike Java, we do not specify a variable type in the declaration in assembly language Instead we
More informationSIGNED AND UNSIGNED SYSTEMS
EE 357 Unit 1 Fixed Point Systems and Arithmetic Learning Objectives Understand the size and systems used by the underlying HW when a variable is declared in a SW program Understand and be able to find
More informationMicroprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)
Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition
More informationAssembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012
19:211 Computer Architecture Lecture 10 Fall 20 Topics:Chapter 3 Assembly Language 3.2 Register Transfer 3. ALU 3.5 Assembly level Programming We are now familiar with high level programming languages
More informationLab 4: Basic Instructions and Addressing Modes
COE 205 Lab Manual Lab 4: Basic Instructions and Addressing Modes - page 36 Lab 4: Basic Instructions and Addressing Modes Contents 4.1. Data Transfer Instructions 4.2. Addition and Subtraction 4.3. Data
More informationAdding Binary Integers. Part 4. Negative Binary. Integers. Adding Base 10 Numbers. Adding Binary Example = 10. Arithmetic Logic Unit
Part 4 Adding Binary Integers Arithmetic Logic Unit = Adding Binary Integers Adding Base Numbers Computer's add binary numbers the same way that we do with decimal Columns are aligned, added, and "'s"
More informationBinary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2
Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Ziad Matni Dept. of Computer Science, UCSB Adding this Class The class is full I will not be adding more ppl L Even if others
More informationDefining and Using Simple Data Types
85 CHAPTER 4 Defining and Using Simple Data Types This chapter covers the concepts essential for working with simple data types in assembly-language programs The first section shows how to declare integer
More informationBasic Pentium Instructions. October 18
Basic Pentium Instructions October 18 CSC201 Section 002 Fall, 2000 The EFLAGS Register Bit 11 = Overflow Flag Bit 7 = Sign Flag Bit 6 = Zero Flag Bit 0 = Carry Flag "Sets the flags" means sets OF, ZF,
More informationAssembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction
Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction E I P CPU isters Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Topics Assembly Programmer
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationAssembly basics CS 2XA3. Term I, 2017/18
Assembly basics CS 2XA3 Term I, 2017/18 Outline What is Assembly Language? Assemblers NASM Program structure I/O First program Compiling Linking What is Assembly Language? In a high level language (HLL),
More informationCS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it
More informationCS 241 Data Organization Binary
CS 241 Data Organization Binary Brooke Chenoweth University of New Mexico Fall 2017 Combinations and Permutations In English we use the word combination loosely, without thinking if the order of things
More informationComputer Architecture and Assembly Language. Practical Session 5
Computer Architecture and Assembly Language Practical Session 5 Addressing Mode - "memory address calculation mode" An addressing mode specifies how to calculate the effective memory address of an operand.
More informationLab 3. The Art of Assembly Language (II)
Lab. The Art of Assembly Language (II) Dan Bruce, David Clark and Héctor D. Menéndez Department of Computer Science University College London October 2, 2017 License Creative Commons Share Alike Modified
More informationCMSC 313 Lecture 08 Project 2 Questions Recap Indexed Addressing Examples Some i386 string instructions A Bigger Example: Escape Sequence Project
CMSC 313 Lecture 08 Project 2 Questions Recap Indexed Addressing Examples Some i386 string instructions A Bigger Example: Escape Sequence Project UMBC, CMSC313, Richard Chang CMSC 313,
More informationBasic Assembly SYSC-3006
Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming
More informationFaculty of Engineering Student Number:
Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, Second Semester: 2013/2014 Course Title: Microprocessors Date: 08/06/2014 Course No:
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More information16.317: Microprocessor Systems Design I Fall 2015
16.317: Microprocessor Systems Design I Fall 2015 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationCS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017
CS 31: Intro to Systems ISAs and Assembly Martin Gagné Swarthmore College February 7, 2017 ANNOUNCEMENT All labs will meet in SCI 252 (the robot lab) tomorrow. Overview How to directly interact with hardware
More informationdata within a computer system are stored in one of 2 physical states (hence the use of binary digits)
Binary Digits (bits) data within a computer system are stored in one of 2 physical states (hence the use of binary digits) 0V and 5V charge / NO charge on a transistor gate ferrite core magnetised clockwise
More informationLab 6: Conditional Processing
COE 205 Lab Manual Lab 6: Conditional Processing Page 56 Lab 6: Conditional Processing Contents 6.1. Unconditional Jump 6.2. The Compare Instruction 6.3. Conditional Jump Instructions 6.4. Finding the
More information1 /* file cpuid2.s */ 4.asciz "The processor Vendor ID is %s \n" 5.section.bss. 6.lcomm buffer, section.text. 8.globl _start.
1 /* file cpuid2.s */ 2.section.data 3 output: 4.asciz "The processor Vendor ID is %s \n" 5.section.bss 6.lcomm buffer, 12 7.section.text 8.globl _start 9 _start: 10 movl $0, %eax 11 cpuid 12 movl $buffer,
More informationDr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1
Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD 21252 rkarne@towson.edu 11/12/2014 Slide 1 Intel x86 Aseembly Language Assembly Language Assembly Language
More informationGiving credit where credit is due
CSCE 230J Computer Organization Machine-Level Programming I: Introduction Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created
More informationMore Programming Constructs -- Introduction
More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationSemester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC
1 2 Semester Transition Point EE 109 Unit 11 Binary Arithmetic At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is
More informationX86-NASM STANDARD COMMANDS. Comment your code with a semicolon (;)! The assembler won t read anything after it.
X86-NASM STANDARD COMMANDS Comment your code with a semicolon (;)! The assembler won t read anything after it. Move mov ax,bx ; ax = bx Use this command when you want to move a value around. You can also
More informationBinary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018
Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Administrative Stuff The class is full I will not be adding more ppl
More informationTime: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:
ECE 120 Midterm 1 HKN Review Session Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location: Your Room on Compass What to bring: icard, pens/pencils, Cheat sheet (Handwritten) Overview of Review Binary IEEE
More informationCSC231 C Tutorial Fall 2018 Introduction to C
mith College CSC231 C Tutorial Fall 2018 Introduction to C Dominique Thiébaut dthiebaut@smith.edu Learning C in 4 Installments! Dennis Ritchie 1969 to 1973 AT&T Bell Labs Close to Assembly Unix Standard
More informationComputer Organization & Systems Exam I Example Questions
Computer Organization & Systems Exam I Example Questions 1. Pointer Question. Write a function char *circle(char *str) that receives a character pointer (which points to an array that is in standard C
More informationCPU. IBM PC and compatible Memory Structure
CPU The CPU is usually organised in three parts: The Arithmetic and Logic Unit or ALU (which performs computations and comparisons) and the Control Unit which fetches information from and stores information
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between
More informationMicroprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)
Microprocessor and Assembly Language Week-5 System Programming, BCS 6th, IBMS (2017) High Speed Memory Registers CPU store data temporarily in these location CPU process, store and transfer data from one
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer
More informationChapter 3: part 3 Binary Subtraction
Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary
More informationCSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK
CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK Question 1: Choose the most appropriate answer 1. In which of the following gates the output is 1 if and only if all the inputs
More informationTurning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p
Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p text C program (p1.c p2.c) Compiler (gcc -S) text Asm
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 7. Procedures and the Stack
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 7 Procedures and the Stack April, 2014 1 Assembly Language LAB Runtime Stack and Stack
More informationC expressions. (Reek, Ch. 5) 1 CS 3090: Safety Critical Programming in C
C expressions (Reek, Ch. 5) 1 Shift operations Left shift: value > n Two definitions: logical version: discard the n
More informationBinghamton University. CS-220 Spring x86 Assembler. Computer Systems: Sections
x86 Assembler Computer Systems: Sections 3.1-3.5 Disclaimer I am not an x86 assembler expert. I have never written an x86 assembler program. (I am proficient in IBM S/360 Assembler and LC3 Assembler.)
More informationTopics of this Slideset. CS429: Computer Organization and Architecture. It s Bits All the Way Down. Why Binary? Why Not Decimal?
Topics of this Slideset CS429: Computer Organization and Architecture There are 10 kinds of people in the world: those who understand binary, and those who don t! Dr. Bill Young Department of Computer
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 11, 2017 at 08:58 CS429 Slideset 2: 1 Topics of this Slideset
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 8 Bit Operations Clock cycle & instruction timing http://www.newagepublishers.com/samplechapter/000495.pdf Clock cycle & instruction timing See 8086: http://www.oocities.org/mc_introtocomputers/instruction_timing.pdf
More informationChapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary
Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary 1 Outline Introduction to assembly programing Introduction to Y86 Y86 instructions,
More informationCSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators
CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to
More informationSystem Programming and Computer Architecture (Fall 2009)
System Programming and Computer Architecture (Fall 2009) Recitation 2 October 8 th, 2009 Zaheer Chothia Email: zchothia@student.ethz.ch Web: http://n.ethz.ch/~zchothia/ Topics for Today Classroom Exercise
More informationmith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Important Review Does the animation leave a trace? Are the moving objects move without a
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
More informationSECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017
SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 YEAR: 10 Computing Time: 1½ Hr. Name: Class: Instructions: 1. Answer all the questions in the space provided on this paper. 2. Calculators
More informationCPSC 213. Introduction to Computer Systems. Reading. Control Flow. Loops (S5-loop) Static Control Flow. Unit 1d. Companion.
Reading Companion CPSC 213 2.7.1-2.7.3, 2.7.5-2.7.6 Textbook 3.6.1-3.6.5 Introduction to Computer Systems Unit 1d Static Control Flow Control Flow 1 Loops (S5-loop) 2 The flow of control is the sequence
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
More informationThe Instruction Set. Chapter 5
The Instruction Set Architecture Level(ISA) Chapter 5 1 ISA Level The ISA level l is the interface between the compilers and the hardware. (ISA level code is what a compiler outputs) 2 Memory Models An
More informationBasic Arithmetic (adding and subtracting)
Basic Arithmetic (adding and subtracting) Digital logic to show add/subtract Boolean algebra abstraction of physical, analog circuit behavior 1 0 CPU components ALU logic circuits logic gates transistors
More informationA complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation
Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers
More information