{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

k265cp2sp10 - Computer Problem 2 ECE 265 Sp 10 For this...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Computer Problem 2 ECE 265 Sp 10 For this computer problem you will write a subroutine to find the position of a single character within a null terminated string. \ Parameters STA C’ K ‘ You will pass the address of the null terminated string through the stack. A will hold the character whose position you want to find in the string. B will hold the position within the string upon return from the subroutine. Position will be defined as the offset from the beginning of the string. So if you look for the letter R in the string RST, register B should return 0. Ifyou look for the letter T in the string RST, B should return 2. If the letter isn’t in the string, you should return -1 in B. So if you look for the letter Q in the string RST, register B should return —1. You can assume that the null terminated string is less than 64 characters in length. If the letter appears more than once in the string, return the position of the first one. For example, if you look for S in the string RSST, register B should return 1, not 2. Here is a skeleton main program to test your subroutine. Org 0 Start lds #$FF Ldaa #’C de #string Pshx"; J SR . your_routine Pulx . Loop bra loop ‘ when the code gets here, examine B to see if you get the right * answer 2 W Org $30 Strifig “ABCDEFGHIJ” Feb 0 ‘ this is the null for the null terminated string. Org $40 Your_routine ...... ’ goes here. You have to turn in two things. [You have to submit your asm file through a Carmen drop box before 11:59 pm on May 7, 2010. We will test how your program runs. You also need to turn in a listing of your file no later than the following Monday in class. This program is mostly a combination of your warm-up computer problem and the , example I gave out in class for a subroutine to add two 32 bit numbers. ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern