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

Memory Access Tutorial or Sample

Uploaded by

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

Memory Access Tutorial or Sample

Uploaded by

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

MICROPROCESSOR SYSTEMS

NAME: __________________________________ SUBJECT CODE: _____

LABORATORY WORK NO. 1


MEMORY ACCESS
I. OBJECTIVE(S):
- to access memory we can use these four registers: BX, SI, DI, BP. combining these
registers inside [ ] symbols, we can get different memory locations.

II. THEORIES:
1. MOV instruction
SAMPLE PROGRAM:

ORG 100h

MOV AX, 0B800h

MOV DS, AX

MOV CL, 'A'

MOV CH, 1101_1111b

MOV BX, 15Eh

MOV [BX], CX

RET

OUTPUT EMULATOR SCREEN:

2. Variables, Arrays and Constant


SAMPLE PROGRAM:

ORG 100h

MOV AL, var1

MOV BX, var2

RET

VAR1 DB 7

var2 DW 1234h
OUTPUT EMULATOR SCREEN:

3. Getting the Address of a Variable

SAMPLE PROGRAM:

ORG 100h

MOV AL, VAR1

MOV BX, OFFSET VAR1

MOV BYTE PTR [BX], 44h

MOV AL, VAR1

RET

VAR1 DB 22h

END

OUTPUT EMULATOR SCREEN:


4. Interrupts –

SAMPLE PROGRAM:
ORG 100h .

MOV AH, 0Eh

MOV AL, 'H'

INT 10h

MOV AL, 'e'

INT 10h

MOV AL, 'l'

INT 10h

MOV AL, 'l'

INT 10h

MOV AL, 'o'

INT 10h

MOV AL, '!'

INT 10h

RET

OUTPUT EMULATOR SCREEN:

5. Library of common functions - emu8086.inc

SAMPLE PROGRAM:

name "hi-world"

org 100h

mov ax, 3

int 10h

mov ax, 1003h

mov bx, 0

int 10h

mov ax, 0b800h

mov ds, ax
mov [02h], 'H'

mov [04h], 'e'

mov [06h], 'l'

mov [08h], 'l'

mov [0ah], 'o'

mov [0ch], ','

mov [0eh], 'W'

mov [10h], 'o'

mov [12h], 'r'

mov [14h], 'l'

mov [16h], 'd'

mov [18h], '!'

mov cx, 12

mov di, 03h

c: mov [di], 11101100b

add di, 2

loop c

mov ah, 0

int 16h

ret

OUTPUT EMULATOR SCREEN:


III. QUESTIONS.
1. List of supported Interrupts and their definitions.
2. What are the two types of variables supported by the EMU 8086 compiler?
3. Differentiate a variable over a constant over an array.
4. What is an assembly language?
5. Enumerate how many ways Variable can be viewed in any numbering system.

IV. ANSWERS:

1. List of supported Interrupts and their definitions.

Hardware Interrupts – Hardware interrupts are those interrupts that are caused by any peripheral device by
sending a signal through a specified pin to the microprocessor. There are two hardware interrupts in the 8086
microprocessor:

NMI (Non-Maskable Interrupt): It is a single pin non-maskable hardware interrupt that cannot be disabled. It is the
highest priority interrupt in the 8086 microprocessor. After its execution, this interrupt generates a TYPE 2
interrupt. IP is loaded from word location 00008 H, and CS is loaded from the word location 0000A H.

INTR (Interrupt Request): It provides a single interrupt request and is activated by the I/O port. This interrupt can
be masked or delayed. It is a level-triggered interrupt. It can receive any interrupt type, so the value of IP and CS
will change on the interrupt type received.

Software Interrupts – These are instructions inserted within the program to generate interrupts. There are 256
software interrupts in the 8086 microprocessor. The instructions are of the format INT type, where the type ranges
from 00 to FF. The starting address ranges from 00000 H to 003FF H. These are 2-byte instructions. IP is loaded
from type * 04 H, and CS is loaded from the following address given by (type * 04) + 02 H. Some important
software interrupts are:

TYPE 0 corresponds to division by zero(0).

TYPE 1 is used for single-step execution for debugging the program.

TYPE 2 represents NMI and is used in power failure conditions.

TYPE 3 represents a break-point interrupt.

TYPE 4 is the overflow interrupt.

2. What are the two types of variables supported by the EMU 8086 compiler?

-The two types of variables supported by the EMU 8086 compiler BYTE and WORD.

3. Differentiate a variable over a constant over an array.

- Arrays are what's called a "reference variable" in that they refer to, or point to a value in memory
instead of directly holding the value. This distinction doesn't often make much difference but here
it does. With const the effect is only one level deep, so can't change which array it points to, but
you are allowed to alter the array.
4. What is an assembly language?

- An assembly language is a programming language that communicates with the hardware of a


computer directly. An assembly language allows a software developer to code using words and
expressions that can be easier to understand and interpret than the binary or hexadecimal data
the computer stores and reads.

5. Enumerate how many ways Variable can be viewed in any numbering system.

You might also like