0% found this document useful (0 votes)
28 views6 pages

Answers: 2. A) Code

The document appears to be a student assignment for a microprocessor lab on character guessing. It includes code snippets for two programs: 1. A character guessing game that takes a character input, compares it to a range, and notifies if the character was guessed or not. 2. A password verification program that takes a password input, compares it to a stored password, and notifies if the password was correct or incorrect. It limits attempts to 4 tries.

Uploaded by

kumarkl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views6 pages

Answers: 2. A) Code

The document appears to be a student assignment for a microprocessor lab on character guessing. It includes code snippets for two programs: 1. A character guessing game that takes a character input, compares it to a range, and notifies if the character was guessed or not. 2. A password verification program that takes a password input, compares it to a stored password, and notifies if the password was correct or incorrect. It limits attempts to 4 tries.

Uploaded by

kumarkl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

JATIN KUMAR 18BCB0072

ASSIGNMENT: MIRCOPROCESSOR LAB CAT

Answers:

2. a)

Code:

.MODEL SMALL

.STACK 100H

.DATA

PROMPT DB 'Enter the character : $'

MSG_1 DB 'The input letter is not gussed : $ '

MSG_2 DB 'The input character is gussed Letter $ '

.CODE

MAIN PROC

MOV AX, @DATA

MOV DS, AX

LEA DX, PROMPT

MOV AH, 9

INT 21H
MOV AH, 1

INT 21H

MOV BL, AL

MOV AH, 2

MOV DL, 0DH

INT 21H

MOV DL, 0AH

INT 21H

CMP BL, "N"

JB @DISPLAY

CMP BL, "Z"

JA @DISPLAY

LEA DX,MSG_1

MOV AH, 9

INT 21H

MOV AH, 2

MOV DL, BL

INT 21H
JMP @EXIT

@DISPLAY:

LEA DX,MSG_2

MOV AH, 9

INT 21H

@EXIT:

MOV AH, 4CH

INT 21H

MAIN ENDP

END MAIN

Output:
2. b)

Code:

DATA SEGMENT

MSG1 DB 10,13,'ENTER YOUR PASSWORD : $'

MSG2 DB 10,13,'WRONG PASSWORD $'

MSG3 DB 10,13,'CORRECT PASSWORD $'

MSG4 DB 10,13,'PASSWORD LENGTH IS NOT SAME $'

STR1 DB "jatin"

P1 LABEL BYTE

M1 DB 0FFH

L1 DB ?

P11 DB 0FFH DUP ('$')

k DB 0h

u DB 04h

DATA ENDS

DISPLAY MACRO MSG


MOV AH,9

LEA DX,MSG

INT 21H

ENDM

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

DISPLAY MSG1

LEA DX,P1

MOV AH,0AH

INT 21H

CMP L1,5

JNE NOTEQUAL

LEA SI,STR1

LEA DI,P11

MOV CX,5

CHECK:

MOV AL,[SI]

CMP [DI],AL

JNE NOPASWD

INC SI

INC DI

LOOP CHECK

DISPLAY MSG3

JMP EXIT

NOTEQUAL:

DISPLAY MSG4
NOPASWD:

DISPLAY MSG2

inc k

mov bh,u

mov bl,k

cmp bl,bh

jne start

JMP EXIT

EXIT: MOV AH,4CH

INT 21H

CODE ENDS

END START

Output:

You might also like