mith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut
|
|
- Brett Howard
- 5 years ago
- Views:
Transcription
1 mith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut
2 A B C D E F 15 Super Useful! Conversion
3 Decimal to Binary Conversion Review Shifting
4 =
5 = 1x x x x x x2 0
6 = 1x x x x x x2 0 = = 41d
7 = 1x x x x x x2 0 = = 41d = 1x x x x x x
8 = 1x x x x x x2 0 = = 41d = 1x x x x x x = 1x x x x x x
9 = 1x x x x x x2 0 = = 41d = 1x x x x x x = 1x x x x x x = 1x x x x x2 0
10 = 1x x x x x x2 0 = = 41d = 1x x x x x x = 1x x x x x x = 1x x x x x2 0 = 10100
11 = 1x x x x x x2 0 = = 41d = 1x x x x x x = 1x x x x x x = 1x x x x x2 0 = 10100
12 = 1x x x x x x2 0 = = 41d = 1x x x x x x = 1x x x x x x = 1x x x x x2 0 = = = 20d
13 Dividing by the base extracts the least significant digit
14 Python Program # prompts user for an integer # decomposes the integer into binary x = int( input( "> " ) ) binary = "" while True: if x==0: break remainder = x % 2 quotient = x // 2 if remainder == 0: binary = "0" + binary else: binary = "1" + binary print( "%5d = %5d * 2 + %d quotient=%5d remainder=%d binary=%16s" % (x, quotient, remainder, quotient, remainder, binary ) ) x = quotient
15 Python Program # prompts user for an integer # decomposes the integer into binary x = int( input( "> " ) ) binary = "" while True: if x==0: break remainder = x % 2 quotient = x // 2 if remainder == 0: binary = "0" + binary else: binary = "1" + binary print( "%5d = %5d * 2 + %d quotient=%5d remainder=%d binary=%16s" % (x, quotient, remainder, quotient, remainder, binary ) ) x = quotient
16 Binary to Decimal
17 = 1x x x x x x2 0 = = 41d
18 Binary to Hex
19 =
20 =
21 = = v
22 A 1011 B 1100 C 1101 D 1110 E 1111 F = = v
23 A 1011 B 1100 C 1101 D 1110 E 1111 F = = = 5 2
24 Hex to Binary
25 A 1011 B 1100 C 1101 D 1110 E 1111 F 5A1F =
26 A 1011 B 1100 C 1101 D 1110 E 1111 F 5A1F =
27 Hex to Decimal
28 1A2F =
29 1A2F = 1x Ax x Fx16 0 =
30 A 1011 B 1100 C 1101 D 1110 E 1111 F 1A2F = 1x Ax x Fx16 0 = 1x x x x1 =
31 A 1011 B 1100 C 1101 D 1110 E 1111 F 1A2F = 1x Ax x Fx16 0 = 1x x x x1 = =
32 A 1011 B 1100 C 1101 D 1110 E 1111 F 1A2F = 1x Ax x Fx16 0 = 1x x x x1 = = 6703
33 Decimal to Hex
34 Do: Decimal > Binary Binary > Hex
35 Exercises CSC231_Review_of_hexadecimal_number_system
36 Convert these hexadecimal numbers to binary, and to decimal AAAA F001 FFFF
37 Convert these decimal numbers to binary, and hexadecimal
38 What comes after these hexadecimal numbers, logically? aaaa F 1ABF FFEF F00F ABCDEF
39 Perform the following additions in hex FFFF + AAAA + F + ABCD + FFFF
40 More Arithmetic Instructions
41 ALU
42 Right now, we are dealing only with UNSIGNED integers!
43 inc inc operand inc inc inc inc inc inc reg8 reg16 reg32 mem8 mem16 mem32 alpha db 3 beta dw 4 x dd 0 inc inc inc al cx ebx inc word[beta] ;beta <- 5 inc dword[x] ;x <- 1
44 dec dec operand dec dec dec dec dec dec reg8 reg16 reg32 mem8 mem16 mem32 alpha db 3 beta dw 4 x dd 6 dec al ;al <- al-1 dec cx dec ebx dec word[beta] ;beta <- 3 dec dword[x] ;x <- 5
45 mul mul operand mul mul mul mul mul mul reg8 reg16 reg32 mem8 mem16 mem32
46 Observation 1001 x 1110
47 Observation 1001 x
48 Observation 1001 x
49 Observation 1001 x
50 Observation 1001 x
51 Observation 1001 x
52 mul mul operand mul mul mul mul mul mul reg8 reg16 reg32 mem8 mem16 mem32 edx:eax < operand32 * eax dx:ax < operand16 * ax ax < operand8 * al alpha db 3 beta dw 4 x dd 6 mul byte[alpha] ;ax <- al*alpha mul ebx ;edx:eax <- ; ebx*eax
53 This has tremendously important consequences!
54 public class JavaLimits { } public static void main(string[] args) { int a = 1; for ( int i = 0; i< 100; i++ ){ a = a * 2; System.out.println( "a = " + a ); } }
55 public class JavaLimits { public static void main(string[] args) { // // a multiplication of ints int x = 0x ; int y = 0x ; System.out.println( "x = " + x ); System.out.println( "y = " + y ); int z = x * y; System.out.println( "z = " + z ); System.out.println(); } } x = y = z =
56 How big is a 32-bit int?
57 Ranges (Unsigned Integers) 8 bits bits 0-65, bits 0-4,294,967,295
58 div R : Q div operand div div div div div div reg8 reg16 reg32 mem8 mem16 mem32 edx:eax < edx:eax/ operand32 dx:ax < dx:ax / operand16 ah:al < ax / operand8 alpha db 3 beta dw 4 x dd 6 ;compute beta/alpha mov ax, word[beta] div byte[alpha] ;quotient in al ;remainder in ah
59 Exercise Compute x = 2*alpha +3*beta + x - 1 alpha db 3 beta dw 4 x dd 6
60 End of Video Lecture (Monday 10/2/17)
61 Elements of Style Past-Due Homework 2
62 ;;; hw2.asm ;;; Ha Cao ;;; The program takes inputs of a, b, c and computes ;;; ans = 3*(a+b-c)+2(c-1) ;;; ;;; Assemble and run the program as follows: ;;; nasm -f elf hw2.asm ;;; nasm -f elf 231Lib.asm ;;; ld -melf_i386 -o hw2 hw2.o 231Lib.o extern _printdec extern _printint extern _printstring extern _println extern _getinput section.data prompt db "> " promptlen equ $-prompt ansstr db "ans = " ansstrlen equ $-ansstr a dd 0 b dd 0 c dd 0 ans dd 0 _start: section.text global _start ;; display prompt mov ecx, prompt mov edx, promptlen call _printstring ;; get a call _getinput mov dword[a], eax ;; display prompt mov ecx, prompt mov edx, promptlen call _printstring ;; get b call _getinput mov dword[b], eax ;; get c call mov _getinput dword[c], eax ;; ;; computation: ans = 3*(a+b-c) + 2*(c-1) ;; ; your code will go here... mov eax, 0 ; clear value left in ; registers mov ebx, 0 mov ecx, 0 mov edx, 0 add eax, dword[a] ; add a and b into eax add eax, dword[b] sub eax, dword[c] ; subtract c from eax add ecx, eax ; add eax into ecx 3 ; times add ecx, eax add ecx, ex add ebx, dword[c] ; add c into ebx sub ebx, 1 ; subtract 1 from ebx add edx, ebx ; add ebx into edx 2 ; times add edx, ebx add ecx, edx ; add edx to ecx mov dword[ans], ecx ; mov the value in ecx ; into the memory at ans ;; ;; display "ans = " ;; mov ecx, ansstr mov edx, ansstrlen call _printstring ;; ;; display ans variable ;; mov eax, dword[ans] call _printint call _println call _println ;; display prompt mov ecx, prompt mov edx, promptlen call _printstring ;;; exit mov ebx, 0 mov eax, 1 int 0x80
63 section.data a db 10 b db 0 c dw 0x1234 d dw 0 e dd 0 f dd 0x Swap a and b. Then c and d. Then e and f. Exercise section.text
64 section.data a db 10 b db 0 c dw 0x1234 d dw 0 e dd 0xcdef f dd 0x Set the least significant byte of e and f to 00. Exercise section.text
65 99 hex Exercise reconstruct the declarations of a, b, c, d, e and f. 44 a b c d e f section.data db db dw dw dd db section.text f 1a a typical midterm question!
66 99 dec Exercise reconstruct the declarations of a, b, c, d, e and f. a b c d e f section.data db db dw dw dd db section.text a typical midterm question!
67 Simple Rule Conversion from byte/word to dword alpha db 15 beta dw ; put alpha in eax ; put beta in ebx
68 Simple Rule Conversion from byte/word to dword Only for unsigned integers! alpha db 15 beta dw ; put alpha in eax ; put beta in ebx
69 Following the step by step execution of the program
70 Computer Simulator : LOAD [8] 0002: ADD : STORE [8] 0006: JUMP : 0
71 We stopped here last time
72 amount dd 1234 no20s dd 0 no10s dd 0 no5s dd 0 no1s dd 0 Exercise call _getinput ; eax <- user input mov dword[amount], eax ; break down amount into 20s, 10s, 5s and 1s
73 Vi & Redirection Lab
mith 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 #8 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #8 Dominique Thiébaut dthiebaut@smith.edu Can't Sleep https://xkcd.com/571/ Logic Design Logic Design Image from http://www.willegal.net/appleii/images/motherboard.jpg
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 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 #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 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 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 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 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 informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 9 Integer Arithmetic and Bit Manipulation April, 2014 1 Assembly Language LAB Bitwise
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 informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 7 Multiplication and Division Multiplication commands: mul and imul mul source (source: register/memory) Unsigned Integer Multiplication (mul) mul src (src: register/memory)
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
More informationComputer Architecture and Assembly Language. Practical Session 3
Computer Architecture and Assembly Language Practical Session 3 Advanced Instructions division DIV r/m - unsigned integer division IDIV r/m - signed integer division Dividend Divisor Quotient Remainder
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 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 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 informationComputer Architecture and System Programming Laboratory. TA Session 3
Computer Architecture and System Programming Laboratory TA Session 3 Stack - LIFO word-size data structure STACK is temporary storage memory area register points on top of stack (by default, it is highest
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 informationELEC 242 Time Delay Procedure
There are many occasions where we wish to time events. If we are using a personal computer, we have a number of ways to do this. The 8088/8086 computer had a Programmable Interval Timer like the 8253/54
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 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 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 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 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 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 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 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 informationIBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.
IBM PC Hardware CPU 8088, 8086 80286 80386 80486 Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory
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 informationQ1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100
16.317: Microprocessor-Based Systems I Summer 2012 Exam 1 July 20, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationINSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
8 Unsigned and Signed Integer Numbers 1. Unsigned integer numbers: each type of integer can be either byte-wide or word-wide. This data type can be used to represent decimal numbers in the range 0 through
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 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 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 informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
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 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 informationECOM Computer Organization and Assembly Language. Computer Engineering Department CHAPTER 7. Integer Arithmetic
ECOM 2325 Computer Organization and Assembly Language Computer Engineering Department CHAPTER 7 Integer Arithmetic Presentation Outline Shift and Rotate Instructions Shift and Rotate Applications Multiplication
More informationInteger Arithmetic Part2
Islamic University Of Gaza Assembly Language Faculty of Engineering Discussion Computer Department Chapter 7 Eng. Ahmed M. Ayash Date: 21/04/2013 Chapter 7 Integer Arithmetic Part2 7.4: Multiplication
More informationLanguage of x86 processor family
Assembler lecture 2 S.Šimoňák, DCI FEEI TU of Košice Language of x86 processor family Assembler commands: instructions (processor, instructions of machine language) directives (compiler translation control,
More informationAssignment 3. Problem Definition:
Att (2) Perm(5) Oral(3) Total(10) Sign with Date Assignment 3 Problem Definition: Write x86 ALP to convert 4-digit Hex number into its equivalent BCD number and 4-digit BCD number into its equivalent HEX
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 informationPositional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal
Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using
More informationAssembly Language Programming
Assembly Language Programming Integer Constants Optional leading + or sign Binary, decimal, hexadecimal, or octal digits Common radix characters: h hexadecimal d decimal b binary r encoded real q/o - octal
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 informationIntel 8086: Instruction Set
IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction
More informationLecture 2 Assembly Language
Lecture 2 Assembly Language Computer and Network Security 9th of October 2017 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 2, Assembly Language 1/37 Recap: Explorations Tools assembly
More informationMnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C
ARITHMETIC AND LOGICAL GROUPS 6-1 Arithmetic and logical groups: The arithmetic group includes instructions for the addition, subtraction, multiplication, and division operations. The state that results
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 informationWeek /8086 Microprocessor Programming I
Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any
More informationAbout the Tutorial. Audience. Prerequisites. Copyright & Disclaimer
About the Tutorial Assembly language is a low-level programming language for a computer or other programmable device specific to a particular computer architecture in contrast to most high-level programming
More informationQ1: Multiple choice / 20 Q2: Protected mode memory accesses
16.317: Microprocessor-Based Systems I Summer 2012 Exam 2 August 1, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationInstructions moving data
do not affect flags. Instructions moving data mov register/mem, register/mem/number (move data) The difference between the value and the address of a variable mov al,sum; value 56h al mov ebx,offset Sum;
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 informationASSEMBLY - QUICK GUIDE ASSEMBLY - INTRODUCTION
ASSEMBLY - QUICK GUIDE http://www.tutorialspoint.com/assembly_programming/assembly_quick_guide.htm Copyright tutorialspoint.com What is Assembly Language? ASSEMBLY - INTRODUCTION Each personal computer
More informationLAB 4 Extending Signed and Unsigned Numbers
LAB 4 Extending Signed and Unsigned Numbers Objective: Explain unsigned and signed numbers, zero extension and sign extension, and variable declarations. The 80x86 provides several instructions that will
More informationChapter 7 Integer Arithmetic
Chapter 7 Integer Arithmetic 7.1 Introduction 193 7.2 Shift and Rotate Instructions 194 7.2.1 Logical Shifts and Arithmetic Shifts 194 7.2.2 SHL Instruction 195 7.2.3 SHR Instruction 196 7.2.4 SAL and
More informationMachine and Assembly Language Principles
Machine and Assembly Language Principles Assembly language instruction is synonymous with a machine instruction. Therefore, need to understand machine instructions and on what they operate - the architecture.
More informationAssembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice
Assembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice Addressing data access specification arrays - specification and manipulation impacts of addressing to performance Processor architecture CISC (more
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 informationLecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide
Lecture 9 INC and DEC Arithmetic Operations Overflow Multiply and Divide INC adds one to a single operand DEC decrements one from a single operand INC destination DEC destination where destination can
More informationConstants and Expressions. Lecture 7: Assembly Language Programs. Constants and Expressions (cont.) Statements. Names. Assembly Directives
Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants
More informationEthical Hacking. Assembly Language Tutorial
Ethical Hacking Assembly Language Tutorial Number Systems Memory in a computer consists of numbers Computer memory does not store these numbers in decimal (base 10) Because it greatly simplifies the hardware,
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 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 informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
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 informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2016 Lecture 12
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2016 Lecture 12 CS24 MIDTERM Midterm format: 6 hour overall time limit, multiple sittings (If you are focused on midterm, clock should be running.) Open book
More informationCSC201, SECTION 002, Fall 2000: Homework Assignment #3
1 of 7 11/8/2003 7:34 PM CSC201, SECTION 002, Fall 2000: Homework Assignment #3 DUE DATE October 25 for the homework problems, in class. October 27 for the programs, in class. INSTRUCTIONS FOR HOMEWORK
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 informationInteger Arithmetic. Pu-Jen Cheng. Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed.
Computer Organization & Assembly Languages Integer Arithmetic Pu-Jen Cheng Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed. Chapter Overview
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 8. Conditional Processing
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 8 Conditional Processing April, 2014 1 Assembly Language LAB Unconditional Jump The
More informationWinter Compiler Construction T11 Activation records + Introduction to x86 assembly. Today. Tips for PA4. Today:
Winter 2006-2007 Compiler Construction T11 Activation records + Introduction to x86 assembly Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv University Today ic IC Language Lexical Analysis
More informationSummer 2003 Lecture 4 06/14/03
Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General
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 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 informationComputer Science Final Examination Wednesday December 13 th 2006
Computer Science 03-60-266 Final Examination Wednesday December 13 th 2006 Dr. Alioune Ngom Last Name: First Name: Student Number: INSTRUCTIONS EXAM DURATION IS 3 hours. OPEN NOTES EXAM: lecture notes,
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 informationSigned number Arithmetic. Negative number is represented as
Signed number Arithmetic Signed and Unsigned Numbers An 8 bit number system can be used to create 256 combinations (from 0 to 255), and the first 128 combinations (0 to 127) represent positive numbers
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 6 Input/output using a Library of Procedures April, 2014 1 Assembly Language LAB Using
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 informationET355 Microprocessors Thursday 6:00 pm 10:20 pm
ITT Technical Institute ET355 Microprocessors Thursday 6:00 pm 10:20 pm Unit 4 Chapter 6, pp. 139-174 Chapter 7, pp. 181-188 Unit 4 Objectives Lecture: BCD Programming Examples of the 805x Microprocessor
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
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 informationConstants and. Lecture 7: Assembly Language Programs. Expressions (cont.) Constants and. Statements. Expressions
Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants
More informationStep 1: Add the least significant digits together: produces with carry 1.
Advanced Arithmetic Advanced Arithmetic Chapter Four 41 Chapter Overview This chapter deals with those arithmetic operations for which assembly language is especially well suited and high level languages
More informationSample Exam I PAC II ANSWERS
Sample Exam I PAC II ANSWERS Please answer questions 1 and 2 on this paper and put all other answers in the blue book. 1. True/False. Please circle the correct response. a. T In the C and assembly calling
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 informationLab 3: Defining Data and Symbolic Constants
COE 205 Lab Manual Lab 3: Defining Data and Symbolic Constants - page 25 Lab 3: Defining Data and Symbolic Constants Contents 3.1. MASM Data Types 3.2. Defining Integer Data 3.3. Watching Variables using
More informationExperiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.
Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language
More informationCDA 3103 Computer Organization Homework #7 Solution Set
CDA 3103 Computer Organization Homework #7 Solution Set 1 Problems 1. Write a MARIE assembly program for the following algorithm where the subroutine takes two numbers and returns their product. Your assembly
More informationAL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: Text-printing program. CSC 209 JAVA I
AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 2- Arithmetic and Decision Making: Equality and Relational Operators Objectives: To use arithmetic operators. The precedence of arithmetic
More informationECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION
ECOM 2325 Computer Organization and Assembly Language Instructor: Ruba A.Salamah INTRODUCTION Overview Welcome to ECOM 2325 Assembly-, Machine-, and High-Level Languages Assembly Language Programming Tools
More informationEC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationregister clicker:
Algorithms and Code register clicker: https://www.student.cs.uwaterloo.ca/~cs105/cgi-bin/clicker-form.cgi activate clicker: hold ON/OFF, wait for power light to flash, enter room code CS 105-01b Algorithms
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 informationArithmetic and Logic Instructions And Programs
Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.
More informationQ1: Multiple choice / 20 Q2: Data transfers and memory addressing
16.317: Microprocessor Systems Design I Fall 2014 Exam 1 October 1, 2014 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More information8088/8086 Programming Integer Instructions and Computations
Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction
More information