Now Day 19Textbook p.
318, #2 (read pp. 244-45), #3(loop),
Now Day 18 #4 Before
(or after??) you figure out what it does, print out the program of
figure 6.16.
Put in all the arrows. There are small bits of "dead",
"inaccessible"
code, that never will be executed. Find and mark these .
)
#12
(Write a while loop)
Now day 19
#13 Don't write the
program.
Make a flow chart, with a diamond decision for each part of the if.
(For
example, one diamond for (ch>='A') and another for (ch<='Z')
)
Hand in your original flow chart, and a linearized one. (Notice,
no loop.) (Note: it took a while
for a programmer trained in
a context without compound decisions like (a &&b) to learn to
use them. It's probably just as hard to figure out how to do
without.)
Now day 17: D. Read about little
and big endian in Null/Lobur (outside my door) , sec. 5.2.2 pp.
201-203.
a) Give an example contrasting them.
Did I get it right in class?
b) Make a table Little
endian
Big endian and put these
into the correct columns:
INTEL (PC chip maker) , MOTOROLA (traditional Macintosh
chip maker), Unix, GIF, JPEG, MacPaint, PCPaintbrush (is this Paint?)
c) Give one advantage and one disadvantage of each
method.
- - - - - - - - - - - - - - - - - - - -
Program 5, assigned Day 14 15, due Monday Day 17, Oct 22
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. One problem is writing the "for" loop.
Write it so it just prints out the decimal numbers from 0 to 127, to
make sure it works. The other is printing out a
correct line of output. Write this so it works for a single
decimal value, for instance 66. Then put the two together.
(Or work on one and then the other. ) If you try to do both at
once, at this point, you're likely to get lost. "Top down" is
excellent, but you have to understand your building materials for it to
work.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = =
Notes:
Byte order storage: AB12 stored as PEP does is Big
endian (most significant "first" in lower-addressed bytes),
stored the other way around as 12AB is Little endian. Read about
it (Null/Lobur, chock full of details. Good reference book
if you can get one cheap.)
Tracing the stack: In the Beta8
version of PEP (Pep8beta8Win folder in the lab) the memory window
updates automatically when you step an instruction (and your position
on the scrollbar stays fixed too). So it's really nice for
tracing the stack. Disadvantages: The only window
you can save as a file is the source code window. And that's
iffy. It said it saved but didn't, multiple times, for me. But:
Copy and paste work in all windows except the Assembler Listing.
You can run the beta version and the 8.03 version in separate windows
and copy/paste the source code from one to the other (if you can keep
track of what you're doing. I suggest cleaning up syntax errors
in 8.03 before going to Beta; 8.03 is more robust that way I think.
Branches list, Day13
Continuing with If/else, Intro loops Day 14
Ops that don't affect flags
NOP Ops
Loops: While, Do while, For Handout.
Friday I'll
talk through the remaining loop
examples from the text (Fig
6.11, do while,Fig 6.12, for , ) We'll
work on programming some simple tasks (techniques of Ch. 5 only). Maybe talk about multiplication.
and introduce procedures.
| To Sievers Home Page |
CS225-Fall06/Daya15.htm
|
|