Device: Math

The math device provides access to efficient implementations of complex math operations.

PortNameDescriptionReadWrite
0x20Operand 1Left-hand operand.
0x21continuedcontinued
0x22Operand 2Right-hand operand.
0x23continuedcontinued
0x24Square rootSquare root.
0x25continuedcontinued
0x26HeadingHeading to a point.
0x27continuedcontinued
0x28ProductProduct of multiplication.
0x29continuedcontinued
0x2Acontinuedcontinued
0x2Bcontinuedcontinued
0x2CQuotientQuotient of division.
0x2Dcontinuedcontinued
0x2ERemainderRemainder of division.
0x2Fcontinuedcontinued

Ports

Operand 1

Reading from this port group will return the value of the left-hand operand. The initial value of this port is zero.

Writing to this port group will set the value of the left-hand operand.

Operand 2

Reading from this port group will return the value of the right-hand operand. The initial value of this port is zero.

Writing to this port group will set the value of the right-hand operand.

Square root

Reading from this port group will return the integer part of the square root of a 32-bit input value. The high 16 bits of the input value are given by operand 1, and the low 16 bits of the input value are given by operand 2.

Heading

Reading from this port group will return the integer part of the angle measured clockwise between a ray extending from the origin in the positive Y direction and a ray extending from the origin to a point. The horizontal and vertical components of the origin are both zero. The horizontal component of the point is a signed integer given by operand 1, and the vertical component of the point is a signed integer given by operand 2. If operand 1 and operand 2 are both zero, the returned value will be zero.

The unit of the returned value is equal to 1/65536 of a full turn.

Product

Reading from this port group will return the product of the multiplication of operand 1 by operand 2.

Quotient

Reading from this port group will return the quotient of the integer division of operand 1 by operand 2. If operand 2 is zero, the returned value will be zero.

Remainder

Reading from this port group will return the remainder of the integer division of operand 1 by operand 2. If operand 2 is zero, the returned value will be zero.

System wake

This device will never send a wake request to the system device.