Write and execute an alp to 8086 Microprocessor to find the length of a given string which terminates with a special character

Aim:

To write an assembly language program to find the length of the given string.

Tools:

PC installed with TASM.

Program:

ASSUME CS : CODE, DS : DATA
CODE SEGMENT
MOV AX, DATA
MOV DS, AX
MOV AL, ’$’
MOV CX, 00H
MOV SI, OFFSET STR1
BACK : CMP AL, [SI]
JE GO
INC CL
INC SI
JMP BACK
GO : MOV LENGTH, CL
HLT
CODE ENDS
DATA SEGMENT
STR1 DB ‘STUDENT BOX OFFICE$’
LENGTH DB ?
DATA ENDS 
END

Flow Chart:

Result:

Input:

STR (DS : 0000H) = STUDENT BOX OFFICE

Output:

LENGTH = 18

Viva-voce questions:

1. How does the CPU identify between 8-bit and 16-bit operations?
2. What is the ASCII value of ‘@’?
3. How to convert BCD to ASCII and ASCII to BCD?
4. What is the difference between packed BCD and unpacked BCD?
5. What are the different machine level instruction codes of 8086 µP?