Digital Systems and Microcomputers MICROCOMPUTERS Worksheet 2 (Week 9) by margaretlester


									     Al Philippe Sinoy                                        Tutor: Dr. Desmond Watson

                          Digital Systems and Microcomputers
                                  Worksheet 2 (Week 9)


     A1.) How are the memory and I/O interfaces allocated address in a microcomputer

     The memory and I/O interfaces allocated address in a microcomputer system are
     controlled by “memory mapping”. Memory mapping is primarily intended to map
     buffers in device memory into the application's address space. Specific memory
     locations will contain a specific memory type or specific I/O type.

                          FFFF H
                                           Not Used

                          21FF H
                          2000 H                                     Example of a
                                           Not Used                  Memory Map
                          10FF H
                          1000 H
                                           Not Used
                          04FF H

                          0000 H

     A2.) A microcomputer has 1K RAM, 8K ROM, printer, keyboard display and an array
     of 8 switches. Devise a memory map for the system and determine how many address
     lines are used for each group of devices.

             1K RAM         = 1024 Bytes           = 210        -10 Address lines
             8K ROM         = 8192 Bytes           = 213        -13 Address lines

4 I/O
             Keyboard       = 4 Bytes              = 22         -2 Address lines
             8 Switches

     A3.) An instruction set can be divided into a number of broad groups according to the
     types of function they perform. Outline five possible groups.

          1. Data Manipulation

                                            Page 1
Al Philippe Sinoy                                           Tutor: Dr. Desmond Watson

   The instructions change data in some way. They are generally all the arithmetic
   and logical operations, rotate, shift, increment, decrement etc. They are
   fundamental to the operation of all programs. They are the most important as they
   are in charge of doing the actual processing of data.

   2. Data Transfer
   These instructions involve moving data from one location to another without
   necessarily changing the contents. There are several sources to which the data can
   be moved around to. It includes
          - transfers between memory locations and a register in the
          - from one register to another register entirely within the
          - between an microprocessor register and an I/O interface
          - between the microprocessor and stack.

   3. Program or Conditional Control Instructions
   Also referred to as the Branch of Jump group. These instructions change the
   normal sequence of a program flow by loading a new address into the Program
   Counter (PC). Both the unconditional and conditional jump instructions are
   included in this group. Unconditional jump instructions always put a new address
   in the program counter. Conditional jump instructions only put a new address
   when a specific condition has been met. The conditions are usually met by the
   examination of some operation via the flags in the processor.

   4. Machine Control & Status
   These instructions control the operation of the microprocessor. They perform
   actions such as reset, halt clear and set specific flags, interrupt handling etc. These
   actions cause no operations to perform.

   5. Input/Output
   These instructions set up and transfer data between the processor and peripheral
   interface and hence the outside world. It includes communication devices and
   special co-processors, etc.


B1.) Explain the various forms of addressing modes by illustrating with examples
from the 8085 instructions set for immediate, direct, register and register indirect
types. What are the advantages of register indirect over direct addressing?

The address mode determines the way data is accessed from and to the memory like
input/output, registers, etc.

   (i)     Immediate: The memory location immediately follows the operand code of
           the instruction.
           Example: MVI A, 2F; // Move contents of 2f into accumulator A

   (ii)    Direct addressing: The operand code itself is an address of memory or
           locations where data may be found.

                                         Page 2
Al Philippe Sinoy                                            Tutor: Dr. Desmond Watson

             Example: LDA       408F; // Load contents of 408F into accumulator A.

   (iii)     Register: Data is transferred rapidly between internal registers of the
             Example: MOV B, A; // Move contents of A into memory B.

   (iv)      Registers Indirect: Microprocessors refers indirectly to a register pair (HL)
             for the address of a location that contains the data stored.
             Example: MOV B, M;          // Move contents of pair HL into B.

B2.) Memory locations 3000H, 3001H, 3002H, 3003H, 3004H, 3005H, 3006H have
contents: 00H, 08H, 10H, 18H, 20H, 28H and 30H respectively. Explain how the
following lines of code change these contents. Identify the addressing modes used.
What are contents of memory locations 3000H to 3006H afterwards?

One:      MVI A, 30H            // Move contents of 30H into accumulator A.
          STA 3000H             // Store the content accumulator A into address 300H.

Two: LDA 3005H                  // Load the contents of address 2005H into the
                                accumulator A. Directly
          STA 3001H             // Store the contents of A into address 3001H.

Three: LXI H, 3004H             // Load the register pair HL into address 3004H.
          LXI D, 3002H          // Load the register pair DE into address 3002H.
          MOV A, M              // Move the contents of M in the Accumulator A.
                                Register Indirect
          XCHG                  //Exchange contents of register pair HL with register
                                pair DE. Register
          MOV M, A              // Move the contents of the accumulator A to the
                                memory location M. Register Indirect

Four: LXI H, 1018H              // Load the register pair HL into address 1018H.
          SHLD 3003H            // Store the contents of L into 3003H and store the
                                contents of H into 3004H. - Directly

Five: LXI H, 3005H              // Load the register pair HL into address 3005H.
          MVI M, 08H            // Move the contents of 08H into M. Immediately

Six:      LXI H, 3006H          // Load the register pair HL into address 3006H
          XRA A                 // XOR A with A. Register

                                          Page 3
Al Philippe Sinoy                                         Tutor: Dr. Desmond Watson

       MOV M, A             // Move the contents of HL into accumulator A.
                            Register Indirect

The contents of the memory locations.
       Memory Address                            Before        After
       3000 H                                    00H           30H
       3001 H                                    08H           28H
       3002 H                                    10H           20H
       3003 H                                    18H           18H
       3004 H                                    20H           10H
       3005 H                                    28H           08H
       3006 H                                    30H           00H

                                        Page 4

To top