Download Lab #2 (15 points)

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Lab #2 (20 points)
Due: Thursday, February 19
1.
Address
(Hex)
0000
Name: ______________________________
Use the binary program shown in the second column of the table below to fill in the rest of the
table. The beginning address of the program is given:
Instruction/Data
Hex
value
Explanation (if instruction, indicate what it does; if
data, give decimal value)
1100 0001 0000 0000 0001
0001
0111 0001 0000 0000 0001
0011
1010 0001 0000 0000 0001
0101
1111 0001 0000 0000 0001
0000
0101 0001 0000 0000 0001
0000
0000 0000
0000 0000
0000 0000 0000 0101
0000 0000 0000 0011
0000 0000 0011 0000
2.
Load the hex version of the program from part 1 into the Pep/8 simulator. Show the output below:
3.
Write a machine language program to add the three numbers 2, -3, and 6 and output the sum on
the output device. Load and execute the program on the Pep/8 simulator. Take a screenshot of the
program run to turn in (see note at end). Your algorithm will be something like the following:
 load 2 into a register (A or X)
 perform a subtract instruction with 3 (which must be stored in memory, at an address past the
end of your instructions)
 perform an add instruction with 6 (again, from memory)
 perform an or instruction with hex value 35 (from memory) to convert the integer value 5 to
the ASCII value ‘5’
 store the result from the register to memory
 output the result
4.
Write a machine language program to input two one-digit numbers whose sum is also a single
digit. Have the program add the numbers, then output their sum. Execute your program on the
Pep/8 simulator; take a screenshot of the program run to turn in.
Taking a screenshot:
 Hold down the shift key and hit the prt sc (print screen) key
 Open up Paint and hit paste: your screen shot should appear in the window
 You can print directly from Paint, or copy and paste the image to Word and print from
there
Turn in: this sheet and your 2 screen shots
Computer Organization & Assembly Language Programming
Sheller
coalpLab2s07 - work
Spring 2009
Page 1