??? 04/16/08 10:42 Read: times |
#153455 - No !!! Responding to: ???'s previous message |
AJMP and ACALL support target addresses within the same physical 2K addressable page as the following instruction. Calling the operand byte of an AJMP or an ACALL an offset may be what is confusing you. When you combine 3-bits from the opcode and the 8-bit operand you get an 11-bit value that replaces the low 11-bits of the program counter. The program counter (PC) value to which this replacement is made is the PC value that is two address locations up from the opcode location.
So these 11 bits are a PAGE address and not really an offset. The use of the term offset should be carefully used for relative addressed type instructions where the operand value is added to a post fetch PC value. (And depending upon the MCU type instruction set such adding may be signed or unsigned). This is the type of behavior you get in the 8051 instruction set for the SJMP where the value of the instruction operand is a signed 8-bit offset. What this all means is that if you position an ACALL or AJMP opcode right at the beginning of a 2K boundary of the CODE space then the target address can be any address from the ACALL/AJMP opcode up to and including any address within that 2K page. If you place the ACALL/AJMP someplace within a 2K page (but not right near the end) the target address can be anywhere within that same 2K page. If you position the ACALL or AJMP opcode right at the last address or second to last address of a 2K page then the target address of the instruction is within the next 2K page. Michael Karas |