6
Products Services LOGO How To Md. Saidul Islam Id : CSE00705396 Id : CSE00705396 CSE Port City International University

An assembly language program for Adds the sales tax in the Price list of items and replace the Price list with the Calculated value

Embed Size (px)

Citation preview

Page 1: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

Md. Saidul Islam Id : CSE00705396Id : CSE00705396

CSEPort City International

University

Page 2: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

Topics of My Program Adds the sales tax in the Price

list of items and replace the Price list with the Calculated

value

Price 1 : 36$Price 2 : 55 $Tax :12%

1. =42. =6

1. 36+4 =40$

2. 55+6=61$

Page 3: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

Let’s go to code ….

DATA SEGMENT

PRICE DB 36,55,27,42,38,41,29,39

LEN DW $-PRICE

TAX DB 12

DATA ENDS

Variable 1) PRICE . [Array]

2) LEN . [ Length of Array ]

3) Tax . [ 12% ] $-PRICE : $-Name of the array

Page 4: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

CODE SEGMENT 

    ASSUME DS:DATA CS:CODE START:       MOV AX,DATA       MOV DS,AX       LEA BX,PRICE

     MOV CX,LEN

LOOP1:           MOV AH,0        MOV AL,[BX]             MOV DL,TAX        MUL DL   MOV DL,100        DIV DL                            MOV AH,[BX]        ADD AH,AL               MOV [BX],AH                 INC BX                      LOOP LOOP1               MOV AH,4CH      INT 21H      ENDS END START

Return to the DOS function.

Increment (++) the address value of BX register .

LOOP LOOP1 : End of the Loop.

Replace the old price by new price

New price = old price + TAX

(PRICE * 12)/100

Multiply element of Array by TAX . Where Tax = 12 .i.e Price[] * 12

Move value of BX register to AL register .

[] is Refered as VALUE.

Clear the garbage value of AH

Len = 8

Base Address of variable PRICE is loaded in DX register.

MOV DEX , OFFSET PRICE

DS AX DATA

1. Data segment Register .2. Code segment Register .

Page 5: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

Input

Output

Page 6: An assembly language program for Adds the sales tax in the Price list of  items and replace the Price list with the Calculated value

Thank YOU