Professional Documents
Culture Documents
Microprocessor and Interfacing Digital Assignment-2
Microprocessor and Interfacing Digital Assignment-2
Microprocessor and Interfacing Digital Assignment-2
DIGITAL ASSIGNMENT- 2
Ishan Kaushik
17BCE2025
_asm
printf("%s", name);
return 0;
.MODEL SMALL
.STACK 100H
.DATA
MOV AX,@DATA
MOV DS,AX
CALL REVERSE
LEA DX,STRING
INT 21H
INT 21H
MAIN ENDP
REVERSE PROC
MOV CX, 0H
LOOP1:
JE LABEL1
PUSH [SI]
INC SI
INC CX
JMP LOOP1
LABEL1:
LOOP2:
CMP CX,0
JE EXIT
POP DX
XOR DH, DH
MOV [SI], DX
INC SI
DEC CX
JMP LOOP2
EXIT:
RET
REVERSE ENDP
END MAIN
e. Compare the user input string with the given string and identify whether equal or not.
DATA SEGMENT
INSTR1 DB 20 DUP("$")
INSTR2 DB 20 DUP("$")
NEWLINE DB 10,13,"$"
N DB ?
S DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,INSTR1
LEA DI,INSTR2
MOV AH,09H
LEA DX,STR1
INT 21H
MOV AH,0AH
MOV DX,SI
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR2
INT 21H
MOV AH,0AH
MOV DX,DI
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR11
INT 21H
MOV AH,09H
LEA DX,INSTR1+2
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR22
INT 21H
MOV AH,09H
LEA DX,INSTR2+2
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV BX,00
MOV BL,INSTR1+1
MOV BH,INSTR2+1
CMP BL,BH
JNE L1
ADD SI,2
ADD DI,2
JNE L1
INC SI
INC DI
JNE L2
MOV AH,09H
LEA DX,MSG1
INT 21
JMP L5
L1:MOV AH,09H
LEA DX,MSG2
INT 21H
L5:
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
2. Write the Control word format of 8255 for I/O Mode. Find the Control word if
a) PA = output
b) PB = input
c) PC0-PC3 = input
d) PC4-PC7= output
Draw an interfacing diagram and write an ALP to perform the 8255 to get data from Port A and send it
to Port B. Also the data from PCL is forward the data to PCU.
Input/output mode (I/O) – This mode is selected when the most significant bit (D7) in the control
register is 1.
Mode 0 – Simple or basic I/O mode:
Port A, B and C can work either as input function or as output function. The outputs are latched but
the inputs are not latched. It has interrupt handling capability.
Mode 1 – Handshake or strobbed I/O:
In this either port A or B can work and port C bits are used to provide handshaking. The outputs as
well as inputs are latched. It has interrupt handling capability. Before actual data transfer there is
transmission of signal to match speed of CPU and printer.
MOV A, #90H
MOVX @DPTR, A
MOV DPTR,#1000H
MOVX A,@DPTR
INC @DPTR
MOVX A, @DPTR
ANL A, #0FH
SWAP A
MOVX @DPTR, A