0% found this document useful (0 votes)
17 views14 pages

COA 1 (pt2)

Coa pr 2

Uploaded by

adityajhingta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views14 pages

COA 1 (pt2)

Coa pr 2

Uploaded by

adityajhingta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS ‘CHAPTER OBJECTIVES In this chaper you wil eam about ‘+ Machine instructions and program execution including ‘branching and subroutine call nd return operations + Number representation and addition subtraction in the ‘s-complement sytem + Addressing methods for accessing register and memory operands + Assembly language for representing machine instructions, data, and programs ‘+ Program-contolled InpuOutput operations Operations on stack, queue, ls, inke-lst and array data structures CHAPTER 2+ Macve nsTRUCHONS AND PROGR This chaper considers the way programs are exacted ina computer fom the ma- chine instruction set viewpoint. Chapter | intrdaced the general cooept that bath program instruction and data operands are sored in the memory. ln this chapter, we study the ways in which sequences of istration sre brought fom the memory into the processor and executed to perform a given task, The addesng methods com- monly usd fr accessing operands in memory location and procestr registers ae presented, ‘The emphasis here is on basi conceps. We use a generic styl to descibe ma- chine ination and operand adessing methods that ae typi of hose found in commerial processor. A suficient numer of instructions and adesing methods are introduced to enable us to present complete, ralitic programs for simple tasks. ‘These generic programs are spose a the assembly language evel. nasembly la ‘uae, mache instructions and operand addressing infommtion are represented by Symbolic names. A complet instruction set is often refered to asthe instruction set ‘architecture (ISA) ofa presse. In adition to specifying instructions, an ISA also specifies the adesing methods used fr acessing data operands and the processor registers availble for se bythe instrcions. Fr the discussion of asic conoeps in this chap, it i ot necessary to define a complete insrocton st, and we wll not attempt do so lstead, we wil present enough examples to illustrate the capebiltis ented. ‘Chapter 3 presents ISAs for thee commercial processors produce by the ARM, ‘Motorola, and Intel companies. This chaper's generic programs are presented in (Chapter 3 in each of those three instruction sets, providing the reader with examples from ral machines. ‘The vast majority of programs are writen in high-level languages suchas C,C+, Java, or Foran. The main purpose of using asembly language programming inthis book is to desribe how computers operate. To execute a high-level language program ‘on procesor, the program must fist be translated int the assembly language ofthat processor The assembly language a readable representation ofthe machine language forthe processor. The relationship between high-level language and machine language features isa key consideration in computer design. We will discuss this issue number of times. ‘All computers deal with aumbers. They have instructions that perform basic arith ‘metic operations on data operands. Also, daring the proces of executing the machine instructions ofa program, itis necessary o perform arithmetic operations to generate the numbers that represent addresses for accessing operand location in the memory ‘To understand how these tasks are accomplished, the reader must know how numbers are represented in computer and how they are manipulated in addition and subtraction ‘operations. Therefore, in the fist section of this chaper, we wll introduce this topic. ‘A detiled discussion of logic circuits that implement compater arithmetic is given in Chapter 6, In addition to numeric data, computers del with characters and characte stings in order to process textual information. Here, in the fist section, we also describe how characters are represented inthe computer. 2.1. Novnans, AseTaric ORATION, AND CHARACTERS 2.1 NUMBERS, ARITHMETIC OPERATIONS, AND CHARACTERS (Computers are ail using logic circuits tht operate on information represented by two- ‘valued electrical signals (Sce Appendix A) We label the two values as Oand 1; and we define the amount of information represented by such a signal as abi of information, ‘where bit stands for binary digit. The most natural way to represent a number in & ‘computer system is by astring of bits, called a binary number. A text character can also be represented by sing of its called character code. ‘We will ist describe binary number representations and arithmetic operations on ‘hese numbers, and then deseibe character representations. 2.1.1 NUMBER REPRESENTATION Consider an m-bit vector Ba bet..biby Dor for 0

You might also like