0% found this document useful (0 votes)
7 views7 pages

MIC Pract

The document contains multiple assembly language code segments that perform various operations, including checking for positive or negative numbers, counting zeros and ones in bytes, and performing arithmetic operations. Each code segment is structured with a data segment and a code segment, utilizing registers and instructions to achieve the desired computations. The outputs of these operations are stored in designated variables for further use.
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)
7 views7 pages

MIC Pract

The document contains multiple assembly language code segments that perform various operations, including checking for positive or negative numbers, counting zeros and ones in bytes, and performing arithmetic operations. Each code segment is structured with a data segment and a code segment, utilizing registers and instructions to achieve the desired computations. The outputs of these operations are stored in designated variables for further use.
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/ 7

[ Check number is positive or negative]

DATA SEGMENT
ARRAY DB 10 DUP(?)
NOFZ DB ?
NOFP DB ?
NOFN DB ?
DATA ENDS

CODE SEGMENT
ASSUME CS:CODE, DS:DATA

START:
MOV AX, DATA
MOV DS, AX
LEA SI, ARRAY
MOV BL, 00H
MOV BH, 00H
MOV DL, 00H
MOV CL, 0AH

UP:
MOV AL, [SI]
CMP AL, 00H
JNE DN
INC BL
JMP LAST

DN:
ROL AL, 1
JNC DN1
INC BH
JMP LAST

DN1:
INC DL

LAST:
INC SI
DEC CL
JNZ UP
MOV NOFZ, BL
MOV NOFP, BH
MOV NOFN, DL
INT 3

CODE ENDS
END START
OUTPUT :
[Count number of ‘0’ and ‘1’]
DATA SEGMENT
BYTE DB 98H
NONE DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AL, BYTE
MOV BL, 00H
MOV CL, 08H
UP:
ROL AL, 1
JNC DN
INC BL
DN:
DEC CL
JNZ UP
MOV NONE, BL
INT 3
CODE ENDS
END START

OUTPUT :
[C``ount number of ‘0’ and ‘1’]

DATA SEGMENT
WORD DW 889BH
NZER DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AX, WORD
MOV DL, 00H
MOV CL, 10H
UP:
ROL AX, 1
JC DN
INC DL
DN:
DEC CL
JNZ UP
MOV NZER, DL
INT 3
CODE ENDS
END START
Output:
[Arithmetic Operations]

DATA SEGMENT
NO1 DB 02H
NO2 DB 03H
ANS DW ?
DATA ENDS

CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AL, NO1
MOV BL, NO2
CALL MULTI
MOV ANS, AX
INT 3
MULTI PROC NEAR
MUL BL
RET
MULTI ENDP
CODE ENDS
END START

OUTPUT :
[Arithmethic Operations using Macro]

DATA SEGMENT
A DB 04H
B DB 02H
C DB 01H
D DB 02H
Z DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AL, A
MOV BL, B
ADD AL, BL
MOV CL, AL
MOV AL, C
MOV BL, D
ADD AL, BL
MUL CL
MOV Z, AX
INT 3
CODE ENDS
END START

OUTPUT :

You might also like