0% found this document useful (0 votes)
21 views

Tutorial 8

1. The document provides examples of calculating memory requirements for different memory chip configurations. 2. It explains concepts like address lines, memory locations, and how to determine the number of chips needed to make up a given memory size. 3. The document also covers stack-related concepts like the stack pointer, how data is pushed and popped from the stack, and how subroutines use the stack and program counter.

Uploaded by

Nixon Gaming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Tutorial 8

1. The document provides examples of calculating memory requirements for different memory chip configurations. 2. It explains concepts like address lines, memory locations, and how to determine the number of chips needed to make up a given memory size. 3. The document also covers stack-related concepts like the stack pointer, how data is pushed and popped from the stack, and how subroutines use the stack and program counter.

Uploaded by

Nixon Gaming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorial 8

1. Calculate the address lines required for an 8K-byte (1024 x 8 = 8192 memory word)
memory chip.

8K bytes = 8 * 1024 = 8192 memory locations

To calculate the number of address lines required, we use the formula:

Number of address lines = log2(number of memory locations)

Number of address lines = log2(8192) ≈ 13

Therefore, an 8K-byte memory chip would require 13 address lines.

2. How many memory locations can be addressed by a microprocessor with 14 address


lines?

2^14 = 16,384 memory locations.

3. Specify the number of registers and memory cells in a 128 x 4 memory chip.

In a 128 x 4 memory chip, "128 x 4" means that it has 128 memory locations and
each location is 4 bits wide. The number of registers in the chip would depend on the
architecture and design, so we cannot determine that from the given information.
However, the number of memory cells can be calculated by multiplying the number
of memory locations by the word size:

Number of memory cells = Number of memory locations * Word size


= 128 * 4
= 512 memory cells

Therefore, there are 512 memory cells in a 128 x 4 memory chip.

4. What is the memory word size required in an 8085 system?

The memory word size required in an 8085 system is 8 bits (1 byte).

5. If the memory chip size is 256 x 1 bits, how many chips are required to make up 1K
(1024) bytes of memory?

If the memory chip size is 256 x 1 bits, we need to determine the number of chips
required to make up 1K (1024) bytes of memory. Each chip has 256 memory
locations, and each location is 1 bit wide. To calculate the number of chips required:
Number of chips = (Required memory size in bits) / (Number of memory locations *
Word size) = 1024 / (256 * 1) = 1024 / 256 = 4 chips
Therefore, 4 chips are required to make up 1K (1024) bytes of memory.

6. If the memory chip size is 1024 x 4 bits, how many chips are required to make up 2K
(2048) bytes of memory?

If the memory chip size is 1024 x 4 bits, we need to determine the number of chips
required to make up 2K (2048) bytes of memory. Each chip has 1024 memory
locations, and each location is 4 bits wide. To calculate the number of chips required:
Number of chips = (Required memory size in bits) / (Number of memory locations *
Word size)
= 2048 / (1024 * 4)
= 2048 / 4096
= 0.5 chips

Since we cannot have half a chip, we need to round it up to the nearest whole
number. Therefore, 1 chip is required to make up 2K (2048) bytes of memory.

7. Check the appropriate answer in the following statements:


A stack is:
(A) an 8-bit register in the microprocessor.
(B) a 16-bit register in the microprocessor.
(C) a set of memory locations in R/WM reserved for storing information temporarily
during the execution of a program.
(D) a 16-bit memory address stored in the program counter.

Answer:
(C) a set of memory locations in R/WM reserved for storing information temporarily
during the execution of a program.

8. Check the appropriate answer in the following statements:


A stack pointer is:
(A) a 16-bit register in the microprocessor that indicates the beginning of the stack
memory.
(B) a register that decodes and executes 16-bit arithmetic expressions.
(C) the first memory location where a subroutine address is stored.
(D) a register in which flag bits are stored.

Answer:
(A) a 16-bit register in the microprocessor that indicates the beginning of the stack
memory.
9. Check the appropriate answer in the following statements:
When a subroutine is called, the address of the instruction following the CALL
instruction is stored in/on the
(A) stack pointer.
(B) accumulator.
(C) program counter.
(D) stack.

Answer:
(C) program counter.

10. Check the appropriate answer in the following statements:


When the RET instruction at the end of a subroutine is executed,
(A) the information where the stack is initialized is transferred to the stack pointer.
(B) the memory address of the RET instruction is transferred to the program counter.
(C) two data bytes stored in the top two locations of the stack are transferred to the
program counter.
(D) two data bytes stored in the top two locations of the stack are transferred to the
stack pointer.

Answer:
(B) the memory address of the RET instruction is transferred to the program counter.

11. Check the appropriate answer in the following statements:


Whenever the POP H instruction is executed,
(A) data bytes in the HL pair are stored on the stack.
(B) two data bytes at the top of the stack are transferred to the HL register pair.
(C) two data bytes at the top of the stack are transferred to the program counter.
(D) two data bytes from the HL register that were previously stored on the stack are
transferred back to the HL register.

Answer:
(B) two data bytes at the top of the stack are transferred to the HL register pair.

12. Read the following program and answer the questions given below:

Line No. Mnemonics


1 LXI SP,XXXXH
2 LXI B,2055H
3 LXI H,22FFH
4 LXI D,2090H
5 PUSH H
6 PUSH B
7 MOV A, L
8 POP H

Memory available for the execution of the program:


0400H
.
.
.
0100H

a) What address the programmer should initialize the stack pointer in Line 1?

The programmer should initialize the stack pointer in Line 1 with the value 0400H
since it represents the start of the available memory for execution.

b) What is the memory location of the stack where the first data byte will be stored?

The specific memory location of the stack where the first data byte will be stored
depends on the initial value of the stack pointer. Since the stack pointer is
initialized to 0400H, the first data byte will be stored at the memory location
03FFH (one address below the stack pointer).

c) Identify the Hex code and machine code for each instruction.

Hex code and machine code for each instruction:

Line 1: LXI SP,0400H


Hex code: 31 00 04
Machine code: 0011 0001 0000 0000 0000 0100

Line 2: LXI B,2055H


Hex code: 01 55 20
Machine code: 0000 0001 0101 0101 0010 0000

Line 3: LXI H,22FFH


Hex code: 21 FF 22
Machine code: 0010 0001 1111 1111 0010 0010

Line 4: LXI D,2090H


Hex code: 11 90 20
Machine code: 0001 0001 1001 0000 0010 0000

Line 5: PUSH H
Hex code: E5
Machine code: 1110 0101
Line 6: PUSH B
Hex code: C5
Machine code: 1100 0101

Line 7: MOV A, L
Hex code: 7D
Machine code: 0111 1101

Line 8: POP H
Hex code: E1
Machine code: 1110 0001

d) List the program counter from the start of the execution until end of the program.
Illustrate the association of each program counter with the content in the
memory.

PC = 0100H: 31 00 04 (Line 1)
PC = 0103H: 01 55 20 (Line 2)
PC = 0106H: 21 FF 22 (Line 3)
PC = 0109H: 11 90 20 (Line 4)
PC = 010CH: E5 (Line 5)
PC = 010DH: C5 (Line 6)
PC = 010EH: 7D (Line 7)
PC = 010FH: E1 (Line 8)

e) List the stack pointer from the start of the execution until end of the program.
Illustrate the association of each stack pointer with the content in the memory.

Initial stack pointer:

SP = 0400H
Line 1: LXI SP,0400H

No change to the stack pointer: SP = 0400H


Line 2: LXI B,2055H

No change to the stack pointer: SP = 0400H


Line 3: LXI H,22FFH

No change to the stack pointer: SP = 0400H


Line 4: LXI D,2090H

No change to the stack pointer: SP = 0400H


Line 5: PUSH H
Decrement stack pointer by 2 (since it pushes a 16-bit value): SP = 03FEH
Content at memory location 03FEH: Value of H register
Content at memory location 03FFH: Value of H register (second byte)
Line 6: PUSH B

Decrement stack pointer by 2: SP = 03FCH


Content at memory location 03FCH: Value of B register
Content at memory location 03FDH: Value of B register (second byte)
Line 7: MOV A, L

No change to the stack pointer: SP = 03FCH


Line 8: POP H

Increment stack pointer by 2: SP = 03FEH


Content at memory location 03FFH: Value of H register (second byte)
Content at memory location 03FEH: Value of H register

After the program execution, the final stack pointer is SP = 03FEH. The stack
pointer moves down the memory locations as items are pushed onto the stack
and moves up as items are popped off the stack.

f) Illustrate the content of accumulator and register array for each instruction when
it is executed.

Content of the accumulator and register array for each instruction when
executed:

Line 1 (LXI SP,0400H): No changes to the accumulator or register array.


Line 2 (LXI B,2055H): No changes to the accumulator or register array.
Line 3 (LXI H,22FFH): No changes to the accumulator or register array.
Line 4 (LXI D,2090H): No changes to the accumulator or register array.
Line 5 (PUSH H): The value in the H register is pushed onto the stack.
Accumulator and register array remain unchanged.
Line 6 (PUSH B): The value in the B register is pushed onto the stack.
Accumulator and register array remain unchanged.
Line 7 (MOV A, L): The value in the L register is moved to the accumulator.
Register array

You might also like