- List the hexadecimal code for the following program (hand
assemble it).
Label Hex Address Instruction
100 Load A
101 Add One
102 Jump Sl
S2, 103 Add One
104 Store A
105 Halt
S1, 106 Add A
107 Jump S2
A, 108 HEX 0023
One, 109 HEX 0001
- What are the contents of the symbol table for the preceding
program?
- Decipher the following MARIE machine language instructions
(write the assembly language equivalent):
- 0010000000000111
- 1001000000001011
- 0011000000001001
- What are the potential problems (perhaps more than one) with
the following assembly language code fragment (implementing a
subroutine) written to run on MARIE? The subroutine assumes the
parameter to be passed is in the AC and should double this value. The
Main part of the program includes a sample call to the subroutine. You
can assume this fragment is part of a larger program.
Main, Load X
Jump Subl
Sret, Store X
...
Subl, Add X
Jump Sret
Use the Marie simulator for these next problems.
Show screen shots of the simulator after loading your code. Include
source code listings. (.mas files).
- Write the following code segment in MARIE's assembly language:
if X > 1 then
Y := X + X;
X := 0;
endif;
Y:=Y+l;
- Write the following code segment in MARIE assembly language:
X := 1;
while X < 10 do
X := X+l;
endwhile;
- Write the following code segment in MARIE assembly language:
Sum := 0;
for X := 1 to 10 do
Sum := Sum + X;
- Write a MARIE program using a loop that multiplies two positive
numbers by using repeated addition. For example, to multiply 3 * 6,
the program would add 3 six times, or 3 + 3 + 3 + 3 + 3 + 3.
- Write a MARIE subroutine to subtract two numbers.
- Write a MARIE program to evaluate the expression A * B + C * D.
(Hint: Use the results of previous problems).