Jump to content
IGNORED

How to feel like a dumbass in just a few steps.


marc.hull

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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 ;-).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...