Assembly Language Programs

Final 10 Program for practical

 

1)      Program Title: - WALP (Write Assembly Language Program) to store 55 H, 88 H, 99 H,   44 H, 02 H, 03 H, 04 H & 05H IN AL, BL, CL, DL, AH, BH, CH & DH Register respectively.  

Register Used: -AL, BL, CL, DL, AH, BH, CH & DH

Data: -55 H, 88 H, 99 H, 44 H, 02 H, 03 H, 04 H & 05H

A2000

Address

Op-code

Label

Mnemonics

Operand

Comments

0000:2000

B0,55

 

MOV

AL,55H

COPY 55H IN AL

        :2002

B3,88

 

MOV

BL,88H

COPY 88H IN BL

        :2004

B1,99

 

MOV

CL,99H

COPY 99H IN CL

        :2006

B2,44

 

MOV

DL, 44H

COPY 44H IN DL

        :2008

B4,02

 

MOV

AH,02H

COPY 02H IN AH

       :200A

B7,03

 

MOV

BH,03H

COPY 03H IN BH

       :200C

B5,04

 

MOV

CH,04H

COPY 04H IN CH

       :200E

B6,05

 

MOV

DH,05H

COPY 05H IN DH

       :2010

CC

 

INT

03

STOP

 

Result:-

AX = 0255H

BX = 0388H  

CX = 0499H

DX = 0544H


2)      Program Title: - WALP to store 55 H, 88 H, in AL, BL Register respectively. Copy the contents of AL register on memory location [2000] and contents of BL register on memory location [3000]. (DS = 0200H)

Register & Memory address Used: -AL, BL, DS, [2000] & [3000]

Data: -55 H, 88 H, [2000] & [3000]

A3000

Address

Op-code

Label

Mnemonics

Operand

Comments

0000:3000

B8,00,02

 

MOV

AX,0200H

Initialisation of DS

       :3003

8E,D8

 

MOV

DS,AX

       :3005

B0,55

 

MOV

AL,55H

Copy 55h In AL

       :3007

B3,88

 

MOV

BL,88H

Copy 88h In BL

       :3009

88,06,00,20

 

MOV

[2000],AL

Copy Contents Of Al On Memory Location [2000]

       :300D

88,1E,00,30

 

MOV

[3000],BL

Copy Contents Of Al On Memory Location [3000]

       :3011

CC

 

INT

03

STOP

 

Result:-

DS :    OFFEST : DATA

0200:[2000]:55H

0200:[3000] : 88H



3)      Program Title: - WALP to store 55 H, 88 H, in AL, BL Register respectively. Exchange contents of AL&BL using third register.

Register Used: -AL, BL &CL

Data: - 22 H& 55 H

A5000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:5000

B0,22

 

MOV

AL,22H

COPY 22H IN AL

     :5002

B3,55

 

MOV

BL,55H

COPY 55H IN BL

     :5004

8A,C8

 

MOV

CL,AL

COPY THE CONTENTS OF AL TO CL

     :5006

8A,C3

 

MOV

AL,BL

COPY THE CONTENTS OF BL TO AL

     :5008

8A,D9

 

MOV

BL,CL

COPY THE CONTENTS OF CL TO BL

     :500A

CC

 

INT

03

STOP

 

AL = 55H

BL = 22H


4)      Program Title: - WALP to store 44H & 55H in AL & BL register respectively. Exchange the contents of register using XCHG instruction.

Register Used: - AL & BL

Data: - 22H & 55H

A6000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:6000

B0,44

 

MOV

AL,22H

COPY 55H IN AL

      :6002

B3,55

 

MOV

BL,55H

COPY 22H IN BL

      :6004

86,C3

 

XCHG

AL,BL

Exchange contents of AL register With BL register

      :6006

CC

 

INT

03

STOP

 

Result:-

AL = 55H

BL = 44H


5)      Program Title: - WALP to 44H & 57H in AL & BL register respectively, perform the addition & store the sum on memory location [2000]. DS = 0200H

Register & Memory Address Used: - AL, BL & [2000]

Data: - 44H, 57H & 0200H

A7000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:7000

B8,00,02

 

MOV

AX,0200

Initialisation of DS

      :7003

8E,D8

 

MOV

DS,AX

 

      :7005

B0,44

 

MOV

AL,44H

;COPY 44H IN AL

      :7007

B3,57

 

MOV

BL,57H

;COPY 55H IN BL

      :7009

02,C3

 

ADD

AL,BL

;ADD CONTENTS OF BL WITH AL & RESULT SOTRED IN AL

      :700B

88,06,00,20

 

MOV

[2000],AL

COPY CONTENTS OF AL ON MEMORY LOCATION [2000]

      :700F

CC

 

INT

03

STOP

 

Result:-

DS : OFFSET : DATA

0200:  [2000]    : 9B H




6)      Program Title: -WALP to store 55H & 22H in DL & AH register respectively, perform the Subtraction & store the result on memory location [4000]. DS = 0300H

Register & Memory Address Used: - DL, AH & [4000]

Data: - 55H, 22H & 0300H

A8000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:8000

B8,00,03

 

MOV

AX,0300

Initialisation of DS

         :8003

8E,D8

 

MOV

DS,AX

 

         :8005

B2,55

 

MOV

DL,55H

;COPY 55H IN DL

         :8007

B4,22

 

MOV

AH,22H

;COPY 22H IN AH

         :8009

2A,D4

 

SUB

DL,AH

;SUBTRACT CONTENTS OF AH FROM DL & RESULT SOTRED IN DL

         :800B

88,16,00,40

 

MOV

[4000],DL

COPY CONTENTS OF DL ON MEMORY LOCATION [4000]

         :800F

CC

 

INT

03

STOP

 

Result:-

DS   : OFFSET : DATA

0300:  [4000]    : 33H


7)      Program Title: - WALP to store 44H & 02H in AL & BL register respectively, perform the Multiplication & store the product on memory location [2000]. DS = 0300H

Register & Memory Address Used: - AL, BL & [2000]

Data: - 44H, 02H & 0300H

A9000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:9000

B8,00,03

 

MOV

AX,0300

Initialisation of DS

        :9003

8E,D8

 

MOV

DS,AX

 

        :9005

B0,44

 

MOV

AL,44H

;COPY 44H IN AL

        :9007

B3,02

 

MOV

BL,02H

;COPY 02H IN BL

        :9009

F6,E3

 

MUL

BL

;MULTIPLY CONTENTS OF BL WITH AL & RESULT SOTRED IN AL

        :900B

88,06,00,20

 

MOV

[2000],AL

COPY CONTENTS OF AL ON MEMORY LOCATION [2000]

        :900F

CC

 

INT

03

STOP

 

Result:-

DS   : OFFSET : DATA

0300:  [2000]    : 88H


8)      Program Title: - WALP to store 0045H & 22H in AX & BL register respectively, perform the Division & store the quotient on memory location [2000] & remainder on memory location [2001].  DS = 0200H

Register & Memory Address Used: - AX, BL & [2000]

Data: - 0045H, 22H & 0200H

A2000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:2000

B8,00,02

 

MOV

AX,0200

Initialisation of DS

       :2003

8E,D8

 

MOV

DS,AX

 

       :2005

B8,45,00

 

MOV

AX,0045H

;COPY 0045H IN AX

       :2008

B3,22

 

MOV

BL,22H

;COPY 22H IN BL

       :200A

F6,F3

 

DIV

BL

;PERFORM DIVISION

       :200C

88,06,00,20

 

MOV

[2000],AL

COPY CONTENTS OF AL(quotient)ON MEMORY LOCATION [2000]

       :2010

88,26,01,20

 

MOV

[2001],AH

COPY CONTENTS OF AH (remainder)  ON MEMORY LOCATION [2001]

       :2014

CC

 

INT

03

STOP

 

Result:-

DS   : OFFSET : DATA

0200:  [2000]    : 02H

0200:  [2001]    : 01H


9)      Program Title: - WALP to store 1122H & 4455H in AX & BX register respectively, store the contents of register on stack, here SS = 0300H & SP = 1009H

Register & Memory Address Used: - AX, BX, SS & SP

Data: - 1122 H, 4455 H, 02H 1009 & 0300H

A3000

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:3000

B8,00,03

 

MOV

AX,0300

Initialisation of SS

       :3003

80,D0

 

MOV

SS,AX

 

       :3005

BC,09,10

 

MOV

SP,1009

;COPY 1009H IN SP

       :3008

B8,22,11

 

MOV

AX,1122H

;COPY 1122H IN AX

       :300B

BB,55,44

 

MOV

BX,4455H

;COPY 4455H IN BX

       :300E

50

 

PUSH

AX

COPY CONTENTS OF AX REGISTER ON STACK.

       :300F

53

 

PUSH

BX

COPY CONTENTS OF BX REGISTER ON STACK.

       :3010

CC

 

INT

03

STOP

 

Result:-

SS   : OFFSET : DATA

0300:  1009    :  XX

0300:  1008    :  11 H

0300:  1007    :  22 H

0300:  1006    :  44 H

0300:  1005    :  55 H


10)  Program Title: - WALP to store 1122H & 4455H in AX & BX register respectively, store the contents of register on stack & then copy the content of stack in the register SI & DI, here SS = 0300H & SP = 1009H

Register & Memory Address Used: - AX, BX, SI, DI, SS & SP

Data: - 1122 H, 4455 H, 02H 1009 & 0300H

Address

Op-code

Label

Mnemonic

Operand

Comments

0000:3000

B8,00,03

 

MOV

AX,0300

Initialisation of SS

       :3003

8E,D0

 

MOV

SS,AX

 

       :3005

BC,09,10

 

MOV

SP,1009

;COPY 1009H IN SP

       :3008

B8,22,11

 

MOV

AX,1122H

;COPY 1122H IN AX

       :300B

BB,55,44

 

MOV

BX,4455H

;COPY 4455H IN BX

       :300E

50

 

PUSH

AX

COPY CONTENTS OF AX REGISTER ON STACK.

       :300F

53

 

PUSH

BX

COPY CONTENTS OF BX REGISTER ON STACK.

       :3010

5E

 

POP

SI

COPY CONTENTS OF STACK IN SI REGISTER.

       :3011

5F

 

POP

DI

COPY CONTENTS OF STACK IN DI REGISTER.

       :3012

CC

 

INT

03

STOP

 

Result:-

SI = 4455 H

DI = 1122 H


Post a Comment

0 Comments