PROGRAM 1 Assigned Friday Sept.
1, Day 4. Due Day 6
(Wednesday)
Due Day 7 (Friday) I hope.
Write a correct assembly language program which does this:
Comments: We are changing "types" on the
data, from thinking of it as string data to thinking of it as word
(2-byte) chunks. I am deliberately trying to break down all your
"type" assumptions from C++/Java, to show they don't exist at this
level.
a) Uses an assembler directive (dot command) to place the string
Hi into memory when the program is loaded.
b) On running, loads the two-bite string Hi into the A
register.
Hint: two bites is a Word! Use LD.
c) Adds 6 to it. (Where will you get the 6? Store
it in memory beforehand.)
d) Stores the Word result back in the location of the original string.
e) Outputs the two characters of the result.
(note, all we have for output so far is CHARO, so have to output the 2
bytes of the word separately.)
Run, Debug, Email me the source, Hand in
the listing, and the output. Tell if
it worked, if not how not, who gave help on what.
Program 2, Due Monday Day 11.
Wednesday Day 12. You can write it now.
Write
a program that will input 2 decimal numbers from the keyboard (or batch input), store
them
in memory locations, add them, store the result in a third location,
and
output the two numbers followed by their sum.
Check the flags after the Add. Create 6
sets of legal input that will cover all the possibilities shown on p.
103; record
your results and verify that the C flag detects overflow for unsigned
addition,
and the V flag detects overflow for signed addition. (Note that
the
output will always be in signed values; to find the unsigned equivalent
of a negative number, add 65536, or read the value off from the (dec)
box in the CPU when the number is in the register.)
Hand in the listing, your 6 sets of input and their sums, and the
results of the C and V flag after each addition..
Program 5, assigned
Day 21, Friday Oct 13, Due Wednesday Day 23, Oct 16
For loop: What will
CHARO output? Write a program.
"Global" variable style is 0K.
For j = 0 to 127
output j, a space, the character with that ascii number, a space, the
character with
that ascii number + 128, and line feed.
Example: for decimal 66, the
output will be 66 B Â
<LF>
Save your output file, open it in Word or equivalent, and print out the
results for 30 up; describe any effects from values below 30 (you know
hex 0A = 10D is the linefeed)
Programming/debugging
suggestions. You should have done the output for a single j
for Day 19, Problem A. So now you just need to put it in a For
loop.
Program 6, Assigned Wed. Day 23, Due Monday
Day 25, Oct. 21
Create a program with procedures, no parameters,
no local variables, no returned values .
Some procedure should call another (so you have calls nested 2 deep),
and
some procedure should be called twice. It should be a
little different from the one at day 22. Hand in the listing,
output, and a memory trace, showing which ops move the stack
pointer,
and what is on the stack inside/after each procedure call.
Program 7, Multiplication Assigned Friday Day 24, Due
Friday Day 27, Oct. 27.
Program specification:
The program should get 2 numbers from Batch input and
multiply them, then output the result.
The algorithm should be the shift-and-add algorithm (multiplication).
Write the program to work for input numbers > 0 and <
25510. You do not need to check that the result
is out of range (though it could print out as a negative number.
Why?).
You may write it with or without a function/procedure. You may
use
global variables (direct addressing) or local (stack-relative), your
choice.
Create a suitable set of test data pairs, and submit the results from
these as well as the listing.
| To Sievers Home Page |
CS225-Fall06/Programs.htm
|
|