Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Electrical & Electronics Expert

1.....If viewing this through the Assignment tool, click the title above to go to the Submissions area.

Introduction

The purpose of this experiment is to examine the operation of loops and their close equivalent, subroutines.

Procedure

1. How many times does each loop execute?

2. Assemble and link to create LOOPS.EXE. Run the program.

3. Comment out the PUSH AX and POP AX instructions. Re-assemble, link, and run. Comment on any changes. Explain how the changes, if any, occurred.

4. Put the PUSH AX and POP AX instructions back in.

5. Take instructions from inside the loop and place them in a subroutine (or procedure). Thus, the loop will call the subroutine once each pass. Only instructions that directly control the looping should stay.

6. Assemble, link, and run the program. You should get the same results. Email the final ASM file.

7. Assemble and link to create LOOPS2.EXE. Run the program. Explain why the loop pass counter value shown is correct.

8. This file contains errors! Edit the file to correct the errors, then assemble, link, and run. Warning! The program may assemble and link correctly and still have errors that may crash your DOS window. The correct result in AL is 7.

9. Submit your findings.

Downloaded copy of Program LOOPS.ASM: Count the number of passes through a loop.

;

        .MODEL SMALL

        .DATA

LOOPS   DW    ?

MSG     DB    'The number of loop passes is '

TENTHOS DB    ?

THOUS   DB    ?

HUNS    DB    ?

TENS    DB    ?

ONES    DB    ?

        DB    0DH,0AH,'$'

 

        .CODE

        .STARTUP

        MOV   AX,0      ;clear loop pass counter

;

;place user loop code here.

;Make sure INC  AX is inside the innermost loop.

;

        MOV   BX,0FF98H

BAK:    PUSH  AX

        MOV   CX,1234H

        MOV   DX,5678H

        XOR   CX,DX

        MOV   AX,9ABCH

        XOR   CX,AX

        POP   AX

        INC   AX                ;increment loop pass counter

        DEC   BX

        JNZ   BAK

;

;end of user loop code

;

        MOV   LOOPS,AX          ;display the loop pass counter

        CALL  BTOD

        LEA   DX,MSG 

        MOV   AH,9

        INT   21H

        .EXIT

 

BTOD    PROC  FAR

        MOV   AX,LOOPS    ;load binary input value

        SUB   DX,DX

        MOV   BX,10000

        DIV   BX                ;get 10,000s digit

        ADD   AL,30H

        MOV   TENTHOS,AL

        XCHG  AX,DX

        SUB   DX,DX

        MOV   BX,1000           ;get 1,000s digit

        DIV   BX

        ADD   AL,30H

        MOV   THOUS,AL

        XCHG  DX,AX

        MOV   BL,100

        DIV   BL          ;get hundreds digit

        ADD   AL,30H      ;convert into ASCII digit

        MOV   HUNS,AL     ;and save

        XCHG  AL,AH       ;get remainder

        SUB   AH,AH       ;prepare for division by 10

        MOV   BL,10

        DIV   BL          ;get tens digit

        ADD   AL,30H      ;convert into ASCII digit

        MOV   TENS,AL     ;and save

        ADD   AH,30H      ;convert ones digit into ASCII

        MOV   ONES,AH     ;and save

        RET

BTOD    ENDP

        END

Electrical & Electronics, Engineering

  • Category:- Electrical & Electronics
  • Reference No.:- M9579952

Have any Question?


Related Questions in Electrical & Electronics

Problems -problem 1 - find v0 in the op amp circuit of fig

Problems - Problem 1 - Find v 0 in the op amp circuit of Fig. 1. Problem 2 - Compute i 0 (t) in the op amp circuit in Fig. 2 if v s = 4 cos(10 4 t). Problem 3 - If the input impedance is defined as Z in = v s /I s , find ...

Question 1 in the voltage regulator circuit in figure p221

Question 1: In the voltage regulator circuit in Figure P2.21, V 1 = 20 V, V Z = 10 V, R i = 222Ω and P z (max) = 400 mW. (a) Determine I L, I z , and I L , if R L = 380Ω. (b) Determine the value of R L , that will establ ...

Assignment -problem 1 -a consider the simplified dc system

Assignment - Problem 1 - a) Consider the simplified dc system shown in Fig. 1. Only one converter is modeled, with the remote end represented by a dc source. The ac system is rated at 345 kV, with the converter transform ...

Question 1 a pnp transistor withnbspbeta 60 is connected

Question 1. A pnp transistor with β = 60 is connected in a common-base configuration as shown in figure P5.8 (a) The emitter is driven by a constant-current source with I E = 0.75 mA. Determine I B , I C , α, and V C . ( ...

Nanotechnology engineering - resonance circuits questions

Nanotechnology Engineering - Resonance Circuits Questions - Q1) A series RLC network has R = 2KΩ, L = 40mH and C = 1μF. Calculate the impedance at resonance and at one-fourth, one-half, twice, and four times the resonant ...

Assignment -consider a common emitter amplifiernow lets say

Assignment - Consider a common emitter amplifier: Now let's say that R B and R C do a fine job at DC biasing the BJT but they are large so they can be neglected for small signal (AC) analysis. In that case, the equivalen ...

Problem 1 a two-phase servomotor has rated voltage applied

Problem 1: A two-phase servomotor has rated voltage applied to its excitation winding. The torque speed characteristic of the motor with Vc = 220 V, 60 Hz applied to its control phase winding is shown in Fig.1. The momen ...

Question -i a star-connected three-phase synchronous

Question - (i) A star-connected, three-phase synchronous induction motor takes a current of 10 amps from a 415 volt supply at unity power factor when supplying a steady load. If the synchronous reactance is 5 ohms/phase ...

Research report1 read 3 to 4 journal articles about digital

Research report 1. Read 3 to 4 journal articles about digital control or industrial control, eg. one particular application, implementation aspect such as selection of sampling time, hardware etc. No text book example is ...

Problem 1given a sequence xn for 0lenle3 where x0 1 x1 1

Problem # 1: Given a sequence x(n) for 0≤n≤3, where x(0) = 1, x(1) = 1, x(2) = -1, and x(3) = 0, compute its DFT X(k). (Use DFT formula, don't use MATLAB function) Problem # 2: Use inverse DFT and apply it on the Fourier ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As