Write a Pep8 Assembly program that reads in and stores two i

Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints out their sum in the form: Total =<value>

Solution

pep/8 assembly program

                 BR MAIN

x:               .BLOCK 2

y:               .BLOCK 2

Main            DECI   x, d

                   LDA    x, d

                   ADDA 2, i

                   ADDA x, d

                   STA     y, d

                  DECO   x, d

                  CHARO \" : \" , i

                   DECO   y, d

                   STOP

                 .END

INPUT - 7                  [ here if you enter 7 that 7 will be added to 2 and then we will get 9 and that 9 will be added

OUTPUT - 9:16               to 7 and it will be 16 so the output i have written in 9 : 16 ]

assembly language program code -

DATA SEGMENT

       NUM1 DB ?

       NUM2 DB ?

       RESULT DB ?

      MSG1 DB 10, 13 , \" ENTER FIRST NUMBER TO ADD : $ \"

      MSG2 DB   10 , 13 , \" ENTER SECOND NUMBER TO ADD : $ \"

      MSG3 DB 10 , 13 , \" RESULT OF ADDITION IS : $ \"

ENDS

CODE SEGMENT

    ASSUME DS : DATA CS:CODE

START :

     MOV AX , DATA

     MOV DS , AX

     LEA DX,MS G1

     MOV AH , 9

     INT 21H

     MOV AH,1

     INT 21H

     SUB AL,30H

     MOV NUM1,AL

     LEA DX ,MS G2

     MOV AH,9

     INT 21H

    MOV AH,1

    INT 21H

    SUB AL , 30H

    MOV NUM2, AL

    ADD AL,NUM1

   MOV RESULT,AL

   MOV AH,0

   AAA

   ADD AH,30H

   ADD AL, 30H

   MOV BX, AX

   LEA DX , MS G3

   MOV AH,9

   INT 21H

    MOV AH,2

    MOV DL,BH

    INT 21H

    MOV AH , 2

    MOV DL,BL

    INT 21H

   MOV AH , 4CH

    INT 21H

ENDS

END START

OUTPUT -

ENTER FIRST NUMBER TO ADD :9

ENTER SECOND NUMBER TO ADD : 6

RESULT OF ADDITTION IS : 15

  

   LEA DX,MS G3

               

Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints out their sum in the form: Total =<value>Solutionpep/8 assem
Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints out their sum in the form: Total =<value>Solutionpep/8 assem
Write a Pep/8 Assembly program that reads in and stores two integers from the user and prints out their sum in the form: Total =<value>Solutionpep/8 assem

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site