Practice Program in Assembly Language

Practice Program in Assembly Language

ORG 100H
.MODEL SMALL
.DATA
ARR DB 4 DUP(?)
ARR1 DB 4 DUP(?)
ARR2 DB 4 DUP(?)
AHSAN DB "ENTER ROLL NUMBER(4-DIGIT): ", "$"
AHSAN1 DB "ENTER COLLEAGUE ROLL NUMBER(4-DIGIT): ", "$"
AHSAN2 DB "ROLL NUMBER IS ", "$"
AHSAN3 DB " GREATER THAN COLLEAGUE'S ROLL-NUMBER", "$"
AHSAN4 DB " LESSER THAN COLLEAGUE'S ROLL-NUMBER", "$"
NewLine DB 0AH, 0DH, "$"
.CODE
LEA DX, AHSAN
MOV AH, 09H
INT 21H
MOV CX, 4
MOV SI, 0
INPUT_1:
MOV AH, 1
INT 21H
MOV ARR[SI], AL
INC SI
LOOP INPUT_1
LEA DX, NewLine
MOV AH, 9 ;PRINT NEW LINE
INT 21H
LEA DX, AHSAN1
MOV AH, 9
INT 21H
MOV CX, 4
MOV BP, 0
INPUT_2:
MOV AH, 1
INT 21H
MOV ARR1[BP], AL
INC BP
LOOP INPUT_2
MOV DH, ARR[0]
CMP DH, ARR1[0]
JG FIRST
MOV BX, 0
MOV BP, 0
MOV SI, 0
MOV CX, 4
SUB_1:
MOV DH, ARR1[BX]
SUB DH, ARR[BP]
MOV ARR2[SI], DH
ADD ARR2[SI], 30H
INC BX
INC BP
INC SI
LOOP SUB_1
LEA DX, NewLine
MOV AH, 9
INT 21H
LEA DX, AHSAN2
MOV AH, 9
INT 21H
JMP SECOND
FIRST:
MOV BX, 0
MOV BP, 0
MOV SI, 0
MOV CX, 4
SUB_2:
MOV DH, ARR[BX]
SUB DH, ARR1[BP]
MOV ARR2[SI], DH
ADD ARR2[SI], 30H
INC BX
INC BP
INC SI
LOOP SUB_2
LEA DX, NewLine
MOV AH, 9
INT 21H
LEA DX, AHSAN2
MOV AH, 9
INT 21H
MOV BX, 0
MOV CX, 4
DISPLAY:
MOV DL, ARR2[BX]
MOV AH, 2
INT 21H
INC BX
LOOP DISPLAY
LEA DX, AHSAN3
MOV AH, 9
INT 21H
JMP END
SECOND:
MOV BX, 0
MOV CX, 4
DISPLAY_1:
MOV DL, [ARR2 + BX]
MOV AH, 2
INT 21H
INC BX
LOOP DISPLAY_1
LEA DX, AHSAN4
MOV AH, 9
INT 21H
END:
.EXIT
RET

Output:

output

Advertisements

3 thoughts on “Practice Program in Assembly Language

  1. Wow, marvelous weblog layout! How lengthy have you been blogging for? you make blogging glance easy. The full glance of your site is wonderful, as well as the content material!

    Like

  2. excellent publish, very informative. I’m wondering why the opposite specialists of this sector do not notice this. You should continue your writing. I’m confident, you’ve a great readers’ base already!

    Like

  3. I’m no longer sure where you’re getting your info, but great topic. I needs to spend some time learning more or figuring out more. Thank you for great information I used to be searching for this information for my mission.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s