Question

INTEL 80x86 ASSEMBLY LANGUAGE CODE Write a windows32 assembly language program that utilizes a recursive procedure....

INTEL 80x86 ASSEMBLY LANGUAGE CODE

Write a windows32 assembly language program that utilizes a recursive procedure.

The main (_MainProc) procedure should: accept, from the user, a positive integer.

Guard against non-positive integers being entered using a loop.

call the sumseries sub-procedure using the cdecl protocol, receive the results of the sub-procedure, and display the results.

The sumseries sub-procedure should: recursively find the sum of the series: 1*2 + 2*3 + 3*4 + ... + i*(i+1) (This is an iterative definition. Change it to a recursive definition. Refer to your CSC 250 notes if you're not sure how to do this.) return the value back to the main procedure.

Notes: Some representative examples are: sumseries(1) = 2, sumseries(2) = 8, sumseries(3) = 20.

Both main and sumseries must follow the cdecl protocol. If they do not, don't bother turning in the assignment.

It will get a grade of 0! There are ways to do this iteratively, and to even find a closed form expression, but that is not the point of this assignment.

Your program must use a recursive sub-procedure.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

To write a Windows 32 assembly language program it utilizes the "Recursive Procedure".

The main procedure should involves:

1.Accept from the user, a positive integer.Guard using a loop to the non-negative integers.

2.Call the sum series subprocedure using the CDECL protocol.

3.Recieve the results of the sub procedure.

4.Finally display the results.

Program:

LDA 2200H

MOV C, A : " Initalize Counter"

MV1 B , 00H : " Sum = 0"

LX1 H,2201H : " Initialize Pointer"

BACK : MOV A ,M : "Get the number"

ANI 01H : " Mask Bit 1 to Bit 7"

JNZ SKIP : " Dont add number is ODD"

MOV A,B : " Get the sum"

ADD M : " SUM=SUM+data"

MOV B,A : "Store result in B register"

SKIP : INX H : "Increment pointer"

DCRC : " Decrement Counter"

JNZ BACK : " Counter 0 repeat"

STA 2210H : "Store Sum"

HLT : " Terminate program execution"

Add a comment
Know the answer?
Add Answer to:
INTEL 80x86 ASSEMBLY LANGUAGE CODE Write a windows32 assembly language program that utilizes a recursive procedure....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the...

    MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the greatest common divisor of two positive numbers. . • Your program should read the two positive integers using dialog boxes. If they are not positive, a message box should be displayed with an appropriate message. • Your program needs to have a procedure that takes two positive integers as parameters. • You need to follow cdecl protocol for parameter passing. • Display the valid...

  • MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the greatest...

    MASM Assembly Language x86 Processor. Must use windows32 framework Write a non-recursive algorithm to find the greatest common divisor of two positive numbers. . • Your program should read the two positive integers using dialog boxes. If they are not positive, a message box should be displayed with an appropriate message. • Your program needs to have a procedure that takes two positive integers as parameters. • You need to follow cdecl protocol for parameter passing. • Display the valid...

  • Intel 80x86 microprocessors 1. (%25) Write an assembly language program which asks the user to enter...

    Intel 80x86 microprocessors 1. (%25) Write an assembly language program which asks the user to enter his/her name and surname through the keyboard. After the entry: The program clears the left top quarter of the screen and displays the name at the center of that quarter. Similarly the program clears the right bottom quarter of the screen and displays the surname at the center of that quarter. For example: If your name and surname are "Al and "Velir, the following...

  • 2. Write an 80x86 assembly language program that reads byte size signed integers from memory and...

    2. Write an 80x86 assembly language program that reads byte size signed integers from memory and counts the number of zeros. Store this count in memory. End when you get a negative number. (20pts) For example: nums DB 4, 0, 0, 12, 6, 8, 0, 4, -1 count DB 0 after executing the procedure count should be 3 count DB 3.

  • PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs...

    PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to:             -define a recursive procedure/function and call it.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9                      if n <= 5              =...

  • Programming: Write a SPIM assembly language program num-vowel.s based on the hardware implementation method in the...

    Programming: Write a SPIM assembly language program num-vowel.s based on the hardware implementation method in the lab notes and the above practice. The program will do the following: Prompt the user to enter a string. The program will call the procedure vowelp to check if a character entered in the string is a vowel or not. Count how many vowels and how many non-vowels are in the string. Print out the calculated results with appropriate message. Hint: A loop is...

  • ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra,...

    ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra, 4($sp) # save the return address on stack beqz $a0, terminate # test for termination subu $sp, $sp, 4 # do not terminate yet sw $a0, 4($sp) # save the parameter sub $a0, $a0, 1 # will call with a smaller argument jal Factorial # after the termination condition is reached these lines # will be executed lw $t0, 4($sp) # the argument I...

  • Practice Problem [no points]: You should read and understand Fibonacci algorithm, write a code in a...

    Practice Problem [no points]: You should read and understand Fibonacci algorithm, write a code in a high level language of your choice and in Assembly to find a Fibonacci number and check your result. At the end of this assignment a possible solution to this problem is given both in Python and MIPS assembler. Note that it would have been possible to write the Python differently to achieve the same function. . [20 points] Write and debug a MIPS program...

  • Write an assembly language program to calculate the following. (((((20 + 21)X 22)+ 23)X 24)+ 25...)+ 2n Hint:Note that w...

    Write an assembly language program to calculate the following. (((((20 + 21)X 22)+ 23)X 24)+ 25...)+ 2n Hint:Note that when n is even, carrying result is multiplied by 2 n . When n is odd, carrying result is added to 2 n (above formula shows the case where n is odd). As an example, when n= 5, it should print 352. •Your test caller should do the followings. – Read n from keyboard. – Call the sub procedure to do...

  • Write a complete MIPS assembly language program that implements the following pseudocode. program h2 define global...

    Write a complete MIPS assembly language program that implements the following pseudocode. program h2 define global integer variables w, x, y, z -- in the .data section function main() SysPrintStr("Enter an integer >= 0 for w? ") w ← SysReadInt() SysPrintStr("Enter an integer >= 0 for x? ") x ← SysReadInt() SysPrintStr("Enter an integer < 0 for y? ") y ← SysReadInt() z ← 16(w + x) - (3 × -y mod 7) SysPrintStr("z = ") SysPrintInt(z) SysExit() end function...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT