0% found this document useful (0 votes)
34 views9 pages

A) Write Down The Status (1/0) of The Following Flags After Execution of Each Piece of Code

Uploaded by

Ali Baig
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)
34 views9 pages

A) Write Down The Status (1/0) of The Following Flags After Execution of Each Piece of Code

Uploaded by

Ali Baig
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/ 9

a) Write down the status (1/0) of the following flags after execution of each piece of code.

b) Write an assembly language Program that inputs 2 numbers from the user and then add both
numbers and display result as ‘Addition is:’.
.model small

.stack 100h

.data

NUM DW 0

TEMP1 DW 0

TEMP2 DW 0

SUM DW 0

Q DB 0

R DB 0

COUNT DB 0

INPUT DB 'ENTER NUMBER: $'

ADDITION DB 'Addition is:$'

.code

MAIN PROC

mov ax,@data

mov ds,ax

CALL CIN

MOV AX,NUM

MOV TEMP1,AX

CALL NEXT_LINE

CALL CIN

MOV AX,NUM

MOV TEMP2,AX

;SUM=TEMP2+TEMP1
MOV BX,TEMP1

MOV CX,TEMP2

ADD BX,CX

MOV SUM,BX

CALL NEXT_LINE

CALL COUT

CALL NEXT_LINE

mov ah,4ch

int 21h

MAIN ENDP

NEXT_LINE PROC

MOV AH,2

MOV DL,0AH

INT 21H

MOV AH,2

MOV DL,0DH

INT 21H

RET
NEXT_LINE ENDP

CIN PROC

MOV NUM,0

MOV AH,9

MOV DX,OFFSET(INPUT)

INT 21H

L1:

MOV AH,1

INT 21H

CMP AL,0DH

JE OUTLOOP

SUB AL,30H

MOV CL,AL

;NUM=NUM*10+AL

MOV AX,NUM

MOV BX,10

MUL BX

MOV CH,0

ADD AX,CX

MOV NUM,AX

JMP L1
OUTLOOP:

RET

MOV AH,4CH

INT 21H

CIN ENDP

COUT PROC

L2:

MOV AX,SUM

MOV DL,10

DIV DL

MOV Q,AL

MOV R,AH

ADD R,30H

MOV CL,R

MOV CH,0

PUSH CX

INC COUNT

CMP Q,0

JE EL2

MOV BL,Q

MOV BH,0

MOV SUM, BX

JMP L2

EL2:

MOV AH,9
MOV DX,OFFSET(ADDITION)

INT 21H

L3:

POP BX

MOV AH,2

MOV DL,BL

INT 21H

DEC COUNT

JNZ L3

CALL NEXT_LINE

RET

COUT ENDP

END MAIN

Find the address range for the Y1, & Y7 of the 74LS138 for the following design.

You might also like