Shree Ramchandra College of Engineering: Lab Manual
Shree Ramchandra College of Engineering: Lab Manual
Shree Ramchandra College of Engineering: Lab Manual
SHREE RAMCHANDRA
COLLEGE OF ENGINEERING
LAB MANUAL
S.E. Computer Semester- IV
GROUP A
1 Write X86/64 Assembly language program (ALP) to add array of N hexadecimal
numbers stored in thememory. Accept input from the user.
2 Write X86/64 ALP to perform non-overlapped and overlapped block transfer (with and
without stringspecific instructions). Block containing data can be defined in the data
segment.
3 Write 64 bit ALP to convert 4-digit Hex number into its equivalent BCD number and
5-digit BCD numberinto its equivalent HEX number. Make your program user friendly
to accept the choice from user for:
(a) HEX to BCD b) BCD to HEX (c) EXIT.
Display proper strings to prompt the user while accepting the input and displaying the
result. (use of 64-bitregisters is expected)
4 Write X86/64 ALP for the following operations on the string entered by the user. (use
of 64-bit registers isexpected)
Make your program user friendly by providing MENU like:
(a) Enter the string b) Calculate length of string c) Reverse string d) Check palindrome
e) Exit
Display appropriate messages to prompt the user while accepting the input and
displaying the result.
5 Write X86/64 ALP to perform multiplication of two 8-bit hexadecimal numbers. Use
successive additionand add and shift method. Accept input from the user. (use of 64-bit
registers is expected)
6 Write 8087ALP to obtain:
i) Mean ii) Variance iii) Standard Deviation
For a given set of data elements defined in data segment. Also display result.
GROUP B
1 8255
(a) Write 8086 ALP to interface DAC and generate following waveforms on
oscilloscope,
(i) Square wave - Variable Duty Cycle and Frequency.
(ii) Ramp wave - Variable direction, (iii) Trapezoidal wave
(b) Write 8086 ALP to rotate a stepper motor for given number of steps at a given
angle and in the givendirection of rotation based on the user choice such as
(i) clockwise rotation,
(ii) anticlockwise rotation.
Also write routines to accelerate and deaccelerate
the motor.
(d)Write 8086 ALP to print a text message on printer using Centronixs parallel printer
interface
2 8253
Write 8086 ALP to program 8253 in Mode 0, modify the program for hardware
retriggerable Mono shotmode. Generate a square wave with a pulse of 1 ms. Comment
on the difference between HardwareTriggered and software triggered strobe mode.
Observe the waveform at GATE & out pin of 1C 8254 onCRO
3 8279
Write 8086 ALP to initialize 8279 and to display characters in right entry mode.
Provide also the facility to display
• Character in left entry mode.
• Rolling display.
• Flashing display
4 8251
Perform an experiment to establish communication between two 8251 systems A and
B. Program 8251system A in asynchronous transmitter mode and 8251 system B in
asynchronous receiver mode. Write anALP to transmit the data from system A and
receive the data at system B. The requirements are as follows:
Transmission:
• message is stored as ASCII characters in the memory.
• message specifies the number of characters to be transmitted as the first byte.
Reception:
• Message is retrieved and stored in the memory.
• Successful reception should be indicated.
5 TSR Program
Write a TSR program in 8086 ALP to implement Real Time Clock (RTC). Read the
Real Time from CMOSchip by suitable INT and FUNCTION and display the RTC at
the bottom right corner on the screen. Accessthe video RAM directly in your routine.
6 TSR Program
Write a TSR program in 8086 ALP to implement Screen Saver. Screen Saver should
get activated if thekeyboard is idle for 7 seconds. Access the video RAM directly in
your routine.
GROUP C
1 Study of Intel i5 Motherboard Block Diagram, Peripheral Connectors Pin Diagrams
and functioning of I/OHub, DDR-3 memory BUS
GROUP A
Assignment No. 1
ProgramStatement:
Write X86/64 Assembly language program (ALP) to add array of N hexadecimal numbers
stored in the memory. Accept input from the user.
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04
Theory :
The assembly program structure -
The assembly program can be divided into three sections:
The .data section
This section is for "declaring initialized data", in other words defining "variables" that already
contain stuff. However this data does not change at runtime so they're not really variables. The
.data section is used for things like filenames and buffer sizes, and you can also define constants
using the EQU instruction. Here you can use the DB, DW, DD, DQ and DT instructions.
For example:
section .data
messagedb 'Hello world!' ; Declare message to contain the bytes
;'Hello world!' (without quotes)
msglengthequ $-msg ; Declare msglength to have the
buffersizedw 1024 ;Declare buffersize to be a word with 1024 bytes
The .bss section
This section is where you declare your variables. You use the RESB, RESW, RESD, RESQ and
REST instructions to reserve uninitialized space in memory for your variables, like this:
section .bss
filenameresb 255 ; Reserve 255 bytes
numberresb 1 ; Reserve 1 byte
bignumresw 1 ; Reserve 1 word (1 word = 2 bytes)
realarrayresq 10 ; Reserve an array of 10 reals
The .text section
This is where the actual assembly code is written. The .text section must begin with the
declaration
global _start, which just tells the kernel where the program execution begins. (It's like the main
function in C or Java, only it's not a function, just a starting point.)
Eg.:
section .text
global _start
_start:
. ; Here is the where the program actually begins
.
.
.
Labels
A label is a sort of bookmark, describing a place in the program code and giving it a name that‟s
easier to remember than a naked memory address.
Labels are used to indicate the places where jump instructions should jump to, and they give
names to callable assembly language procedures.
Here are the most important things to know about labels:
Labels must begin with a letter, or else with an underscore, period, or question mark.
These last three have special meanings to the assembler, so don‟t use them until you
know how NASM interprets them.
Labels must be followed by a colon when they are defined. This is basically what tells
NASM that the identifier being defined is a label. NASM will punt if no colon is there
and will not flag an error, but the colon nails it, and prevents a mistyped instruction
mnemonic from being mistaken for a label. Use the colon!
Labels are case sensitive. So yikes:, Yikes:, and YIKES: are three completely different
labels. This differs from practice in a lot of other languages (Pascal particularly), so keep
it in mind.
Assembly Language Statements
Assembly language programs consist of three types of statements:
Now in the above program we are going to look line by line at the code we have just written:
Section .text
.global _start
_start:
# exit(0)
movrax, 60 # system call 60 is exit
xorrdi, rdi # we want return code 0
syscall # invoke operating system to exit
Mathematical Equation:
𝑵= 𝒏𝟏 + 𝒏𝟐 + ⋯ . . +𝒏 − 𝟏
Where:
Assignment Questions
1. Fedora 19 is how many bit operationg system?
2. Which version of nasm you used in this assignment?
3. Assembly language is Low-level language or High-level language?
4. List advantages of assembly language.
5. List different sections in assembly language program.
6. Which is the crucial difference between data items defined in the .data section and data items
defined in the .bss section?
7. How labels are defined in assembly program?
8. Assembly language programs consists which types of statements?
9. Write syntax of Assembly Language Statements?
Group A
Assignment No. 2
ProgramStatement:
Write X86/64 ALP to perform non-overlapped and overlapped block transfer (with and
without string specific instructions). Block containing data can be defined in the data segment.
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04 commands
Theory:
Allocating Storage Space for Initialized Data
The syntax for storage allocation statement for initialized data is:
Directive
Purpose Storage Space
DB Define Byte allocates 1 byte
DW Define Word allocates 2 bytes
DD Define Doubleword allocates 4 bytes
DQ Define Quadword allocates 8 bytes
DT Define Ten Bytes allocates 10 bytes
The reserve directives are used for reserving space for uninitialized data. The reserve directives
take a single operand that specifies the number of units of space to be reserved. Each define
directive has a related reserve directive.
There are fivebasic
forms of the reserve
directive:
Directive
Purpose
RESB Reserve a Byte
RESW Reserve a Word
RESD Reserve a
Doubleword
RESQ Reserve a Quadword
REST Reserve a Ten Bytes
Newconcepts:-
What is ALP?
AssemblylanguageProgram is mnemonic representation ofmachine code.
Which assemblerused inexecution ofALP?
Threeassemblers available for assemblingtheprograms forIBM-PC are:
1. Microsoft Micro Assembler(MASM)
2. Borland Turbo Assembler(TASM)
3. Net wide Assembler(NASM)
Theory
Assembly Basic Syntax
An assembly program can be divided into three sections:
1. The data section
2. The bss section
3. The text section
section.data
You can make use of Linux system calls in your assembly programs. You need to take the
following steps for using Linux system calls in your program:
Put the system call number in the EAX register.
Store the arguments to the system call in the registers EBX, ECX, etc.
Call the relevant interrupt (80h)
The result is usually returned in the EAX register
There are six registers that stores the arguments of the system call used. These are the EBX,
ECX, EDX, ESI, EDI, and EBP. These registers take the consecutive arguments, starting with
the EBX register. If there are more than six arguments then the memory location of the first
argument is stored in the EBX register.
The following code snippet shows the use of the system call sys_exit:
MOV EAX, 1 ; system call number (sys_exit)
INT 0x80 ; call kernel
The following code snippet shows the use of the system call sys_write:
MOV EDX, 4; message length
MOV ECX, MSG ; message to write
MOV EBX,1; file descriptor (stdout)
MOV EAX,4; system call number (sys_write)
INT0x80; call kernel
Assembly Variables
NASM provides various define directives for reserving storage space for variables. The define
Assembler directive is used for allocation of storage space. It can be used to reserve as well as
initialize one or more bytes.
Instructions needed:
1. MOV-Copies byteorword from specified sourceto specified destination
2. ROR-Rotates bits ofbyteorwordright,LSBto MSBand to CF
3. AND-AND each bit in abyteorword with correspondingbit in anotherbyteorword
4. INC-Increments specified byte/word by1
5. DEC-Decrements specified byte/word by1
6. JNZ-Jumps ifnot equal to Zero
7. JNC-Jumps ifno carryisgenerated
8. CMP-Compares to specified bytes orwords
9. JBE-Jumps ifbelow ofequal
10. ADD-Adds specified byteto byteorword to word
11. CALL-Transfers the control from callingprogramto procedure.
12. RET-Return from where call is made
Algorithm:
1. Start
2. Initialize data section
3. Load counter with number element for Addition
4. Locate first location of array of Number in Pointer Register.
5. Initialize result-low and result high to 00
𝑵= 𝒏𝟏 + 𝒏𝟐 + ⋯ . . +𝒏 − 𝟏
Where:
Commands
• To assemble
nasm –f elf hello.asm -o hello.o
• To link
ld –o hello hello.o
• To execute -
./hello
Theory Questions:
1. Explain in detail address calculation of 16 bit and 32 bit architecture?
2. Explain register model of 16bit, 32bit and 64bit architecture?
3. Describeexecution ofCALLinstruction
4. What doyou mean byisassemblerdirectives?Explain assemblerdirectives.
5. Explain Macro and Procedure?
6. Explain advance features of i7 processor?
7. What is multi core Architecture?
Oral Questions:
1. Explain sys_exit, sys_write, sys_read?
2. Explain .data, .bss, .text ?
3. Explain how to run a program in NASM?
4. Explain RESD, RESW, RESB, RESQ ?
Conclusion:-We have performed overlap and non-overlap transfer of data elements with
the use of string instructions and without using string instructions.,
GROUP A
Assignment No. 3
Problem Definition:
Write 64 bit ALP to convert 4-digit Hex number into its equivalent BCD number and 5-digit BCD
number into its equivalent HEX number. Make your program user friendly to accept the choice from
user for:
(a) HEX to BCD b) BCD to HEX (c) EXIT.
Display proper strings to prompt the user while accepting the input and displaying the result. (use of
64-bit registers is expected)
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04
Directive
Purpose Storage Space
DB Define Byte allocates 1 byte
DW Define Word allocates 2 bytes
DD Define Doubleword allocates 4 bytes
DQ Define Quadword allocates 8 bytes
DT Define Ten Bytes allocates 10 bytes
The reserve directives are used for reserving space for uninitialized data. The reserve directives
take a single operand that specifies the number of units of space to be reserved. Each define
directive has a related reserve directive.
There are five basic forms of the reserve
directive:
Directive
Purpose
RESB Reserve a Byte
RESW Reserve a Word
RESD Reserve a Doubleword
RESQ Reserve a Quadword
REST Reserve a Ten Bytes
ascii table
Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex | Char Dec Oct Hex
-------------------------------------------------------------------------------------
(nul) 0 0000 0x00 | (sp) 32 0040 0x20 | @ 64 0100 0x40 | ` 96 0140 0x60
(soh) 1 0001 0x01 | ! 33 0041 0x21 | A 65 0101 0x41 | a 97 0141 0x61
(stx) 2 0002 0x02 | " 34 0042 0x22 | B 66 0102 0x42 | b 98 0142 0x62
(etx) 3 0003 0x03 | # 35 0043 0x23 | C 67 0103 0x43 | c 99 0143 0x63
(eot) 4 0004 0x04 | $ 36 0044 0x24 | D 68 0104 0x44 | d 100 0144 0x64
(enq) 5 0005 0x05 | % 37 0045 0x25 | E 69 0105 0x45 | e 101 0145 0x65
(ack) 6 0006 0x06 | & 38 0046 0x26 | F 70 0106 0x46 | f 102 0146 0x66
(bel) 7 0007 0x07 | ' 39 0047 0x27 | G 71 0107 0x47 | g 103 0147 0x67
(bs) 8 0010 0x08 | ( 40 0050 0x28 | H 72 0110 0x48 | h 104 0150 0x68
(ht) 9 0011 0x09 | ) 41 0051 0x29 | I 73 0111 0x49 | i 105 0151 0x69
(nl) 10 0012 0x0a | * 42 0052 0x2a | J 74 0112 0x4a | j 106 0152 0x6a
(vt) 11 0013 0x0b | + 43 0053 0x2b | K 75 0113 0x4b | k 107 0153 0x6b
(np) 12 0014 0x0c | , 44 0054 0x2c | L 76 0114 0x4c | l 108 0154 0x6c
(cr) 13 0015 0x0d | - 45 0055 0x2d | M 77 0115 0x4d | m 109 0155 0x6d
(so) 14 0016 0x0e | . 46 0056 0x2e | N 78 0116 0x4e | n 110 0156 0x6e
(si) 15 0017 0x0f | / 47 0057 0x2f | O 79 0117 0x4f | o 111 0157 0x6f
(dle) 16 0020 0x10 | 0 48 0060 0x30 | P 80 0120 0x50 | p 112 0160 0x70
(dc1) 17 0021 0x11 | 1 49 0061 0x31 | Q 81 0121 0x51 | q 113 0161 0x71
(dc2) 18 0022 0x12 | 2 50 0062 0x32 | R 82 0122 0x52 | r 114 0162 0x72
(dc3) 19 0023 0x13 | 3 51 0063 0x33 | S 83 0123 0x53 | s 115 0163 0x73
(dc4) 20 0024 0x14 | 4 52 0064 0x34 | T 84 0124 0x54 | t 116 0164 0x74
(nak) 21 0025 0x15 | 5 53 0065 0x35 | U 85 0125 0x55 | u 117 0165 0x75
(syn) 22 0026 0x16 | 6 54 0066 0x36 | V 86 0126 0x56 | v 118 0166 0x76
(etb) 23 0027 0x17 | 7 55 0067 0x37 | W 87 0127 0x57 | w 119 0167 0x77
(can) 24 0030 0x18 | 8 56 0070 0x38 | X 88 0130 0x58 | x 120 0170 0x78
(em) 25 0031 0x19 | 9 57 0071 0x39 | Y 89 0131 0x59 | y 121 0171 0x79
(sub) 26 0032 0x1a | : 58 0072 0x3a | Z 90 0132 0x5a | z 122 0172 0x7a
(esc) 27 0033 0x1b | ; 59 0073 0x3b | [ 91 0133 0x5b | { 123 0173 0x7b
(fs) 28 0034 0x1c | < 60 0074 0x3c | \ 92 0134 0x5c | | 124 0174 0x7c
(gs) 29 0035 0x1d | = 61 0075 0x3d | ] 93 0135 0x5d | } 125 0175 0x7d
(rs) 30 0036 0x1e | > 62 0076 0x3e | ^ 94 0136 0x5e | ~ 126 0176 0x7e
(us) 31 0037 0x1f | ? 63 0077 0x3f | _ 95 0137 0x5f | (del) 127 0177 0x7f
ALGORITHM
Conclusion: In this experiment we have studied how to convert the given HEX no in to
equivalent BCD no. and vice versa
Assignment Questions
10. Fedora 19 is how many bit operationg system?
11. Which version of nasm you used in this assignment?
12. Assembly language is Low-level language or High-level language?
13. List advantages of assembly language.
14. List different sections in assembly language program.
15. Which is the crucial difference between data items defined in the .data section and data items
defined in the .bss section?
16. How labels are defined in assembly program?
17. Assembly language programs consists which types of statements?
18. Write syntax of Assembly Language Statements?
GROUP A
Assignment No. 4
Problem Definition:
Write X86/64 ALP for the following operations on the string entered by the user. (use of 64-bit
registers is expected)
a) Calculate Length of the string
b) Reverse the string
c) Check whether the string is palindrome
OR
Make your program user friendly by providing MENU like:
(a) Enter the string b) Calculate length of string c) Reverse string d) Check palindrome e) Exit
Display appropriate messages to prompt the user while accepting the input and displaying the result.
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04
Theory :
In computer programming, a file descriptor (FD) is an abstract indicator for accessing a file.
When designing computers, there are two different architectures for handling memory
storage. They are called Big Endian and Little Endian and refer to the order in which the bytes
are stored in memory. Windows NT was designed around Little Endian architecture and was not
designed to be compatible with Big Endian because most programs are written with some
dependency on Little Endian.
Masking Operations
A mask is a value used to force certain bits to zero or one within some other value. A
mask typically affects certain bits in an operand (forcing them to zero or one) and leaves other
bits unaffected. The appropriate use of masks allows you to extract bits from a value, insert bits
into a value, and pack or unpacked a packed data type. The following sections describe these
operations in detail.
Masking Operations with the AND Instruction
If you'll take a look at the truth table for the and operation back in Chapter One, you'll note that if
you fix either operand at zero the result is always zero. If you set that operand to one, the result is
always the value of the other operand. We can use this property of the and instruction to
selectively force certain bits to zero in a value without affecting other bits. This is called masking
out bits.
As an example, consider the ASCII codes for the digits "0".."9". Their codes fall in the range
30h..39h respectively. To convert an ASCII digit to its corresponding numeric value, you must
subtract 30h from the ASCII code. This is easily accomplished by logically anding the value with
0Fh. This strips (sets to zero) all but the L.O. four bits producing the numeric value. You could
have used the subtract instruction, but most people use the andinstruction for this purpose.
Remember the masking out operation described earlier with the and instruction? In that example
we wanted to convert an ASCII code for a digit to its numeric equivalent. You can use the
orinstruction to reverse this process. That is, convert a numeric value in the range 0..9 to the
ASCII code for the corresponding digit, i.e., '0'..'9'. To do this, logically or the specified numeric
value with 30h.
Pointer Registers
The pointer registers are 32-bit EIP, ESP and EBP registers and corresponding 16-bit right
portions � IP, SP and BP. There are three categories of pointer registers:
Instruction Pointer (IP) - the 16-bit IP register stores the offset address of the next instruction
to be
executed. IP in association with the CS register (as CS:IP) gives the complete address of the
current
instruction in the code segment.
Stack Pointer (SP) - the 16-bit SP register provides the offset value within the program stack.
SP in
association with the SS register (SS:SP) refers to be current position of data or address within the
program
stack.
Base Pointer (BP)- the 16-bit BP register mainly helps in referencing the parameter variables
passed to a subroutine. The address in SS register is combined with the offset in BP to get the
location of the parameter.
BP can also be combined with DI and SI as base register for special addressing.
Index Registers
The 32-bit index registers ESI and EDI and their 16-bit rightmost portions SI and DI are used for
indexed
addressing and sometimes used in addition and subtraction. There are two sets of index pointers:
Source Index (SI)- it is used as source index for string operations
Destination Index (DI) - it is used as destination index for string operations.
ALGORITHM:-
Conclusion:-
In this expt we have studied the various operations to be performed on string
Assignment Questions
1. What is the difference between big endian and little endian format?
2. What is a macro? Who executes a macro?
GROUP A
Assignment No.5
Problem Definition:
Write 8086 ALP to perform string manipulation. The strings to be accepted from the user is
to be stored in data segment of program_l and write FAR PROCEDURES in code segment
program_2 for following operations on the string:
(a) Concatenation of two strings (b) Number of occurrences of a sub-string in the given string Use
PUBLIC and EXTERN directive. Create .OBJ files of both the modules and link them to create an
EXE file.
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04
Theory:
Write about far procedure
Prepare three separate programs
i)accepting string1 and string 2,call for concatenation and substring procedure
ii)function for concatenation and substring procedure
iii)macros for system read and write call
Use of PUBLIC and EXTERN directive
%include etc
Write about string instructions(CMPSB,MOVSB,CLD,CLI )
Algorithm:
Follow the program and write steps according to the flow of program
Conclusion:-from this experiment we have studied about how to use global ,extern directive for
passing parameters from one file to other and we have also performed different string operation
on the string such as concatenation and substring
GROUP A
Assignment No.6
Problem Definition:
Write X86/64 ALP to perform multiplication of two 8-bit hexadecimal numbers. Use successive
addition and add and shift method. Accept input from the user. (use of 64-bit registers is expected)
1.1 Prerequisite:
Basics of the Assembly language programming
Knowledge of the instruction set.
Knowledge of nasm 2.10.04
L7: ...
CMP is often used for comparing whether a counter value has reached the number of time a loop
needs to be run. Consider the following typical condition:
INC EDX
CMP EDX, 10 ; Compares whether the counter has reached 10
JLE LP1 ; If it is less than or equal to 10, then jump to LP1
Unconditional Jump
As mentioned earlier this is performed by the JMP instruction. Conditional execution often
involves a transfer of
control to the address of an instruction that does not follow the currently executing instruction.
Transfer of control
may be forward to execute a new set of instructions, or backward to re-execute the same steps.
SYNTAX:
The JMP instruction provides a label name where the flow of control is transferred immediately.
The syntax of the
JMP instruction is:
JMP label
EXAMPLE:
The following code snippet illustrates the JMP instruction:
MOV AX, 00 ; Initializing AX to 0
MOV BX, 00 ; Initializing BX to 0
MOV CX, 01 ; Initializing CX to 1
L20:
ADD AX, 01 ; Increment AX
ADD BX, AX ; Add AX to BX
SHL CX, 1 ; shift left CX, this in turn doubles the CX value
JMP L20 ; repeats the statements
Conditional Jump
If some specified condition is satisfied in conditional jump, the control flow is transferred to a
target instruction. There are numerous conditional jump instructions, depending upon the
condition and data. Following are the conditional jump instructions used on signed data used for
arithmetic operations:
Instruction Description Flags tested
JE/JZ Jump Equal or Jump Zero ZF
JNE/JNZ Jump not Equal or Jump Not Zero ZF
JG/JNLE Jump Greater or Jump Not Less/Equal OF, SF, ZF
JGE/JNL Jump Greater or Jump Not Less OF, SF
JL/JNGE Jump Less or Jump Not Greater/Equal OF, SF
JLE/JNG Jump Less/Equal or Jump Not Greater OF, SF, ZF
Following are the conditional jump instructions used on unsigned data used for logical
operations:
Instruction Description Flags tested
JE/JZ Jump Equal or Jump Zero ZF
JNE/JNZ Jump not Equal or Jump Not Zero ZF
JA/JNBE Jump Above or Jump Not Below/Equal CF, ZF
JAE/JNB Jump Above/Equal or Jump Not Below CF
Algorithm:-
Follow the program and write steps according to the flow of program
ALGORITHMS FOR PROCEDURE MAIN :-
1. Start
2. Physical initialization of data segment
3. Display the following menu for user :-
**** MULTIPLICATION ****
GROUP A
Assignment 7
i) Mean
ii) Variance
iii) Standard Deviation
For a given set of data elements defined in data segment. Also display result.
Apparatus: Computer system with Assembler, Linker and Turbo Debugger programs.
Theory:
Fabricated using HMOS III technology and packaged in a 40-pin cerdip package,
68- instructions,
Instruction set includes both simple and complex floating point instructions,
By interfacing 8087 NDP with 8086 processor, programmer can perform various powerful
arithmetic floating point operations. e.g. add, sub, div, square root, logarithm etc.,
8087 support 7 data types: 16-, 32-, 64-bit integers, 32-, 64-, 80-bit floating point and 18-Digit
BCD operands,
Having 8 X 80 bit individually addressable register stack
Available in
5MHz (8087),
8MHz (8087-2) and
10MHz (8087-1),
7- built-in exception handling functions
Compatible with IEEE floating point standard 754,
The data information inside 8087 is always stored in temporary real format (80-bit floating point
representation)
Use of 8087 in 8086/8088 system increases processing speed to perform different mathematical
operations required in CAM, numeric controllers, CAD or Graphics,
d) Status Register:
e) Control Word
FBSTP: Store integer part of stack top in 10 byte packed BCD format
squared difference from mean and Standard Deviation: It is square root of variance.
xxiv. Load element on stack top and subtract the mean from it and square
the difference
xxv. Repeat step xiii to xiv for all elements
xxvi. Add all squares
xxvii. Divide the addition by count of elements
xxviii. Calculate square root
xxix. Display result message
vii. Display result
viii. Stop
Conclusion: Hence we have executed programs for co-processor to calculate Mean, Variance and
Standard deviation.
GROUP B
Assignment 1
Aim: Write 8086 ALP to interface DAC and generate following waveforms on oscilloscope,
Apparatus: 8086 Kit, DAC 0808 Card, Interfacing Cables, CRO, SMPS.
Objective:
Theory:
1. Performance parameters
a. Resolution: This is the number of possible output levels the DAC is designed to
reproduce. This is usually stated as the number of bits it uses, which is the base two
logarithm of the number of levels.
b. Maximum sampling rate: This is a measurement of the maximum speed at which the
DACs circuitry can operate and still produce the correct output.
c. Monotonicity: This refers to the ability of a DAC's analog output to move only in the
direction that the digital input moves
d. Settling time: settling time is the interval between a command to update (change) its
output value and the instant it reaches its final value, within a specified percentage.
2. Different techniques of conversions:
a. Binary weighted resistor D/A converter
Pin Diagram
Features:
1. Get machine codes for assembly language program to generate different analog waveforms.
2. Connect SMPS to DAC & 8086 kit.
3. Connect CRO to DAC.
4. Connect DAC card to 8086 kit using 26 pin FRC, through J2 (Used for U7- 8255 IC),
5. Enter machine codes to generate different waveforms and execute.
6. Observe the different waveforms on CRO,
7. Take readings for different parameters like Amplitude, Frequency, Duty cycle
8. Draw waveforms on graph paper.
A) Algorithm for Square wave with Variable Duty Cycle and frequency:
Conclusion: Hence we have performed the practical to generate different waveforms using Dyna86 kit
and DAC card.
GROUP B
Assignment 2
Aim: Write 8086 ALP to program 8253 in Mode 0, modify the program for hardware re-triggerable
Mono shot mode. Generate a square wave with a pulse of 1 ms. Comment on the difference between
Hardware Triggered and software triggered strobe mode. Observe the waveform at GATE & out pin of
1C 8253 on CRO
Apparatus: 8086 Kit, 8254 Study Card, Interfacing Cables, CRO, SMPS.
Objective:
Theory:
1. Pin Diagram,
Features:
Block Diagram:
Procedure:
1. Get machine codes for assembly language program to set 8254 in MODE 0(Interrupt on terminal
count for count 5),
2. Connect SMPS 8086 kit & interface 8254 kit to 8086 kit through 50 pin FRC (Using 50 pin FRC
means addresses will be 30- Counter 0, 31- Counter 1, 32- Counter 2, 33- Control register)
3. Give clock input through Manual Pulsar, Connect gate to Vcc,
4. Execute program and observe the function of 8254 in Mode 0 by giving pulses through manual
pulsar,
5. Get machine codes for assembly language program to set 8254 in MODE 1(Hardware Re-
triggerable Mono-shot for count 4),
6. Give clock input through Manual Pulsar, Connect gate to GND,
7. Execute program and give positive going pulse on GATE pin by connecting to Vcc& observe the
function of 8254 in Mode 1 by giving pulses through manual pulsar,
8. Get machine codes for assembly language program to set 8254 in MODE 3 (Square Wave Rate
Generator- to generate Pulse of Ton=1 ms i.e. T=2ms),
9. Give clock input through Auto Pulsar (750 KHz), Connect gate to Vcc, and connect out pin to
CRO,
10. Execute program and observe the function of 8254 in Mode 3 to generate Square wave of 2 ms
i.e. Ton=1ms &Toff=1ms, Observe the waveform on CRO and measure the output time cycle,
Given: Input frequency: 750KHz (Measure the actual frequency using CRO & use that value in
calculations)
Required T=2ms
Therefore n= T X Fin
= 2ms X 750MHz
Conclusion: Hence we have programmed 8253 to operate in different modes and also to generate square
wave with a pulse of 1ms.
GROUP B
Assignment 3
Aim: Write 8086 ALP to initialize 8279 and to display characters in right entry mode. Provide also the
facility to display
• Rolling display.
• Flashing display
Objective:
Theory:
1. Pin Diagram,
Features:
Procedure:
1. Get machine codes for assembly language program to set 8279 in different modes,
2. Connect SMPS 8086 kit & interface 8279 kit to 8086 kit through 50 pin FRC (Using 50 pin
FRC)
3. Execute the program and see the display.
Observation: It is observed that the 7-segment displays are showing messages as per the program written
for.
GROUP B
Assignment 4
Aim: Perform an experiment to establish communication between two 8251 systems A and
B. Program 8251 system A in asynchronous transmitter mode and 8251 system B in asynchronous
receiver mode. Write an ALP to transmit the data from system A and receive the data at system B.
Objective:
Theory:
4. Pin Diagram,
• Asynchronous 5 – 8 bit character; clock rate 1, 16 or 64 times baud rate; Break character
generation; 1, 1.5 or 2 stop bits; False start bit detection; Automatic break Detect and handling.
• Synchronous Baud Rate: DC to 64K Baud
• Asynchronous Baud Rate: DC to 19.2K Baud
• Full duplex, double-buffered transmitter and receiver
• Error detection- Parity, overrun and framing
• Compatible with an extended range of Intel microprocessors
• 28 pin DIP package
• TTL Compatible
• Available in EXPRESS and Military versions
Block Diagram:
Control Words
Procedure:
4. Get assembly language program and enter it in the 8086L Kit at address 1000,
5. Initialise the data to send at address 2000 to 2007
6. Clear the contents of address 3000 to 3007
7. Connect 8086 kit & interface 8251 kit to 8086 kit through 50 pin FRC(Addresses for this
assignment are 30, 31 for Group A and 26, 27 for Group B)
8. Execute the program and see the contents of locations 3000 to 3007.
Observation: It is observed that the data sent through 8051 System A is successfully received at 8051
System B
GROUP B
Assignment 5
TSR Program
Aim: Write a TSR program in 8086 ALP to implement Real Time Clock (RTC). Read the Real Time
from CMOS chip by suitable INT and FUNCTION and display the RTC at the bottom right corner on the
screen. Access the video RAM directly in your routine.
Objective:
Theory:
Structure of TSR programs: These programs are divided in three different parts
i. Data Area
ii. Resident routine
iii. Initialisation routine
• Data Area: Where different data definitions are included as per the requirement of program e.g.
Original entry in interrupt vector table, temporary space for registers etc.
• Resident Routine: Portion of program which will be made resident in the memory to perform
specified task. During execution of specified task original register contents may get change so
these contents must be preserved and again loaded before calling original interrupt service routine
• Initialisation routine: Does the preliminary work to make resident routine stay resident in the
memory, It executes only once,
It performs following steps
1) Get the original address of specified interrupt from IVT and save it
2) Store the address of resident program in the IVT in place of original address,
3) Calculate the size of the resident routine including Data area and PSP. Reserve the
memory area of this size and make the program resident
3. To read time from the CMOS time/clock chip, we use INT 1Ah(Real Time Clock Driver) and its
function 02h (Get Time). It returns CH= Hours in BCD, CL= minutes in BCD, DH= seconds in
BCD, DL= daylight-saving-time code (00h if standard time and 01h if daylight saving time), and
carry will be clear if clock is running else carry will be set if clock is stopped.
This time we are displaying at specific location continuously for which we will use display
RAM
4. Video Display Adaptors: The video display adapters found in IBM PC-compatible computers
have a hybrid interface to the central processor. The overall display characteristics, such as
vertical and horizontal resolution, background color, and palette, are controlled by values written
to I/O ports whose addresses are hardwired on the adapter, whereas the appearance of each
individual character or graphics pixel on the display is controlled by a specific location within an
area of memory called the regen buffer or refresh buffer. Both the CPU and the video controller
access this memory; the software updates the display by simply writing character codes or bit
patterns directly into the regen buffer.
Address for regen buffer for CGA, EGA, MCGA and VGA is B8000h (B800:0000)
Each character-display position is allotted 2 bytes in the regen buffer. The first byte (even
address) contains the ASCII code of the character, which is translated by a special hardware
character generator into a dot-matrix pattern for the screen. The second byte (odd address) is the
attribute byte.
1. ORG 100H
2. Unconditionally jump to initialisation routine
3. Reserve memory lactations to store the registers and original vector address
4. Store the registers temporarily
5. Read time
6. Initialise base address(B800h) of page-0 of video RAM in ES and offset(3984h) of a location
where we want to display the RTC,
7. Display HH:MM:SS
8. Restore the original register contents
9. Call the original interrupt service procedure
1. Clear interrupt flag to avoid any hardware interrupt during the process of initialisation,
2. Read the original vector address entry and store is in data area
3. Set the vector address to our interrupt service routine
4. Set interrupt flag
5. Terminate and make it resident
Conclusion: Hence we have written TSR program to implement Real Time Clock.