0% found this document useful (0 votes)
5 views1 page

Lab 14

This document outlines a lab activity in assembly language programming. It involves creating a program that prompts the user to enter a number and determines if the number is even or odd, displaying the appropriate message. The code includes data segment initialization, input handling, and conditional branching for output based on the number's parity.
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)
5 views1 page

Lab 14

This document outlines a lab activity in assembly language programming. It involves creating a program that prompts the user to enter a number and determines if the number is even or odd, displaying the appropriate message. The code includes data segment initialization, input handling, and conditional branching for output based on the number's parity.
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/ 1

LAB : 14

TASK
TITLE LAB 14 ACTIVITY 1 ;TILE DIRECTIVE
.MODEL SMALL ;RESEVED 64 Kb FOR CS
.STACK 100H ;RESERVED 256 BYTES FOR PROGRAM
.DATA ;INITIATE DATA

INP DB "ENTER A NUMBER : $"


EVEN DB 10,13,'NUMBER IS EVEN $'
ODD DB 10,13,'NUMBER IS ODD $'

NUM DB ?

.CODE ;INITIATE CODE


MAIN PROC
MOV AX,@DATA ;INITIATE DATA SEGMENT
MOV DS,AX

MOV AH,9 ;PRINT FUNCTION 9


LEA DX,INP
INT 21H

INPUT: ;LABEL
MOV NUM,AL ;NUM=AL
MOV AH,1 ;INPUT FUNCTION 1
INT 21H

CMP AL,13 ;COMPARE AL WITH CARRIAGE RETURN


JNZ INPUT ;JUMP TO INPUT IF NOT ZERO

MOV AL,NUM ;AL=NUM


MOV BL,2 ;BL=2

DIV BL ;AL=AL/BL
CMP AH,0 ;COMPARE AH WITH 0
JZ EVE ;JUMP TO EVE IF ZERO

MOV AH,9 ;PRINT FUNCTION 9


LEA DX,ODD
INT 21H

JMP EXIT ;JUMP TO EXIT


EVE: ;LABEL
MOV AH,9 ;PRINT FUNCTION 9
LEA DX,EVEN
INT 21H

EXIT: ;LABLE
MOV AH,4CH ;EXIT TO DOS
INT 21H

MAIN ENDP
END MAIN

OUTPUT

You might also like