UMULT (Super FX): Difference between revisions
(created page) |
(made flags affected more prominent) |
||
(44 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''UMULT''' is an unsigned multiplication [[Super FX]] instruction. | {| class="wikitable" style="float:right;clear:right;width:50%" | ||
!colspan="8"|Basic Info | |||
|+ | |||
|'''Addressing Mode''' | |||
|'''Opcode''' | |||
|'''Length''' | |||
|'''ROM Speed''' | |||
|'''RAM Speed''' | |||
|'''Cache Speed''' | |||
|+ | |||
|[[Implied]] (type 1) | |||
|3D8n | |||
|2 bytes | |||
|6 or 8 cycles | |||
|6 or 8 cycles | |||
|2 or 3 cycles | |||
|+ | |||
|[[Immediate]] | |||
|3F8n<sup>[4]</sup> | |||
|2 bytes | |||
|6 or 8 cycles | |||
|6 or 8 cycles | |||
|2 or 3 cycles | |||
|} | |||
{| class="wikitable" style="float:right;clear:right;width:30%" | |||
!colspan="9"|Flags Affected | |||
|+ | |||
|[[B Flag|B]] | |||
|[[ALT1]] | |||
|[[ALT2]] | |||
|[[O/V]] | |||
|[[Sign Flag|S]] | |||
|[[CY]] | |||
|[[Zero Flag|Z]] | |||
|+ | |||
|0 | |||
|0 | |||
|0 | |||
|. | |||
|S | |||
|. | |||
|Z | |||
|} | |||
'''UMULT''' is an unsigned multiplication [[Super FX]] instruction. The factors are the low byte of the [[source register]] and the low byte of the register specified in the operand or an immediate value. The product is stored in the [[destination register]]. | |||
UMULT utilizes the 8-bit multiplier only once, so it is fast.<sup>[2]</sup> | |||
The exact number of cycles depends on the state of the [[CONFIG]] register. | |||
The [[ALT0]] state is restored. | |||
The source and destination registers should be specified in advance using [[WITH]], [[FROM]], or [[TO]]. Otherwise, R<sub>0</sub> serves as the default. | |||
The page of documentation on the immediate addressing mode of UMULT appears to be missing from the official dev manual. As the SNES scene has access to the two manual pages with page numbers adjacent to UMULT R<sub>n</sub>, it appears to have been printed that way. The information on this page for that addressing mode comes from [4]. | |||
==== Syntax ==== | |||
<pre> | |||
UMULT Rn | |||
UMULT #n | |||
</pre> | |||
==== Example ==== | |||
Let: | |||
S<sub>reg</sub> : R<sub>3</sub> | |||
D<sub>reg</sub> : R<sub>0</sub> | |||
R<sub>3</sub> = 364fh | |||
R<sub>8</sub> = b2cfh | |||
After executing UMULT R<sub>8</sub>: | |||
R<sub>0</sub> = 3fe1h | |||
=== See Also === | === See Also === | ||
* [[FMULT]] | * [[FMULT]] | ||
* [[LMULT]] | |||
* [[MULT]] | |||
* [[MUL]] | |||
* [[DIV2]] | |||
* [[ALT1]] | |||
=== External Links === | |||
# Official Nintendo documentation on UMULT: 9.90 on [https://archive.org/details/SNESDevManual/book2/page/n278 page 2-9-122 of Book II] | |||
# 8.2 "Multiplication Instructions" on [https://archive.org/details/SNESDevManual/book2/page/n155 page 2-8-16 of Book II], lbid. | |||
# Table 2-2-2 Instruction Set (Sheet 1) on [https://archive.org/details/SNESDevManual/book2/page/n100 page 2-2-6 of Book II], lbid. | |||
# https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial#Instruction_Set_Table | |||
[[Category:ASM]] | [[Category:ASM]] | ||
[[Category: | [[Category:Super FX]] | ||
[[Category:Arithmetic Operation Instructions]] | |||
[[Category:Two-byte Instructions]] | |||
[[Category:Expects Sreg/Dreg Prearranged]] |
Latest revision as of 19:16, 30 July 2024
Basic Info | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | ROM Speed | RAM Speed | Cache Speed | ||
Implied (type 1) | 3D8n | 2 bytes | 6 or 8 cycles | 6 or 8 cycles | 2 or 3 cycles | ||
Immediate | 3F8n[4] | 2 bytes | 6 or 8 cycles | 6 or 8 cycles | 2 or 3 cycles |
Flags Affected | ||||||||
---|---|---|---|---|---|---|---|---|
B | ALT1 | ALT2 | O/V | S | CY | Z | ||
0 | 0 | 0 | . | S | . | Z |
UMULT is an unsigned multiplication Super FX instruction. The factors are the low byte of the source register and the low byte of the register specified in the operand or an immediate value. The product is stored in the destination register.
UMULT utilizes the 8-bit multiplier only once, so it is fast.[2]
The exact number of cycles depends on the state of the CONFIG register.
The ALT0 state is restored.
The source and destination registers should be specified in advance using WITH, FROM, or TO. Otherwise, R0 serves as the default.
The page of documentation on the immediate addressing mode of UMULT appears to be missing from the official dev manual. As the SNES scene has access to the two manual pages with page numbers adjacent to UMULT Rn, it appears to have been printed that way. The information on this page for that addressing mode comes from [4].
Syntax
UMULT Rn UMULT #n
Example
Let:
Sreg : R3 Dreg : R0 R3 = 364fh R8 = b2cfh
After executing UMULT R8:
R0 = 3fe1h
See Also
External Links
- Official Nintendo documentation on UMULT: 9.90 on page 2-9-122 of Book II
- 8.2 "Multiplication Instructions" on page 2-8-16 of Book II, lbid.
- Table 2-2-2 Instruction Set (Sheet 1) on page 2-2-6 of Book II, lbid.
- https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial#Instruction_Set_Table