li1drag0n 0 Newbie Poster

I have this assignement and i have no idea how to code it...i was hoping that one of you guys can help me out here...thanks in advance!!!

Description:
This is a 2 part lab assignment (labs number 6 and 7).
High-Level languages, like C++, take advantage of pre-written and compiled functions (e.g. the standard
C++ library). This requires the ability to code and assemble subroutines in separate files, and to link all of
the separate files into a single executable.
Part I:
Instructions
The first part of this lab requires that you code, assemble, and test a number of subroutines that manipulate
strings (InString, StrLen, StrSearch, StrUpper). Place all 4 subroutines in a file named string.a68. Ensure
that you document each and every subroutine. Create another program in a separate file named lab06.a68.
This file contains your main driver program which “exercises” your subroutines. Your driver program
should be based on the following pseudo-code:
Prompt user to enter a string
GET the string
Display the length of the string
Prompt the user to enter a character to search for
GET the character
Display the number of occurrences of the character in the string
Convert all lower case characters in the string to upper case
Display the modified string
Ask the user if they want to process another string
Go to step 1 if necessary
Subroutine Description:
1. InString
Reads a string from the keyboard and stores it in memory.
Pointer to storage for string passed in an address register.
String stored at given memory location.
String is Null terminated.
2. StrLen
Returns length of a string.
Pointer to string passed using an address register.
Length returned in a data register.
3. StrSearch
Returns the number of occurrences of a specified character in a string.
Pointer to string passed using an address register.
Character to search for is passed in a data register
Number of occurrences returned in a data register.
4. StrUpper
Converts all lower case characters in a string to upper case
Pointer to string passed using an address register.


Lab 07

Description
Most high-level languages do not pass parameters back and forth using registers. Parameters, both value and
reference, are passed on the stack. In lab06 you wrote a number of string handling subroutines. It is
assumed that arguments required for these routines where passed using a register.
Note:
The “C” calling format specifies that arguments be pushed to the stack from right-to-left and the
caller clears the stack after the call. The “Pascal” calling format specifies that arguments be pushed
to the stack from left-to-right and the subroutine has the responsibility of clearing the stack.
Instructions
Your task is to modify the subroutines written in Lab06 to pass parameters using the stack. You should
implemented the “C” calling format as described above. You will also save register contents on the stack.
This has been explained in class (and in the on-line lectures). Your subroutines, if using registers should save
and restore the register contents using the stack. None of your subroutines should destroy the contents of a
register. Further, you should make use of the .EQU and/or .SET directives to make your code more readable.
You should follow the “C” calling conventions (arguments are placed on the stack right to left, the caller is
responsible for clearing the stack after the call). Further, you should use the .EQU or .SET directives to
make your code more readable (as per the example in lecture).
1. Modify your subroutines developed in Lab06 so all parameters/arguments are obtained from the
stack. (Subroutines which return a value will continue to use a data register for this purpose.)
Rename your string.A68 file to string2.A68. Implement the “C” calling format. Use the .EQU and
.SET directives to make your code more readable.
2. Your subroutines do not destroy any registers.
3. Modify your driver program (lab06.A68) to pass parameters on the stack. You should rename your
driver program from lab07.A68 to lab07.A68.
4. Don’t forget to modify you PDL to reflect the changes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.