1 / 10

Homework Problem 2.6

Homework Problem 2.6. By Valvano. Description of 2.6. Hand assemble the following program. Include the symbol table, the address and machine code in hexadecimal for each instruction. (hint: Use Program 2.2 and Example 2.2). Initialization.

ann
Download Presentation

Homework Problem 2.6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Homework Problem 2.6 By Valvano

  2. Description of 2.6 • Hand assemble the following program. Include the symbol table, the address and machine code in hexadecimal for each instruction. (hint: Use Program 2.2 and Example 2.2)

  3. Initialization • The first several lines use the pseudo op equ to initalize the direction registers and the port addresses. • The symbol table begins with these values • DDRH--$0262 • DDRT--$0242 • PTH--$0260 • PTT--$0240

  4. Initialization (cont.) • The pseudo op org indicates the start of the EEPROM information (at location $4000). • Main is the label for the first line of code so it is entered into the symbol table. • Main--$4000

  5. Hand assembly • The next line is an instruction. • ldaa #$FF • The machine code for ldaa is $86 and the operand (immediate addressing) is found in the machine code word: $86FF (see page 50 and 51) and the Freescale CPU 12 manual.

  6. Hand Assembly • staa DDRT • At the top of page 51, we see that the store accumulator function is extended addressing. • The machine code becomes $7A0242. • ldaa #$00 and staa DDRH are handled in a similar fashion.

  7. Hand Assembly (cont.) • loop is then added to the symbol table. • loop--$400A • bra loop is discussed on page 51, and is said to be PC relative (PC = has already been incremented by two bytes at this time so its value is $4012 and if we add F8 to this we get $400A. • The code for bra is 20 and we have $20F8 for the machine code.

  8. Final result • Symbol Table • DDRH-- $0262 • DDRT-- $0242 • Main-- $4000 • PTH-- $0260 • PTT-- $0240 • loop-- $400A

  9. Final Result (cont.) • $0262 • $0242 • $0260 • $0240 • $4000 86FF • $4002 7A0242 • $4005 8600 • $4007 7A0262

  10. Final Result (cont.) • $400A B60260 • $400D 7A0240 • $4010 20F8 • $FFFE • $FFFE 4000

More Related