Write an assembly language program to Compute ∑_(i=1)^n▒(x_i y_i )







Objective:
(i) To know about several command in the Assembly language.
(ii) Input a Character.
(iii) Output a Character.

Source Code:
.model small
.stack 100h

print macro msg
                   lea dx,msg
                   mov ah,09h
                   int 21h
endm

.data
                   msg1 db “Result =$”
                   X db 2,3,4
                   Y db 3,2,4
                   Sdw?
.code
main proc
                   mov ax,@data
                   mov ds,ax
                   mov cx,3;loop count 3 times
                   lea si,X;assign address of x to si
                   lea di,y; assign address of y to di
          A1:
                   moval,[si];value of si is placed intoal
                   mov bl,[di];value of di is placed into     bl
                   mul bl
                   add S,ax

                   mov ax,0000h
                   add si,1
                   add di,1
                   loop A1

          print msg1
          mov ax,s
          call int2asc
          mov ah,4ch
          int 21h
main endp

int2ascproc
                   movcx,00
                   mov bx,0ah; 0ah=10
          rpt:
                   mov dx,00h
                   div bx
                   add dl,30h
                   inc cx
                   push dx
                   cmp ax,0ah
                   jgerpt

          add al,30h
          inc cx
          push ax
          mov ah,02h

          print_loop:
                   pop dx
                   int 21h
                   loop print_loop

          ret;return to main function
int2asc endp
end main

Input/output:

          Result = 28

1 comment:

  1. This article will help you find the best oscilloscope for ham radio.

    Oscilloscopes are used to measure the electrical properties of a circuit. They can be used to measure voltage, current, frequency and resistance.

    There are many different types of oscilloscopes, each with their own specific applications and limitations.

    The most common type is the analog oscilloscope which displays a graph of voltage over time on an analog monitor.

    Digital oscilloscopes display a graph of voltage over time on a digital screen and have many advantages over analog models because they can store data for later analysis and easily export it to other programs for further processing.

    Another type is the digital storage oscilloscope which stores data digitally, but uses an analog display screen for viewing.

    ReplyDelete

Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....

Theme images by ideabug. Powered by Blogger.