@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Returns a kinda-random number.
@ Before using for the first time, seed heap[0] with a value.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTSSSSN | Mark: 10000 (random)
@ Generate the next seed value
SSSTSSSSSTTTSSSTTSSTSSTTTSSTTSTTSTN | PUSH 1103515245
SSSTTSSSSSSTTTSSTN | PUSH 12345
@ Store the next seed value but keep a copy on the stack.
@ Calculate the random number and return.
SSSTSSSSSSSSSSSSSSSSN | PUSH 65536
SSSTSSSSSSSSSSSSSSSN | PUSH 32768
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Returns the absolute value of its argument
@ abs(signed number) <-- TOS
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTSSSTN | Mark: 10001 (absolute value)
@ Catch -(2^63) as a special case since its absolute value will overflow
@ a twos-complement 64-bit word. Return zero as though the absolute value
@ overflowed to the bottom of the non-negative integers rather than
@ overflowing back to the most negative integer.
SSTTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSN | -(2^63)
NTSSSSTSSSTSSSSSSTSN | BRZ > 00010001 00000010
@ Handle all the other numbers.
NTTSSSTSSSTSSSSSSSSN | BMI > 00010001 00000000
NSNSSSTSSSTSSSSSSSTN | JMP > 00010001 00000001
NSSVSSSTSSSTSSSSSSSSN | Mark: 00010001 00000000
NSSVSSSTSSSTSSSSSSSTN | Mark: 00010001 00000001
@ Special case: Push 0 and return.
NSSVSSSTSSSTSSSSSSTSN | Mark: 00010001 00000010