um-spec.txt 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. Order for Construction Standard Sand of Pennsylvania Co.
  2. Client: Cult of the Bound Variable
  3. Object: UM-32 "Universal Machine"
  4. -----------------------------------------------------------------
  5. 21 July 19106
  6. Physical Specifications.
  7. ------------------------
  8. The machine shall consist of the following components:
  9. * An infinite supply of sandstone platters, with room on each
  10. for thirty-two small marks, which we call "bits."
  11. least meaningful bit
  12. |
  13. v
  14. .--------------------------------.
  15. |VUTSRQPONMLKJIHGFEDCBA9876543210|
  16. `--------------------------------'
  17. ^
  18. |
  19. most meaningful bit
  20. Figure 0. Platters
  21. Each bit may be the 0 bit or the 1 bit. Using the system of
  22. "unsigned 32-bit numbers" (see patent #4,294,967,295) the
  23. markings on these platters may also denote numbers.
  24. * Eight distinct general-purpose registers, capable of holding one
  25. platter each.
  26. * A collection of arrays of platters, each referenced by a distinct
  27. 32-bit identifier. One distinguished array is referenced by 0
  28. and stores the "program." This array will be referred to as the
  29. '0' array.
  30. * A 1x1 character resolution console capable of displaying glyphs
  31. from the "ASCII character set" (see patent #127) and performing
  32. input and output of "unsigned 8-bit characters" (see patent
  33. #255).
  34. Behavior.
  35. ---------
  36. The machine shall be initialized with a '0' array whose contents
  37. shall be read from a "program" scroll. All registers shall be
  38. initialized with platters of value '0'. The execution finger shall
  39. point to the first platter of the '0' array, which has offset zero.
  40. When reading programs from legacy "unsigned 8-bit character"
  41. scrolls, a series of four bytes A,B,C,D should be interpreted with
  42. 'A' as the most magnificent byte, and 'D' as the most shoddy, with
  43. 'B' and 'C' considered lovely and mediocre respectively.
  44. Once initialized, the machine begins its Spin Cycle. In each cycle
  45. of the Universal Machine, an Operator shall be retrieved from the
  46. platter that is indicated by the execution finger. The sections
  47. below describe the operators that may obtain. Before this operator
  48. is discharged, the execution finger shall be advanced to the next
  49. platter, if any.
  50. Operators.
  51. ----------
  52. The Universal Machine may produce 14 Operators. The number of the
  53. operator is described by the most meaningful four bits of the
  54. instruction platter.
  55. .--------------------------------.
  56. |VUTSRQPONMLKJIHGFEDCBA9876543210|
  57. `--------------------------------'
  58. ^^^^
  59. |
  60. operator number
  61. Figure 1. Operator Description
  62. Standard Operators.
  63. -------------------
  64. Each Standard Operator performs an errand using three registers,
  65. called A, B, and C. Each register is described by a three bit
  66. segment of the instruction platter. The register C is described by
  67. the three least meaningful bits, the register B by the three next
  68. more meaningful than those, and the register A by the three next
  69. more meaningful than those.
  70. A C
  71. | |
  72. vvv vvv
  73. .--------------------------------.
  74. |VUTSRQPONMLKJIHGFEDCBA9876543210|
  75. `--------------------------------'
  76. ^^^^ ^^^
  77. | |
  78. operator number B
  79. Figure 2. Standard Operators
  80. A description of each basic Operator follows.
  81. Operator #0. Conditional Move.
  82. The register A receives the value in register B,
  83. unless the register C contains 0.
  84. #1. Array Index.
  85. The register A receives the value stored at offset
  86. in register C in the array identified by B.
  87. #2. Array Amendment.
  88. The array identified by A is amended at the offset
  89. in register B to store the value in register C.
  90. #3. Addition.
  91. The register A receives the value in register B plus
  92. the value in register C, modulo 2^32.
  93. #4. Multiplication.
  94. The register A receives the value in register B times
  95. the value in register C, modulo 2^32.
  96. #5. Division.
  97. The register A receives the value in register B
  98. divided by the value in register C, if any, where
  99. each quantity is treated treated as an unsigned 32
  100. bit number.
  101. #6. Not-And.
  102. Each bit in the register A receives the 1 bit if
  103. either register B or register C has a 0 bit in that
  104. position. Otherwise the bit in register A receives
  105. the 0 bit.
  106. Other Operators.
  107. ----------------
  108. The following instructions ignore some or all of the A, B and C
  109. registers.
  110. #7. Halt.
  111. The universal machine stops computation.
  112. #8. Allocation.
  113. A new array is created with a capacity of platters
  114. commensurate to the value in the register C. This
  115. new array is initialized entirely with platters
  116. holding the value 0. A bit pattern not consisting of
  117. exclusively the 0 bit, and that identifies no other
  118. active allocated array, is placed in the B register.
  119. #9. Abandonment.
  120. The array identified by the register C is abandoned.
  121. Future allocations may then reuse that identifier.
  122. #10. Output.
  123. The value in the register C is displayed on the console
  124. immediately. Only values between and including 0 and 255
  125. are allowed.
  126. #11. Input.
  127. The universal machine waits for input on the console.
  128. When input arrives, the register C is loaded with the
  129. input, which must be between and including 0 and 255.
  130. If the end of input has been signaled, then the
  131. register C is endowed with a uniform value pattern
  132. where every place is pregnant with the 1 bit.
  133. #12. Load Program.
  134. The array identified by the B register is duplicated
  135. and the duplicate shall replace the '0' array,
  136. regardless of size. The execution finger is placed
  137. to indicate the platter of this array that is
  138. described by the offset given in C, where the value
  139. 0 denotes the first platter, 1 the second, et
  140. cetera.
  141. The '0' array shall be the most sublime choice for
  142. loading, and shall be handled with the utmost
  143. velocity.
  144. Special Operators.
  145. ------------------
  146. One special operator does not describe registers in the same way.
  147. Instead the three bits immediately less significant than the four
  148. instruction indicator bits describe a single register A. The
  149. remainder twenty five bits indicate a value, which is loaded
  150. forthwith into the register A.
  151. A
  152. |
  153. vvv
  154. .--------------------------------.
  155. |VUTSRQPONMLKJIHGFEDCBA9876543210|
  156. `--------------------------------'
  157. ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
  158. | |
  159. | value
  160. |
  161. operator number
  162. Figure 3. Special Operators
  163. #13. Orthography.
  164. The value indicated is loaded into the register A
  165. forthwith.
  166. Cost-Cutting Measures.
  167. ----------------------
  168. As per our meeting on 13 Febtober 19106, certain "impossible
  169. behaviors" may be unimplemented in the furnished device. An
  170. exhaustive list of these Exceptions is given below. Our contractual
  171. agreement dictates that the machine may Fail under no other
  172. circumstances.
  173. If at the beginning of a cycle, the execution finger does not indicate
  174. a platter that describes a valid instruction, then the machine may Fail.
  175. If the program decides to index or amend an array that is not
  176. active, because it has not been allocated or it has been abandoned,
  177. or if the offset supplied for the access lies outside the array's
  178. capacity, then the machine may Fail.
  179. If the program decides to abandon the '0' array, or to abandon an array
  180. that is not active, then the machine may Fail.
  181. If the program sets out to divide by a value of 0, then the machine
  182. may Fail.
  183. If the program decides to load a program from an array that is not
  184. active, then the machine may Fail.
  185. If the program decides to Output a value that is larger than 255, the
  186. machine may Fail.
  187. If at the beginning of a machine cycle the execution finger aims
  188. outside the capacity of the 0 array, the machine may Fail.