• No results found

Microprocessor Lab Manual

N/A
N/A
Protected

Academic year: 2021

Share "Microprocessor Lab Manual"

Copied!
74
0
0

Loading.... (view fulltext now)

Full text

(1)

MICROPROCESSORS LAB

MICROPROCESSORS LAB

CODE NO: 05401 CODE NO: 05401 I. Microprocessor 8086 I. Microprocessor 8086 1.

1. Introduction to MASM/TASMIntroduction to MASM/TASM

2.

2.  Arithmetic  Arithmetic operations – operations – Multi Multi byte byte addition addition and and subtraction, msubtraction, multiplication andultiplication and di

divivisisionon-s-sigignened d anand d ununsisigngned ed ArAritithmhmetetic ic opopereratatioion, n, ASASCICII- I- araritithmhmeteticic operation.

operation.

3.

3. Logic operations- Shift and rotate-Converting packed BCD to Unpacked BCD,Logic operations- Shift and rotate-Converting packed BCD to Unpacked BCD, BCD to ASCII conversion.

BCD to ASCII conversion.

4.

4. By using string operation and instruction prefix: Move block, Reverse string,By using string operation and instruction prefix: Move block, Reverse string, Sorting, Inserting, Deleting, and Length of the string, String comparison

Sorting, Inserting, Deleting, and Length of the string, String comparison

5.

5. DOSDOS/BI/BIOS OS ProProgragrammimming: ng: ReaReadinding g keykeyboaboard rd (Bu(Buffeffered red witwith h and and witwith h outout echo) - Display characters, Strings.

echo) - Display characters, Strings.

II.INTERFACING II.INTERFACING

1.

1. 8259-Interuupt controller: Generate an interrupt using 8259-Interuupt controller: Generate an interrupt using 8259 timer.8259 timer.

2.

2. 82827979-K-Keyeyboboarard d didispsplalayy: : WrWritite e a a smsmalall l prprogograram m to to didispsplalay y a a ststriring ng of of  Characters.

Characters.

3.

3. 8255-PPI: Write ALP to generate sinusoidal wave 8255-PPI: Write ALP to generate sinusoidal wave using PPI.using PPI.

4.

4. 8251-USART: Write a program in ALP establish communication between8251-USART: Write a program in ALP establish communication between to processors.

to processors.

III.MICROCONTROLLER 8051 III.MICROCONTROLLER 8051

1.

1. ReaReadinding and wg and writiriting on a png on a paraarallellel porl port.t. 2.

2. TimTimer er in in difdifferferent ent modmodeses.. 3.

(2)

I.

I. MiMicrcropoprorocecessssor or 80808686

1.

1. IntIntrodroductuction ion to to MASMASM/TM/TASMASM

2.

2.  Arithmetic  Arithmetic operations – operations – Multi Multi byte byte addition addition and and subtraction, msubtraction, multiplication andultiplication and di

divivisisionon-s-sigignened d anand d ununsisigngned ed ArAritithmhmetetic ic opopereratatioion, n, ASASCICII- I- araritithmhmeteticic operation.

operation. 3.

3. Logic oLogic operatiperations- Shifons- Shift and rotatt and rotate-Cone-Convertiverting packng packed BCD to Unped BCD to Unpacked Backed BCD,CD, BCD to ASCII conversion.

BCD to ASCII conversion.

4.

4. By using string operation and instruction prefix: Move block, Reverse string,By using string operation and instruction prefix: Move block, Reverse string, Sorting, Inserting, Deleting, and Length of the string, String comparison

Sorting, Inserting, Deleting, and Length of the string, String comparison

5.

5. DOSDOS/BI/BIOS OS ProProgragrammimming: ng: ReaReadinding g keykeyboaboard rd (Bu(Buffeffered red witwith h and and witwith h outout echo) - Display characters, Strings.

echo) - Display characters, Strings.

II. INTERFACING II. INTERFACING

1.

1. 8258259-I9-Intenteruuruupt pt concontrotrolleller:r: 1.

1. PuPulslse e CoCoununteter r 

2.

2. Frequency Counter Frequency Counter  2.

2. 8278279-K9-Keyeyboaboard rd disdisplaplay:y:

Display String of Characters Display String of Characters 3

3.. 88225555--PPPPII::

Sine wave generation Sine wave generation 4.

4. 82518251-USART-USART: Write a pro: Write a program in ALgram in ALP estabP establish colish communimmunicatiocation betwn betweeneen to processors.

to processors.

III.

III. MICROCONTROLLER MICROCONTROLLER 80518051

1.

1. ArAritithmhmatatic opic opereratatioionsns.. 2.

2. TimTimer er in in difdifferferent ent modmodeses.. a.

a. GeneGenerate derate delay uslay using timing timer 0 in mer 0 in mode 1 fode 1 for squor square ware waveave b.

b. GeneGenerate derate delay uslay using timing timer 0 in mer 0 in mode 2 fode 2 for squor square ware waveave

EXPERIMENTS OTHER THAN JNTU

EXPERIMENTS OTHER THAN JNTU SYLLASYLLABUSBUS

1.

1. 8282779-9-KeKeyyboboarard d didisspplalayy: : WrWritite e a a smsmalall l pprorogrgraam m to to didispsplalay y a a sstrtrining g of of  Characters.

Characters. a.

a. DisDisplaplay oy of Sf Singingle le ChaCharacracter ter  b.

b. ReadReading cing characharacter frter from keyom keyboard board and dand displayisplaying iting it 2

2.. 88225555--PPPPII::

a. Square wave generation a. Square wave generation

b. Stepper motor speed and direction control b. Stepper motor speed and direction control

3.

(3)

MICRO PROCESSOR 8086

MICRO PROCESSOR 8086

1. INTRODUCTION TO MASM/TASM

1. INTRODUCTION TO MASM/TASM

(4)

The assembler is a program that converts an assembly input file also called The assembler is a program that converts an assembly input file also called source file to an object file that can further be converted in to machine codes or an source file to an object file that can further be converted in to machine codes or an executable file using a linker. There are a number of assemblers available like executable file using a linker. There are a number of assemblers available like MASM, TASM and DOS assembler.TASM is one of the popular assemblers used MASM, TASM and DOS assembler.TASM is one of the popular assemblers used along with a link program to structure the codes generated By TASM in the form of  along with a link program to structure the codes generated By TASM in the form of  executable files.TASM reads the source program as its input and provides an object executable files.TASM reads the source program as its input and provides an object file. The link accepts the object file produced by TASM as input and produces an file. The link accepts the object file produced by TASM as input and produces an EXE file.

EXE file.

Before staring the process ensure that all the files namely, TASM, .EXE, Before staring the process ensure that all the files namely, TASM, .EXE, LINK .EXE, DEBUG. EXE

LINK .EXE, DEBUG. EXE  Are

 Are available available in in the the same same directory directory which which is is working working .Start .Start the the procedure procedure with with thethe following command after boot the terminal and enter the directory containing all the following command after boot the terminal and enter the directory containing all the files mentioned.

files mentioned.

D: Valid directory D: Valid directory Cod:

Cod: Change thChange the directory e directory with all with all filesfiles Edit:

Edit: Edit the Edit the assembler to assembler to enter the enter the programprogram Save

Save the files the files with. with. .ASM..ASM.

ASSUME CS:CODE,DS:DATA ASSUME CS:CODE,DS:DATA D DAATTA A SSEEGGMMEENNTT OPR1 OPR1 DW DW 1234H1234H OPR OPR DW DW 0002H0002H RESULT

RESULT DW DW 01H 01H DUP DUP ?? DATA ENDS

DATA ENDS

CODE SEGMENT CODE SEGMENT START:

START: MOV MOV AX, AX, DATADATA MOV DS, AX MOV DS, AX MOV AX, OPR1 MOV AX, OPR1 MOV BX, OPR2 MOV BX, OPR2 CLC CLC ADD AX, BX ADD AX, BX

MOV DI, OFFSET RESULT MOV DI, OFFSET RESULT

MOV DI, AX MOV DI, AX MOV AH, 4CH MOV AH, 4CH INT 03H INT 03H CODE ENDS. CODE ENDS. END START. END START. The main

The main task of task of any assembany assembler program is ler program is to accept the to accept the text _assembtext _assembly languagely language program file as input and prepare an object file .the TASM accepts the file names program file as input and prepare an object file .the TASM accepts the file names only with the extension .ASM.

only with the extension .ASM.

The TASM linking program LINK.EXE .links the different object modules of a source The TASM linking program LINK.EXE .links the different object modules of a source program and function library routines to generate an integrated executable code of  program and function library routines to generate an integrated executable code of  the source program. The main input to the linker is the .OBJ file that contains the the source program. The main input to the linker is the .OBJ file that contains the object modules of the source program.

object modules of the source program.

Debug .Exe facilitates the debugging and trouble shooting of assembly language Debug .Exe facilitates the debugging and trouble shooting of assembly language program. The debug utility enables to have the control these resources unto some program. The debug utility enables to have the control these resources unto some extent.

(5)

TASM file name. ASM TASM file name. ASM TLINK file name

TLINK file name Debug

Debug file file name.exename.exe G- Execute current CS: IP. G- Execute current CS: IP.

- Execute from offset in the current series - Execute from offset in the current series U- Un assemble from the current CS: IP U- Un assemble from the current CS: IP

- Un assemble from

- Un assemble from the address SEG: OFFSETthe address SEG: OFFSET

D- Display 128 memory locations of RAM starting from the current display D- Display 128 memory locations of RAM starting from the current display pointer 

pointer 

-Display memory contents SEG from offset1 to offset2 -Display memory contents SEG from offset1 to offset2

ASSEMBLER DIRECTIVES: ASSEMBLER DIRECTIVES:

An Assembler is a program used to convert an assembly language An Assembler is a program used to convert an assembly language program in to equivalent machine code modules which may further be converted in program in to equivalent machine code modules which may further be converted in to

to exexececututabable le cocodedes. s. ThThe e asassesembmbleler r dedecicidedes s ththe e adaddrdresess s of of eaeach ch lalabebel l anandd substitutes the values for each of the constants and variables. It then forms the substitutes the values for each of the constants and variables. It then forms the machine code for the mnemonics and data in assembly language program. While machine code for the mnemonics and data in assembly language program. While doing all these all these things, the

doing all these all these things, the assembler may find out Syntax errors. The logicalassembler may find out Syntax errors. The logical errors or other programming errors are not find out by the assembler. For completing errors or other programming errors are not find out by the assembler. For completing all these tasks, an assembler needs some hints from the programmer, i.e. the all these tasks, an assembler needs some hints from the programmer, i.e. the required storage for a particular constant or variable, logical names of the segments, required storage for a particular constant or variable, logical names of the segments, type

types s of the of the differdifferent routines and moduleent routines and modules, end s, end of file of file etc. These typeetc. These types s of hints areof hints are gi

givven en to to asasssememblbler er ususining g ssomome e pprerededefifinened d aalplphhababeteticicaal l ststririnngs gs ccalalleledd “ASSEMBLER DIRECTIVES”.

“ASSEMBLER DIRECTIVES”.

DB: DB:

This is used to reserve byte or bytes of memory locations in the available This is used to reserve byte or bytes of memory locations in the available memory. While preparing the EXE file, this directive directs the assembler to allocate memory. While preparing the EXE file, this directive directs the assembler to allocate the specified number of memory bytes to the said data type that may be constant, the specified number of memory bytes to the said data type that may be constant, variable or stringent.

variable or stringent.

DW: DW:

This directive serves the same purposes as the DB directive, but it now makes This directive serves the same purposes as the DB directive, but it now makes the assembler 

the assembler 

Reserve the number of memory

Reserve the number of memory words instead of bytes.words instead of bytes.

DQ: DQ:

This directive

This directive is used is used to direct to direct the assembler the assembler to reserve to reserve words of words of memory for memory for  the specified variable and may initialize it with the specified values.

the specified variable and may initialize it with the specified values.

ASSUME: ASSUME:

The ASSUME directive is used to inform the assemble, the names of the The ASSUME directive is used to inform the assemble, the names of the logical segments to be assumed for

(6)

The

The END dEND directive markirective marks the s the end of end of an asan assembly sembly language language program. program. WhenWhen the a

the assssembembler cler comeomes acrs across oss this directhis directivtive, it igne, it ignoreores the ss the sourource lince lineses available later on.

available later on.

ENDP: ENDP:

In

In assembly assembly language language programming, programming, the sthe subroutines ubroutines are are called called procedures.procedures. Thus, procedures may be

Thus, procedures may be

Independent program modules which return particular results or values to the calling Independent program modules which return particular results or values to the calling

programs. The ENDP programs. The ENDP

Directive is used to indicate an end of procedures. A procedure is usually assigned a Directive is used to indicate an end of procedures. A procedure is usually assigned a

name, i.e. label. To mark name, i.e. label. To mark

The end of a particular procedure, the name of the procedure, i.e label appear as a The end of a particular procedure, the name of the procedure, i.e label appear as a

prefix with the directive prefix with the directive ENDP.

ENDP.

ENDS: ENDS:

This directive marks the end of a logical segment. The logical segments are This directive marks the end of a logical segment. The logical segments are assigned with names

assigned with names

Using the ASSUME directive. The names appear with

Using the ASSUME directive. The names appear with the ENDS directive as prefixesthe ENDS directive as prefixes to mark the end of 

to mark the end of  Those particular segments. Those particular segments.

LABEL: LABEL:

This is used to assign a name to the current content of the location counter. At This is used to assign a name to the current content of the location counter. At the start

the start

of the assembly process, the assembler initializes a location counter to keep track of  of the assembly process, the assembler initializes a location counter to keep track of 

memory memory

Locations assigned to the program. As

Locations assigned to the program. As the program assembly proceeds, the contentsthe program assembly proceeds, the contents of the

of the

Location counter are updated. Location counter are updated.

LENGTH: LENGTH:

This is used to refer the length of a data

This is used to refer the length of a data array or string.array or string.

OFFSET: OFFSET:

When the assembler comes across the offset operator along with a label, it first When the assembler comes across the offset operator along with a label, it first

computes the 6-bit computes the 6-bit

Displacement of the particular label, and replaces the string ‘offset label’ by the Displacement of the particular label, and replaces the string ‘offset label’ by the

computed displacement. computed displacement.

SEGMENT: SEGMENT:

This marks the staring of a logical segment .The started segment is also This marks the staring of a logical segment .The started segment is also assigned a name

assigned a name

i.e., label by this statement. The SEGMENT and ENDS directive must bracket each i.e., label by this statement. The SEGMENT and ENDS directive must bracket each

logical Segment of a program. logical Segment of a program.

(7)

2. ARITHMETIC OPERATIONS

2. ARITHMETIC OPERATIONS

Multi byte addition

Multi byte addition

Multi byte Subtraction

Multi byte Subtraction

Multi byte multiplication

Multi byte multiplication

Multi byte division

Multi byte division

+Ve & -ve No.s of array

+Ve & -ve No.s of array

GCD of two numbers

GCD of two numbers

0s &1s in 16-bit number 

0s &1s in 16-bit number 

Prime number checking

Prime number checking

(8)

THIS PROGRAM PERFORMS MULTIBYTE

THIS PROGRAM PERFORMS MULTIBYTE ADDITIONADDITION

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 add.asm

add.asm

/* the data segment in array1 and the data segment in array2 is added and the result /* the data segment in array1 and the data segment in array2 is added and the result Will be stored and displayed in

Will be stored and displayed in data segment array3*/data segment array3*/

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000s s ssttaarrtt: : mmoovve e aaxx, , ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 000005 05 8B 8B 0E 0E 00000000r r momov v cxcx,n,n1 1 ;i;initnitiaialislise e cocoununteter r  8

8 0000009 9 BBE E 00000022r r lleea a ssii,,aarrrrayay1 ;1 ;ininiittiaialilisse e ppooinintteer r  9

9 000000C C BBB B 00000066r r lleea a bbxx,,aarrrraayy22 1

100 000000F F BBF F 000000AAr r lleea a ddii,,aarrrraayy33 1

111 0000112 2 88A A 004 4 ll11::mmoov v aall,,[[ssii] ] ;;ppeerrffoorrm m aaddddiittiioonn Of 1st byte Of 1st byte 1

122 0000114 4 112 2 007 7 aad d aall,,[[bbxx]] 1

133 0000116 6 888 8 005 5 mmoov v [[ddii]], , aal l ; ; ssttoorre e tthhe e rreessuulltt 1

144 0000118 8 446 6 iinnc c ssi i ;;uuppddaatte e ddaatta a ppooiinntteerrss 1

155 0000119 9 443 3 iinnc c bbxx 1

166 000011A A 447 7 iinnc c ddii 1

177 000011B B 449 9 ddeec c ccx x ; ; rreeppeeaat t aaddddiittiioon n ttiillll The final byte The final byte 1 18 08 00011C C 775 5 FF4 4 jjnnz z ll11 1 199 000011E E CCC C iinnt t 0033 2 20 00 00011F F ccoodde e eennddss 21 21 2 22 02 000000 0 ddaatta a sseeggmmeenntt 2 233 0000000 0 0000004 4 nn1 1 ddw w 00000044hh 2

244 0000002 02 01100220033004 4 aarrrraayy1 1 ddd d 0011002200330044h ;h ;ssppeecciiffy y iinnppuuttss 2

255 0000006 6 001100220033004 4 aarrrraayy2 2 ddd d 0011002200330044hh 2

266 000000A A ??????????????? ? aarrrraayy3 3 dddd? ? ; ; ssttoorre e tthhe e rreessuulltt 2

27 07 00000EE ddaatta a eennddss 2

28 8 eennd d ssttaarrtt

Input :

Input : 1st array: 01020304h1st array: 01020304h 2nd array: 01020304h 2nd array: 01020304h

(9)

Output:

(10)

THIS PROGRAM PERFORMS MULTIBYTE SUBTRACTION THIS PROGRAM PERFORMS MULTIBYTE SUBTRACTION

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 sub.asm

sub.asm

/* The data segment in array1 and the data segment in array2 is subtracted and the /* The data segment in array1 and the data segment in array2 is subtracted and the result

result

Will be stored and displayed in

Will be stored and displayed in data segment array3*/data segment array3*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000s s ssttaarrt t : : mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 88B B 00E E 00000000r r momov v ccxx,,nn1 1 ;;iinniittiiaalliisse e ccoouunntteer  r   8

8 0000009 9 BBE E 00000022r r lleea a ssii,,aarrrraayy1 1 ;;iinniittiiaalliisse e aarrrraayy pointers pointers 9

9 000000C C BBB B 000000AAr r lleea a bbxx,,aarrrraayy22 1

100 000000F F BBF F 00001122r r lleea a ddii,,aarrrraayy33 1

111 0000112 2 88A A 004 4 ll11::mmoov v aall,,[[ssii] ] ;;ppeerrffoorrm m ssuubbttrraaccttiioon n oof  f   ls byte

ls byte 1

122 0000114 4 11A A 007 7 ssbbb b aall,,[[bbxx]] 1

133 0000116 6 889 9 005 5 mmoov v [[ddii]],,aax x ;;ssttoorre e rreessuulltt 1

144 0000118 8 446 6 iinnc c ssi i ;;uuppddaatte e ddaatta a ppooiinntteerrss 1

155 0000119 9 443 3 iinnc c bbxx 1

166 000011A A 447 7 iinnc c ddi i ;;rreeppeeaat t ssuubbttrraaccttiioon n ttiillll last byte last byte 1 177 000011B B 449 9 ddeec c ccxx 1 18 08 00011C C 775 5 FF4 4 jjnnz z ll11 1 199 000011E E CCC C iinnt t 0033 2 20 00 00011F F ccoodde e eennddss 21 21 2 22 02 000000 0 ddaatta a sseeggmmeenntt 23 23 2 244 0000000 0 00000044 nn1 1 ddw w 00000044hh 2

255 0000002 2 00000000000000000055006600880099 aarrrarayy1 1 ddq q 0055006600880099hh;;ssppeeccifify y iinnppuutt 2

266 000000A A 00000000000000000011002200330044 aarrrraayy2 2 ddq q 0011002200330044hh 2

277 0000112 2 ???????????????????????????????? aarrrraayy3 3 ddq q ? ? ;;ssttoorre e oouuttppuutt 2

288 000011AA ddaatta a eennddss 2

29 9 eennd d ssttaarrt t ;;ssttoopp

Input:

Input: array1 :05060809harray1 :05060809h array2 :01020304h array2 :01020304h

Output:

(11)

THIS PROGRAM PERFORMS MULTIBYTE M

THIS PROGRAM PERFORMS MULTIBYTE MULTIPLICAULTIPLICATIONTION

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 mul.asm

mul.asm

/* The data segment in data1 and the data segment in n2 is multiplied and the result /* The data segment in data1 and the data segment in n2 is multiplied and the result Will be stored and displayed in

Will be stored and displayed in data segment data2*/data segment data2*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 00000000s s ssttaarrtt::mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 000005 05 8B 8B 0E 0E 00000000r r momov v cxcx,n,n1 1 ;l;lenengtgth h of of ararrayray 8

8 000009 09 8A 8A 1E 1E 00000202r r momov v blbl,n,n2 2 ;m;mulultitiplplieier r  9

9 000000D D BBA A 0000000 0 mmoov v ddxx,,0000hh 1

100 0000110 B0 BE E 00000033r r lleea a ssii,,ddaattaa1 ;1 ;aarrrraay y ppooiinntteer  r   1

111 0000113 B3 BF F 00000077r r lleea a ddii,,ddaattaa2 ;2 ;rreessuullt t ppooiinntteer  r   1 122 0000116 86 8A A 004 4 ll11: : mmoov v aall,,[[ssii] ] ;;ggeet t 11sst t bbyytte e oof  f   multiplicand multiplicand 1 133 0000118 8 FF6 6 EE3 3 mmuul l bbl l ;;mmuullttiippllyy 1 144 000011A A 003 3 CC2 2 aaddd d aaxx,,ddxx 1 155 000011C C 88A A DD4 4 mmoov v ddll,,aahh 1

166 000011E E 888 8 005 5 mmoov v [[ddii]],,aal l ;;ssttoorre e rreessuullt t iin n rreessuulltt pointer 

pointer  1

177 0000220 0 446 6 iinnc c ssi i ;;uuppddaatte e ddaatta a ppooiinntteer  r   1

188 0000221 1 447 7 iinnc c ddi i ;;ppeerrffoorrm m mmuullttiipplliiccaattiioon n ttiillll the last multiplicand the last multiplicand 1 19 09 000222 2 449 9 ddeec c ccxx 2 200 0000223 3 775 5 FF1 1 jjnnz z ll11 2 21 01 000225 5 CCC C iinnt t 0033 2 222 0000226 6 ccoodde e eennddss 23 23 2 244 0000000 0 ddaatta a sseeggmmeenntt 2 255 0000000 0 0000004 4 nn1 1 ddw w 00000044hh 2 266 0000002 2 005 5 nn2 2 ddb b 0055hh 27 27 0003 0003 010201020304 0304 data1 data1 dd dd 0102010203040304hh 2 288 0000007 7 ??????????????? ? ddaattaa2 2 ddd d ?? 2 299 000000B B ddaatta a eennddss 3

30 0 eennd d ssttaarrt t ;;ssttoopp

Input:

Input: Multiplier: 05hMultiplier: 05h

Multiplicand: 01020304h Multiplicand: 01020304h

Output:

(12)

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 div.asm

div.asm

/* The data segment in data1 and the data segment in n2 is divided and the result /* The data segment in data1 and the data segment in n2 is divided and the result Will be stored and displayed in

Will be stored and displayed in data segment data2*/data segment data2*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 00000000 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 00000000s s ssttaarrtt: : mmoov v aaxx, , ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 000005 05 8B 8B 0E 0E 00000000r r momov v cxcx,n,n1 1 ;d;divivididenend d lelengngthth 8

8 000009 09 8A 8A 1E 1E 00000202r r mov mov blbl,n,n2 2 ;d;divivisisor or  9

9 000000D D BE BE 00000303r r llea ea ssi,i,ddatataa1 1 ;i;innititiaialilize ze dadata ta ppoiointnteer r  1

100 0000110 0 BBF F 00000077r r lleea a ddii,,ddaattaa22 1

111 0000113 3 BB4 4 000 0 mmoov v aahh,,0000hh 1

122 0000115 5 88A A 004 4 ll11::mmoov v aall,,[[ssii] ] ;;ggeet t 11sst t bbyytte e oof f ddiivviiddeenndd 1

133 0000117 7 998 8 ccbbww 1

144 0000118 8 FF6 6 FF3 3 diiv dv bbl l ;;ppeerrffoorrm m ddiivviissiioonn 1

155 000011A A 11B B CC2 2 ssbbb b aaxx,,ddxx 1

166 000011C C 88A A DD4 4 mmoov v ddll,,aahh 1

177 000011E E 888 8 005 5 mmoov v [[ddii]],,aal l ;;ssttoorre e qquuoottiieenntt 1

188 0000220 0 446 6 iinnc c ssi i ;;uuppddaatte e ddiivviiddeennd d aanndd result pointers result pointers 1

199 0000221 1 447 7 iinnc c ddii 2

200 0000222 2 449 9 ddeec c ccx x ;;ppeerrffoorrm m tthhiis s ttiilll l MMSSBB 2 211 0000223 3 775 5 FF0 0 jjnnz z ll11 2 22 02 000225 5 CCC C iinnt t 003 3 ;;ssttoopp 2 23 03 000226 6 ccoodde e eennddss 24 24 2 25 05 000000 0 ddaatta a sseeggmmeenntt 26 26 2 277 0000000 0 0000004 4 nn1 1 ddw w 00000044hh 2 288 0000002 2 005 5 nn2 2 ddb b 0055hh 2 299 0000003 3 114400FF00AA1199 ddaattaa1 1 ddd d 114400ff00aa1199hh 3 300 0000007 7 ???????????????? ddaattaa2 2 ddd d ?? 31 31 3 322 000000B B ddaatta a eennddss 3 333 eenndd ssttaarrtt Input:

Input: Divisor: 05hDivisor: 05h

Dividend; 140F0A19h Dividend; 140F0A19h

Output:

(13)

THIS PROGRAM FINDS NO.OF +VE & -VE NO.S IN ARRAY THIS PROGRAM FINDS NO.OF +VE & -VE NO.S IN ARRAY

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 pos_neg.asm

pos_neg.asm

/*The data segment in the list finds whether it is a positive number or negative /*The data segment in the list finds whether it is a positive number or negative number 

number 

if msb is 1 it i

if msb is 1 it is negative otherwise considered as positive*/s negative otherwise considered as positive*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 00000000 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 333 3 DDB B ssttaarrtt: : xxoor r bbxx,,bbx x ;;iinniittiiaalliisse e rreessuulltt pointer  pointer  6 6 0000002 2 333 3 DD2 2 xxoor r ddxx,,ddxx 7 7 0000004 4 BB8 8 00000000s s mmoov v aaxx,,ddaattaa 8 8 0000007 7 88E E DD8 8 mmoov v ddss,,aaxx 9

9 0000009 B9 B1 1 005 5 990 0 990 0 mmoov v ccll,,ccoouunnt t ;;ddeeccllaarre e lleennggtth h oof f aarrrraayy 1

100 000000D D BBE E 00000000r r mmoov v ssii,,ooffffsseet t lliisstt 1

111 0000110 80 8B B 004 4 aaggaaiinn::mmoov v aaxx,,[[ssii] ] ;;ggeet t 11sst t nnoo.. 1

122 0000112 2 DD1 1 EE0 0 sshhl l aaxx,,0011h h ;;cchheecck k wwhheetthheer r mmssb b iis s 11 1

133 0000114 4 772 2 004 4 jjc c nneegga a ;;iif f 1 1 tthhe e nnoo..iis s --vvee 1

144 0000116 6 443 3 iinnc c bbx x ;;iif f 0 0 tthhe e nnoo..iis s ++vvee 1

155 0000117 7 EEB B 002 2 990 0 jjmmp p nneexxtt 16

16 001001A A 42 42 negnega:ia:inc nc dxdx 17

17 00001B 81B 83 3 C6 C6 002 2 nnexext:t:aadd dd ssi,i,002h 2h ;u;uppdtdte e ddaata ta ppoiointnter er  1

188 000011E E FFE E CC9 9 ddeec c ccl l ;;ddeeccrreemmeennt t lleennggtth h ccoouunntteer r  1

199 0000220 0 775 5 EEE E jjnnz z aaggaaiin n ;;rreeppeeaat t uunnttiilll l ffiinnaal l nnoo.. 2

200 0000222 2 CCC C iinnt t 0033 2

211 0000223 3 ccoodde e eenndds s ;;ssttoorre e rreessuulltt 22

22 2

233 0000000 0 ddaatta a sseeggmmeenntt 24

24 000000 00 A5A500 00 C0C00909 010159 59 B9B900 00 lislist t dw dw 0a0a50500h0h,0,0c0c00909h,h,01015959h,h,0b0b90900h0h 2 25 5 == 0000005 5 ccoouunnt t eeqqu u 0055hh 2 266 0000008 8 ddaatta a eennddss 2 277 eenndd ssttaarrtt Input:

Input: 0a500h,0c009h,0b900h,0159h0a500h,0c009h,0b900h,0159h

Output:

Output: no of positive nos :0159hno of positive nos :0159h no of

(14)

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 gcd.asm

gcd.asm

/*This program calculates the GCD of two numbers stored at data segment num1 /*This program calculates the GCD of two numbers stored at data segment num1 and num2

and num2

locations and g

locations and gives the result at thives the result at the e data segment gdata segment gcd offset address*/cd offset address*/

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000ss ssttaarrtt: : mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 BBE E 00000000r r mmoov v ssii,,ooffffsseet t nnuumm1 1 ;;ggeet t 11sst t nnoo.. 8

8 0000008 8 88B B 004 4 mmoov v aaxx,,[[ssii]] 9

9 000000A BA BE E 00000022r r mmoov v ssii,,ooffffsseet t nnuumm2 2 ;;ggeet t 22nnd d nnoo.. 1

100 000000D D 88B B 11C C mmoov v bbxx,,[[ssii]] 1

111 000000F F 33B B CC3 3 ccmmp p aaxx,,bbx x ;;ggeet t bbiig g nnoo,,aassddiivviiddeenndd 1

122 0000111 1 77F F 001 1 jjg g ggoo 1

133 0000113 3 993 3 bbaacck k : : xxcchhg g aaxx,,bbxx 1

144 0000114 4 22B B CC3 3 ggo o : : ssuub b aaxx,,bbx x ;;ggeet t ggccd d uussiinngg repeated repeated 1 155 0000116 6 33B B CC3 3 ccmmp p aaxx,,bbxx 1 166 0000118 8 77F F FFA A jjg g ggo o ;;ddiivviissiioonn 1 177 000011A A 77C C FF7 7 jjl l bbaacckk 1

188 000011C BC BE E 00000044r r mmoov v ssii,,ooffffsseet t ggccd d ;;ssttoorre e rreessuulltt 1 199 000011F F 889 9 004 4 mmoov v [[ssii]],,aaxx 20 20 2 211 0000221 1 CCC C iinnt t 003 3 ;;ssttoopp 22 22 2 233 0000222 2 ccoodde e eennddss 24 24 2 255 0000000 0 ddaatta a sseeggmmeenntt 2

266 0000000 0 0000118 8 nnuumm1 1 ddw w 00001188h h ;;tthhe e nnoo..s s iin n ddaattaa segment segment 2 277 0000002 02 000006 6 nunumm2 2 ddw w 00000066hh 2 288 0000004 4 ??????? ? ggccd d ddw w ?? 2 299 0000006 6 ddaatta a eennddss 30 30 31

31 end end startstart

Input :

Input : num1 is 0018hnum1 is 0018h num2 is 0006h num2 is 0006h

Output:

(15)

THIS PROGRAM FINDS NO.OF 0's AND 1's IN A 16-BIT NUMBER THIS PROGRAM FINDS NO.OF 0's AND 1's IN A 16-BIT NUMBER

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 zer_one.asm

zer_one.asm

/*The data segment in the num finds no. of 1’s and no. of 0’s by converting the given /*The data segment in the num finds no. of 1’s and no. of 0’s by converting the given number into binary */

number into binary */

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 00000000 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 30 33 3 DDB B ssttaarrtt: : xxoor r bbxx,,bbx x ;;cclleeaar r rreessuullt t ccoouunntteerrss 6 6 0000002 2 333 3 DD2 2 xxoor r ddxx,,ddxx 7 7 0000004 4 BB8 8 00000000s s mmoov v aaxx,,ddaattaa 8 8 0000007 7 88E E DD8 8 mmoov v ddss,,aaxx 9

9 000009 09 B1 B1 10 10 90 90 90 90 momov v clcl,c,couount nt ;d;dececlalare re nono. . bibit t cocoununtt 1

100 000000D D AA1 1 00000000r r momov v aaxx,,nnuum m ;;ggeet t tthhe e nnoo.. 1

111 0000110 D0 D1 1 CC0 0 aaggaaiinn::rrool l aaxx,,0011h h ;;ffiinndds s mmssb b iis s 0 0 oor r 11 1

122 0000112 2 772 2 004 4 jjc c oonnees s ;;iif f 0 0 iinnccrreemmeennt t 00s s ccoouunntt 1

133 0000114 4 443 3 iinnc c bbx x ;;ootthheerrwwiisse e 11s s ccoouunntt 1

144 0000115 5 EEB B 002 2 990 0 jjmp mp nneexxt t ;;ppeerrffoorrm m tthhiis s uunnttil il tthhee 1st bit 1st bit 1 155 0000118 8 442 2 oonneess::iinnc c ddxx 1 166 0000119 9 FFE E CC9 9 nneexxtt::ddeec c ccll 1 177 000011B B 775 5 FF3 3 jjnnz z aaggaaiinn 1 188 000011D D CCC C iinnt t 003 3 ;;ssttoopp 1 19 09 00011E E ccoodde e eennddss 20 20 2 21 01 000000 0 ddaatta a sseeggmmeenntt 2

222 0000000 0 DD77559 9 nnuum m ddw w 00dd775599h h ;;nnoo. . iin n ddaatta a sseeggmmeenntt 2 23 3 == 0000110 0 ccoouunnt t eeqqu u 1100hh 2 24 04 000002 2 ddaatta a eennddss 2 255 eenndd ssttaarrtt Input :

Input : num is 0d759hnum is 0d759h

Output:

Output: number of 0’s :06number of 0’s :06 Number of 1’s:0A Number of 1’s:0A

(16)

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 prime.asm

prime.asm

/*The data segment in num is prime the same data will be displayed at res otherwise /*The data segment in num is prime the same data will be displayed at res otherwise

zero will be displayed*/ zero will be displayed*/

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 0000000s 0s stastart: rt: mov mov ax,ax,datdataa 6 6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7 7 0000005 5 BBE E 00000000r r mmoov v ssii,,ooffffsseet t nnuumm 8 8 0000008 8 88B B 11C C mmoov v bbxx,,[[ssii] ] ;;ggeet t tthhe e nnuummbbeer  r   9

9 00000A 0A 8B 8B 04 04 loloopop1 1 :m:mov ov axax,[,[sisi] ] ;if ;if nono.is .is 11 1 100 000000C C BB9 9 0000001 1 mmoov v ccxx,,00000011hh 11 11 1 122 000000F F BBA A 0000000 0 mmoov v ddxx,,00000000h h ;;nnoo..iis s pprriimmee 1 13 03 000112 2 44B B ddeec c bbxx 1 144 0000113 3 33B B DD9 9 ccmmp p bbxx,,ccxx 1

155 0000115 5 774 4 00B B jjz z aahheeaadd2 2 ;;ootthheerrwwiisse e ppeerrffoorrm m ddiivv 16

16 000017 17 F7 F7 F3 F3 didiv v bx bx ;if ;if reremamainindeder r 0 0 ththenen no.is not prime no.is not prime 1

177 0000119 89 83 3 FFA A 000 0 ccmmp p ddxx,,00000000hh 1

188 000011C C 774 4 002 2 jjz z aahheeaadd11 1

199 000011E E EEB B EEA A jjmmp p lloooopp1 1 ;;nno o rreemmaaiinnddeer r nnoo. . iiss prime

prime 20

20 0020020 0 8B 8B C2 C2 aheaheadad1: 1: mov mov ax,ax,dx dx ;pe;perforform rm div div frofrom m -1t-1to1o1 21

21 22

22 0022 0022 BE BE 0002r 0002r aheaahead2: d2: mov mov si,ofsi,offset fset resres 2 233 0000225 5 889 9 004 4 mmoov v [[ssii]],,aaxx 24 24 2 255 0000227 7 CCC C iinnt t 003 3 ;;ssttoopp 26 26 2 277 0000228 8 ccoodde e eennddss 28 28 2 299 0000000 0 ddaatta a sseeggmmeenntt 3

300 0000000 0 0000112 2 nunum m ddw w 00001122h h ;;ggiivve e tthhe e iinnppuut t nnoo.. 3

311 0000002 2 ??????? ? rrees s ddw w ? ? ;;ssttoorre e rreessuullt t hheerree 3

322 0000004 4 ddaatta a eennddss 33

33 34

34 end end startstart

Input :

Input : num=0012hnum=0012h

Output:

(17)

THIS PROGRAM SOLVES THE EQUATION (P+(Q*R)/S) THIS PROGRAM SOLVES THE EQUATION (P+(Q*R)/S)

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 equ.asm

equ.asm

/*The data segment in the P,Q,R and S substituted in the equation (P+(Q*R)/S) /*The data segment in the P,Q,R and S substituted in the equation (P+(Q*R)/S)

and the calculated result will be stored in res*/ and the calculated result will be stored in res*/

1

1 aassssuumme e ccss:: ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B0 B8 8 00000000s s ssttaarrtt: : mmoov v aaxx,,ddaattaa 6 6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7 7 0000005 5 BB8 8 0000112 2 momov v aaxx,,q q ;;ggeet t nnoo..qq 8 8 0000008 8 BBB B 0000005 5 990 0 mmoov v bbxx,,r  r   9

9 000000C C FF7 7 EE3 3 mmuul l bbx x ;;mmuullttiipplly y wwiitth h r  r   1

100 000000E E BB9 9 0000009 9 990 0 mmoov v ccxx,,ss 1

111 0000112 2 FF7 7 FF1 1 diiv dv ccx x ;;ddiiv v tthhe e rrees s bby y ss 1

122 0000114 4 BBA A 0000223 3 990 0 mmoov v ddxx,,p p ;;aaddd d iit t tto o pp 1

133 0000118 8 003 3 CC2 2 aaddd d aaxx,,ddxx 1

144 000011A BA BF F 00000000r r mmoov v ddii,,ooffffsseet t rrees s ;;ssttoorre e tthhe e rreessuulltt 1 155 000011D D 889 9 005 5 mmoov v [[ddii]],,aaxx 1 166 000011F F CCC C iinnt t 0033 1 177 0000220 0 ccoodde e eennddss 18 18 1

199 0000000 0 ddaatta a sseeggmmeennt t ;;nnoo..s s iin n ddaattaasseeggmmeenntt 20 20 2 21 1 == 0000223 3 p ep eqqu u 00002233hh 2 22 2 == 0000112 2 q eq eqqu u 00001122hh 2 23 3 == 0000005 5 r er eqqu u 00000055hh 2 24 4 == 0000009 9 s es eqqu u 00000099hh 2

255 0000000 0 ??????? ? rrees s ddw w ? ? ;;rreessuullt t iin n ddaatta a sseeggmmeenntt 26

26 2

277 0000002 2 ddaatta a eennddss 2

28 8 eennd d ssttaarrt t ;;ssttoopp

Input :

Input : p=0023h p=0023h , , q=0012h q=0012h , , r= r= 0005h 0005h , , s=0009hs=0009h

Output:

(18)

3.LOGICAL OPERATIONS

3.LOGICAL OPERATIONS

Conversion of ASCII no. to packed

Conversion of ASCII no. to packed BCD

BCD

Conversion of packed BCD no. to

Conversion of packed BCD no. to ASCII

ASCII

(19)

THIS PROGRAM CONVERTS ASCII NOS INTO

THIS PROGRAM CONVERTS ASCII NOS INTO PACKED BCDPACKED BCD

T

Tuurrbbo o AAsssseemmbblleer r VVeerrssiioon n 22..551 1 1100//1111//007 7 1144::1111::442 2 PPaagge e 11 equa.asm

equa.asm

/*The ASCII no’s directly store in the registers bl and al is converted into packed /*The ASCII no’s directly store in the registers bl and al is converted into packed BCD and the result will be stored in the accumulator */

BCD and the result will be stored in the accumulator */

1

1 aassssuumme e ccss::ccooddee 2

2 00000000 ccoodde e sseeggmmeenntt 3

3 0000000 0 BB3 3 332 2 ssttaarrtt: : mmoov v bbll,,''22'' ;;GGEET T 11STST ASCII no.ASCII no.

4

4 0000002 2 BB0 0 334 4 mmoov v aall,,''44'' ;;ggeet t 22ndnd ASCII no.ASCII no.

5

5 0000004 84 80 0 EE3 3 00F F aannd d bbll,,00ffhh ;;mmaassk k tthhe e uuppppeer r nniibbbbllee 6

6 0000007 7 224 4 00FF aannd d aall,,00ffhh ;;oof f 2 2 AASSCCIII I nnooss 7

7 0000009 9 BB1 1 0044 mmoov v ccll,,0044hh ;;ppaacck k tthhe e 2 2 nnooss.. 8

8 000000B B DD2 2 CC33 rrool l bbll,,ccll 9

9 000000D D 00A A CC3 3 oor r aall,,bbll ;;BBCCD D rreessuullt t iin n rreegg..AALL.. 1 100 000000F F CCCC iinnt t 0033hh 1 111 00001100 ccoodde e eennddss 1 122 eenndd ssttaarrtt Input: Input: bl=02hbl=02h al=04h al=04h Output:

(20)

THIS PROGRAM CONVERTS PACKED BCD TO I

THIS PROGRAM CONVERTS PACKED BCD TO ITS EQUIVALENT ASCII NO.TS EQUIVALENT ASCII NO.

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 bcd_asc.asm

bcd_asc.asm

/*The packed BCD number 0095h is converted into its equivalent ASCII number and /*The packed BCD number 0095h is converted into its equivalent ASCII number and result will stored in res1 and res2*/

result will stored in res1 and res2*/

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000s s ssttaarrtt: : mmoov v aaxx,,ddaattaa 6 6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7 7 0000005 5 332 2 EE4 4 xxoor r aahh,,aahh 8 8 0000007 7 BB0 0 995 5 990 0 momov v aall,,bbccd d ;;ggeet t tthhe e nnoo.. 9

9 000000A A 88A A EE0 0 momov v aahh,,aal l ;;ccoonnvveerrt t iinntto o uunnppaacckkeed d bbccdd 1

100 000000C C 224 4 00F F aannd d aall,,00ffhh 1

111 000000E E 00C C 330 0 or or aall,,3300h h ;;ffiinnd d rreess1 1 aasscciiii 1 122 0000110 0 880 0 EE4 4 FF0 0 aannd d aahh,,00ff00hh 1 133 0000113 3 BB1 1 004 4 mmoov v ccll,,0044hh 1 144 0000115 5 DD2 2 CC4 4 rrool l aahh,,ccll 1

155 0000117 7 880 0 CCC C 330 0 anand d aahh,,3300h h ;;ffiinnd d rreess2 2 aasscciiii 1

166 000011A A AA2 2 00000000r r mmoov v rreess11,,aal ;sl ;sttoorre e rreessuulltt 17

17 00001D 1D 88 88 26 26 00000101r r momov v reres2s2,a,ahh 1 18 08 000221 1 CCC C iinnt t 0033 1 199 0000222 2 ccoodde e eennddss 20 20 2 211 0000000 0 ddaatta a sseeggmmeenntt 22

22 = = 0095 0095 bcd bcd equ equ 0095h 0095h ;BCD ;BCD INPUTINPUT 2

233 0000000 0 ??? ? rreess1 1 ddb b ? ? ;;rreessuullt t ddiissppllaayy 2 244 0000001 1 ??? ? rreess2 2 ddb b ?? 2 255 0000002 2 ddaatta a eennddss 2 26 6 eennd d ssttaarrtt Input : Input : 0095h0095h Output:

Output: ASCII value of 9 is 39hASCII value of 9 is 39h  ASCII

(21)

THIS PROGRAM IS FOR THE

THIS PROGRAM IS FOR THE CONVERSION OF BCD TO BINARYCONVERSION OF BCD TO BINARY

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 bcd2bin.asm

bcd2bin.asm

/*The data segment in the bcd_input is converted into binary value and result will be /*The data segment in the bcd_input is converted into binary value and result will be

displayed in bin_value*/ displayed in bin_value*/

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa,,ssss::ssttaacckk__sseegg 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 0000000s 0s stastart:rt:mov mov ax,ax,datdataa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 BB8 8 00000000s s mmoov v aaxx,,ssttaacckk__sseegg 8

8 0000008 8 88E E DD0 0 mmoov v ssss,,aaxx 9

9 000000A A BB8 8 0000000 0 mmoov v aaxx,,00000000hh 1

100 000000D D BBC C 0000CC88r r lleea a sspp,,ttoopp__ssttaacckk 1

111 0000110 0 AA0 0 00000000r r momov v aall,,bbccdd__ininppuut t ;;ggeet t bbccd d ininppuutt 1

122 0000113 3 EE8 8 0000004 4 ccaalll l bbccdd__bbiin n ;;ccaalll l bbiin n pprroocceedduurree 1

133 0000116 6 AA2 2 00000011r r momov v bbiinn__vvaalluuee,a ,a ;;ssttoorre e rreessuultltll 1

144 0000119 9 CCC C iinnt t 003 3 ;;ssttoopp 1

155 000011A A bbccdd__bbiin n pprrooc c nneeaar r ;;ssaavve e mmaaiin n pprrooggrraam m ssttaattuuss 1

16 06 00011A A 99C C ppuusshhf  f   1

177 000011B B 553 3 ppuussh h bbxx 1

188 000011C C 551 1 ppuussh h ccx x ;;ccoonnvveerrt t ppaacckkeed d bbccdd input input 1 199 000011D D 88A A DD8 8 mmoov v bbll,,aall 2 200 000011F F 880 0 EE3 3 00F F aannd d bbll,,00ffh h ;;uunnppaacckkeed d bbccdd 2 211 0000222 2 224 4 FF0 0 aannd d aall,,00ff00hh 2 222 0000224 4 BB1 1 004 4 mmoov v ccll,,0044hh 2

233 0000226 6 DD2 2 CC8 8 rroor r aall,,ccl l ;;mmuullttiipplly y eeaacch h ddiiggiit t bbyy its pos. its pos. 2 244 0000228 8 BB7 7 00A A mmoov v bbhh,,00aahh 2 255 000022A A FF6 6 EE7 7 mumul l bbhh 2

266 000022C C 002 2 CC3 3 aaddd d aall,,bbl l ;;aaddd d tthhe e rreessuullttaannttss 2

27 07 00022E E 559 9 ppoop p ccxx 2

288 000022F F 55B B ppoop p bbx x ;;bbaacck k tto o mmaaiin n pprrooggrraamm 2 29 09 000330 0 99D D ppooppf  f   3 30 00 000331 1 CC3 3 rreett 3 311 0000332 2 bbccdd__bbiin n eennddpp 3 333 0000332 2 ccoodde e eennddss 3 355 0000000 0 ddaatta a sseeggmmeenntt 3

366 0000000 0 111 1 bbccdd__iinnppuut t ddb b 117 7 ;;bbccd d iinnppuut t ddaatta a sseeggmmeenntt 3

377 0000001 1 ??? ? bbiinn__vvaalluue e ddb b ? ? ;;rreessuullt t aarreeaa 3

388 0000002 2 ddaatta a eennddss 39

39 4

400 0000000 0 ssttaacckk__sseeg g sseeggmmeennt t ;;rreesseerrvve e ssttaacck k aarreeaa 4

411 0000000 0 6644**((00000000) ) ddw w 11000 0 dduupp((00)) 4

422 0000CC8 8 ttoopp__ssttaacck k llaabbeel l wwoorrdd 4

433 0000CC8 8 ssttaacckk__sseeg g eennddss 4

44 4 eennd d ssttaarrtt

Input:

(22)

4.STRING OPERATIONS AND

4.STRING OPERATIONS AND

INSTRUCTION PREFIX

INSTRUCTION PREFIX

String transfer 

String transfer 

Ascending order 

Ascending order 

Inserting character and spell checking

Inserting character and spell checking

Deleting character 

Deleting character 

(23)

THIS PROGRAM TRANSFERS A STRING OF CHARACTERS FROM THIS PROGRAM TRANSFERS A STRING OF CHARACTERS FROM

ONE LOCATION TO ANOTHER ONE LOCATION TO ANOTHER

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 trfr_str.asm

trfr_str.asm

/*The data segme

/*The data segment in the first_string is transferred to nnt in the first_string is transferred to new location a ew location a and in betweenand in between it leaves 100 locations*/

it leaves 100 locations*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa,,eess::ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000ss ssttaarrtt::mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 88E E CC0 0 mmoov v eess,,aaxx 8

8 0000007 7 BBE E 00000000rr lleea a ssii,,ffiirrsstt__ssttrriinng g ;;ddeeccllaarre e ssoouurrcce e && destination destination 9

9 000000A A BBF F 00006688rr lleea a ddii,,nneeww__llooc c ;;ppooiinntteerrss 1

100 000000D D BB9 9 000011EE mmoov v ccxx,,330 0 ;;ssppeecciiffy y ssttrriinng g lleennggtthh 1

111 0000110 0 FFC C cclld d ;;mmoovve e tthhe e ssttrriinng g ffrroomm source to destination source to destination 1 122 0000111 1 FF33> > AA4 4 rreep p mmoovvssbb 1 13 03 000113 3 CCC C iinnt t 0033 1 144 0000114 4 ccoodde e eenndds s ;;ssttoopp 15 15 1 166 0000000 0 ddaatta a sseeggmmeenntt 17

17 000000 72 00 72 61 61 76 76 69 69 firsfirst_t_ststriring ng db db 'r'ravavi'i' 1

188 0000004 4 6644**((????) ) ddb b 11000 0 dduupp((??) ) ; ; lleeaavve e 110000

locations locations 1

199 0000668 8 11EE**((0000) ) nneeww__llooc c ddbb 330 0 dduupp((00) ) ;;llooccaattiioonns s ffoor  r   destination destination 2 200 0000886 6 ddaatta a eennddss 2 21 1 eennd d ssttaarrtt Input :

Input : String is ‘ravi’ at 0B7F:0000String is ‘ravi’ at 0B7F:0000

Output:

(24)

BUBBLE SORT BUBBLE SORT

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 bubsrt.asm

bubsrt.asm

/*The data segment in the list are arranged in ascending order */ /*The data segment in the list are arranged in ascending order */

1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa,,eess::ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 0 BB8 8 00000000s s ssttaarrtt: : mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 000005 05 B2 B2 04 04 90 90 90 90 momov v dldl,c,couountnt-1 -1 ;i;initnitiaialislise e cocoununteter r  8

8 000009 09 8A 8A CA CA agagaiain1n1: : momov v clcl,d,dll 9

9 00000B 0B BBE E 0000000r 0r momov v ssi,i,ofoffsfset et lilisst t ;g;geet t ofoffsfset et aaddddreressss 10

10 000000E E 8A 8A 04 04 agaagain2in2: : mov mov al,al,[si[si] ] ;ge;getsmtsmallallno.no.in1in1stlstlococatiationon 1

111 0000110 0 33A A 444 4 001 1 ccmmp p aall,,[[ssii++11]] 12

12 000013 13 77 77 05 05 jb jb ahaheaead d ;com;compapareres s tiltill l ththe e enend d of of  array

array 1

133 0000115 5 886 6 444 4 001 1 xxcchhg g [[ssii++11]],,aall 14

14 0000118 8 886 6 004 4 xxchchg g [s[si]i],a,all 1

155 00001A 83 1A 83 C6 C6 001 1 aaheheadad: : adadd d ssi,i,001 1 ;bri;bring ng ssmamall ll nno.o.s s ininto to 11sstt location

location 16

16 1

177 000011D D EE2 2 EEF F lloooop p aaggaaiinn2 2 ;;iin n eeaacch h llooccaattiioonn 1

188 000011F F FFE E CCA A ddeec c ddll 1

199 0000221 1 775 5 EE6 6 jjnnz z aaggaaiinn1 1 ;;ppeerrffoorrm m uunnttiilll l nnoo..s s aarree arrange in order  arrange in order  20 20 2 211 0000223 3 CCC C iinnt t 0033h h ; ; ssttoopp 22 22 2 233 0000224 4 ccoodde e eennddss 24 24 2 255 0000000 0 ddaatta a sseeggmmeenntt 2 266 0000000 34 0 34 550 0 778 8 881 1 112 2 lliisst t ddb b 3344hh,,5500hh,,7788hh,,8811hh,,1122hh 2 27 7 = = 0000005 5 ccoouunnt t eeqqu u 0055hh 2 28 08 000005 5 ddaatta a eennddss 29 29 3 30 0 eennd d ssttaarrtt Input : Input : 34h,50h,78h,81h,12h34h,50h,78h,81h,12h Output: Output: 12h,34h,50h,78h,81h12h,34h,50h,78h,81h

(25)

THIS PROGRAM INSERTS A MISSED CHARACTER IN A WORD / CORRECTS A THIS PROGRAM INSERTS A MISSED CHARACTER IN A WORD / CORRECTS A

MISSPELT WORD MISSPELT WORD

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 miscr.asm

miscr.asm

/*The data segment in the array1 is compared with data segment array and correct /*The data segment in the array1 is compared with data segment array and correct the

the misspelt misspelt word*/word*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 00000000s s ssttaarrtt::mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 88E E CC0 0 mmoov v eess,,aaxx 8

8 0000007 B7 BE E 00000000r r lleea a ssii,,aarrrraay y ;;ggeet t tthhe e rriigghht t wwoorrdd 9

9 000000A A BB9 9 0000005 5 990 0 mmoov v ccxx,,nnuumm 1

100 000000E BE BF F 00000055r r lleea a ddii,,aarrrraayy1 1 ;;ccoommppaarre e tthhe e rriigghht t wwoorrdd 1

111 0000111 1 FFC C ll22: : cclld d ;;tthhe e wwoorrd d tto o bbe e ccoorrrreecctteedd 1

122 0000112 2 FF33> > AA6 6 rreeppe e ccmmppssbb 1

133 0000114 4 EE3 3 005 5 jjccxxz z ll11 1

144 0000116 6 EE8 8 0000003 3 ccaalll l pprroocceedduurre e ;;ccaalll l pprroocceedduurree 1

155 0000119 9 EEB B FF6 6 jjmmp p ll2 2 ;;iif f mmiissmmaattcch h ffoouunndd 1

166 000011B B CCC C ll11: : iinnt t 0033hh 17

17 001001C C 57 57 proprocedcedureure: : puspush h didi 1

188 000011D D 551 1 ppuussh h ccx x ;;iinnsseerrt t tthhe e cchhaarraacctteer r  1 199 000011E E 556 6 ppuussh h ssii 2 200 000011F F 44E E ddeec c ssii 2 211 0000220 0 44F F ddeec c ddii 2 222 0000221 1 88A A 004 4 mmoov v aall,,[[ssii]] 2 233 0000223 3 886 6 005 5 ll33: : xxcchhg g aall,,[[ddii]] 2 244 0000225 5 447 7 iinnc c ddii 2 255 0000226 6 449 9 ddeec c ccxx 2 266 0000227 7 775 5 FFA A jjnnz z ll33 2

277 0000229 9 888 8 005 5 mmoov v bbyytte e ppttrr[[ddii]],,aal l ;;mmaakke e ffiinnaal l bbyytte e 00 2 28 08 00022B B 55E E ppoop p ssii 2 29 09 00022C C 559 9 ppoop p ccxx 3 30 00 00022D D 55F F ppoop p ddii 3 31 01 00022E E CC3 3 rreett 32 32 3 333 000022F F ccoodde e eennddss 34 34 3 355 0000000 0 ddaatta a sseeggmmeenntt 3 366 0000000 0 66B B 669 9 772 2 661 1 66E E aarrrraay y ddb b ''kkiirraann'' 3

37 7 = = 0000005 5 nunum m eeqqu u (($$--aarrrraayy)) 38

38 000005 05 6E 6E 6B 6B 72 72 69 69 ararrarayy1 1 db db 'n'nkrkri'i' 3

399 0000009 9 ddaatta a eennddss 40

40 4

41 1 eennd d ssttaarrt t ; ; ssttoopp

Input:

(26)

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 del_char.asm

del_char.asm

/*The data segment in the

/*The data segment in the array1 and the specified character in array1 and the specified character in accumulator alaccumulator al will be deleted*/

will be deleted*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa,,eess::ddaattaa 2 2 3 3 00000000 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B0 B8 8 00000000s s ssttaarrtt: : mmoov v aaxx,,ddaattaa 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 88E E CC0 0 mmoov v eess,,aaxx 8

8 0000007 7 BBE E 00000000r r lleea a ssi,i,aarrrraayy1 1 ;;ggeet t tthhe e ssttririnng g aaddddrreessss 9

9 000000A A BB9 9 0000007 7 990 0 mmoov v ccxx,,nnuumm 1

100 000000E E BB0 0 665 5 mmoov v aall,,''ee' ' ;;ggeet t tthhe e cchhaarraacctteer r tto o bbee deleted

deleted 1

111 0000110 30 3A A 004 4 ll22::ccmmp p aall,,[[ssii] ] ;;ffiinnd d tthhe e cchhaarraacctteer r tto o bbee deleted

deleted 1

12 02 000112 2 775 5 006 6 jjnne e ll11 1

133 0000114 4 EE8 8 0000008 8 ccaalll l pprroocceedduurre e ;;ccaalll l tthhe e ddeelleettee procedure procedure 1 144 0000117 7 449 9 ddeec c ccxx 1 15 05 000118 8 775 5 FF6 6 jjnnz z ll22 1 166 000011A A 446 6 ll11::iinnc c ssii 1 177 000011B B 449 9 ddeec c ccxx 1 188 000011C C 775 5 FF2 2 jjnnz z ll2 2 ;;ssttoopp 1 199 000011E E CCC C iinnt t 0033 2

200 000011F F 5511 prrop occeedduurree::ppuussh h ccxx 2

211 0000220 0 556 6 ppuussh h ssii 2

222 0000221 1 88B B FFE E momov v ddii,,ssi i ;;iinniittiiaalliisse e ppooiinntteerrss 2

233 0000223 3 449 9 ddeec c ccxx 2

244 0000224 4 446 6 iinnc c ssi i ;;mmoovve e tthhe e ssttrriinng g 1 1 bbyyttee forth forth 2 255 0000225 5 FFC C cclldd 2 266 0000226 6 FF33> > rreepp 2 277 0000227 7 AA4 4 mmoovvssbb 2

288 0000228 C8 C6 6 005 5 000 0 mmoov v bbyytte e ppttrr[[ddii]],,0000h ;h ;mmaakke e ffiinnaal l bbyytte e 00 2 299 000022B B 55E E ppoop p ssii 3 300 000022C C 559 9 ppoop p ccxx 3 311 000022D D CC3 3 rreett 3

322 000022E E ccoodde e eenndds s ;;bbaacck k tto o mmaaiin n pprrooggrraamm 33

33 34

34 0000 0000 data data segmentsegment 35

35 0000000 65 0 65 6C 6C 65 65 6D 6D 65 65 6E6E 74 a74 arrarray1 y1 db db 'e'elemlementent' ' ;st;stringring 3

36 6 == 0000007 7 nunum m eeqqu u (($$--aarrrraayy11)) 3

377 0000007 7 ddaatta a eennddss 3

388 eenndd ssttaarrtt

Input :

(27)

THIS PROGRAM COMPARES 2 STRINGS &

THIS PROGRAM COMPARES 2 STRINGS & DISPLAY 0 IF NOT DISPLAY 0 IF NOT EQUALEQUAL AND DISPLAY 00 FF EQUAL

AND DISPLAY 00 FF EQUAL

T

Tururbo bo AsAssseembmbleler r VVerersision on 22.5.511 cmpr2str.asm

cmpr2str.asm

/* The string stored in the second_string is if equal to the string

/* The string stored in the second_string is if equal to the string in first_stringin first_string then display 00 FF other

then display 00 FF other wise 00*/wise 00*/ 1

1 aassssuumme e ccss: : ccooddee,,ddss: : ddaattaa,,eess::ddaattaa 2 2 3 3 0000000 0 ccoodde e sseeggmmeenntt 4 4 5

5 0000000 B8 0 B8 00000000ss ststarart: t: momov v aaxx,d,datata a ;i;innititiaialilise se ththe e sseegmgmenentsts needed

needed 6

6 0000003 3 88E E DD8 8 mmoov v ddss,,aaxx 7

7 0000005 5 88E E CC0 0 mmoov v eess,,aax x ;;ccoommppaarre e 2 2 ssttrriinnggss 8

8 0000007 7 BBE E 00000000r r lleea a ssii,,ffiirrsstt__ssttrriinngg 9

9 000000A A BBF F 000000EEr r lleea a ddii,,sseeccoonndd__ssttrriinngg 10

10 00000D 0D B9 B9 00000E 0E 90 90 mov mov cxcx,s,strtr_l_lenengtgthh 1

11 01 000111 1 FFC C cclldd 1

122 0000112 2 FF33> > AA6 6 rreeppe e ccmmppssbb 1

133 0000114 4 775 5 003 3 jjnne e ssoouunndd__aallaarrmm 1

144 0000116 6 EEB B 005 5 990 0 jjmmp p ook k ;;ddiissppllaay y 0 0 iif f nnoot t eeqquuaall 1

155 0000119 9 ssoouunndd__aallaarrmm:: 1 166 0000119 9 BB8 8 0000000 0 mmoov v aaxx,,00000000hh 1 177 000011C C CCC C iinnt t 0033 18 18 1 19 09 00011D D ookk:: 2

200 000011D D BB8 8 0000FFF F mmoov v aaxx,,0000ffffh h ;;ddiissppllaay y 000 0 if if eeqquuaall 2 211 0000220 0 CCC C iinnt t 0033hh 2 222 00002211 ccoodde e eennddss 23 23 2 24 04 0000000 ddaatta a sseeggmmeenntt 25

25 0000000 0 6D 6D 69 69 63 63 72 72 6F 6F 7070 72+ 72+ firsfirst_st_strintring dg db'mb'micricroproprococessessor'or';de;declaclare2re2 strings strings 2

26 6 66F F 663 3 665 5 773 3 773 3 66FF 7722 2

27 7 == 000000E E ssttrr__lleennggtthh eeqquu(($$ffiirrsstt__ssttrriinngg));;ssppeecciiffyy length of string length of string 28

28 000000E E 6D 6D 69 69 63 63 72 72 6F 6F 7070 72+ 72+ seseconcond_sd_strintring g db db 'mi'microcroproprocescessorsor'' 2 29 9 66F F 663 3 665 5 773 3 773 3 66FF 7722 3 30 00 00011C C ddaatta a eennddss 3 311 eenndd ssttaarrtt Input:

Input: first string’ MICROPROCESSOR'first string’ MICROPROCESSOR' second string 'MICROPROCESSOR' second string 'MICROPROCESSOR'

Output:

(28)

6.DOS/BIOS PROGRAMMING

6.DOS/BIOS PROGRAMMING

Reading keyboard (Buffered with and with out

Reading keyboard (Buffered with and with out

echo) - Display characters

(29)

THIS PROGRAM READS CHARACTER FROM KEY BOARD AND

THIS PROGRAM READS CHARACTER FROM KEY BOARD AND DISPLAYS THEDISPLAYS THE PRESSED KEY

PRESSED KEY

T

Tuurrbbo o AAsssseemmbblleer r VVeerrssiioon n 22..551 1 1100//1111//007 7 1144::0099::115 5 PPaagge e 11 cons.asm

cons.asm

/*The data segment in the mesg1rreads the character from the keyboard and the /*The data segment in the mesg1rreads the character from the keyboard and the same character displayed on the mesg2*/

same character displayed on the mesg2*/ 1

1 asassusume me cscs:c:codode,e,dsds:d:datataa 2

2 00000000 ccoodde e sseeggmmeenntt 3

3 0000000 B0 B8 8 00000000s s ssttaarrtt::mmoov v aaxx,,ddaattaa ;;iinniittiiaalliizze e ddaatta a sseeggmmeenntt 4

4 0000003 3 88E E D8D8 mmoov v ddss,,aaxx 5

5 0000005 5 BB4 4 009 9 mmoov v aahh,,0099hh ;;pprroommppt t ffoor r kkeey y pprreessss 6

6 0000007 7 BBA A 00000000rr mmoov v ddxx,,ooffffsseet t mmeessgg11 7 0

7 00000A A CCD D 2211 iinnt t 2211hh 8

8 000000C C BB4 4 001 1 mmoov v aahh,,0011hh ;;rreeaad d cchhaarraacctteer  r   9 0

9 00000E E CCD D 2211 iinnt t 2211hh 1

100 0000110 0 AA2 2 000011CCr r mmoov v cchhaarr,,aall 1

111 0000113 3 BBA A 22000000 mmoov v ddxx,,22000000h h ;;wwaaiit t ffoor r ssoomme e ttiimmee 1 122 0000116 B6 B9 9 FFFFFFFF aaggaaiinn11::mmoov v ccxx,,00ffffffffhh 1 13 03 000119 9 9900 aaggaaiinn22::nnoopp 1 144 000011AA 9900 nnoopp 1 155 000011B B 4499 ddeec c ccxx 1 16 06 00011C C 775 5 FFBB jjnnz z aaggaaiinn22 1 177 000011E E 44A A ddeec c ddxx 1 188 000011F F 775 5 FF55 jjnnz z aaggaaiinn11 1 199 0000221 1 BB4 4 0099 mmoov v aahh,,0099hh ddiissppllaay y mmssgg22 &character  &character  2

200 0000223 3 BBA A 000000EErr mmoov v ddxx,,ooffffsseet t mmeessgg22 2 211 0000226 6 CCD D 2121 iinnt t 2211hh 2 222 0000228 8 BB4 4 0022 mmoov v aahh,,0022hh 2 233 000022A A 88A A 116 6 000011CCrr mmoov v ddll,,cchhaar  r   2 24 04 00022E E CCD D 221 1 iinnt t 2211hh 2 255 0000330 0 BB4 4 44C C mmoov v aahh,,44cchh 2 266 0000332 2 CCD D 2121 iinnt t 2211hh 2 277 0000334 4 ccooddee eennddss 2 288 00000000 ddaattaa sseeggmmeenntt 2

299 0000000 0 774 4 779 9 770 0 665 5 220 0 6611 66EE+ + mmeessgg1 1 ddb b ''tytyppe e aanny y kkeeyy::$$'';;msmsggs s in dain dattaa seg.

seg. 3

30 0 779 9 220 0 66B B 665 5 779 9 33AA 2244 3

311 000000E E 774 4 779 9 770 0 665 5 664 4 2200 66BB++ memessgg2 2 ddb b ''ttyyppeed kd key ey iiss::$$'' 3 32 2 665 5 779 9 220 0 669 9 773 3 33AA 2244 3 333 000011CC 0000 cchhaarr ddbb 00 3 344 000011DD ddaattaa eennddss 3 355 eenndd ssttaarrtt Input:

Input: ‘Type any key’: u‘Type any key’: u

Output:

(30)

II.INTERFACING

II.INTERFACING

(31)

1.8259-INTERRUPT CONTROLLER : GENERATE AN INTERRUPT

1.8259-INTERRUPT CONTROLLER : GENERATE AN INTERRUPT

USING 8259 INTERRUPT CONTROLLER

USING 8259 INTERRUPT CONTROLLER

AIM: AIM:

a)

a) To dTo dispisplay tlay the phe pulsulse coe countunter.er. b)

b) To deTo derivrive the fe the freqrequenuency cocy countunter.er.

APPARATUS: APPARATUS:

1.

1. ESA ESA 86/86/88-88-2 Mi2 Microcroproprocescessor ksor kit.it. 2.

2. FuFuncnctition on gegeneneraratotor.r. 3.

3. CoConnnnecectinting g wiwireres.s.

THEORY: THEORY:

The

The Processor Processor 8085 h8085 had five ad five hardware intehardware interrupt pins. rrupt pins. Out of Out of these fivethese five interrupt pins, four pins were allotted fixed vector addresses but the pin INTR was interrupt pins, four pins were allotted fixed vector addresses but the pin INTR was not allotted any vector address, rather

not allotted any vector address, rather an externalan external

Device was supposed to hand over the type of the interrupt to the microprocessor. Device was supposed to hand over the type of the interrupt to the microprocessor. The microprocessor then gets this type and derives the interrupt vector address from The microprocessor then gets this type and derives the interrupt vector address from that. Consider an application where a number of 

that. Consider an application where a number of 

I/O devices connected with CPU desire to transfer data using interrupt driven data I/O devices connected with CPU desire to transfer data using interrupt driven data transfer mode. In this type of applications more number of interrupts are required transfer mode. In this type of applications more number of interrupts are required than available in typical microprocessor. Moreover ,in this multiple interrupts systems than available in typical microprocessor. Moreover ,in this multiple interrupts systems the processor w

the processor will have to take ill have to take the care of priorities the care of priorities for the interrupts, simultanefor the interrupts, simultaneouslyously occurring at the interrupt

occurring at the interrupt request pins to ovrequest pins to overcome all this difficults ,wercome all this difficults ,we require e require aa Programmable interrupt controller which is able to handle a number of interrupts at a Programmable interrupt controller which is able to handle a number of interrupts at a time.8259A was operated with 8-bit as well as 16-bit processors.

time.8259A was operated with 8-bit as well as 16-bit processors.

PORT ADDRESSES OF 8279 PORT ADDRESSES OF 8279

Control

Control word word register register = = FFF4FFF4 Data

(32)

8259INTERFACING 8259INTERFACING

(33)

PROGRAM: PROGRAM: PULSE COUNTER PULSE COUNTER Main program: Main program: Memor  Memor  yy address address O

Op p ccooddeess llaabbeellss MMnneemmoonniiccss OOppeerraannddss CCoommmmeennttss

2000 2000 2006 2006 200C 200C 2012 2012 2015 2015 2017 2017 2018 2018 201B 201B 201D 201D 201E 201E 2020 2020 2021 2021 2023 2023 2024 2024 2025 2025 C7,06,00,30,00,0 C7,06,00,30,00,0 0 0 C7,06,20,01,50,2 C7,06,20,01,50,2 0 0 C7,06,22,01,00,0 C7,06,22,01,00,0 0 0 BA,F4,FF BA,F4,FF B0,13 B0,13 EE EE BA,F6,FF BA,F6,FF B0,48 B0,48 EE EE B0,03 B0,03 EE EE B0,FE B0,FE EE EE FB FB EB,FE EB,FE L1: L1: MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV OUT OUT MOV MOV MOV MOV OUT OUT MOV MOV OUT OUT MOV MOV OUT OUT STI STI JMP JMP [3000],0000H [3000],0000H [0120],2050H [0120],2050H [0122],0000H [0122],0000H DX,FFF4H DX,FFF4H  AL,13H  AL,13H DX,AL DX,AL DX,FFF6H DX,FFF6H  AL,48H  AL,48H DX,AL DX,AL  AL,03H  AL,03H DX,AL DX,AL  AL,FEH  AL,FEH DX,AL DX,AL L1 L1 ;Initial ;Initial cnt.0 cnt.0 ; ; IISSRR a addddr r ..iinn INT vector  INT vector  location. location. ;Initialize ;Initialize 8 822559 9 iinn edge edge triggered triggered in

inteterrurrupt pt ,, 8086 8086 processor, processor, automatic automatic e ennd d oof  f   in

inteterrurrupt pt ,, interrupt interrupt no. 0 no. 0 ; ; KKeeeepp monitoring monitoring the the interrupt. interrupt. Delay subroutine: Delay subroutine: Memory Memory address address O

Op p ccooddeess llaabbeellss MMnneemmoonniiccss OOppeerraannddss CCoommmmeennttss 2050 2050 2053 2053 2055 2055 2056 2056 2059 2059 205E 205E  A1,00,30  A1,00,30 04,01 04,01 27 27  A3,00,30  A3,00,30 9A,0A,0B,00,FF 9A,0A,0B,00,FF CF CF MOV MOV  ADD  ADD DAA DAA MOV MOV CALL CALL IRET IRET  AX,[3000]  AX,[3000]  AL,01H  AL,01H [3000],AX [3000],AX FF00:0B0A FF00:0B0A ;

; InInccreremementnt th

the e ccouounnteter r  by 1. by 1. ;Display ;Display count count ; ; BBaacck k ttoo main. main.

(34)
(35)

FREQUENCY COUNTER FREQUENCY COUNTER Main program: Main program: Memor  Memor  yy address address O

Op p ccooddeess llaabbeellss MMnneemmoonniiccss OOppeerraannddss CCoommmmeennttss

2000 2000 2006 2006 200C 200C 2012 2012 2015 2015 2017 2017 2018 2018 201B 201B 201D 201D 201E 201E 2020 2020 2021 2021 2023 2023 2024 2024 2025 2025 2028 2028 202B 202B 202C 202C 202D 202D 202F 202F 2030 2030 2032 2032 2037 2037 C7,06,00,30,00,0 C7,06,00,30,00,0 0 0 C7,06,20,01,50,2 C7,06,20,01,50,2 0 0 C7,06,22,01,00,0 C7,06,22,01,00,0 0 0 BA,F4,FF BA,F4,FF B0,13 B0,13 EE EE BA,F6,FF BA,F6,FF B0,48 B0,48 EE EE B0,03 B0,03 EE EE B0,FE B0,FE EE EE FB FB BB,0C,00 BB,0C,00 B9,02,63 B9,02,63 90 90 49 49 75,FC 75,FC 4B 4B 75,F6 75,F6 9A,0A,0B,00,FF 9A,0A,0B,00,FF EB,FE EB,FE L2: L2: L1: L1: L3: L3: MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV OUT OUT MOV MOV MOV MOV OUT OUT MOV MOV OUT OUT MOV MOV OUT OUT STI STI MOV MOV MOV MOV NOP NOP DEC DEC JNZ JNZ DEC DEC JNZ JNZ CALL CALL JMP JMP [3000],0000H [3000],0000H [0120],2050H [0120],2050H [0122],0000H [0122],0000H DX,FFF4H DX,FFF4H  AL,13H  AL,13H DX,AL DX,AL DX,FFF6H DX,FFF6H  AL,48H  AL,48H DX,AL DX,AL  AL,03H  AL,03H DX,AL DX,AL  AL,FEH  AL,FEH DX,AL DX,AL BX,000CH BX,000CH CX,6302H CX,6302H CX CX L1 L1 BX BX L2 L2 FF00:0B0A FF00:0B0A L3 L3 ;Initial ;Initial cnt.0 cnt.0 ; ; IISSRR a addddeer r ..iinn INT vector  INT vector  location. location. ;Initialize ;Initialize 8 822559 9 iinn edge edge triggered triggered in

inteterrurrupt pt ,, 8086 8086 processor, processor, automatic automatic e ennd d oof  f   in

inteterrurrupt pt ,, interrupt interrupt no. 0 no. 0 ;Activate ;Activate interrupt interrupt ;

; InInitiitialalizizee counters counters ffoor r 1 1 sseecc delay.

delay. ;

; WWaait it ffoor r  1sec.

1sec.

;

; DDiissppllaayy the the frequency frequency value. value.

Interrupt service subroutine: Interrupt service subroutine:

Memory Memory address address

O

Op p ccooddeess llaabbeellss MMnneemmoonniiccss OOppeerraannddss CCoommmmeennttss 2050 2050 2053 2053 2055 2055 2056 2056  A1,00,30  A1,00,30 04,01 04,01 27 27  A3,00,30  A3,00,30 MOV MOV  ADD  ADD DAA DAA MOV MOV  AX,[3000]  AX,[3000]  AL,01H  AL,01H [3000],AX [3000],AX ;;CCoouunnt t tthhee pulses pulses

(36)

RESULT: RESULT:

The count of the

The count of the pulses is displayed on the microprocessor data field.pulses is displayed on the microprocessor data field. The frequency is

The frequency is measured and displayed.measured and displayed.

VIVA QUESTIONS: VIVA QUESTIONS:

1.

1. WhiWhich initich initialialisatsation commion command worand word d indindicaicates whetes whethether r PIC is PIC is beibeing used inng used in single or cascaded mode?

single or cascaded mode? 2.

2. WhaWhat is t is meameant by nt by hanhandshdshakiakingng?? 3.

3. ExExplaplain in IREIRET T insinstrutructiction?on? 4.

4. In the PIn the PIC whIC which regich registers iisters is uses used to masd to mask the ink the interrupterrupts?ts? 5.

5. What arWhat are the totae the total numbel numbers of inters of interrupts arrupts availavailable if all thble if all the 8-inpue 8-inputs of PIC arts of PIC aree having slave?

having slave? 6.

6. WhWhat at is is MAMACRCRO?O? 7.

7. WhaWhat art are the the fle flags ags of of 8088086?6?

8.

(37)

References

Related documents

pylori, isolated in Sicily, to clarithromycin; the principal point of mutation associated with this resistance; and the more frequent association between resistance to

The essential features, which are the coarse aggregate skeleton and mastic composition, and the consequent surface texture and mixture stability,

In the political-administrative context, the ming-shi polarity is used to speak about official duties (ming) and their fulfillment (shi), about the intended (ming) and actual

d For each of the server.crt and CA.crt files, use the keytool command to import the new certificate into the Truecontrol key store file..

3 Using case studies as a promotional tool 4 Types of media and marketing 6 News release example 7 Engaging with employers 8 Letter/email template for employers 9 Networking

ICICI Bank offers a wide range of banking products and financial services to corporate and retail customers through a variety of delivery channels and

Correspondence and orders for medicines written in English will facilitate  execution of orders.. MRP