Date: Tue, 05 Nov 1996 00:31:58 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Sat, 07 Sep 1996 23:25:08 GMT Content-length: 2313
Name (printed): |
Name (signed): |
(1) T/F, 10 points, 1 point each
Note: The complete SAL instruction set is given in Appendix A of the textbook, page 386.
(a) all variables in SAL programs are global
(b) the SAL statement "get x" works the same for all types of "x"
(c) the label "b" could be used for a variable in a SAL program
(d) variables must be declared before they are used in SAL programs
(e) when executed, the SAL statement "b (ret)" will cause a branch to the SAL statement labeled by "ret:"
(f) when executed, the SAL statement "j ret" will cause a branch to the SAL statement labeled by "ret:"
(g) every SAL program must have a "__start:" label in it somewhere
(h) "done" is part of the SAL instruction set
(i) "rem" is used to put a remark or comment in a SAL program
(j) type declarations are made in SAL programs so that type checking can be done by the assembler
(2) 2 points
In a single sentence, explain what "computer architecture" means.
(3) 8 points
Translate the following C code into the equivalent SAL statements. Assume that all variables are of C type "int."
if ((A > 0 ) || ( B == 1 )) {
C = A + B * 5;
} else {
A++;
B = ( A / B ) % C;
}