Difference between revisions of "CSC270 Homework 7 2012"

From dftwiki3
Jump to: navigation, search
(Problem #3)
(Question 1)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
<bluebox>
 
<bluebox>
This homework assignment is due on 4/4/12, at 1:00 p.m.  You may work on this lab in teams of at most 2 people.
+
This homework assignment is due on 4/4/12, at 1:00 p.m.  You may work on this assignment in teams of at most 2 people.
 
</bluebox>
 
</bluebox>
  
Line 30: Line 30:
 
=Problem #2=
 
=Problem #2=
 
===Question 1===
 
===Question 1===
Using the same idea as the "Hacking" problem in the last [[CSC270 Lab 7 2012|lab]] (putting your name into the display of the kit), pick a message that you want to display, and ''hack'' the code you used in the lab to make it display your code.
+
Using the same idea as the "Hacking" problem in the last [[CSC270 Lab 7 2012|lab]] (putting your name into the display of the kit), pick a message that you want to display, and ''hack'' the code you used in the lab to make it display your message.
  
 
Take a picture (or several pictures) of the display showing your message and include it/them with your answer
 
Take a picture (or several pictures) of the display showing your message and include it/them with your answer
Line 83: Line 83:
  
 
===Question 3===
 
===Question 3===
* How many cycles does your program take to execute from first to last instruction.
+
* How many cycles does your program take to execute from first to last instruction. How long does it take, in &mu;sec to run from beginning to end?
  
  
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 +
<onlydft>
 +
[[Image:6800ProgrammingIsEasyAndFun.png]]
 +
</onlydft>
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 
[[Category:CSC270]][[Category:6811]][[Category:Homework]]
 
[[Category:CSC270]][[Category:6811]][[Category:Homework]]

Latest revision as of 07:41, 5 April 2012

--D. Thiebaut 13:43, 28 March 2012 (EDT)



This homework assignment is due on 4/4/12, at 1:00 p.m. You may work on this assignment in teams of at most 2 people.


Problem #1

Disassemble the code you used in the lab to display your message. This requires looking up the op-codes and figuring out what instructions they correspond to, and write the whole program using mnemonics.

The reverse table found here will help you do the reverse engineering.

The second table below (taken from the Heathkit Manual) is a list of the different Operating System entry points for the 6811 Kit. You'll see addresses that are used in the program you are reverse-engineering.

6811RomEntriePoints.png


For example, if you wanted to output an Ascii character, say the letter 'A', to the screen of the 6811 Kit, you'd use the function at Address C006, which requires the character to be in AccB:

         LDAB   #41                   ;Hex for 'A'
         JSR     C006

Even though the handout says "JMP C006", one should actually use a JSR instruction, which means "JMP to Subroutine": it's a call to a function, and execution will automatically return to the instruction following the JSR when the function is done. In other words, there is a function at Address C006 that will print the ASCII equivalent to whatever hex number is in Accumulator B. When the printing to the screen is done, the processor returns automatically to the instruction following the JSR instruction.

Problem #2

Question 1

Using the same idea as the "Hacking" problem in the last lab (putting your name into the display of the kit), pick a message that you want to display, and hack the code you used in the lab to make it display your message.

Take a picture (or several pictures) of the display showing your message and include it/them with your answer

Question 2 (optional extra credit)

Write the code of your hacked program in assembly using the knowledge you acquired in Problem 1.

Problem #3

Question 1

  • Write a program in 6800 Assembly Language that computes the quantity
        Y =  3 * ( a + b ) - ( c - 2 )


where Y, a, b, and c are byte variables.
  • Assemble your code by hand.
  • Write the listing of your code in a format similar to the example below:


                        ORG     0000            ; specifies starting address 0000                                                 
	
0000 96 10      start:  LDAA    a               ; get Mem[0000] in ACCA (direct addressing)                                       
0002 D6 11              LDAB    b               ; get Mem[0001] in ACCB                                                           
0004 1B                 ABA                     ; ACCA <- ACCA + ACCB                                                             
0005 97 12              STAA    c               ; Mem[0002] <- ACCA                                                               
0007 BD C0 00           JSR     C000		; jmp back to Operating System                                                    

                        ORG     0010            ; specifies starting address 0                                                    

0010 02         a       DB      2               ; 2 is stored at 0010                                                             
0011 03         b       DB      3               ; 3 is stored at 0011                                                             
0012 00         c       DB      ?               ;


  • Make sure you include the opcodes on the left of the program, including the address for each instruction.


Question 2

  • How many bytes of code plus data does your program take?

Question 3

  • How many cycles does your program take to execute from first to last instruction. How long does it take, in μsec to run from beginning to end?













...