spacepaste

  1.  
  2. // encoding
  3. // https://codeabbey.github.io/heavy-data-1/msc-4-asm-manual-1973.pdf
  4. // only word BEFORE the colon shall be recognised, the rest shall be counted as if it where a comment
  5. // x shall count as 0 or 1
  6. #P:
  7. 0P: r0:r1
  8. 1P: r2:r3
  9. 2P: r4:r5
  10. 3P: r6:r7
  11. 4P: r8:r9
  12. 5P: r10:r11
  13. 6P: r12:r13
  14. 7P: r14:r15
  15. RP:
  16. 000:0P
  17. 001:1P
  18. 010:2P
  19. 011:3P
  20. 100:4P
  21. 101:5P
  22. 110:6P
  23. 111:7P
  24. REG:
  25. 0000:r0
  26. 0001:r1
  27. 0010:r2
  28. 0011:r3
  29. 0100:r4
  30. 0101:r5
  31. 0110:r6
  32. 0111:r7
  33. 1000:r8
  34. 1001:r9
  35. 1010:r10
  36. 1011:r11
  37. 1100:r12
  38. 1101:r13
  39. 1110:r14
  40. 1111:r15
  41. xx:
  42. 00:ADD
  43. 01:SUB
  44. 10:LD
  45. 11:XCH
  46. xxxx:
  47. 0000:CLR
  48. 0001:CLC
  49. 0010:IAC
  50. 0011:CMC
  51. 0100:CMA
  52. 0101:RAL
  53. 0110:RAR
  54. 0111:TCC
  55. 1000:DAC
  56. 1001:TCS
  57. 1010:STC
  58. 1011:DAA
  59. 1100:KBP
  60. CN:
  61. //1xxx: invert all other jump conditions
  62. 0xx1: none //jump if test signal of 4004 is = 0
  63. 1xx1: none //jump if test signal of 4004 is = 1
  64. 0x1x: none //jump if carry bit = 1
  65. 1x1x: none //jump if carry bit = 0
  66. 01xx: none //jump if accumulator = 0
  67. 11xx: none //jump if accumulator != 0
  68. OP:
  69. 0000:WRM
  70. 0001:WMP
  71. 0010:WRR
  72. 0011:WPM
  73. 0100:WR0
  74. 0101:WR1
  75. 0110:WR2
  76. 0111:WR3
  77. 1000:SBM
  78. 1001:RDM
  79. 1010:RDR
  80. 1011:ADM
  81. 1100:RD0
  82. 1101:RD1
  83. 1110:RD2
  84. 1111:RD3
  85. /* consecutive sequence will be concated
  86. * example:
  87. * |DATA|DATA|
  88. * assuming DATA is 4 bits long
  89. * indicates DATA takes up 8 bits
  90. */
  91. DATA:
  92. xxxx:DATA
  93. ADDR:
  94. xxxx:ADDR
  95. // | does nothing and can act as a visual seperator to help visualize the structure of an encoding's binary layout
  96. FIN: |0011|RP|0| // 0011 000 0 OR 0011 001 0 OR 0011 010 0 and so on 0011 111 0
  97. INC: |0110|REG |
  98. |10|xx|REG|
  99. |1111|xxxx|
  100. FIM: |0010|RP|0|DATA|DATA|
  101. LDM: |1101|DATA|
  102. JUN: |0100|ADDR|ADDR|ADDR|
  103. JIN: |0011|RP|1|
  104. JCN: |0001|CN |ADDR|ADDR|
  105. ISZ: |0111|REG |ADDR|ADDR|
  106. JMS: |0101|ADDR|ADDR|ADDR|
  107. BBL: |1100|DATA|
  108. NOP: |0000|0000|
  109. DCL: |1111|1101|
  110. SRC: |0010|RP|1|
  111. |1110|OP |
  112.