marc.hull Posted June 25, 2011 Share Posted June 25, 2011 Step 1) Spend about 40 hours writing a program full of indexed memory accesses. Step 2) Spend another 10 hours or so trying to debug perfectly good logic. Step 3) RTFM and discover that R0 cannot be used as an index. Step 4) Pull head out of ass 2 Quote Link to comment Share on other sites More sharing options...
matthew180 Posted June 25, 2011 Share Posted June 25, 2011 If you want to know why R0 can not be used as an index register, read on... Various 9900 instructions can have source and / or destination "addressing modes". The 9900 has 5 addressing modes for instructions that support them (some instructions are fixed register only, immediate only, etc.) A dual operand instruction that supports addressing modes is encoded like this: | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +-----------+---+-------+---------------+--------+--------------+ | OPCODE | B | TD | D | TS | S | +-----------+---+-------+---------------+--------+--------------+ The 9900 has about 7 various instruction formats, but any that support the various addressing modes will have the TS/S and / or TD/D (source and destination) bits. S and D encode the register to use, 0 to 15. The mode is encoded in the 2 bits (TS or TD) of the instruction (as seen above) and are encoded as follows: TS S Addressing Mode ----+----------+---------------- 00 | 0,1...15 | Workspace register 01 | 0,1...15 | Workspace register indirect 10 | 0 | Symbolic 10 | 1,2...15 | Indexed 11 | 0,1...15 | Workspace register indirect auto increment ----+----------+---------------- You may have noticed that there are 5 addressing modes, but only 2-bits to encode the mode, and with 2-bits you only have 4 possible combinations. Thus, if you look at the table above, you will see '10' is used to indicate both Symbolic AND Indexed addressing, and the source (or destination) register is used to determine the final mode. When TS or TD is '10', and the register (S or D) is 0, then that indicates Symbolic addressing, otherwise a register of 1...15 indicates Indexed addressing. Thus, you can't use R0 for Indexed mode because that actually causes the instruction mode to be Symbolic. 1 Quote Link to comment Share on other sites More sharing options...
marc.hull Posted June 25, 2011 Author Share Posted June 25, 2011 If you want to know why R0 can not be used as an index register, read on... Various 9900 instructions can have source and / or destination "addressing modes". The 9900 has 5 addressing modes for instructions that support them (some instructions are fixed register only, immediate only, etc.) A dual operand instruction that supports addressing modes is encoded like this: | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +-----------+---+-------+---------------+--------+--------------+ | OPCODE | B | TD | D | TS | S | +-----------+---+-------+---------------+--------+--------------+ The 9900 has about 7 various instruction formats, but any that support the various addressing modes will have the TS/S and / or TD/D (source and destination) bits. S and D encode the register to use, 0 to 15. The mode is encoded in the 2 bits (TS or TD) of the instruction (as seen above) and are encoded as follows: TS S Addressing Mode ----+----------+---------------- 00 | 0,1...15 | Workspace register 01 | 0,1...15 | Workspace register indirect 10 | 0 | Symbolic 10 | 1,2...15 | Indexed 11 | 0,1...15 | Workspace register indirect auto increment ----+----------+---------------- You may have noticed that there are 5 addressing modes, but only 2-bits to encode the mode, and with 2-bits you only have 4 possible combinations. Thus, if you look at the table above, you will see '10' is used to indicate both Symbolic AND Indexed addressing, and the source (or destination) register is used to determine the final mode. When TS or TD is '10', and the register (S or D) is 0, then that indicates Symbolic addressing, otherwise a register of 1...15 indicates Indexed addressing. Thus, you can't use R0 for Indexed mode because that actually causes the instruction mode to be Symbolic. Naw, it's enough for me to know that I can't do it . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.