Page 26 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 26

Unit 2: Data Processing



            depending on the details of the particular computer. The program counter is automatically   Notes
            incremented for each machine cycle so that instructions are normally retrieved sequentially
            from memory.
            The control unit places these instructions into its instruction register and then increments the
            program counter so that it contains the address of the next instruction stored in memory. It then
            executes the instruction by activating the appropriate circuitry to perform the requested task.
            As soon as the instruction has been executed, it restarts the machine cycle, beginning with the
            fetch step.
            During one machine cycle the processor executes at least two steps, fetch (data) and execute
            (command). The more complex a command is (more data to fetch), the more cycles it will take
            to execute. Reading data from the zero page typically needs one cycle less as reading from an
            absolute address. Depending on the command, one or two more cycles will eventually be needed
            to modify the values and write them to the given address.
            Control Unit is the part of the computer that controls the Machine Cycle.

            It takes numerous cycles to do even a simple addition of two numbers.
            Fetch - get an instruction from Main Memory
            Decode - translate it into computer commands

            Execute - actually process the command
            Store - write the result to Main Memory
            It has to be considered how long a specific command takes to execute when coding, so that the
            whole timing inside the program altogether and specially the screen output works. This is referred
            to as “cycle counting”. Beginners in assembler programming often throw in NOP commands
            (takes two cycles) to achieve a stable timing.

            2.3 Memory

            There are two kinds of computer memory: primary and secondary. Primary memory is an integral
            part of the computer system and is accessible directly by the processing unit. RAM is an example of
            primary memory. As soon as the computer is switched off the contents of the primary memory is
            lost. The primary memory is much faster in speed than the secondary memory. Secondary memory
            such as floppy disks, magnetic disk, etc., is located external to the computer. Primary memory
            is more expensive than secondary memory. Because of this, the size of primary memory is less
            than that of secondary memory. Computer memory is used to store two things: (i) instructions
            to execute a program and (ii) data.
            When the computer is doing any job, the data that have to be processed are stored in the primary
            memory. This data may come from an input device like keyboard or from a secondary storage
            device like a floppy disk. As program or the set of instructions is kept in primary memory, the
            computer is able to follow instantly the set of instructions.
            2.3.1 Primary Memory

            The primary memory in the computer is in the form of IC’s (Integrated Circuits). These
            circuits are called Random Access Memory (RAM). Each of RAM’s locations stores one byte
            of information. (One byte is equal to 8 bits). A bit is an acronym for binary digit, which
            stands for one binary piece of information. This primary or internal storage section is made
            up of several small storage locations (ICs) called cells. Each of these cells can store a fixed
            number of bits called word length. Each cell has a unique number assigned to it called the




                                             LOVELY PROFESSIONAL UNIVERSITY                                    19
   21   22   23   24   25   26   27   28   29   30   31