0% found this document useful (0 votes)
171 views109 pages

MP LAB MANUAL 2015 Ise PDF

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 109

QMP 7.

1 D/F

Channabasaveshwara Institute of Technology


(An ISO 9001:2008 Certified Institution)

NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka.

Department of Information Science and Engineering

Microprocessor Laboratory
10CSL48
B.E – IV Semester (Even Semester)
Lab Manual 2015-16

Name : _____________________________________

USN : _____________________________________

Batch : __________________ Section : ___________


Channabasaveshwara Institute of Technology
(An ISO 9001:2008 Certified Institution)

NH 206 (B.H. Road), Gubbi, Tumkur – 572 216. Karnataka.

Department of Information Science and Engineering

Microprocessor Laboratory
10CSL48
Version 1.0
February 2016

Prepared by: Approved by:


Mr. Chethan Balaji, Associate Professor Mrs. Jyothi K S

Mr. Shashidhara M S, Associate Professor Associate Professor

Incharge Head
Contents
Sl. No. Name of the Experiment Page No.

Masm Commands 01
Sample Programs 03
1 a) Binary Search Program 07
b) Logic controller- odd and even parity 09
2 a) Read and Write using Macros 11
b) Logic controller- BCD Up-Down Counter 13
3 a) Sorting in Ascending order using bubble sort 15
b) Logic Controller- 8 bit Multiplication 16
4 a) Read alphanumeric character and display its ASCII code 17
b) 7-Segment display- FIRE and HELP 19
5 a) To check the string for a palindrome 21
b) 7-segment Display- Rolling Fashion 23
6 a) Compare two strings for equality 25
b) 7-segmant Display – Binary to BCD conversion 28
7 a) To display a name 31
b) Matrix Keypad- Key Scan 33
8 a) Compute nCr using recursive procedure 36
b) Stepper Motor 38
9 a) Display the system time 40
b) Generate a SINE wave using DAC 41
10 a) To simulate a Decimal Up-counter to display 00- 99 43
b) Generate a half rectified SINE wave using DAC 45
11 a) Move the Cursor to specified Location on the screen 47
b) Generate a fully rectified SINE wave using DAC 49
12 a) Program to create a file (input file) and to delete an 51
existing file
b) Program to perform Elevator process 53
References 57
Annexure 58
Viva Questions 80
SYLLABUS
MICROPROCESSORS LABORATORY
(Common to CSE & ISE)
Subject Code : 10CSL48 I.A. Marks : 25
Hours/Week : 03 Exam Hours: 03
Total Hours : 42 Exam Marks: 50
Notes:
· Develop and execute the following programs using 8086 Assembly Language. Any
suitable assembler like MASM, TASM etc may be used.
· Program should have suitable comments.
· The board layout and the circuit diagram of the interface are to be provided to the
student during the examination.

1. a) Search a key element in a list of ‘n’ 16-bit numbers using the Binary search algorithm.
b) Read the status of eight input bits from the Logic Controller Interface and display ‘FF’ if it
is the parity of the input read is even; otherwise display 00.

2. a) Write two ALP modules stored in two different files; one module is to read a character
from the keyboard and the other one is to display a character. Use the above two modules to
read a string of characters from the keyboard terminated by the carriage return and print the
string on the display in the next line.
b) Implement a BCD Up-Down Counter on the Logic Controller Interface.

3. a) Sort a given set of ‘n’ numbers in ascending order using the Bubble Sort algorithm.
b) Read the status of two 8-bit inputs (X & Y) from the Logic Controller Interface and
display X*Y.

4. a) Read an alphanumeric character and display its equivalent ASCII code at the center of
the screen.
b) Display messages FIRE and HELP alternately with flickering effects on a 7-segment
display interface for a suitable period of time. Ensure a flashing rate that makes it easy to read
both the messages (Examiner does not specify these delay values nor is it necessary for the
student to compute these values).

5. a) Reverse a given string and check whether it is a palindrome or not.


b) Assume any suitable message of 12 characters length and display it in the rolling fashion
on a 7-segment display interface for a suitable period of time. Ensure a flashing rate that
takes it easy to read both the messages. (Examiner does not specify these delay values nor is
it necessary for the student to compute these values).
6. a) Read two strings, store them in locations STR1 and STR2. Check whether they are equal
or not and display appropriate messages.
Also display the length of the stored strings.
b) Convert a 16-bit binary value (assumed to be an unsigned integer) to BCD and display it
from left to right and right to left for specified number of times on a 7-segment display
interface.

7. a) Read your name from the keyboard and display it at a specified location on the screen
after the message “What is your name?”. You must clear the entire screen before display.
b) Scan a 8 x 3 keypad for key closure and to store the code of the key pressed in a memory
location or display on screen. Also display row and column numbers of the key pressed.

8. a) Compute nCr using recursive procedure. Assume that ‘n’ and ‘r’ are non-negative
integers.
b) Drive a Stepper Motor interface to rotate the motor in specified direction (clockwise or
counter-clockwise) by N steps (Direction and N are specified by the examiner). Introduce
suitable delay between successive steps. (Any arbitrary value for the delay may be assumed
by the student).

9. a) Read the current time from the system and display it in the standard format on the
screen.
b) Generate the Sine Wave using DAC interface (The output of the DAC is to be displayed
on the CRO).

10. a) Write a program to simulate a Decimal Up-counter to display 00-99.


b) Generate a Half Rectified Sine wave form using the DAC interface. (The output of the
DAC is to be displayed on the CRO).

11. a) Read a pair of input co-ordinates in BCD and move the cursor to the specified location
on the screen.
b) Generate a Fully Rectified Sine waveform using the DAC interface. (The output of the
DAC is to be displayed on the CRO).

12. a) Write a program to create a file (input file) and to delete an existing file.
b) Drive an elevator interface in the following way:
i. Initially the elevator should be in the ground floor, with all requests in OFF state.
ii. When a request is made from a floor, the elevator should move to that floor, wait there for
a couple of seconds (approximately), and then come down to ground floor and stop. If some
requests occur during going up or coming down they should be ignored.

Note: In the examination each student picks one question from the lot of all 12
questions.
INDEX PAGE

Note:

Record Marks
Manual Marks
(Max . 25)

(Student)
(Max. 10)

Signature

Signature
Date

(Faculty)
Sl.
No
Name of the Experiment
Submission
Conduction Repetition
of Record

Average

 If the student fails to attend the regular lab, the experiment


has to be completed in the same week. Then the
manual/observation and record will be evaluated for 50% of
maximum marks.
Course Objectives and Outcomes

Course name: Microprocessor Laboratory


Course Code: 10CSL48

This laboratory will cover the software and hardware design


requirements for PC-based system design.

The student
Course Objectives:
 To understand microprocessor types and programming of them
 To understand various interfacing circuits necessary for various
applications
 To learn various interfacing concepts and methods
 Learn the program creation using Microsoft Macro Assembler
(MASM).
Course Outcomes:
 Can design input/ output interface
 Can prepare required assembly software modules required for
various applications.
 Can provide hardware interfacing for software of different
applications.
General Instructions to Students

 Do the program construction in the systems specified by the supervisor.


 Do not switch on or run the program on the hardware until verified &
approved by the supervisor.
 Do not touch anything with which you are not completely familiar.
 Carelessness may not only break the valuable equipment in the lab but
may also cause serious injury to you and others in the lab.
 Please follow instructions precisely as instructed by your supervisor.
 Keep the work area clear of all materials except those needed for your
work and cleanup after your work.
 If any part of the equipment fails while being used, report it immediately
to your supervisor.
 Never try to fix the problem yourself because you could further damage
the equipment and harm yourself and others in the lab.
 Do not crowd around the equipment’s & run inside the laboratory.
10CSL48-MP-LAB IV Sem. ISE

MASM COMMANDS:

C :/>cd foldername

C:/foldername>edit filename.asm

After this command executed in command prompt an editor window will open.
Program should be typed in this window and saved. The program structure is given
below.

Structure of Program:

.model tiny/small/medium/large

.Stack <some number>

.data
; Initialize data
; which is used in program.
.code
; Program logic goes here.
;
end

To run the program, the following steps have to be followed:

C:/foldername>masm filename.asm

After this command is executed in command prompt if there are no errors in


program regarding to syntax the assembler will generates an object module as discuss
above.

C:/foldername>link filename.obj

After verifying the program for correct syntax and the generated object files
should be linked together. For this the above link command should be executed and it
will give an EXE file if the model directive is small as discuss above.

C:/foldername>debug filename.exe

After generating EXE file by the assembler it‟s the time to check the output. For
this the above command is used and the execution of the program can be done in different
ways. It is as shown below:

__ g ; complete execution of program in single step.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 1 -


10CSL48-MP-LAB IV Sem. ISE

__ t ; Stepwise execution.

__d ds: starting address or ending address ; To see data in memory locations

__p ; Used to execute interrupt or procedure during stepwise execution of


program

__ q ; To quit the execution.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 2 -


10CSL48-MP-LAB IV Sem. ISE

SAMPLE PROGRAMS:

1. Write an ALP to move the data between the Registers.

.model small
.data
num1 db 50h
num2 dw 1234h

.code
mov ax,@data
mov ds,ax ;DATA SEGMENT INITIALIZATION

mov al,num1
mov ah,al
mov bh,ah
mov bl,al ;MOVES BYTE LENGTH OF DATA FROM REG.AL TO REG.BL

mov cx,num2
mov dx,cx
mov si,ax
mov di,si ;MOVES WORD LENGHT OF DATA FROM REG.CX TO REG.DX

int 3 ;TERMINATES THE PROGRAM EXECUTION

end

2. Write and ALP to move immediate data to Registers.

.model small
.code
mov al,10h
mov ah,10
mov cl,50h
mov ch,50 ;MOVES IMMEDIATE VALUE TO 8 BIT REGISTER

mov bx,1234h
mov dx,1234 ;MOVES IMMEDIATE VALUE TO 16 BIT REGISTER

mov si,4000h
mov di,2000h

int 3 ;TERMINATE THE PROGRAM EXECUTION


end

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 3 -


10CSL48-MP-LAB IV Sem. ISE

3. Write an ALP to add two numbers and to store the result in the specified
destination.

.model small

.data
num1 db 05h
num2 db 06h
num3 dw 1234h
num4 dw 0002h
sum db ?
sum2 dw ?

.code
mov ax,@data
mov ds,ax ;INITIALIZES DATA SEGMENT

mov al,num1
mov bl,num2
add al,bl ;ADD THE 2 BYTES
mov sum,al ;STORES THE RESULT IN MEMORY

mov cx,num3
add cx,num4 ;ADD THE 2 WORDS
mov sum2,cx ;STORES THE RESULT IN MEMORY

int 3 ;TERMINATE THE PROGRAM EXECUTION

align 16 ;DS STARTS FROM PAGE BOUNDARY


end

4. Write and ALP to multiply two 16-bit numbers and to store the result in the
specified location.

.model small

.data
num1 dw 1234h
num2 dw 0ffffh
res dw 5 dup(0)

.code
mov ax,@data
mov ds,ax ;INITIALIZATION OF DATA SEGMENT

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 4 -


10CSL48-MP-LAB IV Sem. ISE

mov ax,num1
mov dx,num2
mul dx ;MULTIPLIES 2 16-BIT NUMBERS

mov res,ax
mov res+2,dx ;STORES THE IN MEMORY

int 3 ;TERMINATE THE PROGRAM EXECUTION


align 16 ;DS STARTS FROM PAGE BOUNDARY
end

5. Write an ALP to divide a 32-bit Unsigned number by a 16-bit Unsigned number


and to store the quotient and remainder in the specified location.

.model small

.data
dvd dd 12345678h
dvr dw 0ffffh
quot dw ?
remd dw ?

.code
mov ax,@data
mov ds,ax ;INITIALIZATION OF DATA SEGMENT

mov si,offset dvd


mov ax,word ptr[si]
mov dx,word ptr[si+2]

mov cx,dvr
div cx

mov quot,ax
mov remd,dx

int 3 ;TERMINATES THE PROGRAM EXECUTION


align 16 ;DS STARTS FROM PAGE BOUNDARY
end

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 5 -


10CSL48-MP-LAB IV Sem. ISE

6. Write an ALP to illustrate the operation of AAA instruction. Use Macros

.model small

.data
read macro ;Start of a macro
mov ah,01h ;read a single key stroke
int 21h
endm ;end of macro

.code
mov ax,@data
mov ds,ax ;INITIALIZATION OF DATA SEGMENT

read ;CALL MACRO READ


mov bl,al ;STORE THE READ KEY IN BL REGISTER

read
mov cl,al

add al,bl ;ADD AL WITH BL AND STORES THE RESULT IN AL.

mov dl,al
mov ah,0
aaa ;ADJUST THE AL VALUE TO UNPACKED BCD

mov si,ax

int 3 ;TERMINATES THE PROGRAM EXECUTION


end

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 6 -


10CSL48-MP-LAB IV Sem. ISE

LAB PROGRAMS:

Program No.01.A. Date:


BINARY SEARCH

AIM:

Search a key element in a list of „n‟ 16-bit numbers using the Binary search
algorithm.

.model small

.data ;start of the data segment

arr dw 0111h,0112h,0113h,0114h,0115h ; „n‟ elements to be searched


len dw ($-arr)/2
key equ 0116h ; key element to be searched
msg1 db "found$"
msg2 db "not found$"

.code ; start of the code segment

mov ax,@data ;initialization of data segment


mov ds,ax

mov bx,00 ; first data position to bx.


mov dx,len ; last data position to dx.
mov cx,key

again: cmp bx,dx


ja notfnd

mov ax,bx
add ax,dx
shr ax,1 ;Get the middle element of array
mov si,ax
add si,si

cmp cx,arr[si] ;compare the key with middle


jae big ; element of array

dec ax
mov dx,ax ;last element of new array to dx
jmp again

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 7 -


10CSL48-MP-LAB IV Sem. ISE

big: je found
inc ax

mov bx,ax
jmp again

found: lea dx,msg1 ;content of the string to be displayed.


jmp displ

notfnd: lea dx,msg2 ;content of the string to be displayed.

displ : mov ah,09h


int 21h
int 3 ; Terminates the execution
end ;end of program

Conclusion:
This program performs a search for a key element in an array. If the search
element is found it will display a message „found‟. As the search element (key element in
program) is not present in the given array it will display a message „not found‟.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 8 -


10CSL48-MP-LAB IV Sem. ISE

Program No. 01. B. Date:

LOGIC CONTROLLER-ODD AND EVEN PARITY


AIM:

Read the status of eight input bits from the Logic Controller Interface and display
FF if it is even parity bits otherwise display 00.

.model small
.data
pa equ 0d800h ; Port address
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h ; control Register address
.code
start: mov ax, @data
mov ds, ax ; Initialization of data segment

mov dx, ctrl


mov al, 82h ; move the control word to „al‟ register
out dx, al ; move the control word to control register

mov dx, pb ; Get the input data form „pb‟


in al, dx ; Get the input data to AL register
mov bl, 00h
mov cx, 08 ; number of rotations
up: rcl al,1
jnc down ; after each rotation check for the carry flag
inc bl ; If there is a carry, increment the „BL‟ register
down: loop up ; Repeat rotation for „08‟ times

test bl,01h ; perform „AND‟ operation to check for even or odd parity
jnz oddp ; If the result of the „AND‟ is not zero, it is odd parity

mov al,0ffh ; If even parity display 0ffh


jmp next
oddp: mov al,00h ; If odd parity display 00h
next: mov dx,pa
out dx,al ; put the result to the ports

int 3

End start

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 9 -


10CSL48-MP-LAB IV Sem. ISE

Conclusion:
The program reads port B of 82C55A which is an input port. If input
contains an odd number of 1‟s (that is the number of LED‟s at logic 1) then the output
will be 00 at port A, which is an output port, indicating input is odd parity and after some
delay the number of 1‟s present in input will be displayed through port A on the output.

Similarly If input contains an even number of 1‟s (that is the number of LED‟s at logic 1)
then the output will be FF at port A, which is an output port, indicating input is even
parity and after some delay the number of 1‟s present in input will be displayed through
port A on the output.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 10 -


10CSL48-MP-LAB IV Sem. ISE

Program No.02.A. Date:


Read and Write using Macros
AIM:

Write two ALP modules stored in two different files; one module is to read a
character from the keyboard and the other one is to display a character. Use
the above two modules to read a string of characters from the keyboard
terminated by the carriage return and print the string on the display in the
next line.

.model small
.data
String db 30 dup (?)
.code
include c:\masm\read.mac
include c:\masm\write.mac

start: mov ax, @data


mov ds, ax ; Initialization of data segment

mov si, 00h

again: read ; CALL MACRO READ


cmp al, 0dh ; compare the data in „AL‟ reg with enter Key
je down
mov string[si], al ; Move the data in „AL‟ reg to destination.
inc si
jmp again

down: mov cx, si


mov si, 00h

write 0dh ; „13‟,‟10‟ , To go to next line


write 0ah

back: write string[si] ; Call write macro to write the data


inc si
loop back ; Repeat the writing
int 3 ; Termination of the program
end start

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 11 -


10CSL48-MP-LAB IV Sem. ISE

read.mac

read macro
mov ah, 01h ; Dos command to read a data from keyboard
int 21h
endm

write.mac

write macro x
mov dl, x
mov ah, 02h ; Dos command to write a data to the O/P screen
int 21h
endm
Conclusion:
This program reads the character entered through the Key board and stores in
the consecutive specified memory locations. This process repeats till the ENTER Key
(carriage return) is pressed. Once the ENTER key (carriage return) is pressed the
character stored in the consecutive memory locations will be displayed on the next line.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 12 -


10CSL48-MP-LAB IV Sem. ISE

Program No.02.B. Date:

Logic controller- BCD Up-Down Counter


AIM:

Implement a BCD Up-Down Counter on the Logic Controller Interface.


.model small
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h

.code
mov ax, @data
mov ds, ax

mov al, 80h


mov dx, ctrl
out dx, al

mov cx, 0Ah


mov al, 00h
Next: mov dx, pa
out dx, al
call delay
inc al
loop Next

mov cx, 0Ah


mov al, 09h
rpt: mov dx, pa
out dx, al
call delay
dec al
loop rpt

int 3h

delay proc

push cx
push bx

L1: mov cx, 0ffffh

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 13 -


10CSL48-MP-LAB IV Sem. ISE

L2: mov bx, 8fffh


dec bx
jnz L2
loop L1

pop bx
pop cx

ret
delay endp
end

Conclusion:
The program performs the up-down counter based on the input data given
on logic controller read through port B. If the input is zero then it performs down counter
starting from 99 down to 00 and if other than zero is the input then it performs up counter
starting from 00 down to 99. And the counting will continue until a key „q‟ is pressed in
the key board, after displaying the count on logic controller every time it checks whether
a key „q‟ is pressed or not.

While observing the output of down counter or up counter if the input changes then from
that point the counting will also changes. Suppose if the input is zero then it perform
down counting from 99 to 00 after some time when the output is 50 then if we change the
input other than zero then from that point it will start up counting that is form 50, 51, 52.
and so on.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 14 -


10CSL48-MP-LAB IV Sem. ISE

Program No.03.A. Date:


Ascending order using Bubble Sort

AIM:

Sort a given set of „n‟ numbers in ascending order using the Bubble Sort
algorithm.

.model small
.data
arr1 db 5h, 89h, 3h, 56h, 1h ; The numbers to be sorted
len1 equ $-arr1

.code
start: mov ax, @data
mov ds, ax

mov ch, len1-1 ; no of iterations

agn1: mov cl, ch ; no of comparisions

mov si, offset arr1

rept1: mov al, [si] ; Get the first data of the array
inc si ; Increment the array
cmp al, [si] ; Compare the first and second data
jbe next1 ; Check, if the 1st data is less than 2nd
xchg al, [si] ; If the 1st data is greater than the 2nd,
mov [si-1], al ; Swap the two data.

next1: dec cl ; dec the no of comparisons


jnz rept1 ; check for zero
dec ch ; dec the no of iterations
jnz agn1 ; check for zero

int 3 ; Terminate the program


end start

Conclusion:
This program will sort the given numbers in ascending order. The sorted numbers
will be stored directly in the data Segment. To view the data segment the following code
must be used.
-d ds: 0
Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 15 -


10CSL48-MP-LAB IV Sem. ISE

Program No.03.B. Date:


Logic Controller- 8 bit Multiplication
AIM:
Read the status of two 8-bit inputs (X & Y) from the Logical Controller
Interface and display X*Y.

.model small
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h

.code
mov ax,@data
mov ds,ax

mov al,82h ; Control word (PB as input port and PA as output port)
mov dx, ctrl
out dx, al

mov dx, pb
in al,dx ; Read the first 8 bit number
mov bl,al ; Store the first number

top: mov ah,1 ; Read a character from the key board


int 21h
cmp al,13 ; Compare the character with the "ENTER" key, cmp al,0dh
jnz top

mov dx, pb ; Read the Second 8 bit number


in al,dx ; Store the first number
mul bl ; Multiply bl*al

mov dx, pa
out dx, al ; Display the result
int 3
end
Conclusion:
The program performs the multiplication between two bytes and gives the
result. First byte is read from the port B of logic controller (user has to provide) and waits
for enter key to be pressed and once enter key is and it reads the Second byte and
multiplies and displays the result through Port A.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 16 -


10CSL48-MP-LAB IV Sem. ISE

Program No.04.A. Date:

Read alphanumeric character and display its ASCII code


AIM:

Read an alphanumeric character and displays its equivalent ASCII code at the
center of the screen.

.model small
.data
alpha db ?
ascii db ?, ?, "$"
.code
start: mov ax, @data
mov ds, ax ; Initialization of data segment

mov ah, 01h ; READ A CHARACTER FROM KEY BOARD


int 21h

mov alpha, al
mov cl, 04 ; Store the character in the memory
shr al, cl ; Shift right the data by 4 times
cmp al, 09h ;l compare the shifted data with 09h
jbe add30
add al, 07h
add30: add al, 30h
mov ascii, al

mov al, alpha ; Get back the character


and al, 0fh ; And ( to mask the higher nibble)
cmp al, 09h
jbe add30h
add al, 07h
add30h: add al, 30h
mov ascii+1, al

mov cx, 30h*90 ;CLEAR THE SCREEN


mov dl, ' '
mov ah, 02
back: int 21h
loop back

mov ah, 02h ;Set the cursor position


mov bh, 00 ; to desired location
mov dl, 30 ;column no.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 17 -


10CSL48-MP-LAB IV Sem. ISE

mov dh, 15 ;row no.


int 10h
mov dx, offset ascii ; display the ascii code
mov ah, 09h
int 21h

mov ah, 01h ; PRESS ENTER KEY


int 21h
int 3
end start

Conclusion:
This program reads the character from key board by using the DOS function 01H
and finds its ASCII equivalent number.

First it clears the entire screen and places the cursor to the specified location using BIOS
function 02H. After, it will display the ASCII value where cursor is placed. In order to
observe the output on the screen the program is not been terminated until enter key is
pressed.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 18 -


10CSL48-MP-LAB IV Sem. ISE

Program No.04.B. Date:

7-Segment display- FIRE and HELP


AIM:

Display messages FIRE and HELP alternately with flickering effects on a 7-Segment
display interface for a suitable period of time. Ensure a flashing rate that makes it
easy to read both the messages.

.model small
.stack 100
.data
pa equ 0d800h ; Port address
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h ; Control word address
str1 db 8eh, 0f9h, 88h, 86h ; Hexa values for “FIRE”
str2 db 89h, 86h, 0c7h, 8ch ; Hexa values for “HELP”
.code
start: mov ax, @data
mov ds, ax ; data segment Initialization

mov al, 80h ; control word


mov dx, ctrl
out dx, al

again: mov bx, offset str1


call display ; Jump to display procedure
call delay ; Jump to delay procedure
mov bx, offset str2
call display
call delay

mov ah, 06h ; direct console input or output


mov dl, 0ffh
int 21h ;get character from keyboard buffer (if any)
cmp al, 'q'
jne again

int 3 ; Terminate the program

display proc
mov si, 03h ; To get the last byte
up1: mov cl, 08h
mov ah, [bx+si] ; Load the data bit to „ah‟

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 19 -


10CSL48-MP-LAB IV Sem. ISE

up: mov dx, pb


rol ah, 1 ;Rotate each bit in the data by one
mov al, ah
out dx, al ; Out the first bit

call clock
dec cl
jnz up ; repeat the steps „08‟ times
dec si
cmp si, -1
jne up1
ret ; return back to main program
display endp

clock proc
mov dx, pc
mov al, 01h ; rising edge of clock pulse
out dx, al
mov al, 0 ; falling edge of the clock pulse
out dx, al
mov dx, pb
ret
clock endp

delay proc
push cx
push bx
mov cx, 0ffffh
d2: mov bx, 8fffh
d1: dec bx
jnz d1
loop d2
pop bx
pop cx
ret
delay endp

end start

Conclusion:
This program displays “FIRE” and “HELP” on seven segment display interface
recursively one after the other with some delay till key „q‟ is pressed on key board. It‟s
not going to read any data from interface device. The data which has to be displayed is
provided in the program itself.
Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 20 -


10CSL48-MP-LAB IV Sem. ISE

Program No.05.A. Date:

Check a string for a Palindrome


AIM:

Reverse a given string and check whether it is a palindrome or not.

.model small
.data
str1 db "alam" ; String to be checked for palindrome
slen equ ($-str1)
str2 db 40 dup(0)
msg1 db "Palindrome$"
msg2 db "Not Palindrome$"
.code
start: mov ax,@data
mov ds,ax
mov es,ax ; Initialize extra segment

mov cx,slen ; Length of the string


lea si, str1
add si,slen – 1 ; get the last byte of the data
lea di, str2

up: mov al,[si]


mov [di],al ; load the byte from [Si] to [Di]
dec si
inc di
loop up ; Repeat the process

lea si, str1


lea di, str2
mov cx,slen
cld ; Clear the direction flag
repe cmpsb ; compare the string bytes present in SI & DI
jne down ; Jump if the strings are not equal

lea dx, msg1


jmp down1
down: lea dx, msg2
down1: mov ah,09h
int 21h
int 3 ; Terminate the program
end start

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 21 -


10CSL48-MP-LAB IV Sem. ISE

Conclusion:
This program reverse the string provided in data segment by keeping the
original string as it is and compares both the strings. It will check each and every
character. If all the characters are same then the given string is said to be as palindrome
and it will display a message “palindrome” on screen otherwise the given string is not
palindrome and it will display a message “not palindrome” on screen.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 22 -


10CSL48-MP-LAB IV Sem. ISE

Program No.05.B. Date:

7-segment Display- Rolling Fashion


AIM:

Assume any suitable message of 12 characters length and display it in the


rolling fashion on a 7-Segment display Interface for a suitable period of time.
Ensure a flashing rate that makes it easy to read the message.

.model small
.stack 100
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h
str1 db 0c0h,0f9h,0a4h,0b0h,99h,92h,83h,0f8h,80h,98h,0c0h,0f9h
.code
start: mov dx, @data
mov ds, dx ; Initialize the data segment

mov al, 80h ; Control word


mov dx, ctrl
out dx, al

again: mov bx, offset str1 ; Get the offset address of the string
call display
call delay
mov ah, 06h ; direct console input or output
mov dl, 0ffh ; get the character for the key-board
int 21h
cmp al, 'q' ; compare the character with „q‟
jnz again
int 3 ; terminate the program

display proc
mov si, 0bh ; Load [Si] with 12 (0dh)

up1: call delay


mov cl, 08h ; To get the last byte
mov ah, [bx+si] ; Load the data bit to „ah‟

up: mov dx, pb


rol ah, 1 ; Rotate each bit in the data by one
mov al, ah

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 23 -


10CSL48-MP-LAB IV Sem. ISE

out dx, al ; Out the first bit

call clock
dec cl
jnz up ; repeat the steps „08‟ times

dec si
cmp si, -1
jne up1 ; repeat the steps „12‟ times
ret
display endp

clock proc
mov dx, pc
mov al, 01h ; Rising edge of the clock pulse
out dx, al
mov al, 0 ; Falling edge of the clock pulse
out dx, al
mov dx, pb
ret
clock endp

delay proc
push cx
push bx

mov cx, 0ffffh


d2: mov bx, 8fffh
d1: dec bx
jnz d1
loop d2

pop bx
pop cx
ret ; Return back to main program
delay endp
end start

Conclusion:
This program displays a message of 12 characters in rolling fashion on
seven segment display. The message is stored in data segment. It will continue of rolling
the message until „q‟ is pressed in keyboard. But it will check for a key press event only
after displaying the complete string. Till then it will just keep on displaying the
characters.
Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 24 -


10CSL48-MP-LAB IV Sem. ISE

Program No.06.A. Date:

Compare two strings for equality


AIM:

Read two strings; store them in locations STR1 and STR2. Check whether they are
equal or not and display appropriated messages. Also display the length of the
stored strings.

.model small
.data
str1 db 30 dup(0)
str2 db 30 dup(0)
len1 dw 1 dup(0)
len2 dw 1 dup(0)
msg1 db 13,10, "Enter the 1st string : $"
msg2 db 13,10, "Enter the 2nd string : $"
msg3 db 13,10, "String are not equal $"
msg4 db 13,10, "Strings are equal $"
msg5 db 13,10, "The length of the first string is : "
slen1 db ?, ?
msg6 db 13,10,"The length of the second string is : "
slen2 db ?, ?,13,10,'$'
.code
read macro ; create a macro for read operation
mov ah, 01
int 21h
endm

disp macro x ; create a macro for display the string


mov dx, offset x
mov ah, 09
int 21h
endm

start: mov ax,@data


mov ds,ax
mov es,ax ; Initialize Data and extra segment

disp msg1 ; READ FIRST STRING


mov si,0h

up1: read ; Read a character from Key-board


cmp al,0dh ; compare the key with Enter Key.
je down1

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 25 -


10CSL48-MP-LAB IV Sem. ISE

mov str1[si],al ; Store the key in the location


inc si
jmp up1
down1: mov len1,si

disp msg2 ; READ SECOND STRING


mov si,0h
up2: read ; Read a character from Key-board
cmp al,0dh ; compare the key with Enter Key.
je down2
mov str2[si],al ; Store the key in the location
inc si
jmp up2

down2: mov len2,si

mov cx,len1
cmp cx,len2 ; Check whether the strings are equal or not
jne noteq
mov si,offset str1
mov di,offset str2
cld ; Clear direction flag
repe cmpsb ; repeat the comparisons if
; the strings are equal
jne noteq

disp msg4
jmp next

noteq: disp msg3


next: mov al,byte ptr len1
aam
add ax, 3030h ; Display the length of the 1st String
mov slen1, ah
mov slen1+1, al

mov al,byte ptr len2


aam
add ax, 3030h ; Display the length of the 2nd String
mov slen2, ah
mov slen2+1, al

disp msg5
int 3 ; Terminate the program
end start

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 26 -


10CSL48-MP-LAB IV Sem. ISE

Conclusion:
This program reads two strings from user and compares both the strings. First it
checks the length of the strings and if lengths are equal then it will check each and every
character. If all the characters are same then the given strings are said to be equal and it
will display a message “strings are equal” along with length of both the strings on screen.
Else will display as “strings are not equal”.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 27 -


10CSL48-MP-LAB IV Sem. ISE

Program No.06.B. Date:

7-segment Display – Binary to BCD conversion


AIM:

Convert a 16-bit binary value(assumed to be an unsigned integer) to BCD and


display it form left to right and right to left for specified number of times on a 7-
Segment display Interface.

.model small
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h
bin dw 000Fh
bcd db 4 dup(0)
count db 02
disptbl db 0c0h, 0f9h, 0a4h, 0b0h, 99h,
db 92h, 82h, 0f8h, 80h, 98h ; Look up table
.code
start: mov ax, @data
mov ds, ax

mov al, 80h ; All ports are output ports


mov dx, ctrl
out dx, al

mov bx, 10 ; To perform BCD division


mov cx, 04 ; Divide 04 times
mov ax, bin ; Load the number to be divided
back: mov dx, 0
div bx
push dx ; store the result in the stack.
loop back ; Repeat the division
lea si, bcd
mov cx, 04

back1: pop dx
mov [si], dl ; Get the result from the stack
inc si
loop back1

mov bx, offset disptbl


disp: call display1

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 28 -


10CSL48-MP-LAB IV Sem. ISE

call delay
call display
call delay
dec count
jnz disp
int 3

display proc
mov si, 00
nxtchar: mov al, bcd[si]
xlat ; Translate a byte
mov ah, 8
nxtseg: mov dx, pb
rol al, 01
out dx, al
mov ch, al

call clock
mov al,ch
dec ah
jnz nxtseg

inc si
cmp si,4
jne nxtchar
ret
display endp

display1 proc
mov si, 03
nxtchar1: mov al, bcd[si]
xlat
mov ah, 8

nxtseg1: mov dx, pb


rol al, 01
out dx, al
mov ch, al

call clock
mov al,ch
dec ah
jnz nxtseg1

dec si

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 29 -


10CSL48-MP-LAB IV Sem. ISE

cmp si,-1
jne nxtchar1
ret
display1 endp

clock proc
mov dx, pc
mov al, 01h
out dx, al
mov al, 0
out dx, al
mov dx, pb
ret
clock endp

delay proc
push cx
push bx

mov cx, 0ffffh


d2: mov bx, 8fffh
d1: dec bx
jnz d1
loop d2

pop bx
pop cx
ret
delay endp

end start

Conclusion:
This program converts a 16-bit number provided in data segment into
BCD. Then it will displays the BCD number on seven segment display interface form left
to right and right to left for specified number of times.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 30 -


10CSL48-MP-LAB IV Sem. ISE

Program No.07.A. Date:

Name Display
AIM:

Read your name from the keyboard and displays it at a specified location on the
screen in front of the message “What is your name?” you must clear the entire
screen before display.

.model small
.data
msg1 db "Enter the name $"
x db 10
y db 20
msg2 db "What is your name ? "
str db 30 dup(0)
.code
disp macro z ; macro to display a string
mov dx, offset z
mov ah, 09
int 21h
endm

start: mov ax,@data


mov ds,ax

disp msg1
mov si,0h
up: mov ah, 01 ; read the character from the keyboard
int 21h
cmp al,0dh
je down
mov str[si],al
inc si
jmp up
down: mov str[si],'$'

mov cx, 29h*50h ; To clear the screen


mov dl, ' '
mov ah, 02
back: int 21h ; Get DOS functions
loop back
mov dl, x ; Row number
mov dh, y ; Column number
mov bh, 00h

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 31 -


10CSL48-MP-LAB IV Sem. ISE

mov ah, 02
int 10h ; To move the cursor to the location
disp msg2
mov ah,01
int 21h
int 3 ; Termination of the program
end start

Conclusion:
This program will reads a string and displays the same string on the screen at the
desired position after clearing the screen.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 32 -


10CSL48-MP-LAB IV Sem. ISE

Program No.07.B. Date:

Matrix Keypad- Key Scan


AIM:

Scan a 8x3 keypad for key closure and to store the code of the key pressed in a
memory location and display on screen. Also display row and column numbers
of the key pressed.

.model small
.stack 100
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h
ASCIICODE db "0123456789.+-*/%ack=MRmn" ; look up table
str db 13,10,"press any key on the matrix keyboard$"
str1 db 13,10,"Press y to repeat and any key to exit $"
msg db 13, 10,"the code of the key pressed is :"
key db ?
msg1 db 13,10,"the row is "
row db ?
msg2 db 13,10,"the column is "
col db ?,13,10,‟$‟
.code
disp macro x ; Display a string
mov dx, offset x
mov ah, 09
int 21h
endm ; End of a macro

start: mov ax,@data


mov ds,ax

mov al,90h ; Port „A‟ is input port


mov dx,ctrl
out dx,al

again1: disp str


mov si,0h

again: call scan


mov al,bh ; Row number
add al,31h

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 33 -


10CSL48-MP-LAB IV Sem. ISE

mov row,al

mov al,ah ; Column number


add al,31h
mov col,al
cmp si,00
je again
mov cl,03
rol bh,cl
mov cl,bh
mov al,ah
lea bx,ASCIICODE ; Address of the look up table
add bl,cl
xlat ; Translate a byte in AL
mov key,al

disp msg
disp str1
mov ah, 01 ; Read a string
int 21h
cmp al,'y'
je again1
int 3
scan proc
mov cx,03
mov bh,0
mov al,80h

nxtrow: rol al,1


mov bl,al
mov dx,pc
out dx,al
mov dx,pa
in al,dx
cmp al,0
jne keyid

mov al,bl
inc bh
loop nxtrow
ret
keyid: mov si,1
mov cx,8
mov ah,0

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 34 -


10CSL48-MP-LAB IV Sem. ISE

agn: ror al,1


jc skip ; check for the carry
inc ah
loop agn
skip: ret ; Return to main program
scan endp
end start
Conclusion:
This program reads the data from the 8*3 key interface board. It will display its
value on the screen. It will also display the row number and column number of the key
pressed.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 35 -


10CSL48-MP-LAB IV Sem. ISE

Program No.08.A. Date:

Compute nCr using recursive procedure


AIM:

Compute nCr using recursive procedure. Assume that „n‟ and „r‟ are non-negative
integers.

.model small
.stack 20
.data
n db 08h
r db 05h
ncr db ?
.code
start: mov ax,@data
mov ds,ax
mov ncr,00h
mov al,n
mov bl,r
call encer
int 3
encer proc
para1: cmp al,bl ; compare „n‟,‟r‟ for equality
je para8
para2: cmp bl,00h ; compare „r‟ with 00
je para8
para3: cmp bl,01h ; compare „r‟ with 01h
je para10
para4: dec al ; decrement „n‟
cmp bl,al
je para9
para5: push ax ; Push „n‟ to the stack
push bx ; Push „r‟ to the stack
call encer
para6: pop bx ; Get „r‟ and „n‟ from the stack
pop ax
dec bl
push ax
push bx
call encer
para7: pop bx
pop ax
ret
para8: inc ncr

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 36 -


10CSL48-MP-LAB IV Sem. ISE

ret
para9: inc ncr
para10: add ncr,al
ret
encer endp
end start

Conclusion:
This program performs nCr using recursive procedure. Output is stored in data
segment. To observe the output in data segment we have to search for our given „n‟ and
„r‟ values as program is written to store the result after the given data in data segment.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 37 -


10CSL48-MP-LAB IV Sem. ISE

Program No.08.B. Date:

Stepper Motor
AIM:

Drive a Stepper Motor interface to rotate the motor in specified direction


(clockwise or counter-clockwise) by N steps (Direction and N are specified by
the examiner).Introduce suitable delay between successive steps. (Any arbitrary
value for the delay may be assumed by the student).

.model small
.data
pa equ 0d800h
pb equ 0d801h
pc equ 0d802h
ctrl equ 0d803h
nstep db 2
.code
start: mov ax, @data
mov ds, ax

mov al, 80h ; All ports are output ports


mov dx, ctrl
out dx, al

mov bh, nstep


mov al, 88h

again1: call step


rol al, 1 ; for counter-clock wise direction
; Replace rol al,1 with ror al,1 for clock wise direction
dec bh
jnz again1

int 3

step proc
mov dx, pa
out dx, al

push cx
push bx

mov cx, 0ffffh


d2: mov bx, 8fffh

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 38 -


10CSL48-MP-LAB IV Sem. ISE

d1: dec bx
jnz d1
loop d2

pop bx
pop cx

ret
step endp
end start

Conclusion:

This program drives a stepper motor interface to rotate by 8 steps in anti-


clockwise direction. After each rotation a delay is introduced to observe the rotation.
After completing the rotations the execution will get stopped.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 39 -


10CSL48-MP-LAB IV Sem. ISE

Program No.09.A. Date:

Display the system time


AIM:

Read the current time from the system and display it in the standard format on
the screen.

.model small
.data
msg db "The time is: "
hrs db ?,?,' : '
mins db ?,?,' (hh:mm) ',10,13,'$'
.code
start: mov ax,@data
mov ds,ax

mov ah,2ch ; DOS function to read system time


int 21h

mov al,ch ; load the hours to „al‟


aam ; ASCII adjust after multiplication
add ax, 3030h
mov hrs, ah
mov hrs+1, al

mov al,cl ; load the seconds to „al‟


aam
add ax, 3030h
mov mins, ah
mov mins+1,al

lea dx,msg ; Display the time


mov ah,09h
int 21h
int 3
end start

Conclusion:
This program displays the present system time. Our program displays only the
hours and minutes in the format HH: MM.By using the same DOS function we can also
display the seconds and milliseconds.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 40 -


10CSL48-MP-LAB IV Sem. ISE

Program No.09.B. Date:

Generate a SINE wave using DAC


AIM:

Generate a Sine Wave using the DAC interface. (The output of the
DAC is to be displayed on the CRO).

.model small
.data
pa equ 0c400h
pb equ 0c401h
pc equ 0c402h
ctrl equ 0c403h
table db 128,132,137,141,146,150,154,159,163,167,171,176,180,184,188
db 192,196,199,203,206,210,213,217,220,223,226,229,231,234,236
db 239,241,243,245,247,248,250,251,252,253,254,255
db 255,254,253,252,251,250,248,247,245,243,241,239,236,234,231
db 229,226,223,220,217,213,210,206,203,199,196,192,188,184,180
db 176,171,167,163,159,154,150,146,141,137,132,128
db 123,119,114,110,105,101,97,93,88,84,80,76,72,68,64,60,56,52,49
db 45,42,39,36,33,30,27,24,22,19,17,15,11,9,7,6,5,4,3,2,1,0
db 0,1,2,3,4,5,6,7,9,11,15,17,19,22,24,27,30,33,36,39,42,45,49,52,56
db 60,64,68,72,76,80,84,88,93,97,101,105,110,114,119,123
.code
start: mov ax,@data
mov ds,ax

mov al,80h ; All the ports are out put ports


mov dx,ctrl
out dx,al

again: mov bx,05h


up: mov cx,164 ; Load 164 values
mov si,00h
mov dx,pa

again1: mov al,table[si] ; Load each value from Look-up-table to al


out dx,al
inc si
loop again1

dec bx
cmp bx,00
jne up

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 41 -


10CSL48-MP-LAB IV Sem. ISE

mov ah,06h ; direct console input or output


mov dl,0ffh ; Read the character from the keyboard
int 21h
jz again
int 3
end start

Conclusion:
This program generates a sine wave of having amplitude of 5V. Output will be
seen in CRO. It will be continues wave. It stops execution as soon as any key is pressed
from the key board.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 42 -


10CSL48-MP-LAB IV Sem. ISE

Program No.10.A. Date:

To simulate a Decimal Up-counter to display 00- 99


AIM:

Write a program to simulate a Decimal Up-counter to display 00- 99.

.model small
.data
string db "the count is "
nors db ?,?,'$'
.code
start: mov ax,@data
mov ds,ax

mov ah,03h ; get cursor position and size.


mov bh,00h ; page number.
int 10h

up: mov cl,00h


up1: mov al,cl
aam
add ax, 3030h
mov nors, ah
mov nors+1, al
push dx

mov ah,02h ; set cursor position


mov bh,00h ; page number
int 10h

mov dx,offset string ; Display the string


mov ah,09h
int 21h
inc cl
call delay

mov ah,06h ; direct console input or output.


mov dl,0ffh ; get character from keyboard buffer
int 21h

cmp al,'q'
je exit
pop dx
cmp cl,100

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 43 -


10CSL48-MP-LAB IV Sem. ISE

je up
jmp up1
exit: int 3 ; Terminate the program

delay proc ; Delay procedure


push cx
push bx

mov cx, 0ffffh


d2: mov bx, 8fffh
d1: dec bx
jnz d1
loop d2

pop bx
pop cx
ret ; Return back to main program

delay endp
end start

Conclusion:
This program counts decimal values from 00 to 99. Count will continue until a
key is pressed in key board.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 44 -


10CSL48-MP-LAB IV Sem. ISE

Program No.10.B. Date:

Generate a half rectified SINE wave using DAC


AIM:

Generate a Half Rectified Sine wave form using the DAC interface. (The
output of the DAC is to be displayed on the CRO).

.model small
.data
pa equ 0c400h
pb equ 0c401h
pc equ 0c402h
ctrl equ 0c403h
table db 128,132,137,141,146,150,154,159,163,167,171,176,180,184,188
db 192,196,199,203,206,210,213,217,220,223,226,229,231,234,236
db 239,241,243,245,247,248,250,251,252,253,254,255,254,253,252
db 251,250,248,247,245,243,241,239,236,234,231,229,226,223,220
db 217,213,210,206,203,199,196,192,188,184,180,176,171,167,163
db 159,154,150,146,141,137,132,128 ; Look_up_table
.code
start: mov ax,@data
mov ds,ax

mov al,80h ; All the ports are out put ports


mov dx,ctrl
out dx,al

again3: mov bx,05h


up: mov cx,83 ; Load 83 values
mov si,00

again4: mov dx,pa


mov al,table[si] ; Load each value from Look-up-table to al
out dx,al
inc si
loop again4

mov cx,83
mov al,128
next: out dx,al
loop next
dec bx
cmp bx,00h
jnz up

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 45 -


10CSL48-MP-LAB IV Sem. ISE

mov ah,06h ; direct console input or output


mov dl,0ffh ; Read the character from the keyboard
int 21h
jz again3
int 3 ; Terminate the program
end start

Conclusion: This program generates a half - rectified sine wave of 5V amplitude. Output
will be seen in CRO. It stops execution as soon as any key is pressed from the key board.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 46 -


10CSL48-MP-LAB IV Sem. ISE

Program No.11.A. Date:

Move the Cursor to specified Location on the screen


AIM:

Read a pair of input co-ordinates in BCD and move the cursor to the specified
location on the screen.

.model small
.data
x db ?
y db ?
msg1 db 13, 10, "Enter the y co ordinate (00 - 19)$"
msg2 db 13, 10, "Enter the x co ordinate (00 - 50)$"
.code
read macro ; Macro to read the character
mov ah, 01h
int 21h
endm ; End of Macro

start: mov ax,@data


mov ds,ax

mov dx,offset msg1 ; Display the first message


mov ah,09h
int 21h

read ; Read a character


mov cl, 04h
shl al, cl
mov bl,al

read ; Read a character


and al,0fh
or al,bl
mov y,al

mov dx,offset msg2 ; Display the first message


mov ah,09h
int 21h

read ; Read a character


mov cl,04h
shl al,cl
mov bl,al

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 47 -


10CSL48-MP-LAB IV Sem. ISE

read ; Read a character


and al,0fh
or al,bl
mov x,al

mov ah,02h ; Clear the screen


mov cx, 19h*50h
mov dl, ' '
back: int 21h
loop back

mov ah,02h ; Set the cursor to the specified location


mov bh,00h
mov dh,y
mov dl,x
int 10h

read
int 3
end start

Conclusion:
This program reads X and Y coordinates from key board and takes the cursor to
the specified location after clearing the screen and it will remains at the same position
until a key pressed.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 48 -


10CSL48-MP-LAB IV Sem. ISE

Program No.11.B. Date:

Generate a fully rectified SINE wave using DAC


AIM:

Generate a Fully Rectified Sine waveform using the DAC interface. (The
output of the DAC is to be displayed on the CRO).

.model small
.data
pa equ 0c400h
pb equ 0c401h
pc equ 0c402h
ctrl equ 0c403h
table db 128,132,137,141,146,150,154,159,163,167,171,176,180,184,188
db 192,196,199,203,206,210,213,217,220,223,217,220,223,226,229
db 231,234,236,239,241,243,245,247,248,250,251,252,253,254,255
db 254,253,252,251,250,248,247,245,243,241,239,236,234,231,229
db 226,223,220,217,213,210,206,203,199,196,192,188,184,180,176
db 171,167,163,159,154,180,146,141,137,132,128
count dw 83
.code
start: mov ax,@data
mov ds,ax

mov al,80h ; All the ports are out put ports


mov dx,ctrl
out dx,al

agn : mov bx,05


back1: mov cx,count ; Load 83 values
mov si,00h

back: mov al,table[si] ; Load each value from Look-up-table to al


mov dx,pa
out dx,al
inc si
loop back

dec bx
cmp bx,00
jnz back1

mov ah,06h ; direct console input or output


mov dl,0ffh ; Read the character from the keyboard

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 49 -


10CSL48-MP-LAB IV Sem. ISE

int 21h
jz agn
int 3
end start

Conclusion:
This program generates a fully rectified sine wave of 5V amplitude. Output will
be seen in CRO. It stops execution as soon as key is pressed from the key board.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 50 -


10CSL48-MP-LAB IV Sem. ISE

Program No.12.A. Date:

Program to create a file (input file) and to delete an existing file


AIM:

Program to create a file (input file) and to delete an existing file.

.model small
.data
string db "Enter the file name for the file to be created",13,10,'$'
msg1 db 13,10,"The file cannot be created",13,10,'$'
msg2 db 13,10,"File created successfully",13,10,'$'
str1 db 40 dup(0)
string1 db "Enter the file name to be deleted",13,10,'$'
msg3 db 13,10,"The file cannot be deleted",13,10,'$'
msg4 db 13,10,"File deleted successfully",13,10,'$'
str2 db 40 dup(0)
.code
disp macro x ; Display macro
lea dx, x
mov ah, 09h
int 21h
endm

start: mov ax,@data


mov ds,ax
disp string ; Display String
mov bx,00h

up: mov ah,01h ; Read the character from the keyboard


int 21h
cmp al,0dh
je exit
mov str1[bx],al
inc bx
jmp up

exit: mov str1[bx],'$'


mov ah,3ch ; Create or truncate file
mov cx,00h ; File Attributes
mov dx,offset str1
int 21h

jc down
disp msg2

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 51 -


10CSL48-MP-LAB IV Sem. ISE

jmp down1

down: disp msg1

down1: disp string1


mov bx,00h
up1: mov ah,01h
int 21h
cmp al,0dh
je exit1
mov str2[bx],al
inc bx
jmp up1

exit1: mov str2[bx],'$'


mov ah,41h ; delete file .
mov dx,offset str2
int 21h
jc down2 ; CF set on error, AX = error code.

disp msg4 ; if successful, CF will be clear,


; and the value of AX is cleared
jmp down3
down2: disp msg3
down3: int 3
end start

Conclusion:
This program creates a file in current root directory. If creation of file success it
will display a message “file created successfully”. After that it will delete the file from
the current directory. If deletion of file is success then it will display a message “file
deleted successfully”.

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 52 -


10CSL48-MP-LAB IV Sem. ISE

Program No.12.B. Date:

ELEVATOR
AIM:

Drive an elevator interface in the following way:


i. Initially the elevator should be in the ground floor, with all requests in OFF
state.
ii. When a request is made from a floor, the elevator should move to that floor,
wait there for a couple of seconds (approximately), and then come down to
ground floor and stop. If some requests occur during going up or coming
down they should be ignored.

.model small
.data
pa equ 0c800h ;define port addresses
pb equ 0c801h
pc equ 0c802h
ctrl equ 0c803h ;define control word address
.code
Start: mov ax, @data
mov ds, ax ;initialize data segment

mov al, 82h ;initialize port A as output and port B as input port
mov dx, ctrl
out dx, al

mov bl, 0 ; Initially display lift in ground floor

; PRESS ANY KEY TO EXIT


S1: call delay
mov ah, 06h
mov dl, 0ffh
int 21h
jz proceed ;if none of the key is pressed then jump to location proceed
int 3 ;else terminate program execution

; PLACE LIFT IN GROUND FLOOR


proceed:call delay
mov al, bl ;take floor number to AL
or al, 0f0h ;set upper nibble of the number
mov dx, pa
out dx, al
cmp bl, 0 ;check whether the lift is in ground floor or not
jnz down ;if not in then jump to location down to move lift to ground floor

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 53 -


10CSL48-MP-LAB IV Sem. ISE

jmp fchk ;else jump to location fchk to check the request from any floor
down: dec bl
jmp proceed

;CHECK REQUEST FROM ANY FLOOR


fchk: call chk ;call procedure chk to check is there request from any floor
shr al, 01 ;shift right the request by 1 position
jnc gfr ;if carry is not set then request will be from ground
; floor and jump to location gfr
shr al, 01 ;else shirt right the request by 1 more position
jnc ffr ;if carry is not set then request will be from 1st floor and
;jump to location ffr
shr al, 01 ;else shirt right the request by 1 more position
jnc sfr ;if carry is not set then request will be from 2nd floor
;and jump tp location sfr
shr al, 1 ;else shirt right the request by 1 more position
jnc tfr ;if carry is not set then request will be from 2nd floor
;and jump tp location sfr
jmp start ;else jump to start

gfr: call delay


mov al, 0e0h ;data to disable ground floor request
mov dx, pa ;load port A address to DX reg.
out dx, al ;send data to port A
jmp S1 ;to repeat the process jump to location start

ffr: call delay


mov bl, 3
call floor
mov al, 0d3h
mov dx, pa
out dx, al
jmp S1

sfr: call delay


mov bl, 6
call floor
mov al, 0b6h
mov dx, pa
out dx, al
jmp S1

tfr: call delay


mov bl, 9
call floor

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 54 -


10CSL48-MP-LAB IV Sem. ISE

mov al, 79h


mov dx, pa
out dx, al
jmp S1

chk proc
mov dx, pb
in al,dx ;read data from port b
or al,0f0h ;set upper nibble of the data
cmp al,0ffh ;check is there any request or not
jz chk ;if no request then jump to location chk
ret ;else return to main program
chk endp ;end of procedure

floor proc

mov cl, 0

floor1: inc cl
mov al, cl
or al, 0f0h
mov dx, pa
out dx, al
call delay
cmp cl, bl
jnz floor1
ret
floor endp

delay proc
delay proc
push cx
push bx

mov cx, 0ffffh


d2: mov bx, 8fffh
d1: dec bx
jnz d1
loop d2

pop bx
pop cx
ret
delay endp
end start

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 55 -


10CSL48-MP-LAB IV Sem. ISE

Conclusion:
This program does the operation of lift as follows: always the lift will be in ground floor.
When a request comes from any other floor then the lift will go to that floor and waits for
some time and returns to ground floor. While executing the first request, other requests
are not recognized

Date: Signature of the staff

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 56 -


10CSL48-MP-LAB IV Sem. ISE

References:

1. The Intel Microprocessors: Eighth Edition: Bary B. Brey.

2. Microprocessors and Interfacing: Second Edition: D V Hall.

3. Advanced Microprocessors and Peripherals: A K Ray.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 57 -


10CSL48-MP-LAB IV Sem. ISE

ANNEXURES:

Instruction Set:

Instructions Operands Description


Copy operand2 to operand1.
REG, memory
MOV memory, REG The MOV instruction cannot:
REG, REG
memory, immediate  Set the value of the CS and IP registers.
REG, immediate  Copy value of one segment register to another segment
register (should copy to general register first).
SREG, memory  Copy immediate value to segment register (should copy to
memory, SREG general register first).
REG, SREG
SREG, REG
Algorithm: operand1 = operand2

Ex:
Mov AX,BX ;Copy contents of BX to AX
Mov si,00h ;load Si with 00h
Unsigned multiply.
MUL REG Multiply the contents of REG/Memory with contents of AL register.
Memory Algorithm:

When operand is a byte:


AX = AL * operand.

When operand is a word:


(DX: AX) = AX * operand.
Compare.
REG, memory
CMP memory, REG Algorithm: operand1 - operand2
REG, REG
memory, immediate Result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF,
REG, immediate CF) according to result.

Unconditional Jump.

JMP Label Transfers control to another part of the program. 4-byte address may
be entered in this form: 1234h: 5678h, first value is a segment
second value is an offset.

Algorithm: always jump


Jump If Above.

JA Label Short Jump if first operand is Above second operand (as set by CMP
instruction). Unsigned.

Algorithm: if (CF = 0) and (ZF = 0) then jump

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 58 -


10CSL48-MP-LAB IV Sem. ISE

Jump If Above Or Equal

JAE Label Short Jump if first operand is Above or Equal to second operand (as
set by CMP instruction). Unsigned.
Algorithm:

if CF = 0 then jump

Jump If Below.

JB Label Short Jump if first operand is Below second operand (as set by CMP
instruction). Unsigned.

Algorithm:

if CF = 1 then jump

Jump If Below Or Equal

JBE Label Short Jump if first operand is Below second operand (as set by CMP
instruction). Unsigned.

Algorithm:

if CF = 1 then jump

Jump If Carry

JC Label Short Jump if Carry flag is set to 1.

Algorithm:

if CF = 1 then jump
Jump If Equal.

JE Label Short Jump if first operand is Equal to second operand (as set by
CMP instruction). Signed/Unsigned.

Algorithm:

if ZF = 1 then jump
Jump If Greater

JG Label Short Jump if first operand is Greater then second operand (as set by
CMP instruction). Signed.

Algorithm:

if (ZF = 0) and (SF = OF) then jump

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 59 -


10CSL48-MP-LAB IV Sem. ISE

Jump If Greater Or Equal.

JGE Label Short Jump if first operand is Greater or Equal to second operand (as
set by CMP instruction). Signed.

Algorithm:

if SF = OF then jump
Jump If Less than.

JL Label Short Jump if first operand is Less then second operand (as set by
CMP instruction). Signed.

Algorithm:

if SF <> OF then jump


Jump If Less Or Equal.

JLE Label Short Jump if first operand is Less or Equal to second operand (as
set by CMP instruction). Signed.

Algorithm:

if SF <> OF or ZF = 1 then jump


Jump If Non Zero.

JNZ Label Short Jump if Not Zero (not equal). Set by CMP, SUB, ADD, TEST,
AND, OR, XOR instructions.

Algorithm:

if ZF = 0 then jump
Jump If Zero.

JZ Label Short Jump if Zero (equal). Set by CMP, SUB, ADD, TEST, AND,
OR, XOR instructions.

Algorithm:

if ZF = 1 then jump
Load Effective Address.

LEA REG, memory Algorithm:

 REG = address of memory (offset)

Decrease CX, jump to label if CX not zero.

Algorithm:
LOOP Label
 CX = CX - 1
 if CX <> 0 then

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 60 -


10CSL48-MP-LAB IV Sem. ISE

o jump

else

o no jump, continue

Add.
REG, memory
ADD memory, REG Algorithm:
REG, REG
memory, immediate operand1 = operand1 + operand2
REG, immediate

Logical AND between all bits of two operands. Result is stored in


REG, memory operand1.
AND memory, REG
REG, REG These rules apply:
memory, immediate
REG, immediate 1 AND 1 = 1; 1 AND 0 = 0
0 AND 1 = 0; 0 AND 0 = 0

Logical OR between all bits of two operands. Result is stored in first


operand.
OR REG, memory
memory, REG These rules apply:
REG, REG
memory, immediate 1 OR 1 = 1; 1 OR 0 = 1
REG, immediate 0 OR 1 = 1; 0 OR 0 = 0

Subtract.
REG, memory
memory, REG Algorithm:
SUB REG, REG
memory, immediate operand1 = operand1 - operand2
REG, immediate

Decimal adjust After Addition.


Corrects the result of addition of two packed BCD values.

DAA No Operands Algorithm:


if low nibble of AL > 9 or AF = 1 then:

 AL = AL + 6
 AF = 1

if AL > 9Fh or CF = 1 then:

 AL = AL + 60h
 CF = 1

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 61 -


10CSL48-MP-LAB IV Sem. ISE

Decimal adjust After Subtraction.


Corrects the result of subtraction of two packed BCD values.

DAS No Operands Algorithm:


if low nibble of AL > 9 or AF = 1 then:

 AL = AL - 6
 AF = 1

if AL > 9Fh or CF = 1 then:

 AL = AL - 60h
 CF = 1

Increment.

INC REG Algorithm: operand = operand + 1


memory
Decrement.

DEC REG Algorithm: operand = operand – 1


Memory
Unsigned divide.

REG Algorithm:
DIV Memory
when operand is a byte:
AL = AX / operand
AH = remainder (modulus)
when operand is a word:
AX = (DX AX) / operand
DX = remainder (modulus)

Shift Left.
memory, immediate
SHL REG, immediate Shift operand1 Left. The number of shifts is set by operand2.

memory, CL Algorithm:
REG, CL
 Shift all bits left, the bit that goes off is set to CF.
 Zero bit is inserted to the right-most position.

Shift Right.
memory, immediate
SHR REG, immediate Shift operand1 Right. The number of shifts is set by operand2.

memory, CL Algorithm:
REG, CL
 Shift all bits right, the bit that goes off is set to CF.
 Zero bit is inserted to the left-most position.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 62 -


10CSL48-MP-LAB IV Sem. ISE

Rotate Left.
memory, immediate
REG, immediate Rotate operand1 left. The number of rotates is set by operand2.
ROL
memory, CL Algorithm:
REG, CL
Shift all bits left, the bit that goes off is set to CF and the
same bit is inserted to the right-most position.
Rotate Right.
memory, immediate
REG, immediate Rotate operand1 right. The number of rotates is set by operand2.
ROR
memory, CL Algorithm:
REG, CL
Shift all bits right, the bit that goes off is set to CF and the
same bit is inserted to the left-most position.
memory, immediate Rotate operand1 left through Carry Flag. The number of rotates is
REG, immediate set by operand2.
RCL memory, CL Algorithm:
REG, CL
Shift all bits left, the bit that goes off is set to CF and
previous value of CF is inserted to the right-most position.

Example:
STC ; set carry (CF=1).
MOV AL, 1Ch ; AL = 00011100b
RCL AL, 1 ; AL = 00111001b, CF=0.
RET
C O
r r
OF=0 if first operand keeps original sign.

procedure name Transfers control to procedure, return address is (IP) pushed to


CALL label stack.

Return from near procedure.

RET No operands Algorithm:


Or even immediate
date  Pop from stack:
o IP

if immediate operand is present: SP = SP + operand


Input from port into AL or AX.
AL, im.byte Second operand is a port number. If required to access port number
IN AL, DX over 255 - DX register should be used.
AX, im.byte
AX, DX
AL, im.byte Output from AL or AX to port.
AL, DX First operand is a port number. If required to access port number
OUT AX, DX over 255 - DX register should be used.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 63 -


10CSL48-MP-LAB IV Sem. ISE

Get 16 bit value from the stack.


REG
POP SREG Algorithm: Operand = SS : [SP](top of stack)
memory
SP = Sp + 2.

Store 16 bit value in the stack.

REG Algorithm:
PUSH SREG
memory  SP = SP - 2
 SS:[SP] (top of the stack) = operand

Logical XOR (Exclusive OR) between all bits of two operands.


REG, memory Result is stored in first operand.
memory, REG
XOR REG, REG These rules apply:
memory, immediate
REG, immediate 1 XOR 1 = 0; 1 XOR 0 = 1
0 XOR 1 = 1; 0 XOR 0 = 0

Exchange values of two operands.


REG, memory
XCHG memory, REG Algorithm: operand1 < - > operand2
REG, REG

Translate byte from table.


Copy value of memory byte at DS:[BX + unsigned AL] to AL
XLAT No Operands register.

Algorithm: AL = DS:[BX + unsigned AL]

ASCII Adjust after Addition.


Corrects result in AH and AL after addition when working with
AAA No Operands BCD values.

Algorithm:

if low nibble of AL > 9 or AF = 1 then:

 AL = AL + 6
 AH = AH + 1
 AF = 1
 CF = 1

else

 AF = 0
 CF = 0

in both cases:
clear the high nibble of AL.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 64 -


10CSL48-MP-LAB IV Sem. ISE

Example:
MOV AX, 15 ; AH = 00, AL = 0Fh
AAA ; AH = 01, AL = 05

ASCII Adjust after Subtraction.


Corrects result in AH and AL after subtraction when working with
BCD values.

Algorithm:

if low nibble of AL > 9 or AF = 1 then:

 AL = AL - 6
AAS No Operands  AH = AH - 1
 AF = 1
 CF = 1

else

 AF = 0
 CF = 0

in both cases:
clear the high nibble of AL.

Example:
MOV AX, 02FFh ; AH = 02, AL = 0FFh
AAS ; AH = 01, AL = 09

ASCII Adjust after Multiplication.


Corrects the result of multiplication of two BCD values.

Algorithm:

 AH = AL / 10
AAM No Operands  AL = remainder

Example:
MOV AL, 15 ; AL = 0Fh
AAM ; AH = 01, AL = 05

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 65 -


10CSL48-MP-LAB IV Sem. ISE

INTERRUPTS:

Interrupt INT 21h:


INT 21h calls DOS functions.

Function 01h - Read character from standard input, result is stored in AL. If there is
no character in the keyboard buffer, the function waits until any key is pressed.

Invoked by: AH = 01h


Returns: AL = character entered.

Example:
Mov AH, 01h
INT 21h

Function 02h - Write a character to standard output.


INT 21h
Invoked by: DL = character to write.
AH =02h
After execution AL = DL.

Example:
Mov AH, 02h
Mov DL, ‟a‟ ; Character to be displayed on screen must be stored in DL reg.
INT 21h

Function 02h- set cursor position.

INT 10h / AH = 2 - set cursor position.


input:
DH = row.
DL = column.
BH = page number (0..7).

Function 03h- get cursor position and size.

INT 10h / AH = 03h -


input:
BH = page number.
return:
DH = row.
DL = column.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 66 -


10CSL48-MP-LAB IV Sem. ISE

CH = cursor start line.


CL = cursor bottom line.

Function 06h – Direct console for input/output. If DL = 0FFH on entry, then this
function reads the console. If DL = ASCII character, then this function displays the
ASCII character on the console video screen.

Invoked by: Parameters for O/P: DL = 0…255


Parameters for I/P: DL = 255.

Returns: for O/P: AL = DL.


For I/P: ZF set if no character available & AL = 0
ZF clear if character available & AL = character.
Example:
mov ah, 6
mov dl, 'a'
int 21h ; output character.

mov ah, 6
mov dl, 255
int 21h ; get character from keyboard buffer (if any) or set ZF=1.
Function 09h - Write a string to standard output at DS: DX.
String must be terminated by '$'. The string can be of any length and may contain control
characters such as carriage return (0DH) and line feed (0AH).

Invoked by: DS = string to write.


AH = 09h

Example:
Mov AH, 09h
Mov DX, offset str ; Address of the string to be displayed
INT 21h

Function 2Ch - Get system time.

Invoked by: AH =2Ch


Return: CH = hour. CL = minute. DH = second. DL = 1/100 seconds.

Example:
Mov AH, 2ch
INT 21h

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 67 -


10CSL48-MP-LAB IV Sem. ISE

Function 3Ch - Create or truncate file.

Invoked by: CX = file attributes:


mov cx, 0 ; normal - no attributes.
mov cx, 1 ; read-only.
mov cx, 2 ; hidden.
mov cx, 4 ; system
mov cx, 7 ; hidden, system and read-only!
mov cx, 16 ; archive
mov cx, 0BH ; Volume label
mov cx, 10H ; Subdirectory

DS: DX -> filename. ; AH =3Ch

Returns:
CF clear if successful, AX = file handle.
CF set on error AX = error code.

Example:
Mov AH, 3ch
Mov CX, 01
Mov DX, offset Filename
INT 21h

Function 41h - Delete file (unlink).

Invoked by: DS: DX -> ASCIZ filename (no wildcards, but see notes).
AH=41h
Return:
CF clear if successful, AX destroyed.
CF set on error AX = error code.

Example:
Mov AH, 41h
Mov DX, offset Filename
INT 21h

Function 4Ch – Terminate a process.

Invoked by: AH = 4ch


Return: returns control to the operating system.

Example:
Mov AH, 4Ch
INT 21h

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 68 -


10CSL48-MP-LAB IV Sem. ISE

Interrupt INT 10h:


INT 10h calls the BIOS functions. This interrupt often called the video services
interrupt as it directly controls the video display in a system.

Function 02h - Set cursor position.

Invoked by: DH = row; DL = column; BH = page number (0...7); AH=02h.

Example:
MOV AH, 02h
MOV BH, 00
MOV DH, 06
MOV DL, 10
INT 10h

Function 03h – Get cursor position.


Invoked by: BH = page number. (In general 0)
AH = 03h

Return: DH = row number; DL = column number; CH = cursor start line;


CL = cursor bottom line.

Example:
Mov BH, 0
Mov AH, 03h
INT 10h

Function 06h – Scroll up window


Invoked by: AL = number of lines by which to scroll. (00h = clear the entire screen.)
BH = attribute used to write blank lines at bottom of window.
CH, CL = row, column of window's upper left corner.
DH, DL = row, column of window's lower right corner.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 69 -


10CSL48-MP-LAB IV Sem. ISE

Circuit diagrams of interfacing devices

1. Logic Controller Interface

Logic controllers find extensive application in industries for the programming of


processes. The nature of control would range from a simple ON/OFF type of control ro
complex systems implementing sophisticated control algorithms while accepting multiple
inputs and actuating multiple outputs. A controller would typically, accept a number of
inputs from transducers like sensors/limit switches, key inputs etc.. perform a sequence of
logical and arithmetic opertaions on them and use the result to maitain the process within
specified safe operating conditions while providing information on the status of the
process at any instant of time.The logic controller interface consits essentially of two 8
bit ports, an input and an output port. The inputs and outputs are connected to the user
systems. The logic state fo each input and output is indicated by LEDs and all signals are
TTL compatible. The input signals are connected to port B of 82C55A while output lines
are driven from port A.

Some of the cpabilities of theis interface are:

a. Programmable Counter b. Sequential Counter c. Combinational Controller.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 70 -


10CSL48-MP-LAB IV Sem. ISE

2. Seven Segment Display

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 71 -


10CSL48-MP-LAB IV Sem. ISE

The hardware uses four shift register ICs 74164. 74164 is an 8-bit serial in-parallel out
shift register with asynchronous reset and two input pins. It requires 8 clock cycles at
“CLK” pin to shift the serial data from input to 8 parallel outputs. After 8 shifts, the first
serial bit will be in output QH, and only now the data at output is valid. To cascade more
74164 shift register IC need to connect the last output QH to the input of second shift
register.

The output is connected to the cathode of the LEDs in the 7 segment display and thus
common anode displays are used. The anode is connected to +Vcc. The last output of the
first sift register is connected to input of the 2nd shift register and the last output o f 2nd
shift register to input of 3rd and so on. Thus the shift register are serial in parallel out and
they are connected to displays, in such a way that output 0A is connected to display
segment „a‟ and 0B to „b‟ and so on up to 0H; through 330 ohm resistors.

The shifting of data bit takes place for each clock cycle. 7404 IC used provides isolation
and the interface board gets 5V through port bit.

Pin 1 is used as data pin and pin 2 is used as other input to Vcc. The clock signal is
generated at a port bit which will be connected to the clock of the shift register.

PB0 is used for data bit; and PC0 for clock through which a falling edge has to be sent.

The microprocessor stores the display information in a RAM. Each time a display has to
be updated the microprocessor fetches all bytes one by one from RAM and outputs
corresponding display codes serially that is bit by bit to display. Hexadecimal code is
stores in the RAM. The code conversion from hexa to 7 segment is done just before the
display is updated.

The 7 segment display is used as a numerical indicator on many types of test equipment.
It is an assembly of light emitting diodes which can be powered individually. There are
two important types of 7-segment LED display.
In a common cathode display, the cathodes of all the LEDs are joined together and the
individual segments are illuminated by HIGH voltages.
In a common anode display, the anodes of all the LEDs are joined together and the
individual segments are illuminated by connecting to a LOW voltage.
Display code

Since the outputs of shift registers are connected to cathode sides of displays, low input
must be given to segments for making them glow and high inputs for making them blank.
Each display has 8 segments (a, b, c, d, e, f, g, h) as shown. For displaying any character
the corresponding segment must be given low inputs.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 72 -


10CSL48-MP-LAB IV Sem. ISE

The one shown above is a common anode display since all anodes are joined together and
go to the positive supply. The cathodes are connected individually to zero volts. Resistors
must be placed in series with each diode to limit the current through each diode to a safe
value. The d.p represents a decimal point.

The following table shows how to form characters: '0' means that pin is connected to
ground. '1' means that pin is connected to Vcc.

d.p g f e d c b a Hex. value


0 1 1 0 0 0 0 0 0 C0
1 1 1 1 1 1 0 0 1 F9
2 1 0 1 0 0 1 0 0 A4
3 1 0 1 1 0 0 0 0 B0
4 1 0 0 1 1 0 0 1 99
5 1 0 0 1 0 0 1 0 92
6 1 0 0 0 0 0 1 0 82
7 1 1 1 1 1 0 0 0 F8
8 1 0 0 0 0 0 0 0 80
9 1 0 0 1 1 0 0 0 98
F 1 0 0 0 1 1 1 0 8e
I 1 1 1 1 1 0 0 1 F9
R 1 0 0 0 1 0 0 0 88
E 1 0 0 0 0 1 1 0 86

3. Stepper Motor:

A stepper motor is a widely used device that translates electrical pulses into mechanical
movement. In applications such as disk drives, dot matrix printers, and robotics, the
stepper motor is used for Position control.

Every stepper motor has a permanent magnet rotor (also called the shaft.) surrounded by
a stator. The most common stepper motors have four common stator windings that are
pairs with a center-taped common. This type of stepper motor is commonly referred to as
a four-phase stepper motor.

A Stepper motor is stepped from one position to the next by changing the currents
through the fields in the motor. Common step sizes for stepper motors range from 0.9
degrees to 30 degrees.

82C55A is used to provide the drive signals that are used to rotate the armature of the
motor in either the right-hand or left-hand direction.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 73 -


10CSL48-MP-LAB IV Sem. ISE

The power circuit for one winding of the stepper motor is as shown in figure above. It is
connected to the port A (PA0) of 82C55A. Similar circuits are connected to the remaining
lower bits of port A (PA1, PA2, PA3). One winding is energized at a time. The coils are
turned ON/OFF one at a time successively.

The stepper motor showing full-step operation is shown below.


(A) 45-degrees. (B) 135-degrees (C) 225-degrees (D) 315-degrees.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 74 -


10CSL48-MP-LAB IV Sem. ISE

4. Matrix Keyboard Display:

The rows are connected to an output port and the columns are connected to an input port.
If no key has been pressed, reading the input port will yields 0s for all columns since they
are all connected to ground. If all the rows are high and a key is pressed, one of the
columns will have 1 since the key pressed provides the path to high. It is the function of

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 75 -


10CSL48-MP-LAB IV Sem. ISE

the microprocessor to scan the keyboard continuously to detect and identify the key
pressed.

Label on Hex code Label on Hex code


the keytop the key top
0 0 - 0C
1 1 X 0D
2 2 / 0E
3 3 % 0F
4 4 AC 10
5 5 CE 11
6 6 CHK 12
7 7 = 13
8 8 MC 14
9 9 MR 15
. 0A M 16
+ 0B M+ 17

Process of identifying the key pressed:

To detect a pressed key, the micro processor set high all rows by providing 1 to the
output latch, then it reads the columns. If the data read from the columns is PA0-PA7 =
00000000, no key has been pressed and process continues until a key press is detected.
If one of the column bits has a high, this means that a key press has occurred.

For example, if PA0-PA7 = 00001000, this means that a key in the PA4 column has been
pressed.

After a key press is detected, the micro processor will go through the process of
identifying the key. Now micro processor sets each row to ground then it reads the
columns. If the data read is all 0s, no key in that row is activated and the process is
moved to next row. It grounds the next row, reads the columns, and checks for any 1.
This process continues until the row is identified. After identification of the row in which
the key has been pressed, the next task is to find out which column the pressed key
belongs to.
To identify the key press, it rotates the column bits, one bit at a time, into the carry flag
and checks to see if it is high. Upon finding the 1, it pulls out the ASCII code for that key
from the look-up table; otherwise, it increments the pointer to point to the next element of
the look-up table.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 76 -


10CSL48-MP-LAB IV Sem. ISE

5. DAC INTERFACE

The pin details of DAC 0800 is given below and schematic diagram of the dual DAC
interface is given below.

The port A and port B of 82C55A peripheral are used as output ports. The digital inputs
to the DACs are porvided through these ports. The analog outputs of the DACs are
connected to the inverting inputs of OP-amps 741 which acts as current to voltage
converters. The outputs from the OP-amps are connected to points marked X out and Y
out at which the waveforms are observed on a CRO. The power supplies of +12 and -12
are regulated for this interface.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 77 -


10CSL48-MP-LAB IV Sem. ISE

6. Elevator Interface.

The above figure gives hardware details required for the simulation of the elevator.
This interface has four keys, marked 0, 1, 2, and 3(In above fig K1, K2, K3, K4)
representing the request buttons at the four floors. These keys are connected to preset
(PR) of the D flip-flop. If this key is closed the output goes low and it goes high and thus
the corresponding request LED will be ON.

The outputs of the four Flip-flops (74LS74) can be read through port B (PBO, PBI, PB2
and PB3) so that the floor at which request is required is known and the same will be
serviced. Also, the status of these signals is reflected by a setoff 4 LED‟s which are called
as request LEDs whose cathode are connected to outputs of four flip-flops; while anodes
are connected to +5v as shown in figure. The Flip-Flop can be rest (LED‟s are cleared)
through higher bits of port A (PA4, PA5, PA6, and PA7) so that after servicing the floor

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 78 -


10CSL48-MP-LAB IV Sem. ISE

at which request was done the corresponding request LED is turned OFF, sending a low
to the flip-flop through port A.

A column of 10 LED‟s, representing the elevator can be controlled through Port A (PA0,
PA1, PA2 and PA3). These port lines are fed to the inputs of the BCD to decimal decoder
IC7442 whose outputs are active-low used to control the on/off states of the LED‟s which
simulate the motion of the elevator. These LEDS have their cathodes connected to the
outputs of the decoder through the resistors and the anodes are commonly connected to
the +5v supply as shown in the figure. As the output of BCD decoders are active low and
logic low on output causes the corresponding LED goes ON. For Example, If 0010 is the
input to the decoder then line 2 goes low and the third LED goes ON.

The motion of elevator can be simulated by turning on successive LED‟s one at a time.
The delay between turning off one LED and turning on the next LED can simulate the
“speed” of the elevator.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 79 -


10CSL48-MP-LAB IV Sem. ISE

Viva Questions and Answers

1. What is a Microprocessor?

ANS: Microprocessor is a program-controlled device, which fetches the instructions from


memory, decodes and executes the instructions. Most Micro Processor are single- chip
devices.

2. What is the difference between 8086 and 8088?

ANS: The BIU in 8088 is 8-bit data bus & 16- bit in 8086.Instruction queue is 4 byte
long in 8088and 6 byte in 8086.

3. what are the functional units in 8086?

ANS: 8086 has two independent functional units because of that the processor speed is
more. The Bus interface unit and Exectuion unit are the two functional units.

4. What are the flags in 8086?

ANS: In 8086 Carry flag, Parity flag, Auxiliary carry flag, Zero flag, Overflow flag,
Trace flag, Interrupt flag, Direction flag, and Sign flag.

5. What is the Maximum clock frequency in 8086?

ANS: 5 Mhz is the Maximum clock frequency in 8086.

6. What are the various segment registers in 8086?

ANS: Code, Data, Stack, Extra Segment registers in 8086.

7. Logic calculations are done in which type of registers?

ANS: Accumulator is the register in which Arithmetic and Logic calculations are done.

8. How 8086 is faster than 8085?

ANS: Because of pipelining concept. 8086 BIU fetches the next instruction when EU
busy in executing the anoter instruction.

9. What does EU do?

ANS: Execution Unit receives program instruction codes and data from BIU, executes
these instructions and store the result in general registers.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 80 -


10CSL48-MP-LAB IV Sem. ISE

10. Which Segment is used to store interrupt and subroutine return address
registers?

ANS: Stack Segment in segment register is used to store interrupt and subroutine return
address registers.

11. What does microprocessor speed depend on?

ANS: The processing speed depends on DATA BUS WIDTH.

12. What is the size of data bus and address bus in 8086?

ANS: 8086 has 16-bit data bus and 20- bit address bus.

13. What is the maximun memory addressing capability of 8086?

ANS: The maximum memory capability of 8086 is 1MB.

14. What is flag?

ANS: Flag is a flip-flop used to store the information about the status of a processor and
the status of the instruction executed most recently.

15. Which Flags can be set or reset by the programmer and also used to control the
operation of the processor?

ANS: Trace Flag, Interrupt Flag, Direction Flag.

16. In how many modes 8086 can be opertaed and how?

ANS: 8086 can be opertaed in 2 modes. They are Minimum mode if MN/MX pin is
active high and Maximum mode if MN/MX pin is ground.

17. What is the difference between min mode and max mode of 8086?

ANS: Minimum mode operation is the least expensive way to operate the 8086
microprocessor because all the control signals for the memory and I/O are generated by
the micro processor. In Maximum mode some of the control signals must be externally
generatred. This requires the addition of an external bus controller. It used only when the
system contains external coprocessors such as 8087 arithmetic coprocessor.

18. Which bus controller used in maximum mode of 8086?

ANS: 8288 bus controller is used to provide the signals eliminated from the 8086 by the
maximum mode operation.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 81 -


10CSL48-MP-LAB IV Sem. ISE

19. What is stack?

ANS: Stack is a portion of RAM used for saving the content of Program Counter and
general purpose registers.

20. Which Stack is used in 8086?

ANS: FIFO (First In First Out) stack is used in 8086.In this type of Stack the first stored
information is retrieved first.

21. What is the position of the Stack Pointer after the PUSH instruction?

ANS: The address line is 02 less than the earlier value.

22. What is the position of the Stack Pointer after the POP instruction?

ANS: The address line is 02 greater than the earlier value.

23. What is interrupt?

ANS: Interrupt is a signal send by external device to the processor so as to request the
processor to perform a particular work.

24. What are the various interrupts in 8086?

ANS: Maskable interrupts, Non-Maskable interrupts.

25. What is meant by Maskable interrupts?

ANS: An interrupt that can be turned off by the programmer is known as Maskable
interrupt.

26. What is Non-Maskable interrupts?

ANS: An interrupt which can be never be turned off (ie.disabled) is known as Non-
Maskable interrupt.

27. Which interrupts are generally used for critical events?

ANS: Non-Maskable interrupts are used in critical events. Such as Power failure,
Emergency, Shut off etc.,

28. Give example for Non-Maskable interrupts?

ANS: Trap is known as Non-Maskable interrupts, which is used in emergency condition.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 82 -


10CSL48-MP-LAB IV Sem. ISE

29. Give examples for Maskable interrupts?

ANS: RST 7.5, RST6.5, RST5.5 are Maskable interrupts. When RST5.5 interrupt is
received the processor saves the contents of the PC register into stack and branches to
2Ch (hexadecimal) address.

When RST6.5 interrupt is received the processor saves the contents of the PC register
into stack and branches to 34h (hexadecimal) address.

When RST7.5 interrupt is received the processor saves the contents of the PC register
into stack and branches to 3Ch (hexadecimal) address.

30. What is SIM and RIM instructions?

ANS: SIM is Set Interrupt Mask. Used to mask the hardware interrupts. RIM is Read
Interrupt Mask. Used to check whether the interrupt is Masked or not.

31. What is macro?

ANS: Macro is a set of instructions that perform a task and all the isntructions defined in
it is inserted in the program at the point of usage.

32. What is the difference between Macro and Procedure?

ANS: A procedure is accessed via a CALL instruction and a macro will inserted in the
program at the point of execution.

33. What is meant by LATCH?

ANS: Latch is a D- type flip-flop used as a temporary storage device controlled by a


timing signal, which can store 0 or 1. The primary function of a Latch is data storage. It is
used in output devices such as LED, to hold the data for display

34. What is a compiler?

ANS: Compiler is used to translate the high-level language program into machine code
at a time. It doesn.t require special instruction to store in a memory, it stores
automatically. The Execution time is less compared to Interpreter.

35. What is the disadvantage of microprocessor?

ANS: It has limitations on the size of data. Most Microprocessor does not support
floating-point operations.

36. What is the 82C55A device?

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 83 -


10CSL48-MP-LAB IV Sem. ISE

ANS: The 8255A/82C55A interfaces peripheral I/O devices to the microcomputer system
bus. It is programmable by the system software. It has a 3-state bi-directional 8-bit buffer
which interfaces the 8255A/82C55A to the system data bus.

37. What kind of input/output interface dose a PPI implement?

ANS: It provides a parallel interface, which includes features such as single-bit, 4-bit, and
byte-wide input and output ports; level-sensitive inputs; latched outputs; strobed inputs or
outputs; and strobed bidirectional input/outputs.

38. How many I/O lines are available on the 82C55A?

ANS: 82C55A has a total of 24 I/O lines.

39. Describes the mode 0, mode 1, and mode 2 operations of the 82C55A?

ANS: MODE 0: Simple I/O mode. In this mode, any of the ports A, B, and C can be
programmed as input or output. In this mode, all the bits are out or in.

MODE 1: Ports A and B can be used as input or output ports with handshaking
capabilities. Handshaking signals are provided by the bits of port C.

MODE 2: Port A can be used as a bidirectional I/O port with handshaking capabilities
whose signals are provided by port C. Port B can be used either in simple I/O mode or
handshaking mode 1.

40. What is the mode and I/O configuration for ports A, B, and C of an 82C55A
after its control register is loaded with 82H?

ANS: If control register is loaded with 82H, then the port B is configured as an input
port, port A and port C are configured as output ports and in mode 0.

Dept. of ISE, CIT, Gubbi- 572 216 Page No. - 84 -


Viva Questions
1)What is Microprocessor?
ans:- A MicroProcessor is a multipurpose, programmable, clock-driven, register-based
electronic device that reads binary instructions from a storage device called memory, accepts
binary data as input and processes the data according to those instruction, and provides
results as output.

2} Explain the function of CPU in Microprocessor


ans:-A microprocessor controls all functions of the CPU, or central processing unit, of a
computer or other digital device. The microprocessor is programmed to give and receive
instructions from other components of the device. The system can control everything from
small devices such as calculators and mobile phones, to large automobiles.

3) Define Compiler
ans:-A compiler is a computer program (or set of programs) that transformssource code
written in a programming language (the source language) into another computer language
(the target language, often having a binary form known as object code). The most common
reason for wanting to transform source code is to create an executable program.

4)Define Intrepreter
ans:- An interpreter may be a program that either :-executes the source code directly;
translates source code into some efficient intermediate representation (code) and immediately
executes this; explicitly executes stored precompiled code[1] made by a compiler which is
part of the interpreter system.

5)Define Assembler
ans:-An assembler is a program that takes basic computer instructions and converts them into
a pattern of bits that the computer's processor can use to perform its basic operations.

6)What is Assembly level language?


ans:-An assembly language is a low-level programming language for microprocessors. It
implements a symbolic representation of the binary machine codes and other constants
needed to program a particular CPUarchitecture. This representation is usually defined by the
hardware manufacturer, and is based on mnemonics that symbolize processing steps
(instructions), processor registers, memory locations, and other language features.

7)What are Mnemonics?


ans:-mnemonics are instructions or commands to perform a
particular operation given by user to microprocessor
e.g MOV MIV ADD SUB IMUL

8)What is a bus?
ans:-Information is transferred between units of the microcomputer by collections of
conductors called buses.
There will be one conductor for each bit of information to be passed,
e.g., 16 lines for a 16 bit address bus. There will be address, control, and data buses.

9)Distinguish between Microprocessor & Microcontroller.


ans:-The microprocessor is a digital integrated circuit device that can be programmed with a
series of instructions to perform specified functions on data.
But micro controller is a computer on a chip which has memory,input,ouput on the chip itself.
So,micro processor can perform only few functions but micro controller can perform so many
functions.

10)Define address bus, data bus and control bus


ans:- ADDRESS BUS:-An address bus is a computer bus (a series of lines connecting two or
more devices) that is used to specify a physical address. When a processor or DMA-enabled
device needs to read or write to a memory location, it specifies that memory location on the
address bus (the value to be read or written is sent on the data bus). The width of the address
bus determines the amount of memory a system can address.

DATA BUS:-The bus (connections between and with in the CPU, memory, and peripherals)
used to carry data. Other connections are the address bus and control signals. The width and
clock rate of the data bus determine its data rate (the number of bytes per second it can carry),
which is one of the main factors determining the processing power of a computer

CONTROL BUS:-The control bus (or command bus) transports orders and synchonisation
signals coming from thecontrol unit and travelling to all other hardware components. It is a
bidirectional bus, as it also transmits response signals from the hardware.

11)What is nibble, byte and word


ans:-NIBBLE:-In computing, a nibble is a four-bit aggregation or half an octet. As a nibble
contains 4 bits.

BYTE:-
The byte (pronounced /ˈbaɪt/) is a unit of digital information in computing and
telecommunications. The size of a byte is typically hardware dependent, but the modern de
facto standard is 8 bits, as this is a convenient power of 2.

WORD:- The most common microprocessors used in personal computers (for instance, the
Intel Pentiums and AMD Athlons) are an example of this; their IA-32 architecture is an
extension of the original Intel 8086 design which had a word size of 16 bits.
12)What is a register?
ans:-In computer architecture, a processor register (or general purpose register) is a small
amount of storage available on the CPU whose contents can be accessed more quickly than
storage available elsewhere. Typically, this specialized storage is not considered part of the
normal memory range for the machine. Processor registers are at the top of the memory
hierarchy, and provide the fastest way for a CPU to access data.

13) Why is the data bus bidirectional?


ans:-Data bus is bi-directional bcoz same bus is used for data transmission from
microprocessor to memory location or input/output device and vice versa. thats y data bus is
bi-directional

14. Give the features of 8085 microprocessor


ans:-
 8-bit microprocessor,» Up to 8 MHz,» 64 KB RAM,» Single voltage,» On-chip peripherals,»
256 I/O ports,
 8080 object-code compatible,40-pin DIP,44-pin PLCC

15. Give the features of 8086 microprocessor


ans:-8086

16)What is a flag?
ans:-Flag Registers:-
* The flag indicates the condition of the microprocessor as well as controls its operations. * A
flag register is a flip-flop which indicates some conditions produced by the execution of an
instruction or controls certain operations of the EU. A 16-bit flag register in the EU contains
nine active flags. Two types of flags: Conditional or status flags: Six flags are conditional
flags. They are set or reset by the EU on the basis of the results of some arithmetic operation.
16-bit microprocessor,» 16-bit data bus,» Up to 10 MHz,» 1 MB RAM,» 64K I/O ports,40-
pin DIP,56-pin QFP,44-pin PLCC

17)What is the function of the accumulator?


ans:-An accumulator is an 8-bit register that is a part of ALU (Arithmatic-Logic Unit) of a
processor. It is used for temporary storage of 8-bit data and to perform arithmatic
operations like addition, subtraction, multiplication, division or logical operations like AND,
OR, XOR etc. The result of operation is stored in accumulator.

18) What is stack pointer?


ans:-The CPU has an automatic program stack. At any given time, the SP holds the 16-bit
address of the next free location in the stack. The stack acts like any other stack when there is
a subroutine call or on an interrupt. ie. pushing the return address on a jump, and retrieving it
after the operation is complete to come back to its original location. There are instructions
that push and pull the A and B accumulators and the X and Y index registers. These
instructions are often used to preserve program context.

19) What are the advantages of 8086 microprocessor over 8085?


ans:-The Intel 8085 and 8086 microprocessors is that the 8085 is an 8-bit system and
the 8086 is a 16-bit system.
This difference allows the 8086 system to have a much larger set of operational instructions
and can make calculations to more significant places.

20)Define effective address


ans:-Effective address is the final address generated by offsetting and indexing which is sent
to the virtual translation logic. It is the address of the operand in the virtual address space of
the process, but not necessarily the address of the operand in the physical address space of the
computer.

21)How many segment registers are there in 8086?


ans:-4 different types of segments in 8086
CS(Code Segment)to hold code area
SS(Stack Segment)to run program
DS(Data Segment)to hold data
ES(Extra Segment)to hold large data

22)What are the registers present in internal architecture 8086?


ans:-The 8086 had eight (more or less general) 16-bit registers including the stack pointer,
but excluding the instruction pointer, flag register and segment registers. Four of them, AX,
BX, CX, DX, could also be accessed as twice as many 8-bit registers (see figure) while the
other four, BP, SI, DI, SP, were 16-bit only.

23)What is PSW? Give its structure and explain


ans:-The current state of the processor is stored in a register called Processor Status
Word(PSW).The PSW contains bits which indicate such things as whether the previous
arithmetic operations produced a positive, negative or zero result. If a subtract instruction is
followed by a "branch on zero" instruction, then the branch will be taken if the PSW indicates
that the subtraction resulted in a zero. Most loops, such as DO-WHILE, FOR, etc involve
incrementing or decrementing a counter and repeating the loop until the counter reaches the
limit. Each time the counter is changed, the result is compared with the limit, the PSW is set
accordingly, and branch is taken or not depending on the contents of the PSW. The 8086
microprocessor has a 16-bit PSW.

25. What is an instruction?


ans:-An instruction is an order given to a computer processor by a computer program. At the
lowest level, each instruction is a sequence of 0s and 1s that describes a physical operation
the computer is to perform (such as "Add") and, depending on the particular instruction type,
the specification of special storage areas called registers that may contain data to be used in
carrying out the instruction, or the location in computer memory of data.

The Microsoft Macro Assembler (MASM) is an x86 assembler for MS-DOS and Microsoft
Windows. It supports a wide variety of macro facilities and structured programming idioms,
including high-level functions for looping and procedures.

26. What are different types of instructions. Give examples


ans:-There are different instruction types:-
1)Data Movement:-examples:-{Load,Move,Push,Pop}
(2)Logical Operations:-ex:-{And,Or,Xor,Not,Shl,Shr}
3)Arithmetic Operations:-ex:-{Add,Sub,Mulu*,Muls*,Divu*,Divs*}
(4)Comparison:-ex:-{Cmp}
5)Flow Control:-ex:-{Bra,Bsr,Rts,Rti}
(6)Others:-ex:-{Nop}

27. What are addressing modes


ans:-1. Immediate addressing.2. Register addressing.3. Direct addressing.4. Indirect
addressing.

28. Give the different type of data related addressing modes and explain with examples.
ans:-1}Immediate addressing
Load the immediate data into the register, R.
Example: MVI R,data
2)Register addressing
Data from source register is moved into destination register.
Example: MOV Rd, Rs
3)Direct addressing
Accepts data from external devices to be stored in the accumulator or sends the data from the
Accumulator to the external device.
Example: IN 00H or OUT 01H

29. What are the different types of branch related addressing modes?
ans:-II. Branch Addressing Modes
1. Intrasegment Direct 2. Intrasegment Indirect 3. Intersegment Direct 4. Intersegment Direct

30. Distinguish between packed BCD and unpacked BCD


ans:-Packed BCD numbers are stored two digits to a byte in 4 bit groups referred as nibbles
Ex:86 in unpacked BCD there is only one digit per byte Ex: 08, 06

31. Describe CBW and CWD instructions


ans:-The CBW and CWDE mnemonics reference the same opcode. The CBW instruction is
intended for use when the operand-size attribute is 16 and the CWDE instruction for when
the operand-size attribute is 32. The CWDE instruction is different from the CWD (convert
word to double) instruction. The CWD instruction uses the DX:AX register pair as a
destination operand; whereas, the CWDE instruction uses the EAX register as a destination.

32)Describe about MUL, IMUL, DIV, IDIV instructions


ans:-MUL (multiply) instruction is used for unsigned multiplication. This instruction
multiplies bytes or words.

IMUL (Integer multiply) instruction is used for signed multiplication. This instruction
multiply bytes or words.

The DIV instruction is to divide unsigned data. We can divide a byte by byte, a word by byte,
double word by word.
The IDIV instruction is to divide signed data. We can divide a byte by byte, a word by byte,
double word by word and the operations are just like DIV instructions

33)Describe about LOOP instructions


ans:-The LOOP instruction is a combination of a decrement of CX and a conditional jump. In
the 8086, LOOP decrements CX and if CX is not equal to zero, it jumps to the address
indicated by the label. If CX becomes a 0, the next sequential instruction executes.

34)Give examples of conditional branch instructions


ans:-In a loop if there are different jump instructions with a condition or counter called
conditional loop and instructions in that loop are called unconditional branch instructions.

35)Give examples of unconditional branch instructions


ans:-In a loop if there are different jump instructions with no condition it is called
unconditional loop and instructions in that loop are called unconditional branch instructions.

36)What are flag manipulation instructions ? Give examples


ans:-Flag manipulation instructions. STC, CLC, CMC. Set, clear, complement carry flag.
STD, CLD. Set, clear direction flag

37)Explain about DAA instruction


ans:-decimal adjust addition result
daa
The daa instruction is used to adjust the content of the AL register after that register is used to
perform the addition of two packed BCDs. The CPU uses the following logic:

CF_old = CF
IF (al AND 0Fh > 9) or (the Auxilliary Flag is set)
al = al+6
CF = CF or CF_old
AF set
ENDIF
IF (al > 99h) or (Carry Flag is set)
al = al + 60h
CF set
ENDIF

38)Explain shift and rotate instructions


ans:-SHL(SHIFT LEFT):-shifting bit code by no.of bits to left{ex:-00001011 when shifted
left by one bit it becomes 00010110},SHR(SHIFT RIGHT):-shifting bit code by no.of bits to
right{ex:-00001011 when shifted left by one bit it becomes 00000101}
ROR(ROTATE RIGHT):-rotate bit code from right to left{ex:-00001011 when rotated right
by one bit it becomes as 00010110}ROL{ROTATE LEFT}:-rotate bit code from left to
right{ex:-00001011 when rotated left by one bit it becomes as 10000101}RCL{ROTATE
CARRY TO LEFT};RCR{ROTATE CARRY TO RIGHT}

39. What are directives?


ans:-Assembler directives are instructions to the assembler concerning the program being
assembled.

41. Define assembly process


ans:-A microprocessor executes a collection of machine instructions that tell the processor
what to do is known as assembly process.

42. Define two pass assembler


ans:-A two pass assembler does two passes over the source file ( the second pass can be over
a file generated in the first pass ). In the first pass all it does is looks for label definitions and
introduces them in the symbol table. In the second pass, after the symbol table is complete, it
does the actual assembly by translating the operations and so on.

43. What are the advantages of modular programming?


ans:-Modular programming can be used to break up a large program into manageable units,
or to create code that can be easily re-used. Reduce problem to smaller, simpler, humanly
comprehensible problems

44. What is linking and relocation


ans:- A linker is a program used to join together several object files into one large object file.
The linker produces a link file which contains the binary codes for all the combined modules.
It also produces a link map which contains the address information about the link files. The
linker does not assign absolute addresses but only relative address starting from zero, so the
programs are relocatable & can be put anywhere in memory to be run.

45. What is a stack?


ans:-A stack is a last in, first out (LIFO) abstract data type and data structure. A stack can
have any abstract data type as an element, but is characterized by only two fundamental
operations: push and pop.

46. What are stack operated instructions? Explain


ans:-The generic use of stack is for, Return address return value ,parameters to called
function, local variables in the called function, processor registers that will be reused in the
called function.

47. Define Procedure


ans:-Procedures are a group of instructions stored as a separate program in memory and it is
called from the main program whenever required. The type of procedure depends on where
the procedures are stored in memory. If it is in the same code segment as that of the main
program then it is a near procedure otherwise it is a far procedure.

48. Explain about CALL and RETURN instructions


ans:-CALL 16-bit memory address of a subroutine It is a 3-byte instruction that transfers the
program sequence to a subroutine Saves the content of the PC (Program Counter-16-bit
register) , the address of the next instruction , on the stack. Decrements the stack pointer by 2.
Jumps unconditionally to the memory location specified by the 2nd and 3rd bytes. This
instruction is accompanied by a RETURN instruction in the subroutine. The return
instruction is used either to return a function value or to terminate the execution of a function.
The exit may be from anywhere within the function body, including loops or nested blocks. If
the function returns a value, the return instruction is required

49. What is recursive procedure


ans:-A recursive procedure is a procedure, which calls itself. Recursive procedures are used
to work with complex data structures called trees. If the procedure is called with N=3, then
the N is decremented by 1 after each procedure CALL and the procedure is called until N=0.

50. What is an interrupt. Explain


ans:-An interrupt is a condition that causes the microprocessor to temporarily work on a
different task, and then later return to its previous task. Interrupts can be internal or external.
Internal interrupts, or "software interrupts," are triggered by a software instruction and
operate similarly to a jump or branch instruction

Turbo Assembler (TASM) is an x86 assembler package developed by Borland. It is used with
Borland's high-level language compilers, such as Turbo Pascal, Turbo Basic and Turbo C.
ASCII Code - The extended ASCII table

a) ASCII control characters (character code 0-31)

DEC OCT HEX BIN Symbol HTML Number HTML Name Description
0 000 00 00000000 NUL &#000; Null char
1 001 01 00000001 SOH &#001; Start of Heading
2 002 02 00000010 STX &#002; Start of Text
3 003 03 00000011 ETX &#003; End of Text
4 004 04 00000100 EOT &#004; End of Transmission
5 005 05 00000101 ENQ &#005; Enquiry
6 006 06 00000110 ACK &#006; Acknowledgment
7 007 07 00000111 BEL &#007; Bell
8 010 08 00001000 BS &#008; Back Space
9 011 09 00001001 HT &#009; Horizontal Tab
10 012 0A 00001010 LF &#010; Line Feed
11 013 0B 00001011 VT &#011; Vertical Tab
12 014 0C 00001100 FF &#012; Form Feed
13 015 0D 00001101 CR &#013; Carriage Return
14 016 0E 00001110 SO &#014; Shift Out / X-On
15 017 0F 00001111 SI &#015; Shift In / X-Off
16 020 10 00010000 DLE &#016; Data Line Escape
17 021 11 00010001 DC1 &#017; Device Control 1 (oft. XON)
18 022 12 00010010 DC2 &#018; Device Control 2
19 023 13 00010011 DC3 &#019; Device Control 3 (oft. XOFF)
20 024 14 00010100 DC4 &#020; Device Control 4
21 025 15 00010101 NAK &#021; Negative Acknowledgement
22 026 16 00010110 SYN &#022; Synchronous Idle
23 027 17 00010111 ETB &#023; End of Transmit Block
24 030 18 00011000 CAN &#024; Cancel
25 031 19 00011001 EM &#025; End of Medium
26 032 1A 00011010 SUB &#026; Substitute
27 033 1B 00011011 ESC &#027; Escape
28 034 1C 00011100 FS &#028; File Separator
29 035 1D 00011101 GS &#029; Group Separator
30 036 1E 00011110 RS &#030; Record Separator
31 037 1F 00011111 US &#031; Unit Separator
b) ASCII printable characters (character code 32-127)

DEC OCT HEX BIN Symbol HTML Number HTML Name Description
32 040 20 00100000 &#32; Space
33 041 21 00100001 ! &#33; Exclamation mark
34 042 22 00100010 " &#34; &quot; Double quotes (or speech marks)
35 043 23 00100011 # &#35; Number
36 044 24 00100100 $ &#36; Dollar
37 045 25 00100101 % &#37; Procenttecken
38 046 26 00100110 & &#38; &amp; Ampersand
39 047 27 00100111 ' &#39; Single quote
40 050 28 00101000 ( &#40; Open parenthesis (or open bracket)
41 051 29 00101001 ) &#41; Close parenthesis (or close bracket)
42 052 2A 00101010 * &#42; Asterisk
43 053 2B 00101011 + &#43; Plus
44 054 2C 00101100 , &#44; Comma
45 055 2D 00101101 - &#45; Hyphen
46 056 2E 00101110 . &#46; Period, dot or full stop
47 057 2F 00101111 / &#47; Slash or divide
48 060 30 00110000 0 &#48; Zero
49 061 31 00110001 1 &#49; One
50 062 32 00110010 2 &#50; Two
51 063 33 00110011 3 &#51; Three
52 064 34 00110100 4 &#52; Four
53 065 35 00110101 5 &#53; Five
54 066 36 00110110 6 &#54; Six
55 067 37 00110111 7 &#55; Seven
56 070 38 00111000 8 &#56; Eight
57 071 39 00111001 9 &#57; Nine
58 072 3A 00111010 : &#58; Colon
59 073 3B 00111011 ; &#59; Semicolon
60 074 3C 00111100 < &#60; &lt; Less than (or open angled bracket)
61 075 3D 00111101 = &#61; Equals
62 076 3E 00111110 > &#62; &gt; Greater than (or close angled bracket)
63 077 3F 00111111 ? &#63; Question mark
64 100 40 01000000 @ &#64; At symbol
65 101 41 01000001 A &#65; Uppercase A
66 102 42 01000010 B &#66; Uppercase B
67 103 43 01000011 C &#67; Uppercase C
68 104 44 01000100 D &#68; Uppercase D
69 105 45 01000101 E &#69; Uppercase E
70 106 46 01000110 F &#70; Uppercase F
71 107 47 01000111 G &#71; Uppercase G
72 110 48 01001000 H &#72; Uppercase H
73 111 49 01001001 I &#73; Uppercase I
74 112 4A 01001010 J &#74; Uppercase J
75 113 4B 01001011 K &#75; Uppercase K
76 114 4C 01001100 L &#76; Uppercase L
77 115 4D 01001101 M &#77; Uppercase M
78 116 4E 01001110 N &#78; Uppercase N
79 117 4F 01001111 O &#79; Uppercase O
80 120 50 01010000 P &#80; Uppercase P
81 121 51 01010001 Q &#81; Uppercase Q
82 122 52 01010010 R &#82; Uppercase R
83 123 53 01010011 S &#83; Uppercase S
84 124 54 01010100 T &#84; Uppercase T
85 125 55 01010101 U &#85; Uppercase U
86 126 56 01010110 V &#86; Uppercase V
87 127 57 01010111 W &#87; Uppercase W
88 130 58 01011000 X &#88; Uppercase X
89 131 59 01011001 Y &#89; Uppercase Y
90 132 5A 01011010 Z &#90; Uppercase Z
91 133 5B 01011011 [ &#91; Opening bracket
92 134 5C 01011100 \ &#92; Backslash
93 135 5D 01011101 ] &#93; Closing bracket
94 136 5E 01011110 ^ &#94; Caret - circumflex
95 137 5F 01011111 _ &#95; Underscore
96 140 60 01100000 ` &#96; Grave accent
97 141 61 01100001 a &#97; Lowercase a
98 142 62 01100010 b &#98; Lowercase b
99 143 63 01100011 c &#99; Lowercase c
100 144 64 01100100 d &#100; Lowercase d
101 145 65 01100101 e &#101; Lowercase e
102 146 66 01100110 f &#102; Lowercase f
103 147 67 01100111 g &#103; Lowercase g
104 150 68 01101000 h &#104; Lowercase h
105 151 69 01101001 i &#105; Lowercase i
106 152 6A 01101010 j &#106; Lowercase j
107 153 6B 01101011 k &#107; Lowercase k
108 154 6C 01101100 l &#108; Lowercase l
109 155 6D 01101101 m &#109; Lowercase m
110 156 6E 01101110 n &#110; Lowercase n
111 157 6F 01101111 o &#111; Lowercase o
112 160 70 01110000 p &#112; Lowercase p
113 161 71 01110001 q &#113; Lowercase q
114 162 72 01110010 r &#114; Lowercase r
115 163 73 01110011 s &#115; Lowercase s
116 164 74 01110100 t &#116; Lowercase t
117 165 75 01110101 u &#117; Lowercase u
118 166 76 01110110 v &#118; Lowercase v
119 167 77 01110111 w &#119; Lowercase w
120 170 78 01111000 x &#120; Lowercase x
121 171 79 01111001 y &#121; Lowercase y
122 172 7A 01111010 z &#122; Lowercase z
123 173 7B 01111011 { &#123; Opening brace
124 174 7C 01111100 | &#124; Vertical bar
125 175 7D 01111101 } &#125; Closing brace
126 176 7E 01111110 ~ &#126; Equivalency sign - tilde
127 177 7F 01111111 &#127; Delete

c) The extended ASCII codes (character code 128-255)

DEC OCT HEX BIN Symbol HTML Number HTML Name Description
128 200 80 10000000 € &#128; &euro; Euro sign
129 201 81 10000001
130 202 82 10000010 ‚ &#130; &sbquo; Single low-9 quotation mark
131 203 83 10000011 ƒ &#131; &fnof; Latin small letter f with hook
132 204 84 10000100 „ &#132; &bdquo; Double low-9 quotation mark
133 205 85 10000101 … &#133; &hellip; Horizontal ellipsis
134 206 86 10000110 † &#134; &dagger; Dagger
135 207 87 10000111 ‡ &#135; &Dagger; Double dagger
136 210 88 10001000 ˆ &#136; &circ; Modifier letter circumflex accent
137 211 89 10001001 ‰ &#137; &permil; Per mille sign
138 212 8A 10001010 Š &#138; &Scaron; Latin capital letter S with caron
139 213 8B 10001011 ‹ &#139; &lsaquo; Single left-pointing angle quotation
140 214 8C 10001100 Œ &#140; &OElig; Latin capital ligature OE
141 215 8D 10001101
142 216 8E 10001110 Ţ &#142; Latin captial letter Z with caron
143 217 8F 10001111
144 220 90 10010000
145 221 91 10010001 Ř &#145; &lsquo; Left single quotation mark
146 222 92 10010010 ř &#146; &rsquo; Right single quotation mark
147 223 93 10010011 Ŗ &#147; &ldquo; Left double quotation mark
148 224 94 10010100 ŗ &#148; &rdquo; Right double quotation mark
149 225 95 10010101 • &#149; &bull; Bullet
150 226 96 10010110 Ŕ &#150; &ndash; En dash
151 227 97 10010111 ŕ &#151; &mdash; Em dash
152 230 98 10011000 ˜ &#152; &tilde; Small tilde
153 231 99 10011001 ™ &#153; &trade; Trade mark sign
154 232 9A 10011010 š &#154; &scaron; Latin small letter S with caron
155 233 9B 10011011 › &#155; &rsaquo; Single right-pointing angle quotation mark
156 234 9C 10011100 œ &#156; &oelig; Latin small ligature oe
157 235 9D 10011101
158 236 9E 10011110 ţ &#158; Latin small letter z with caron
159 237 9F 10011111 Ÿ &#159; &Yuml; Latin capital letter Y with diaeresis
160 240 A0 10100000 &#160; &nbsp; Non-breaking space
161 241 A1 10100001 ¡ &#161; &iexcl; Inverted exclamation mark
162 242 A2 10100010 ¢ &#162; &cent; Cent sign
163 243 A3 10100011 £ &#163; &pound; Pound sign
164 244 A4 10100100 ¤ &#164; &curren; Currency sign
165 245 A5 10100101 ¥ &#165; &yen; Yen sign
166 246 A6 10100110 ¦ &#166; &brvbar; Pipe, Broken vertical bar
167 247 A7 10100111 § &#167; &sect; Section sign
168 250 A8 10101000 ¨ &#168; &uml; Spacing diaeresis - umlaut
169 251 A9 10101001 © &#169; &copy; Copyright sign
170 252 AA 10101010 ª &#170; &ordf; Feminine ordinal indicator
171 253 AB 10101011 « &#171; &laquo; Left double angle quotes
172 254 AC 10101100 ¬ &#172; &not; Not sign
173 255 AD 10101101 &#173; &shy; Soft hyphen
174 256 AE 10101110 ® &#174; &reg; Registered trade mark sign
175 257 AF 10101111 ¯ &#175; &macr; Spacing macron - overline
176 260 B0 10110000 ° &#176; &deg; Degree sign
177 261 B1 10110001 ± &#177; &plusmn; Plus-or-minus sign
178 262 B2 10110010 ² &#178; &sup2; Superscript two - squared
179 263 B3 10110011 ³ &#179; &sup3; Superscript three - cubed
180 264 B4 10110100 ´ &#180; &acute; Acute accent - spacing acute
181 265 B5 10110101 µ &#181; &micro; Micro sign
182 266 B6 10110110 ¶ &#182; &para; Pilcrow sign - paragraph sign
183 267 B7 10110111 · &#183; &middot; Middle dot - Georgian comma
184 270 B8 10111000 ¸ &#184; &cedil; Spacing cedilla
185 271 B9 10111001 ¹ &#185; &sup1; Superscript one
186 272 BA 10111010 º &#186; &ordm; Masculine ordinal indicator
187 273 BB 10111011 » &#187; &raquo; Right double angle quotes
188 274 BC 10111100 ¼ &#188; &frac14; Fraction one quarter
189 275 BD 10111101 ½ &#189; &frac12; Fraction one half
190 276 BE 10111110 ¾ &#190; &frac34; Fraction three quarters
191 277 BF 10111111 ¿ &#191; &iquest; Inverted question mark
192 300 C0 11000000 À &#192; &Agrave; Latin capital letter A with grave
193 301 C1 11000001 Á &#193; &Aacute; Latin capital letter A with acute
194 302 C2 11000010 Â &#194; &Acirc; Latin capital letter A with circumflex
195 303 C3 11000011 Ã &#195; &Atilde; Latin capital letter A with tilde
196 304 C4 11000100 Ä &#196; &Auml; Latin capital letter A with diaeresis
197 305 C5 11000101 Å &#197; &Aring; Latin capital letter A with ring above
198 306 C6 11000110 Æ &#198; &AElig; Latin capital letter AE
199 307 C7 11000111 Ç &#199; &Ccedil; Latin capital letter C with cedilla
200 310 C8 11001000 È &#200; &Egrave; Latin capital letter E with grave
201 311 C9 11001001 É &#201; &Eacute; Latin capital letter E with acute
202 312 CA 11001010 Ê &#202; &Ecirc; Latin capital letter E with circumflex
203 313 CB 11001011 Ë &#203; &Euml; Latin capital letter E with diaeresis
204 314 CC 11001100 Ì &#204; &Igrave; Latin capital letter I with grave
205 315 CD 11001101 Í &#205; &Iacute; Latin capital letter I with acute
206 316 CE 11001110 Î &#206; &Icirc; Latin capital letter I with circumflex
207 317 CF 11001111 Ï &#207; &Iuml; Latin capital letter I with diaeresis
208 320 D0 11010000 Ð &#208; &ETH; Latin capital letter ETH
209 321 D1 11010001 Ñ &#209; &Ntilde; Latin capital letter N with tilde
210 322 D2 11010010 Ò &#210; &Ograve; Latin capital letter O with grave
211 323 D3 11010011 Ó &#211; &Oacute; Latin capital letter O with acute
212 324 D4 11010100 Ô &#212; &Ocirc; Latin capital letter O with circumflex
213 325 D5 11010101 Õ &#213; &Otilde; Latin capital letter O with tilde
214 326 D6 11010110 Ö &#214; &Ouml; Latin capital letter O with diaeresis
215 327 D7 11010111 × &#215; &times; Multiplication sign
216 330 D8 11011000 Ø &#216; &Oslash; Latin capital letter O with slash
217 331 D9 11011001 Ù &#217; &Ugrave; Latin capital letter U with grave
218 332 DA 11011010 Ú &#218; &Uacute; Latin capital letter U with acute
219 333 DB 11011011 Û &#219; &Ucirc; Latin capital letter U with circumflex
220 334 DC 11011100 Ü &#220; &Uuml; Latin capital letter U with diaeresis
221 335 DD 11011101 Ý &#221; &Yacute; Latin capital letter Y with acute
222 336 DE 11011110 Þ &#222; &THORN; Latin capital letter THORN
223 337 DF 11011111 ß &#223; &szlig; Latin small letter sharp s - ess-zed
224 340 E0 11100000 à &#224; &agrave; Latin small letter a with grave
225 341 E1 11100001 á &#225; &aacute; Latin small letter a with acute
226 342 E2 11100010 â &#226; &acirc; Latin small letter a with circumflex
227 343 E3 11100011 ã &#227; &atilde; Latin small letter a with tilde
228 344 E4 11100100 ä &#228; &auml; Latin small letter a with diaeresis
229 345 E5 11100101 å &#229; &aring; Latin small letter a with ring above
230 346 E6 11100110 æ &#230; &aelig; Latin small letter ae
231 347 E7 11100111 ç &#231; &ccedil; Latin small letter c with cedilla
232 350 E8 11101000 è &#232; &egrave; Latin small letter e with grave
233 351 E9 11101001 é &#233; &eacute; Latin small letter e with acute
234 352 EA 11101010 ê &#234; &ecirc; Latin small letter e with circumflex
235 353 EB 11101011 ë &#235; &euml; Latin small letter e with diaeresis
236 354 EC 11101100 ì &#236; &igrave; Latin small letter i with grave
237 355 ED 11101101 í &#237; &iacute; Latin small letter i with acute
238 356 EE 11101110 î &#238; &icirc; Latin small letter i with circumflex
239 357 EF 11101111 ï &#239; &iuml; Latin small letter i with diaeresis
240 360 F0 11110000 ð &#240; &eth; Latin small letter eth
241 361 F1 11110001 ñ &#241; &ntilde; Latin small letter n with tilde
242 362 F2 11110010 ò &#242; &ograve; Latin small letter o with grave
243 363 F3 11110011 ó &#243; &oacute; Latin small letter o with acute
244 364 F4 11110100 ô &#244; &ocirc; Latin small letter o with circumflex
245 365 F5 11110101 õ &#245; &otilde; Latin small letter o with tilde
246 366 F6 11110110 ö &#246; &ouml; Latin small letter o with diaeresis
247 367 F7 11110111 ÷ &#247; &divide; Division sign
248 370 F8 11111000 ø &#248; &oslash; Latin small letter o with slash
249 371 F9 11111001 ù &#249; &ugrave; Latin small letter u with grave
250 372 FA 11111010 ú &#250; &uacute; Latin small letter u with acute
251 373 FB 11111011 û &#251; &ucirc; Latin small letter u with circumflex
252 374 FC 11111100 ü &#252; &uuml; Latin small letter u with diaeresis
253 375 FD 11111101 ý &#253; &yacute; Latin small letter y with acute
254 376 FE 11111110 þ &#254; &thorn; Latin small letter thorn
255 377 FF 11111111 ÿ &#255; &yuml; Latin small letter y with diaeresis

Number System

Converting any base to decimal

101012 = 10101B = 1×24+0×23+1×22+0×21+1×20 = 16+4+1= 21


278 = 2×81+7×80 = 16+7 = 23
2816 = 28H = 2×161+8×160 = 40

Converting decimal to any base

510 = 1012 14010 = 2148 11010 = 6E16


DOS INT 21h - DOS Function Codes

AH Description AH Description
01 Read character from STDIN 02 Write character to STDOUT
05 Write character to printer 06 Console Input/Output
Direct char read (STDIN), no
07 08 Char read from STDIN, no echo
echo
09 Write string to STDOUT 0A Buffered input
0B Get STDIN status 0C Flush buffer for STDIN
0D Disk reset 0E Select default drive
19 Get current default drive 25 Set interrupt vector
2A Get system date 2B Set system date
2C Get system time 2D Set system time
2E Set verify flag 30 Get DOS version
35 Get Interrupt vector
36 Get free disk space 39 Create subdirectory
3A Remove subdirectory 3B Set working directory
3C Create file 3D Open file
3E Close file 3F Read file
40 Write file 41 Delete file
42 Seek file 43 Get/Set file attributes
47 Get current directory 4C Exit program
4D Get return code 54 Get verify flag
56 Rename file 57 Get/Set file date

You might also like