Lsb must be 0 20 machine code of goto machine the

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: t 20 bits are included. Why? included. – Program memory Program are organized as 2-byte blocks. LSB must be 0. 20 Machine code of GOTO Machine • The goto Main line in our previous The example forces PC to 0x000004, where the Main label is. the • The machine code is The EF02 EF F000 • Thus, the program goes to Thus, 0000 0000 0000 0000 0010 0 in binary 0000 0000 0000 0000 0010 (i.e., 0x000004 in hex) (i.e., 21 Example for the goto instruction Example • e.g., In our program, we want to branch e.g., to address 0x000020. What is the machine code of the goto instruction? machine • The program will go to The 0000 0000 0000 0001 0000 0 0000 0000 0000 0001 0000 EF10 F000 22 call instruction call 23 Long Jumps Long • bra – allocated 11 bits for storing the relative allocated address of the targeting instruction. address – bra can jump forward for a max. of 1023 bra instructions and backward for a max. of 1024 instructions. 1024 24 rcall rcall • Relative address ranges from -1024 to Relative 1023. 1023. 25 Conditional Branching Conditional • Relative address ranges from -128 to Relative 127. 127. 26 27 28 Answers Answers • • • • Line 23: RA = ½ * (3C-38) = 2 Line 23: D802 Line Line 24: Back at 000036 0 0000 0000 000-0 001-1 011-0 0000 – 0001B • EF18 F000 • Line 29: Delay at 00004A • 0 0000 0000 000/0 010/0 101/0 – 00025 • EC25 F000 29 • • • • Line 33: RA = ½ * (58-50) = 4 Line 33: D804 Line D804 Line 35: DelayLoop at 00004E 0 0000 0000 000/0 010/0 111/0 0000 – 00027 • • • Line 35: EF27...
View Full Document

Ask a homework question - tutors are online