Changes

Jump to navigation Jump to search
3,855 bytes added ,  13:50, 25 September 2009
m
copypasta from wiibrew
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->

=== Usage ===
Use [[Template:reg8]] for 8-bit registers. Make sure that the bit sizes add up and that your field count is correct. Fields with no name show up in dark grey.

<pre><nowiki>
{{reg8 | MAGIC_REGISTER | addr = 0x1337 | fields = 4
|7 !6 !5 !4 !3 !2 !1 !0 ! Bit
|3 |1 |1 |3 | Size
|U |R |R |W | Access
| |FOO |BAR |QUUX | Name
}}</nowiki></pre>

Gives:
{{reg8 | MAGIC_REGISTER | addr = 0x1337 | fields = 4
|7 !6 !5 !4 !3 !2 !1 !0 ! Bit
|3 |1 |1 |3 | Size
|U |R |R |W | Access
| |FOO |BAR |QUUX | Name
}}

You can also omit some informational parts and collapse the layout; the result is the same:

<pre><nowiki>
{{User:Marcan/BitTest | MAGIC_REGISTER | addr = 0x1337 | fields = 4 |
|3 |1 |1 |3 |
|U |R |R |W |
| |FOO |BAR |QUUX |
}}</nowiki></pre>

Gives:
{{reg8 | MAGIC_REGISTER | addr = 0x1337 | fields = 4
|7 !6 !5 !4 !3 !2 !1 !0 ! Bit
|3 |1 |1 |3 | Size
|U |R |R |W | Access
| |FOO |BAR |QUUX | Name
}}

Use [[Template:reg16]] for 16-bit registers:

<pre><nowiki>{{reg16 | MAGIC_REGISTER | addr = 0x1337 | fields = 5 |
|3 |1 |1 |5 |6 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS |
|}}</nowiki></pre>

Gives:
{{reg16 | MAGIC_REGISTER | addr = 0x1337 | fields = 5 |
|3 |1 |1 |5 |6 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS |
|}}

Use [[Template:reg24]] for 24-bit registers:

<pre><nowiki>{{reg24 | MAGIC_REGISTER | addr = 0x1337 | fields = 5 |
|7 |1 |1 |5 |10 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS |
|}}</nowiki></pre>

Gives:
{{reg24 | MAGIC_REGISTER | addr = 0x1337 | fields = 5 |
|7 |1 |1 |5 |10 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS |
|}}

For 32-bit registers, the layout (and the template parameters) are split into two 16-bit halves:
<pre><nowiki>{{reg32 | MAGIC_REGISTER | addr = 0x1337 | hifields = 5 | lofields = 6
|31 !30 !29 !28 !27 !26 !25 !24 !23 !22 !21 !20 !19 !18 !17 !16 ! Bit
|3 |1 |1 |5 |6 | Size
|U |R |R |W |W | Access
| |FOO |BAR |QUUX |LEETNESS | Name
|15 !14 !13 !12 !11 !10 !9 !8 !7 !6 !5 !4 !3 !2 !1 !0 ! Bit
|1 |2 |2 |8 |2 |1 | Size
|D |EA |DB |EE |F |? | Access
|! |FOO2 |BAR2 | |QUUX |EVIL| Name
}}</nowiki></pre>

Or:
<pre><nowiki>{{reg32 | MAGIC_REGISTER | addr = 0x1337 | hifields = 5 | lofields = 6 |
|3 |1 |1 |5 |6 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS ||
|1 |2 |2 |8 |2 | 1 |
|D |EA |DB |EE |F | ? |
|! |FOO2 |BAR2 | |QUUX | EVIL |
}}</nowiki></pre>

Both give:

{{reg32 | MAGIC_REGISTER | addr = 0x1337 | hifields = 5 | lofields = 6 |
|3 |1 |1 |5 |6 |
|U |R |R |W |W |
| |FOO |BAR |QUUX |LEETNESS ||
|1 |2 |2 |8 |2 | 1 |
|D |EA |DB |EE |F | ? |
|! |FOO2 |BAR2 | |QUUX | EVIL |
}}

=== See also ===
* [[Template:Reg8]]
* [[Template:Reg16]]
* [[Template:Reg32]]

<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->

</includeonly>

Navigation menu