Advertisement
NovaYoshi

16-bit fixed opcode size machines

Jan 3rd, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.45 KB | None | 0 0
  1. = Survey Computer Science computer =
  2. a piece of shit
  3.  
  4. 16 8-bit registers
  5. 8-bit address space
  6.  
  7. 1RXY - LOAD rR, memory
  8. register rR = memory at address XY
  9.  
  10. 2RXY - LOAD rR, constant
  11. register rR = constant XY
  12.  
  13. 3RXY - STORE rR, memory
  14. memory at address XY = register rR
  15.  
  16. 40RS - MOVE rS, rR
  17. register rS = register rR
  18.  
  19. 5RST - ADD rR, rS, rT
  20. register rR = rS + rT
  21.  
  22. 6RST - ADDF rR, rS, rT
  23. register rR = rS + rT, except they're really shitty 8-bit floating point numbers
  24.  
  25. 7RST - OR rR, rS, rT
  26. register rR = rS | rT
  27.  
  28. 8RST - AND rR, rS, rT
  29. register rR = rS & rT
  30.  
  31. 9RST - XOR rR, rS, rT
  32. register rR = rS ^ rT
  33.  
  34. AR0X - ROTATE rR, X
  35. register rR is rotated right X times
  36.  
  37. BRXY - JUMP rR, address
  38. jump to address XY if rR == r0
  39.  
  40. C000 - HALT
  41. stop execution
  42.  
  43. -------------------------------------------------------
  44.  
  45. = MARIE =
  46. a slightly less piece of shit
  47.  
  48. 16-bit accumulator, AC
  49. 12-bit program counter, PC
  50.  
  51. 0nnn - JnS address
  52. Stores program counter to location NNN.
  53. Set accumulator and program counter ot NNN+1.
  54.  
  55. 1nnn - Load address
  56. AC = memory at address NNN
  57.  
  58. 2nnn - Store address
  59. memory at address NNN = AC
  60.  
  61. 3nnn - Add address
  62. AC += memory at address NNN
  63.  
  64. 4nnn - Subt address
  65. AC -= memory at address NNN
  66.  
  67. 5000 - Input
  68. Request a value from the user and put it in AC
  69.  
  70. 6000 - Output
  71. Write AC to the output
  72.  
  73. 7000 - Halt
  74.  
  75. 8000 - Skipcond <
  76. Skip next opcode if AC < 0
  77.  
  78. 8400 - Skipcond =
  79. Skip next opcode if AC == 0
  80.  
  81. 8800 - Skipcond >
  82. Skip next opcode if AC > 0
  83.  
  84. 9nnn - Jump address
  85. PC = NNN
  86.  
  87. A000 - Clear
  88. AC = 0
  89.  
  90. BNNN - AddI address
  91. AC += memory accessed through pointer at address NNN
  92.  
  93. CNNN - JumpI address
  94. PC = memory at address NNN
  95.  
  96. DNNN - LoadI address
  97. AC = memory accessed through pointer at address NNN
  98.  
  99. ENNN - StoreI address
  100. memory accessed through pointer at address NNN = AC
  101.  
  102. -------------------------------------------------------
  103.  
  104. = CHIP-8 =
  105. a bit better but suffers from poor access to memory
  106.  
  107. 12-bit program counter
  108. 16 8-bit registers V0 through VF
  109. 12-bit register I
  110. 16 stack levels
  111. 8-bit timer register, counts down at 60hz
  112. 8-bit sound register, counts down at 60hz, beeps while nonzero
  113. 64x32 monochrome display
  114. * marks SuperChip only opcodes
  115.  
  116. 00CN - SCD lines *
  117. Scroll display N lines down
  118.  
  119. 00E0 - CLS
  120. Clear the display
  121.  
  122. 00EE - RET
  123. Return from subroutine
  124.  
  125. 00FB - SCR *
  126. Scroll display 4 pixels right
  127.  
  128. 00FC - SCL *
  129. Scroll display 4 pixels left
  130.  
  131. 00FD - EXIT *
  132. Exit intereter
  133.  
  134. 00FE - LOW *
  135. Disable extended screen mode
  136.  
  137. 00FF - HIGH *
  138. Enable extended screen mode (128x64)
  139.  
  140. 1NNN - JP address
  141. PC = address
  142.  
  143. 2NNN - CALL address
  144. push old PC to stack
  145. PC = address
  146.  
  147. 3xkk - SE Vx, byte
  148. Skip next opcode if Vx == byte
  149.  
  150. 4xkk - SNE Vx, byte
  151. Skip next opcode if Vx != byte
  152.  
  153. 5xy0 - SE Vx, Vy
  154. Skip next opcode if Vx == Vy
  155.  
  156. 6xkk - LD Vx, byte
  157. Vx = byte
  158.  
  159. 7xkk - ADD Vx, byte
  160. Vx += byte
  161.  
  162. 8xy0 - LD Vx, Vy
  163. Vx = Vy
  164.  
  165. 8xy1 - OR Vx, Vy
  166. Vx |= Vy
  167.  
  168. 8xy2 - AND Vx, Vy
  169. Vx &= Vy
  170.  
  171. 8xy3 - XOR Vx, Vy
  172. Vx ^= Vy
  173.  
  174. 8xy4 - ADD Vx, Vy
  175. Vx += Vy
  176. VF = carry from this operation
  177.  
  178. 8xy5 - SUB Vx, Vy
  179. Vx -= Vy
  180.  
  181. 8x06 - SHR Vx
  182. Vx >>= 1
  183. VF = carry
  184.  
  185. 8x07 - SUBN
  186. Vx = Vy - Vx
  187. If Vy > Vx, VF = 1. Otherwise it's 0
  188.  
  189. 8x0E - SHL Vx
  190. Vx <<= 1
  191. VF = carry
  192.  
  193. 9xy0 - SNE Vx, Vy
  194. Skip next opcode if Vx != Vy
  195.  
  196. Annn - LD I, address
  197. I = address
  198.  
  199. Bnnn - JP V0, address
  200. PC = address + V0
  201.  
  202. Cxkk - RND Vx, byte
  203. Vx = random()&byte
  204.  
  205. DXYN - DRW Vx, Vy, size
  206. An 8 pixel wide sprite is drawn at position Vx and Vy, using XOR to change the pixels.
  207. Sprite graphics are at I, and are a given number of pixels tall
  208. VF = 1 if any pixels are turned off, or 0 if not
  209.  
  210. DXY0 - DRW Vx, Vy, 0
  211. In extended mode, draw a 16x16 sprite
  212.  
  213. EX9E - SKP Vx
  214. Skip if key of value Vx is pressed
  215.  
  216. EXA1 - SKNP Vx
  217. Skip if key of value Vx is not pressed
  218.  
  219. FX07 - LD Vx, DT
  220. Vx = Delay timer
  221.  
  222. FX0A - LD Vx, K
  223. Wait for key press, store its value into Vx
  224.  
  225. FX15 - LD DT, Vx
  226. Delay timer = Vx
  227.  
  228. FX18 - LD ST, Vx
  229. Sound timer = Vx
  230.  
  231. FX1E - ADD I, Vx
  232. Vx += I
  233.  
  234. FX29 - LD F, Vx
  235. I is set to a pointer to a hex digit sprite corresponding to Vx (5 rows tall)
  236.  
  237. FX30 - LD F, Vx *
  238. I is set to a pointer to a decimal digit sprite corresponding to Vx (10 rows tall)
  239.  
  240. FX33 - LD B, Vx
  241. Stores 3-digit BCD version of Vx at I (hundreds), I+1 (tens), I+2 (ones)
  242.  
  243. FX55 - LD [I], Vx
  244. Stores registers V0 through Vx into memory at I through I+x
  245.  
  246. FX65 - LD [I], Vx
  247. Loads memory at I through I+x into registers V0 through Vx
  248.  
  249. -------------------------------------------------------
  250.  
  251. = Data General Nova =
  252.  
  253. big endian
  254. four 16-bit accumulators (AC0, AC1, AC2, AC3)
  255.  
  256. I/O
  257. 011AATTTCCDDDDDD
  258. AA = Which accumulator
  259. TTT = 000 NIO - no I/O transfer
  260. 001 DIA - data in from buffer A
  261. 010 DOA - data out to buffer A
  262. 011 DIB - data in from buffer B
  263. 100 DOB - data out to buffer B
  264. 101 DIC - data in from buffer C
  265. 110 DOC - data out to buffer C
  266. 111 SKP - skip on condition
  267. CC (if not SKP) send a control signal to device
  268. = 00 issue no commands
  269. 01 (S) set busy flag, clear done flag
  270. 10 (C) clear both busy and done flag
  271. 11 (P) issue a pulse to device
  272. (if SKP)
  273. = 00 (SKPBN) skip if busy flipflop is nonzero
  274. 01 (SKPBZ) skip if busy flipflop is zero
  275. 10 (SKPDN) skip if done flipflop is nonzero
  276. 11 (SKPDZ) skip if done flipflop is zero
  277.  
  278. Memory access (without accumulator)
  279. 000FFINNDDDDDDDD
  280.  
  281. FF = 00 JMP to effective address
  282. 01 JSR (store PC in AC, set PC to effective address)
  283. 10 ISZ - increment memory address, skip if zero
  284. 11 DSZ - decrement memory address, skip if zero
  285. NN = 00 D is a zeropage address
  286. 01 PC relative
  287. 10 index with AC2
  288. 11 index with AC3
  289. I = use address as a pointer if 1
  290. D = displacement
  291.  
  292. Memory address (with accumulator)
  293. 0FFAAINNDDDDDDDD
  294. FF = 01 LDA - load accumulator
  295. 10 STA - store accumulator
  296.  
  297. ALU opcodes
  298. 1SSDDFFFRRCCNTTT
  299.  
  300. SS = source accumulator
  301. DD = destination accumulator
  302. FFF = 000 COM, destination = ~source
  303. 001 NEG, destination = -source
  304. 010 MOV, destination = source
  305. 011 INC, destination = source + 1
  306. 100 ADC, destination = destination + source, 1's complement
  307. 101 SUB, destination = destination - source
  308. 110 ADD, destination = destination + source
  309. 111 AND, destination = destination & source
  310. RR = 00 no shifting
  311. 01 L, rotate result of function left 1 bit, including carry
  312. 10 R, rotate result of function right 1 bit, including carry
  313. 11 S, swap the two bytes in the word
  314. CC = 00 don't change carry before function
  315. 01 Z, force carry to zero before function
  316. 10 O, force carry to one before function
  317. 11 C, complement carry before function
  318. N = if 1, don't actually change destination register
  319. TTT = 000 never skip
  320. 001 SKP, skip unconditionally
  321. 010 SZC, skip if carry zero
  322. 011 SNC, skip if carry nonzero
  323. 100 SZR, skip if result of function is zero
  324. 101 SNR, skip if result of function is nonzero
  325. 110 SEZ, skip if either carry or result are zero
  326. 111 SBN, skip if both carry and result are nonzero
  327.  
  328. Macros:
  329. IORST - IO reset
  330. HALT - halt the processor
  331. READS - read switches on the machine
  332. INTEN - interrupt enable
  333. INTDS - interrupt disable
  334. MSKO - interrupt mask out
  335. INTA - interrupt acknowledge
  336.  
  337. Special addresses:
  338. 16-23 - When used as a pointer, auto post-increment
  339. 24-31 - When used as a pointer, auto pre-decrement
  340. 0 - Return address for interrupts
  341. 1 - Interrupt handler address
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement