hw8 - associated with the subroutine. The start of the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
- 1 - 1. (20 points) The lecture notes describe a program for converting a sequence of decimal digits stored as ASCII characters into an internal value. The program assumes the existence of a multiply instruction, which is not present in the WashU-2 processor. In this problem, you are to write a small program that multiplies an input value by ten and returns the resulting product in the ACC. The program should be written so that it can be used by as part of a larger program. In machine-language programming, such programs are commonly called subroutines . Subroutines need a method for returning control to the calling program when they are done. This is most often done using a stack , but in this case we will use a simpler method. Specifically, the calling program will store its return value in the first memory location associated with the subroutine. It will then load the subroutine argument (the value to be multiplied by 10) into the accumulator, and branch to the second memory location
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: associated with the subroutine. The start of the subroutine is shown below. Complete the subroutine, using whatever method you like to multiply-by-ten. Include comments to explain what you’re doing. The last instruction of the subroutine should be a branch that transfers control back to the calling program. Remember that the product should be in the accumulator when your subroutine returns. address instruction comment 2000 0000 -- return address 2001 5010 M[2010]=ACC -- save argument value CSE 260 – Digital Computers: Organization and Logical Design Homework 8 Jon Turner 10/28/2010 - 2 - Write a code fragment that uses the subroutine to compute one hundred times M[1020], where M[1020] is the value stored in memory location 1020. Store the result of the computation in M[1021] . Start your program at memory location 1000. address instruction comment 1000...
View Full Document

This note was uploaded on 11/12/2010 for the course KTMT KTMT04 taught by Professor Son during the Spring '10 term at Dallas Colleges.

Page1 / 2

hw8 - associated with the subroutine. The start of the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online