The MC4010 math co-processor expands the limited MCxxxx family’s programming language by adding more complex mathematical operations.
In game description[]
Write a command sequence to any pin to instruct the MC4010 to perform a calculation. A command sequence (see table, right) consists of an operation code followed by one or two values. Once a complete command sequence is written to the MC4010, the result
register is updated with the result of the specified calculation.
Reading from any pin retrieves the value stored in the result
register. result
can be read any number of times.
In the following example, the command sequence 50 20 4
is sent to the MC4010 to perform the calculation 20 / 4 = __
. The result, 5
, is stored in the result
register and read back into the accumulator.
# x0 is connected to an MC4010 input pin mov 50 x0 # op code for division mov 20 x0 # write first value mov 4 x0 # write second value mov x0 acc # read back result (5)
Command List[]
Operation | Command sequence | result is set to:
|
---|---|---|
Set | 10 A |
A
|
Add | 20 A B |
A + B
|
Subtract | 30 A B |
A - B
|
Multiply | 40 A B |
A x B
|
Divide | 50 A B |
A / B
|
Remainder | 51 A B |
(A / B) ;negative if A was negative
|
Modulus | 60 A B |
A mod B ;negative if B was negative
|
Exponent | 70 A B |
AB
|
Square root | 80 A |
Square root of A , rounded down
|
Min | 90 A B |
Smaller of A and B
|
Max | 91 A B |
Larger of A and B
|
Pin Configuration[]
Register | Purpose |
---|---|
input
|
Holds operations and values until a complete command sequence has been sent. |
result
|
Holds the result of the last executed command. The value is limited to the range -999 to 999. |
Pricing[]
This part is for prototyping ONLY!
– Carl