CIS 020 Assembly Programming Chapter 11 - Binary Operations Using RX-Format Instructions © John Urrutia 2012, All Rights Reserved.5/27/20121.

Slides:



Advertisements
Similar presentations
Number Systems and Codes
Advertisements

INSTRUCTION SET ARCHITECTURES
CIS 020 Assembly Programming Chapter 13 - Branching and Looping With Registers © John Urrutia 2012, All Rights Reserved.5/27/20121.
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
CIS 020 Assembly Programming Chapter 02 - Numbering Systems & Data Representation © John Urrutia 2012, All Rights Reserved.5/27/20121.
Number Systems Standard positional representation of numbers:

1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
What is an instruction set?
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
CIS 020 Assembly Programming Chapter 14 - Instruction Formats & Interrupt Codes for DEBUGGING PROGRAMS © John Urrutia 2012, All Rights Reserved.5/27/20121.
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Data Representation Number Systems.
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
Computer Arithmetic Nizamettin AYDIN
How Computers Work Dr. John P. Abraham Professor UTPA.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
Fundamental of Computer Architecture By Panyayot Chaikan November 01, 2003.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Data Representation in Computer Systems
CIS 020 Assembly Programming Chapter 07 - Decimal Arithmetic Operations © John Urrutia 2012, All Rights Reserved.5/27/20121.
CIS 020 Assembly Programming Chapter 12 - RR-Format Instructions & more RX-Format Instructions © John Urrutia 2012, All Rights Reserved.5/27/20121.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
The Hexadecimal Number System and Memory Addressing ISAT 121.
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor.
Number Systems Revision of conversations What is a register Addition Complementation.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
Data Representation, Number Systems and Base Conversions
Computer Architecture and Organization
Computer Architecture EKT 422
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
MECH1500 Chapter 3.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
CIS 020 Assembly Programming Chapter 08 - Advanced Decimal Arithmetic Instructions © John Urrutia 2012, All Rights Reserved.5/27/20121.
CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS.
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
CIS 020 Assembly Programming
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 10 – Loaders.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
NUMBER SYSTEMS.
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Programming in Machine Language
Data Representation Binary Numbers Binary Addition
Chapter 3 Data Representation
Microcomputer Programming
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
The University of Adelaide, School of Computer Science
Data Representation Data Types Complements Fixed Point Representation
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
Chapter 3 - Binary Numbering System
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

CIS 020 Assembly Programming Chapter 11 - Binary Operations Using RX-Format Instructions © John Urrutia 2012, All Rights Reserved.5/27/20121

Objectives Familiarization with the General Purpose Registers Syntax & Use of some RX-Format instructions Conversion to Binary format from Decimal format Conversion to Decimal format from Binary format Boundary Alignment © John Urrutia 2012, All Rights Reserved.25/27/2012

General Purpose Registers As we will see there are multiple instructions that do the similar things Register instructions are the most efficient because they are part of the CPU In the 390 architecture there are: 16 General Purpose Register 16 Control Registers 16 Floating Point Registers Most programs only use the General Purpose Registers © John Urrutia 2012, All Rights Reserved.35/27/2012

General Purpose Registers Each Register is internally designated by 1 hexadecimal digit. ( 0 – F ) The Assembler recognizes registers in context by numeric values. ( 0 – 15 ) To help prevent confusion with numeric values we generally identify registers with R0 – R15. This is done with the assembly Macro EQUREGS that uses the equate assembler directive. © John Urrutia 2012, All Rights Reserved.45/27/2012

General Purpose Registers Each register is 4 bytes long, however we will see later that we can pair registers together to form 8 bytes. Instructions that use Registers directly, come in 3 basic formats. RR – Register to Register RX – Register to Indexed Storage RS – Register to Storage In this chapter we concentrate on the RX format © John Urrutia 2012, All Rights Reserved.55/27/2012

Review of Data Representation We have already explored Character & Decimal format. Character format is used for displayable text and includes A – Z, a – z, 0 – 9 (Standard letters & numerals) (Special Characters) Control characters Decimal format is used for arithmetic operations and is stored in the Packed Decimal format Character = Hexadecimal = Packed Decimal C’012345’ X’F0F1F2F3F4F5’ X’012345F’ © John Urrutia 2012, All Rights Reserved.65/27/2012

Review of Data Representation Packed Decimal format, negative numbers are represented by the last character byte Character = Hexadecimal = Packed Decimal C’01234N’ X’F0F1F2F3F4D5’ X’012345D Binary format is used primarily for addressing and calculations. Each byte has 8 bits and each bit has an ordinal value. The above numeric value is = 70 Hex = X’46’, Packed = X’070F’, Character = C’70’ © John Urrutia 2012, All Rights Reserved.75/27/

Review of Data Representation Binary format is always a series of ones & zeros So to convey a 4 byte value like “BULL” in binary Convert each character to it’s binary equivalent Combine in sequence the 4 conversions and Spew forth the answer: There’s got to be a better way, Which is to use hexadecimal to convey the binary equivalent C2E4D3D3 © John Urrutia 2012, All Rights Reserved.85/27/2012

Review of Data Representation Binary numbers are a bit strange Rule 1 : If the high-order bit is on the number is negative If the high-order bit is off the number is positive Rule 2 : Negative numbers are stored as 2 ’s complement of the positive number Take the positive binary number Complement the bits Add 1 © John Urrutia 2012, All Rights Reserved.95/27/2012

Review of Data Representation Examples © John Urrutia 2012, All Rights Reserved.105/27/2012

Review of Data Representation Binary data will generally be aligned to specific addresses. All of which are even numbers. D – Doubleword – 8 Bytes long, address is a multiple of 8 F – Fullword – 4 Bytes long, address is a multiple of 4 H – Halfword – 2 Bytes long, address is a multiple of 2 The Assembler will automatically align to these addresses by padding with slack bytes When defining constants the binary equivalent of the decimal number will be stored. © John Urrutia 2012, All Rights Reserved.115/27/2012

Register to Indexed Storage There are 47 RX instructions All RX instructions are 4 bytes long with the following syntax © John Urrutia 2012, All Rights Reserved.125/27/2012 RXOp CodeR1X2B D2 First HalfwordSecond Halfword

Register to Indexed Storage The Load instruction Loads 4 consecutive bytes into the specified register. Parameter should be on a fullword boundary. Failure to do this will slow down the instruction © John Urrutia 2012, All Rights Reserved.135/27/2012

Register to Indexed Storage The Store instruction Stores the specified register into 4 consecutive bytes. Parameter should be on a fullword boundary. Failure to do this will slow down the instruction © John Urrutia 2012, All Rights Reserved.145/27/2012

Register to Indexed Storage The Add instruction Adds 4 consecutive bytes to the specified register. Parameter should be on a fullword boundary. Failure to do this will slow down the instruction © John Urrutia 2012, All Rights Reserved.155/27/2012

Register to Indexed Storage The Add instruction When Adding, no Overflow or Underflow will occur. Condition Code 3 is set if there is a carry out of the high- order bit. If the program mask has been set to recognize a fixed- point exception. The Fixed-point overflow exception occurs. © John Urrutia 2012, All Rights Reserved.165/27/2012

Register to Indexed Storage The Subtract Instruction Subtract behaves the same as the Add instruction except Operand 2 is subtracted from the general purpose register in operand 1. © John Urrutia 2012, All Rights Reserved.175/27/2012

Register to Indexed Storage The index value in an RX instruction X2 – is the general purpose register temporarily added to the base register along with the displacement to resolve the Operand 2 address. Any value from 1 through 15 can be used By default X2 is set to zero which is treated as a NOP. © John Urrutia 2012, All Rights Reserved.185/27/2012

Convert to Binary All data must be in a binary format when using registers. CVB – Convert To Binary, takes packed decimal values and stores them in a register in binary format Op. 2 must be PL8 and on a Doubleword Boundary © John Urrutia 2012, All Rights Reserved.195/27/2012

Convert to Decimal CVD – Convert To Decimal, takes a register in binary format and stores it in packed decimal format. Op. 2 must be PL8 and on a Doubleword Boundary © John Urrutia 2012, All Rights Reserved.205/27/2012