Difference between revisions of "MOD"
Jump to navigation
Jump to search
m (Xifanie moved page Event Instruction B8 to MOD) |
|||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
{{IE_B8_desc}} | {{IE_B8_desc}} | ||
+ | |||
+ | |||
+ | Divides the selected Variable Value by the Immediate Value and gives the ''remainder'' as the result. | ||
+ | |||
+ | So if the Variable Value was 0018 and the Immediate Value was 0006, the result would be 0000. | ||
+ | |||
+ | If the Variable Value was 0019 and the Immediate Value was 0006, the result would be 0001. | ||
+ | |||
+ | |||
+ | Can be used after [[Event_Instruction_BF|{{IE_BF}}]] to essentially generate a random number along a specific range - from 0 to one number less than the Immediate Value. | ||
Latest revision as of 05:01, 23 February 2021
{B8} MOD
MOD(xVARI,xVALU)
Divide Immediate (modulus) | Variable = Variable % ImmediateValue (high 32bit)
Divides the selected Variable Value by the Immediate Value and gives the remainder as the result.
So if the Variable Value was 0018 and the Immediate Value was 0006, the result would be 0000.
If the Variable Value was 0019 and the Immediate Value was 0006, the result would be 0001.
Can be used after Random to essentially generate a random number along a specific range - from 0 to one number less than the Immediate Value.
See also: {B4} MULT ― {B5} MULTVar ― {BE} ZERO
Variable : Half-Word (hex)
Click here for the list of Variables
Immediate Value : Half-Word (hex)
Value that will be use along with the operand to change the address' value.