To write and execute an Assembly language Program (ALP) to 8086 processor to insert or delete a character/ number from the given string.
Aim:
To write and execute an Assembly language Program (ALP) to 8086 processor to insert or delete a character/ number from the given string.
Tools:
PC installed with MASM 6.11
Program:
a) String insertion
ASSUME CS : CODE, DS : DATA, ES : EXTRA
DATA SEGMENT
STRING1 DB 'EMPTY VESSELS MORE NOISE$'
STRLEN EQU ($-STRING1)
DATA ENDS
EXTRA SEGMENT
STRING2 DB STRLEN + 5 DUP(0)
EXTRA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV SI, OFFSET STRING1
MOV DI, OFFSET STRING2
CLD
MOV CX, 14
REP MOVSB
MOV DL, 5
BACK: MOV AH, 01
INT 21H
STOS STRING2
DEC DL
JNZ BACK
MOV CX, 11
REP MOVSB
NOP
MOV AH, 4CH
INT 21H
CODE ENDS
END START
END
b) String deletion
ASSUME CS : CODE, DS : DATA, ES : EXTRA
DATA SEGMENT
STRING1 DB 'EMPTY VESSELS MAKE MORE NOISE$'
STRLEN EQU ($ - STRING1)
DATA ENDS
EXTRA SEGMENT
STRING2 DB STRLEN - 5 DUP (0)
EXTRA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AX, EXTRA
MOV ES, AX
MOV SI, OFFSET STRING1
MOV DI, OFFSET STRING2
CLD
MOV CX, 13
REP MOVSB
CLD
MOV SI, 18
MOV CX, 12
REP MOVSB
MOV AH, 4CH
INT 21H
CODE ENDS
END START
END
Result:
EMPTY VESSELS MAKE MORE NOISE
Viva-voce questions:
1. What are the different string instructions of 8086? 2. What is the difference between near and far procedure? 3. What is the difference between macro and sub-routine? 4. What is meant by DUP? 5. What are the functions of SI and DI registers?
-
UpdatedNov 05, 2014
-
Views18,561
Write and execute an alp to 8086 Microprocessor to add, subtract and multiply two 16 bit unsigned numbers. Store the result in extra segment
Write and execute an alp to 8086 Microprocessor to a sort the give array of 32 bit number in ascending and descending order.
Program to generate following waveforms
- Ramp waveform
- Square waveform
- Step waveform
- Triangle waveform
Write and execute an alp to 8086 Microprocessor to find the length of a given string which terminates with a special character
Write and execute an alp to 8086 Microprocessor to divide a 32 bit unsigned numbers by a 16 bit unsigned number. Store the result in stack segment
Interface a stepper motor to 8086 and operate it in clock wise and anticlockwise by choosing variable stepsize.