Hw13SLN - ECE 212 HW 13 SOLUTIONS p 1 of 10 ECE 212 Homework Set 13 SOLUTIONS 1 For the given memory contents determine the effect of each

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 212 HW 13 SOLUTIONS p 1 of 10 ECE 212 Homework Set 13 SOLUTIONS 1. For the given memory contents, determine the effect of each instruction (the instructions are executed in sequence). ` Location Contents 00FD 35 00FE 6E 00FF C8 0100 1F 0101 A9 0102 B2 0103 7E 0104 CD 0105 B2 A B X Y ?? ?? ???? ???? ldaa 0x105 ldab 0xFD ldx #0xFD ldx 0x101 ldx #0x101 ldaa 3,X ldab 0,X ldx 2,X Solution: A B X Y ?? ?? ???? ???? ldaa 0x105 B2 ?? ???? ???? ldab 0xFD B2 35 ???? ???? ldx #0xFD B2 35 00FD ???? ldx 0x101 B2 35 A9B2 ???? (X receives the contents of mem locs 0101, 0102) ldx #0x101 B2 35 0101 ???? ldaa 3,X CD 35 0101 ???? ldab 0,X CD A9 0101 ???? ldx 2,X CD A9 7ECD ???? (X receives the contents of mem locs 0103, 0104)
Background image of page 1

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

View Full DocumentRight Arrow Icon
ECE 212 HW 13 SOLUTIONS p 2 of 10 2. Write a 6812 program to accept five Bytes from PortA and to put them into memory locations 0150 through 0154. Use indexed addressing. One Solution: main: ldx #0x150 ;Initialize a pointer to the first location. ldaa PortA ;Get a Byte, staa 1,X+ ; store it, and point to the next location. ldaa PortA ;Get the second Byte, staa 1,X+ ; and store it. ldaa PortA ;And the third Byte, staa 1,X+ ; ldaa PortA ; fourth Byte, staa 1,X+ ; ldaa PortA ; fifth Byte. staa 0,X ; jmp DBug12 ;All done. Another Solution: main: ldx #0x150 ;Initialize a pointer to the first location. movb PortA 1,X+ ;Get a Byte, store it, ; and point to the next location. movb PortA 1,X+ ;Same for next Byte, movb PortA 1,X+ ; third Byte, movb PortA 1,X+ ; fourth Byte, movb PortA 0,X ; and fifth. jmp DBug12 ;All done.
Background image of page 2
ECE 212 HW 13 SOLUTIONS p 3 of 10 3. Write a 6812 program to complement the contents of each Byte in memory locations 0160 through 0164. (Can you do this without reading the data into A or B?) One Solution: The instruction com can the complement the contents of a memory location. This instruction does not affect the contents of registers A or B. We can use indexed addressing to access the memory location. main: ldx #0x160 ;Initialize a pointer to the first location. com
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/17/2008 for the course ECE 212 taught by Professor Greco during the Spring '08 term at Lafayette.

Page1 / 10

Hw13SLN - ECE 212 HW 13 SOLUTIONS p 1 of 10 ECE 212 Homework Set 13 SOLUTIONS 1 For the given memory contents determine the effect of each

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online