hw5_solution

# hw5_solution - and the 6 th bits of the value at \$C100 and...

This preview shows pages 1–2. Sign up to view the full content.

ECE331 SS-08 HOMEWORK #5 Solution Problems from the textbook Chapter 2: Fundamental: 8. The effective address is calculated as the contents of X+20. The contents of this effective address are loaded into accumulator A. 10. Program: ORG 0000 FCB \$12 FCB \$10 12. (a) The directive initialized two memory locations designated by label DATA with \$C2, \$00. (b) The FCB directive initializes the next memory location with \$F0. (c) The FDB directive initializes the next two 8-bit memory locations with \$11 and \$00. 13. FCB allows you to initialize the reserved location. RMB does not. Advanced: 9. We must first calculate the number of bytes for each instruction so we can determine the offset. DECA Æ 1 byte TSTA Æ 1 byte BNE Æ 2 bytes Thus we need to jump back 4 bytes. -4 = \$FC. Therefore, the relative address should be \$FC. Challenging: 3. There are many ways to do this. Here is one possible solution: 5. The first three instructions store \$F0 and \$0D to memory locations \$C100 and \$C101, respectively. The BSET instruction sets the 2 nd

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and the 6 th bits of the value at \$C100, and the BCLR instruction clears the 0 th and the 4 th bits of the value at \$C101. The resulting values, therefore, are \$F4 and \$0C in \$C100 and \$C101 respectively. 6. Many ways to do this. Most common is to set up a mask to check the bits. Problems from the textbook Chapter 3: Fundamental: 2. Each 68HC12 assembler creates two files during an assembly process: “filename.s19” and “filename.lst”. The “s19” file is the machine language file which is loaded onto a 68HC12 controller for execution. The “lst” file contains the hexadecimal machine language code, the original assembly language code, and the memory locations where the machine code is stored. The “lst” file is a valuable tool for debugging purposes. In addition, some assemblers create other files such as a backup file and a simulation file for 68HC12 simulators. Challenging: 2. Hand assembled program is as follows: Note that RESULT is allocated memory at address \$C20D, at the end of the program....
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern