- 131 Views
- Uploaded on
- Presentation posted in: General

UNIT

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

UNIT

Memory Usage

Topics:

- Hardware Components
- Numbering Systems
- Numeric Conversions
- Data Representation

Unit: Memory Usage

- When you program in Assembler Language, you are dealing much more closely with the actual computer hardware than if you were programming in a High Level Language. The Assembler Language programmer must be intimately acquainted with the computer’s hardware components and how they interact, in order to write correct, efficient programs.
- This unit covers:
- Computer hardware
- Numbering systems
- Converting between numbering systems and data representation

Introduction

Unit: Memory Usage

- At the end of this unit, you will be able to:
- Describe how an Assembler program uses main storage
- Describe the kinds of registers used in the architecture
- Convert numbers between decimal, binary and hexadecimal systems
- Add and subtract in binary and hexadecimal
- Describe how characters and numbers are stored within S/390 architecture

Introduction

UNIT

Memory Usage

Topics:

- Hardware Components
- Numbering Systems
- Numeric Conversions
- Data Representation

Topic: Hardware Components

Unit: Memory Usage

- At the end of this topic, you will be able to:
- Describe the functions of main storage
- Describe the kinds of registers used in the architecture
- Define a General Purpose Register (GPR) and Program Status Word (PSW)

Introduction

Topic: Hardware Components

Unit: Memory Usage

- What is main storage?
- Main storage, or memory, is the location where programs and data must reside in order to execute. Main storage contains the programs and data that are part of the operating system, and the programs and data that are part of your program.
- What is a byte?
- The memory is made up of individual binary digits or bits. Bits are grouped into units of 8 bits, called a byte. The byte is the basic unit of addressability in the hardware.

00001111

01000000 00001000

00011000 00011000

11010010

OPERANDS

OP CODE

BIT NUMBER

11 00 10 10

01 23 45 57

Byte 1

Byte n

Byte 0

Concepts

Topic: Hardware Components

Unit: Memory Usage

- Modern operating systems such as MVS, are designed so that “real main storage” is shared between many users. Only the current executable portions of the program and data for each user are present in storage at any point of time.
- The programmers view, however, is of virtual storage. The whole Assembler program space resides in virtual storage, in addresses that are continuous from the start to the end of the program space.

Virtual Storage:

MVS

2 GB

User Area

Program A

Concepts

Topic: Hardware Components

Unit: Memory Usage

- What are registers?
- Registers are another location where operands reside in an Assembler Language program. There are several registers in the architecture.
- Types of registers in the architecture are:
- General Purpose Registers (GPRs)
- Floating Point Registers (FPRs)
- Control Registers
- Access Registers
- Vector Registers

General Purpose

Registers (GPRs)

GPR – Used by the

Programmer for Storage

Address, Accumulator

and Work Area.

Floating - Point

Registers (FPRs)

FPR – Performs Floating

Point Arithmetic.

Control Registers

Control Registers and

Access Registers –

Used by the Operating

System.

Access Registers

Vector Registers – Used

for advanced math

calculations

Vector Registers

Concepts

Topic: Hardware Components

Unit: Memory Usage

- What are General Purpose Registers (GPRs)?
- GPRs are of the most interest to programmers.
- There are 16 general purpose registers (GPRs),
- numbered from 0-15. They are referred to with a
- prefix of R (R0, R1, R2…. R15).
- The GPRs are 32 bits in length and can hold
- fixed-point values between -2, 147, 483, 648, and
- +2, 147, 483, 647.
- GPRs are used as:
- Part of the address for all storage operands
- As accumulators and work areas in performing fixed-point arithmetic

General Purpose Registers

R1

R15

R0

0

BITS

31

1 byte

1 byte

1 byte

1 byte

Concepts

Topic: Hardware Components

Unit: Memory Usage

- What is a Program Status Word (PSW)?
- The Program Status Word is a hardware location
- where the current status of the Central
- Processing Unit (CPU) is represented. It is a
- register that is of particular interest to the
- Assembler Language programmer.
- Amongst other fields, the PSW contains:
- The address of the next instruction to be executed
- The current value of the condition code (CC)
- Other flags, such as the one to indicate whether the CPU is in problem state or supervisor state

Program

Mask

CC

C

P

0000 0000

0

31

8

12

18

20

24

Instruction Address

0000 0000

32

63

40

Program Status Word (EC Mode)

Concepts

Topic: Hardware Components

Unit: Memory Usage

- Which of the following registers do applications programs use?A. General Purpose Registers
- B. Floating Point Registers
- C. Vector Registers
- D. Control Registers

Review

Topic: Hardware Components

Unit: Memory Usage

- GPRs are ______________ bits in size.

Review

Topic: Hardware Components

Unit: Memory Usage

- Virtual Storage – Memory that appears to an application to be larger and more uniform than it is. Virtual storage may be partially simulated by secondary storage such as a hard disk. Applications access memory through virtual addresses, which are translated (mapped) by special hardware and software into physical addresses.
- Problem State– A CPU state, determined by a bit in the Program Status Word (PSW), in which only non-privileged instructions may be executed.
- Floating-point– A numeric format that can be used to represent very large real numbers and very small real numbers. Floating-point numbers are stored in two parts, a mantissa and an exponent. The mantissa specifies the digits in the number, and the exponent specifies the magnitude of the number.
- Floating-Point
- Arithmetic– Arithmetic performed on floating-point numbers.
- Supervisor State– A CPU state, determined by a bit in the Program Status Word (PSW), in which both privileged and non-privileged instructions may be executed.

Glossary

Topic: Hardware Components

Unit: Memory Usage

- Now that you have completed this topic, you should be able to:
- Describe the functions of main storage
- Describe the kinds of registers used in S/390 architecture
- Describe a General Purpose Register (GPR) and Program Status Word (PSW)

Summary

UNIT

Memory Usage

Topics:

- Hardware Components
- Numbering Systems
- Numeric Conversions
- Data Representation

Topic: Numbering Systems

Unit: Memory Usage

- At the end of this topic, you will be able to:
- Define and understand Base Value
- Define binary and hexadecimal numbers
- Convert binary and hexadecimal numbers to decimal numbers and vice versa

Introduction

Topic: Numbering Systems

Unit: Memory Usage

- Although most people are comfortable using the
- decimal number system for doing arithmetic,
- computers are however binary devices, based on
- elements which have two states, represented by
- the numbers 0 (off) and 1 (on).
- While the HLL programmer does not often have to
- work with non-decimal numbers, the Assembler
- Language programmer does.
- The Assembler Language programmer also has
- to be aware of hexadecimal or base 16 numbers.

Number System Example

1234

Decimal

Binary

0110

2E3

Hexadecimal

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- What is base value?
- Every number system has some base value. The
- base value of the decimal system is 10. To
- represent numbers in a number system of base n,
- there must be n unique symbols.

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- To represent numbers equal to or greater than the
- base, more than one digit is required.
- To represent the number ten in decimal, we use
- the two digits 10. To represent the number two
- hundred and forty one, we use the three digits
- 241. What does 241 mean? It means 2 times 100
- plus 4 times 10 plus 1.

2

4

1

1

2

0

10

10

10

Ones

1 X 1 = 1

Tens

4 X 10 = 40

Hundreds

2 X 10 X 10 = 200

So 241= (2*10*10) + (4*10) + (1*1)

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- The number 241 can be represented as
- (2*102) + (4*101) + (1*100)
- To determine the value of a number proceed as follows:
- Multiply the digit in the rightmost position by the base raised to power 0, which is 1
- Add the next leftmost digit multiplied by the base raised to the power 1, which is the base
- Add the next digit multiplied by the base raised to the power of 2 etc., until we run out of digits

1

2

4

0

1 X 10

1

4 X 10

2

2 X 10

Concepts

Topic: Numbering Systems

Unit: S/390 Memory Usage

- How many unique symbols are used in the octal (base 8) number system?
- A. 2
- B. 7
- C. 8
- D. 9

Review

Topic: Numbering Systems

Unit: Memory Usage

- What are binary numbers?
- Binary numbers are numbers represented using
- the base 2. Base 2 numbers are represented with
- only 2 unique symbols, 0 and 1. The only values
- that can be represented with a single binary digit
- (or bit) are 0 and 1.

1

1

0

1

(23)

(22)

(21)

(20)

ones

twos

fours

eights

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- What decimal value does the binary number 101101 represent ?
- To determine this, we can rewrite the number to represent its meaning more clearly.

1011012

(Binary Value)

= (1 X 25) + (0 X 24) + (1 X 23) + (1 X 22)

+ (0 X 21) + (1 X 20)

= (1 X3210) + (0 X 1610) + (1 X 810) +

(1 X410) + (0 X 210) + (1 X 1)

= 3210 + 810 + 410 + 110

= 4510 (Decimal Value)

A subscript coded after a number represents its base.

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- Once we get used to using binary notation, it is
- easy to convert binary values back to the
- equivalent decimal value.

1

0

1

1

0

1

1 X 20 = 10

+

0 X 21 = 0

+

+

1 X 22 = 4

+

1 X 23 = 8

+

1 X 24 = 0

4510 (DECIMAL VALUE)

=

1 X 25 = 32

Remember – Digit positions, from right to left, represent the values 1,2,4,8,16, 32, 64 and so on.

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- In 45 10 = 101101 2 , the value of the number
- is the same but, the notation and the base are
- different.

4510

1011012

=

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- What is the decimal equivalent of 110112?
- A. 20
- B. 27
- C. 23
- D. 26

Review

Topic: Numbering Systems

Unit: Memory Usage

- Match the binary values with their decimal equivalents.
- 1. 10112A. 1510
- 2. 10002B. 5103. 11112 C. 11104. 01012D. 810

Review

Topic: Numbering Systems

Unit: Memory Usage

- The binary system is important because it is the
- way the computer represents numbers internally.
- The binary system is difficult to work with large
- values, since the number of digit positions
- become very large. As a result, we often use
- hexadecimal notation as an alternative to binary
- to represent numbers.
- The number 4510 required 6 binary digits to
- represent it. The largest 4 digit decimal number,
- 9999, requires 14 binary digits. It is difficult to deal
- with representations this long without making
- errors.

00002 = 010

1011012 = 4510

1110010002 = 35610

111100111012 = 92510

100111100011112 = 999910

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- The symbol A16 is equivalent to 10, B is 11, C is
- 12, D is 13, E is 14 and F is 15. Since 16 (the
- base of hexadecimal numbers) is 24, there is a
- close equivalent between binary and hexadecimal
- notations.

HEXADECIMAL

BINARY

DECIMAL

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

1011

B

11

1100

C

12

1101

D

13

1110

E

14

Each hexadecimal digit is equal to 4 binary digits. See these equivalencies in the table.

1111

F

15

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- These equivalencies between binary and hexadecimal make conversion between these two bases almost trivial. Assembler language programmers should be able to perform the conversions represented in this table almost without thinking.

1100

C

4

0100

1111

F

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- Which of the following are true?
- A. The hexadecimal number system uses 16 unique symbols to represent numbers.
- B. The hexadecimal digit C is equivalent to 13 decimal.
- C. The hexadecimal number A00 is equal to 10 * 163 in decimal.
- D. Values greater than 1510 need more than one digit in their hexadecimal representation.

Review

Topic: Numbering Systems

Unit: Memory Usage

- The binary value of 10011101 is represented in hexadecimal as _____________.

Review

Topic: Numbering Systems

Unit: Memory Usage

- In the case of binary to hexadecimal, group the
- binary digits into groups of four, starting at the
- right and replace each group of 4 binary digits by
- the corresponding hexadecimal digits. You may
- have to add some leading zeroes to the left most
- group to get up to four bits.

Hexadecimal

C

4

F

1111

0100

Binary

1100

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- Converting between decimal and the other two
- bases is a little more complex.
- To convert binary or hexadecimal to decimal,
- simply multiply each hexadecimal or binary digit
- by the decimal value of its position and add the
- products.

Binary to Decimal

101011012 = 1 + 4 + 8 + 32 + 128

= 17310

Hexadecimal to Decimal

2 AC16 = (2 X 162) + (10 X 161) + (12 X 160)

= 512 + 160 +12

= 68410

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- Such conversions are performed generating one digit at a time, right to left by successive divisions by the
- desired base.
- Example: To convert 83 decimal to binary we would proceed as follows. We form the binary number from the
- digits we have extracted. Thus 8310 = 10100112

83(10) =

1 Divide 1 by 2 giving a quotient of 0 and a remainder of 1. 1 is the seventh rightmost digit. Since the

quotient is now zero, we stop.

1

0 Divide 2 by 2 giving a quotient of 1 and a remainder of 0. 0 is the sixth rightmost digit.

0

1

1 Divide 5 by 2 giving a quotient of 2 and a remainder of 1. 1 is the fifth rightmost digit.

0 Divide 10 by 2 giving a quotient of 5 and a remainder of 0. 0 is the fourth rightmost digit.

0

0

0 Divide 20 by 2 giving a quotient of 10 and a remainder of 0. 0 is the third rightmost digit.

1

1 Divide 41 by 2 giving quotient of 20 and a remainder of 1. 1 is the second rightmost digit.

1

1 Divide 83 by 2 giving quotient of 41 and a remainder of 1. 1 is the rightmost digit of the result.

Continued…

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- Conversion from decimal to hexadecimal works in
- a similar manner, only now the divisor is 16, which
- is the base of hexadecimal numbers.
- Example:
- To convert 1205 decimal to hexadecimal proceed
- as follows. Form the hexadecimal numbers from
- the digits that have been extracted. Thus
- 120510 = 4B516

Decimal to Hex

1205(10) =

4 Divide 4 by 16 giving a quotient of 0 and a

remainder of 4.4 is the third rightmost digit

4

B Divide 75 by 16 giving a quotient of 4 and

a remainder of 11.B is the third rightmost

digit

B

5 Divide 1205 by 16 giving a quotient of 75

and a remainder of 5.5 is the rightmost

digit of the result

5

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- The manual process can be disregarded if the
- programmer is in possession of a calculator with
- the capability of performing binary to decimal to
- hexadecimal conversions.
- A table of conversion factors can also save time.

Concepts

Topic: Numbering Systems

Unit: Memory Usage

- To convert decimal numbers to hexadecimal, divide the decimal number by _______________ , record the remainder and continue division with the quotient.

Review

Topic: Numbering Systems

Unit: Memory Usage

- Which of the following are equal to decimal 20?
- A. 1416
- B. 267
- C. 346
- D. 101002

Review

Topic: Numbering Systems

Unit: Memory Usage

- Now that you have completed this topic, you should be able to:
- Define and understand Base Value
- Define binary and hexadecimal numbers
- Convert binary and hexadecimal numbers to decimal numbers and vice versa

Summary

UNIT

Memory Usage

Topics:

- Hardware Components
- Numbering Systems
- Numeric Conversions
- Data Representation

Topic: Numbering Conversions

Unit: Memory Usage

- At the end of this topic, you will be able to:
- Understand simple binary and hexadecimal arithmetic
- Add and subtract with binary and hexadecimal numbers

Introduction

Topic: Numbering Conversions

Unit: Memory Usage

- The Assembler Language Programmer will
- sometimes be required to do simple arithmetic
- with binary and hexadecimal numbers. The
- methodology of doing addition and subtraction is
- the same as with decimal numbers, except that
- the base is different.
- Example:
- First add two binary numbers:
- 1001011
- +101101
- --------------

CCCC

1001011

+ 101101

1111000

In arithmetic addition, a carry occurs when the sum of a specific position exceeds the base minus one.

Concepts

Topic: Numbering Conversions

Unit: Memory Usage

- Example:
- Look at an example of hexadecimal addition: 36B5 + 83C7

B Finally, 0 + 3 + 8 = B. Record the final digit.

36B5 + 83C7 = BA7C. Thus 36B516 + 83C7 = BA7C16

B

A In the next position 1 + 6 + 3 = A. Record the A and carry 0.

Carry 0 A in hex represents a 10.

36B5 + 83C7 = A7C

A

7 In the next rightmost position 0 + B + C = 17. Record the 7 and carry the 1.

Carry 1 36B5 + 83C7 = 7C

B + C = 23 which in base 16, can be represented by a 7 for a total of 7 past the base 16(16 + 7 = 23)

and carry the one which is the base 16.

7

C Again we start in the rightmost position. 5 + 7 = C. Record the C and carry 0.

Carry 0 36B5 + 83C7 = C

5 + 7 = 12 which in hex is represented by a C.

C

Concepts

Topic: Numbering Conversions

Unit: Memory Usage

- What is the sum of the following binary numbers? 100101102 + 1110012 = ____________________

Review

Topic: Numbering Conversions

Unit: Memory Usage

- What is the sum of the following hexadecimal numbers?
- BC3716 + 179416 = __________________

Review

Topic: Numbering Conversions

Unit: Memory Usage

- Subtraction in binary and hexadecimal is
- performed similar to decimal subtraction, but
- remembering that when having to borrow, the
- value borrowed is the base.
- Example:
- 10100110
- -1101001
- ---------------
- 111101

10100110

- 1101001

111101

Continued…

Concepts

Topic: Numbering Conversions

Unit: Memory Usage

- Example:
- C5E6
- -2D47
- ------------
- 989F

C5E6

- 2D47

989F

Concepts

Topic: Numbering Conversions

Unit: Memory Usage

- To borrow in subtraction subtract 1 from the digit position n+1 and add the ___________
- value to position n.

Review

Topic: Numbering Conversions

Unit: Memory Usage

- What is the difference when subtracting the following hexadecimal numbers?
- D08C16 - 531616 = ________________

Review

Topic: Numbering Conversions

Unit: Memory Usage

- Binary Numbers – A number expressed in binary form, having 2 as its base, so values are expressed as combinations of digits 0 and 1. These two digits can represent the logical values true and false as well as numerals.

Glossary

Topic: Numbering Conversions

Unit: Memory Usage

- Now that you have completed this topic, you should be able to do:
- Simple binary and hexadecimal arithmetic
- Addition and subtraction with binary and hexadecimal numbers

Summary

UNIT

Memory Usage

Topics:

- Hardware Components
- Numbering Systems
- Numeric Conversions
- Data Representation

Topic: Data Representation

Unit: Memory Usage

- At the end of this topic, you will be able to:
- Describe Data Representation. Understand EBCDIC
- Describe different kinds of arithmetic instructions – Fixed-Point arithmetic and Floating-Point arithmetic
- Describe types of decimal numbers – Packed and Zoned decimal

Introduction

Topic: Data Representation

Unit: Memory Usage

- How is data represented?
- Contents of main storage consist of, at the lowest
- level of just binary digits (bits) grouped into 8 bit
- units called bytes. However, all data is encoded
- and must be interpreted according to its type.
- Data representing textual information is
- represented differently than data representing
- decimal or fixed point numbers.

Name

1.0083

Continued…

Concepts

Topic: Data Representation

Unit: Memory Usage

- In S/390 architecture characters are
- represented using the Extended Binary Coded
- Decimal Interchange Code (EBCDIC).
- Each character is represented by one byte code,
- a combination of eight bits.
- Many printers and terminals are built to convert
- EBCDIC data into display characters.

EBCDIC is a different code from ASCII, which is used in many other computer architectures.

Concepts

Topic: Data Representation

Unit: Memory Usage

- The table shown here shows some of the more
- common characters, and their EBCDIC
- representation, expressed in hexadecimal.

LETTERS

DIGITS

- 0 F0
- F1
- F2
- F3
- F4
- F5
- F6
- F7
- F8
- F9

A C1

B C2

C C3

SPECIAL CHARACTERS

$ 5B

/ 61

% 6C

Continued…

Concepts

Topic: Data Representation

Unit: Memory Usage

- The EBCDIC representation of the string "System /390" would be the hexadecimal string
- E2A8A2A385944061F3F9F0.
- It is highly desirable for the Assembler Language
- programmer to have a reference card containing
- all the characters and their representation in the
- EBCDIC code. Most experienced Assembler
- Language programmers have memorized the
- codes for the most common characters.

Concepts

Topic: Data Representation

Unit: Memory Usage

- What is the acronym for EBCDIC?
- A. Extended Binary Coded Decimal Interchange CodeB. Enhanced Binary Coding for Decimal Integers and CharactersC. Exceptional Basis for Corporate Data Information Coding
- D. Exemplary Binary Coding Defined for Integrated Computers

Review

Topic: Data Representation

Unit: Memory Usage

- What would be the EBCDIC representation of ‘CAB’?A. C1C2C3
- B. C2C3C1C. C3C1C2
- D. C3C2C1

Review

Topic: Data Representation

Unit: Memory Usage

- Although EBCDIC represents numbers in character form, it cannot be used for arithmetic operations.
- What are the kinds of arithmetic instructions?
- Fixed-Point (Binary) arithmetic and Decimal arithmetic are integer based, handling only whole numbers . Floating-Point arithmetic handles real numbers, numbers with fractional portions.

Fixed Point

(Binary)

0111111111111111

F3F2F7F6C7

32767C

Decimal:

Zoned Decimal

Packed Decimal

Floating Point:

278.31924

Briefly look at each of the types and how it is used to represent numeric values.

Concepts

Topic: Data Representation

Unit: Memory Usage

- What is Fixed-Point arithmetic?
- Fixed-Point arithmetic uses three data types:
- Full words – sometimes called a word, is four bytes (32 bits) in length
- Half words – 2 bytes (16 bits) in length
- Double words – 8 bytes (64 bits) in length

- What do fixed-point numbers consist of?
- Fixed-point numbers consist of two parts, a sign and a magnitude. The sign is in the leftmost, or high-order bit, and the magnitude occupies the rest of the field.
- A zero bit represents a positive sign, a one bit a negative sign.

0

2

HALF

HALFWORD = 2 bytes

2 bytes x 8 Bits = 16 Bits

4

0

FULL

FULLFWORD = 4 bytes

4 bytes x 8 Bits = 32 Bits

0

8

DOUBLE

8 bytes x 8 Bits = 64 Bits

DOUBLEWORD = 8 bytes

0

0

0

0

1

0

0

1

Magnitude

Sign

Continued…

Concepts

Topic: Data Representation

Unit: Memory Usage

- For positive numbers, the magnitude is represented in true binary. A half word value of +25 would be represented as:
- 0000 0000 0001 1001
- For negative numbers the magnitude is expressed in twos-complement form. To convert a binary value to twos-complement, flip all the bits, change 1s to 0 and 0s to 1, and then add one. A halfword value of -25 would be represented as:
- 1111 1111 1110 0111

Halfword Value of + 25

0000

0000

0001

1001

1111

1111

1110

0110

= +25

REVERSE

BITS

ADD + 1

= -25

1

TWOS-COMPLEMENT

1111

1111

1110

0111

Halfword Value of - 25

Concepts

Topic: Data Representation

Unit: Memory Usage

- Leading zeroes
- Note that in positive numbers, leading zeroes (0s)
- are insignificant, and in negative numbers, leading
- one (1s) are insignificant. In general, bits equal to
- the sign bit are insignificant.
- Twos-complement
- Twos-complement notation used to represent
- negative fixed-point numbers makes doing
- arithmetic easy for the computer.

Positive Numbers:

0000

1000 0001

Leading Zeros

Negative Numbers:

1111

0111 1111

Leading Ones

Concepts

Topic: Data Representation

Unit: Memory Usage

- Decimal numbers are of the following two types:
- Zoned Decimal
- Packed Decimal

- What is packed decimal?
- Packed decimal requires less storage than
- EBCDIC, since each number is represented by
- half a byte (4 bits). Arithmetic is only done on
- packed decimal numbers.
- What is zoned decimal?
- Zoned decimal is an intermediate format, used in
- converting numbers from characters to packed
- decimal. Packed numbers can be from 1 to 31
- digits in length, while zoned can be from 1 to 16
- digits.

Zoned Decimal

to

DIGITS

1

16

Packed Decimal

to

DIGITS

1

31

Concepts

Topic: Data Representation

Unit: Memory Usage

- What is a zone nibble?
- Each byte in a zoned decimal number consists of
- a zone nibble and a numeric nibble. The zone
- nibble is the first half of each byte, and the
- numeric nibble is the second half.
- Each numeric nibble contains the decimal digit
- value for that position. All zone nibbles except the
- rightmost contain the hex value F (one one
- binary). The rightmost nibble contains the sign.
- The hex character C represents a positive sign
- and D represents a negative sign.

Zoned Decimal Number:

Numeric nibble

F

0

F

4

F

5

F

C

1

2

Sign

Zone nibble

A nibble is half a byte.

Concepts

Topic: Data Representation

Unit: Memory Usage

- Packed decimal notation adds one decimal digit
- into each nibble, except for the rightmost nibble,
- which contains the sign. The sign is coded the
- same way as for zoned decimal.
- A three byte packed decimal number containing
- the value 4521 would be represented (in hex) as:
- 04521C

Packed Decimal Number:

-2 digits/byte

Byte 1

Byte 2

Byte 3

04

52

1C

Zoned Decimal Number:

-1 digit/byte

F0

F4

F5

F2

C1

Byte 1

Byte 2

Byte 3

Byte 4

Byte 5

Concepts

Topic: Data Representation

Unit: Memory Usage

- Fixed point and decimal numbers are integers. Real numbers, numbers with a fractional part, are
- represented with floating point numbers. Floating
- point numbers allow you to represent a large
- range of numbers.

1.74642 X 1017

= 174642000000000000

Concepts

Topic: Data Representation

Unit: Memory Usage

- Following are the 3 data types used for floating- point numbers?
- Short numbers – 4 bytes in length
- Long - 8 bytes in length
- Extended – 16 bytes in length

- A floating-point number consists of the following parts:
- A Sign
- A Mantissa
- An Exponent

Floating Point Numbers:

SHORT

4 bytes

Mantissa (3 bytes)

8 bytes

LONG

Mantissa 7 bytes

16 bytes

EXTENDED

Mantissa

7 bytes

Low Order

Mantissa

7 bytes

High Order

Sign (1st bit)

0 – Positive

1 - Negative

1 byte ( Unused)

Exponent ( 7 bits)

1 byte

0

1010001

Concepts

Topic: Data Representation

Unit: Memory Usage

- The three floating-point formats all provide for
- essentially identical ranges of magnitude, since
- the exponent is the same size in each.
- Going from short to long or from long to extended
- simply increases the length of the mantissa, and
- thus provides more precision.

Floating-Point Formats

0.32641 X 1070

0.32641347961 X 1070

0.3264134796128439 X 1070

Concepts

Topic: Data Representation

Unit: Memory Usage

- Which of the following data types allow for representing fractional numbers?A. Packed Decimal
- B. Fixed PointC. Floating Point
- D. Zoned Decimal

Review

Topic: Data Representation

Unit: Memory Usage

- Which of the following would describe a field in storage containing 003C?A. A halfword value of +60
- B. A zoned decimal value of +3C. A character value of ‘C’
- D. A packed decimal value of +3

Review

Topic: Data Representation

Unit: Memory Usage

- Fixed-point Binary – A numeric format and a set of machine arithmetic instructions. Fixed-point arithmetic is integer based using binary for positive numbers and twos-complements for negative numbers.
- Decimal– The base-10 numbering system.
- Fixed-Point Arithmetic– Arithmetic performed on fixed-point numbers
- Sign – The character used to indicate a positive or negative number. In Assembly-Level programming, the sign is indicated by the sign bit accompanying the other number.
- Leading Zero– A zero that precedes the most significant (leftmost) digit of a number. One or more leading zeroes may be used as fill characters in a field containing numeric input. Leading zeroes have no significance in the value of a number.
- Twos-Complement – A number in the base-2 system that is the Twos-complement of another number. Twos-complement are usually derived by reversing the digits in a binary number and adding 1 to the result. When twos-complement is used to represent negative numbers, the most significant digit is always 1.

Continued…

Glossary

Topic: Data Representation

Unit: Memory Usage

- Integers – A positive or negative “whole” number such as 37, -50 or 764. Integers are widely used in programming for counting and numbering purposes due to the fact that calculations are much faster using integers as opposed to floating-point numbers.

Glossary

Topic: Data Representation

Unit: Memory Usage

- Now that you have completed this topic, you learned to:
- Describe Data Representation. Understand EBCDID
- Describe types of decimal numbers – Packed and Zoned decimal

Summary

Unit: Memory Usage

- Now that you have completed this unit, you should be able to:
- Describe how an Assembler program uses main storage
- Describe the kinds of registers used in S/390 architecture
- Convert numbers between decimal, binary and hexadecimal systems
- Add and subtract in binary and hexadecimal
- Describe how characters and numbers are stored within S/390 architecture

Continued…

Summary