Advertisement
LuigiBlood

WireMod CPU Ref.

Nov 19th, 2013
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.80 KB | None | 0 0
  1. ZCPU Reference
  2.  
  3. Usable directly:
  4. Main Set: EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP
  5. Extended Set: R0, R1, ..., R31
  6.  
  7. Vectors/Matrix:
  8. scalar name,...; //For example "scalar x,10"
  9. vector1f name,...;
  10. vector2f name,...;
  11. vector3f name,...;
  12. vector4f name,...;
  13. vec1f name,...;
  14. vec2f name,...;
  15. vec3f name,...;
  16. vec4f name,...;
  17. uv name,...;
  18. color name,...;
  19. matrix name; //No default initializer
  20.  
  21. Num Registers Description
  22. ----|---------------|--------------------------------
  23. 00 IP Instruction Pointer
  24. 01 EAX General Purpose register A
  25. 02 EBX General Purpose register B
  26. 03 ECX General Purpose register C
  27. 04 EDX General Purpose register D
  28. 05 ESI Source Index
  29. 06 EDI Destination Index
  30. 07 ESP Stack Pointer
  31. 08 EBP Base Pointer
  32. 09 ESZ Stack Size
  33. 16 CS Code Segment
  34. 17 SS Stack Segment
  35. 18 DS Data Segment
  36. 19 ES Extra Segment
  37. 20 GS User Segment
  38. 21 FS User Segment
  39. 22 KS Key Segment
  40. 23 LS Library Segment
  41. 24 IDTR Interrupt Descriptor Table Pointer
  42. 25 CMPR Comparsion Result Register
  43. 26 XEIP Pointer to start of currently executed instruction
  44. 27 LADD Current Interrupt Code
  45. 28 LINT Current Interrupt Number
  46. 29 TMR Instruction/Cycle Counter
  47. 30 TIMER Internal Precise Timer
  48. 31 CPAGE Current Page Number
  49. 32 IF Interrupts Enabled Flag
  50. 33 PF Protected Mode Flag
  51. 34 EF Extended Mode Flag
  52. 35 NIF Next cycle interrupt enabled flag state
  53. 36 MF Extended Memory Mapping Flag
  54. 37 PTBL Page Table Offset
  55. 38 PTBE Page Table Number of Entries
  56. 39 PCAP Processor Paging System Capability
  57. 40 RQCAP Processor delayed memory request capability
  58. 41 PPAGE Previous Page ID
  59. 42 MEMRQ Type of the Memory Request
  60. 43 RAMSize Amount of Internal Memory
  61. 44 External External I/O operation
  62. 45 BusLock Is Bus Locked for Read/Write
  63. 46 Idle Should CPU skip some cycles
  64. 47 INTR Handling an Interrupt
  65. 48 SerialNo Processor Serial Number
  66. 49 CODEBYTES Amount of bytes executed so far
  67. 50 BPREC Binary Precision Level
  68. 51 IPREC Integer Precision Level
  69. 52 NIDT Number of interrupt descriptor table entries
  70. 53 BlockStart Start Offset of the Block
  71. 54 BlockSize Size of the Block
  72. 55 VMODE Vector Mode (2: 2D, 3: 3D)
  73. 56 XTRL Runlevel for External Memory Access
  74. 57 HaltPort Halt until this port changes value
  75. 58 HWDEBUG Hardware Debug Mode Active
  76. 59 DBGSTATE Hardware Debug Mode State
  77. 60 DBGADDR Hardware Debug Mode Address/Parameter
  78. 61 CRL Current RunLevel
  79. 62 TimerDT Current Time Discrete Step
  80. 63 MEMADDR Address requested by the memory operation
  81. 64 TimerMode Timer Mode (off, instructions, seconds)
  82. 65 TimerRate Timer Rate
  83. 66 TimerPrevTime Previous Timer Fire Time
  84. 67 TimerAddress Number of external interrupt to call when timer fires
  85.  
  86.  
  87. Num Instruction Operation Description
  88. ----|---------------|-----------------------|-----------------------------------------
  89. 000 STOP INT 2 Stops execution
  90. 001 JNE X JNE X Jump to X if Not Equal
  91. 001 JNZ X JNE X Jump to X if Not Zero
  92. 002 JMP X JMP X Jump to X
  93. 003 JG X JG X Jump to X if Greater
  94. 003 JNLE X JG X Jump to X if not Less or Equal
  95. 004 JGE X JGE X Jump to X if Greater or Equal
  96. 004 JNL X JGE X Jump to X if not Less
  97. 005 JL X JL X Jump to X if Less
  98. 005 JNGE X JL X Jump to X if not Greater or Equal
  99. 006 JLE X JLE X Jump to X if Less or Equal
  100. 006 JNG X JLE X Jump to X if not Greater
  101. 007 JE X JE X Jump to X if Equal
  102. 007 JZ X JE X Jump to X if Zero
  103. 008 CPUID X EAX = CPUID Writes to EAX:
  104. X=0:Version (10.00 as 1000)
  105. X=1:IRAM Size
  106. X=2:Type (0=ZCPU; 1=ZGPU Beta; 2=ZSPU; 3=ZGPU)
  107. X=3:IROM Size
  108. 009 PUSH X PUSH X Pushes X to Stack
  109. 010 ADD X,Y X = X + Y Adds Y to X
  110. 011 SUB X,Y X = X - Y Subtracts Y to X
  111. 012 MUL X,Y X = X * Y Multiply Y to X
  112. 013 DIV X,Y X = X / Y Divide Y to X (Triggers Error/IRQ 3 if Y = 0)
  113. 014 MOV X,Y X = Y Copy Y to X
  114. 015 CMP X,Y CMPR = X - Y Compares X with Y
  115. 018 MIN X,Y X>Y: X = Y Compares X with Y and puts Y in X if it's the smaller one
  116. 019 MAX X,Y X<Y: X = Y Compares X with Y and puts Y in X if it's the bigger one
  117. 020 INC X X = X + 1 Increments X
  118. 021 DEC X X = X - 1 Decrements X
  119. 022 NEG X X = -X Negates X
  120. 023 RAND X X = RAND Generates a Random Value between 0.0 and 1.0
  121. 024 LOOP X ECX>0: JMP X; ECX-- Jump to X and decrements ECX if ECX > 0
  122. 025 LOOPA X EAX>0: JMP X; EAX-- Jump to X and decrements EAX if EAX > 0
  123. 026 LOOPB X EBX>0: JMP X; EBX-- Jump to X and decrements EBX if EBX > 0
  124. 027 LOOPD X EDX>0: JMP X; EDX-- Jump to X and decrements EDX if EDX > 0
  125. 028 SPG X SPG X Clear Write Flag to Page X (each page are made of 128 bytes)
  126. 029 CPG X CPG X Set Write Flag to Page X
  127. 030 POP X POP X Pops Stack to X
  128. 031 CALL X PUSH IP; JMP X Calls a Subroutine with X
  129. 032 BNOT X X = NOT X Toggles bits (depending of BPREC) in X
  130. 033 FINT X X = floor(X) Rounds down X to the lower integer
  131. 034 FRND X X = round(X) Rounds down X to the nearest integer
  132. 035 FFRAC X X = frac(X) Returns the fractional value of X
  133. 036 FINV X X = 1 / X Returns the inverse of X (Triggers Error/IRQ 3 if X = 0)
  134. 038 FSHL X X = X * 2 Shifts X to the left (equivalent to X * 2)
  135. 039 FSHR X X = X / 2 Shifts X to the right (equivalent to X / 2)
  136. 040 RET POP IP Returns from a subroutine via CALL
  137. 041 IRET (EF=1: POP CS); POP IP Returns from Interrupt
  138. 042 STI IF = 1 Sets Interrupt Flag (IF) after the next instruction
  139. 043 CLI IF = 0 Clears Interrupt Flag (IF) after the next instruction
  140. 047 RETF POP CS; POP IP Returns from subroutine via CALLF
  141. 048 STEF EF = 1 Sets Extended Mode (EF)
  142. 049 CLEF EF = 0 Clears Extended Mode (EF)
  143. 050 AND X,Y X = X AND Y Performs logical AND operation with X and Y to X
  144. 051 OR X,Y X = X OR Y Performs logical OR operation with X and Y to X
  145. 052 XOR X,Y X = X XOR Y Performs logical XOR operation with X and Y to X
  146. 053 FSIN X,Y X = sin(Y) Finds Sine of Y and puts it to X
  147. 054 FCOS X,Y X = cos(Y) Finds Cosine of Y and puts it to X
  148. 055 FTAN X,Y X = tan(Y) Finds Tangent of Y and puts it to X
  149. 056 FASIN X,Y X = arcsin(Y) Finds ArcSine of Y and puts it to X
  150. 057 FACOS X,Y X = arccos(Y) Finds ArcCosine of Y and puts it to X
  151. 058 FATAN X,Y X = arctan(Y) Finds ArcTangent of Y and puts it to X
  152. 059 MOD X,Y X = X MOD Y Finds remainder of X / Y and puts it to X
  153. 060 BIT X,Y CMPR = X.bitY Tests bit Y of X
  154. 061 SBIT X,Y X.bitY = 1 Sets bit Y of X
  155. 062 CBIT X,Y X.bitY = 0 Clears bit Y of X
  156. 063 TBIT X,Y X.bitY = 1 - X.bitY Toggles bit Y of X
  157. 064 BAND X,Y X = X AND Y Performs logical AND operation (depending of BPREC) with X and Y to X
  158. 065 BOR X,Y X = X OR Y Performs logical OR operation (depending of BPREC) with X and Y to X
  159. 066 BXOR X,Y X = X XOR Y Performs logical XOR operation (depending of BPREC) with X and Y to X
  160. 067 BSHL X,Y X = X SHL Y Shifts X by Y to the left (depending of BPREC)
  161. 068 BSHR X,Y X = X SHR Y Shifts X by Y to the right (depending of BPREC)
  162. 069 JMPF X,Y IP = X; CS = Y Jump (Far) to X at Y
  163. 070 EXTINT X PUSH CPUSTATE External Interrupt
  164. 071 CNE X CNE X Call Subroutine at X if Not Equal
  165. 071 CNZ X CNE X Call Subroutine at X if Not Zero
  166. 073 CG X CG X Call Subroutine at X if Greater
  167. 073 CNLE X CG X Call Subroutine at X if Not Less or Equal
  168. 074 CGE X CGE X Call Subroutine at X if Greater or Equal
  169. 074 CNL X CGE X Call Subroutine at X if Not Less
  170. 075 CL X CL X Call Subroutine at X if Less
  171. 075 CNGE X CL X Call Subroutine at X if Not Greater or Equal
  172. 076 CLE X CLE X Call Subroutine at X if Less or Equal
  173. 076 CNG X CLE X Call Subroutine at X if Not Greater
  174. 077 CE X CE X Call Subroutine at X if Equal
  175. 077 CZ X CE X Call Subroutine at X if Zero
  176. 078 MCOPY X EDI[0,X-1] = ESI[0,X-1] Copies X bytes from ESI to EDI
  177. 079 MXCHG X EDI[0,X-1]<> ESI[0,X-1] Swaps X bytes from ESI to EDI
  178. 080 FPWR X,Y X = X ^ Y Power X by Y
  179. 081 XCHG X,Y Y=X; X=Y Swaps X and Y
  180. 082 FLN X,Y ln
  181. 083 FLOG10 X,Y log10
  182. 084 IN X,Y X = PORT(Y) Reads Port Y to X
  183. 085 OUT X,Y PORT(Y) = X Writes X to Port Y
  184. 086 FABS X,Y X = abs(Y) Gets absolute value of Y to X
  185. 087 FSGN X,Y X = sgn(Y) Gets Signum value of Y to X
  186. 088 FEXP X,Y X = exp(Y) Gets Exponent value of Y to X
  187. 089 CALLF X,Y PUSH IP,CS; IP=X; CS=Y Call (Far) Subroutine to X at Y
  188. 090 FPI X X = pi() Puts Pi in X
  189. 091 FE X X = e^(X) Puts Exponent power X to X
  190. 092 INT X INT X Interrupts Number X
  191. 093 TPG X TPG X Toggles Write Flag to Page X
  192. 094 FCEIL X X = ceil(X) Rounds down X to the higher integer
  193. 095 ERPG X ERPG X Erase ROM Page X
  194. 096 WRPG X WRPG X Write ROM Page X
  195. 097 RDPG X RDPG X Read ROM Page X
  196. 098 TIMER X X = TIMER Read TIMER to X
  197. 099 LIDTR X INT Table Offset = X Loads Interrupt Table from X
  198. 101 JNER X JNER X Relative Jump to X if Not Equal
  199. 101 JNZR X JNER X Relative Jump to X if Not Zero
  200. 102 JMPR X JMPR X Relative Jump to X
  201. 103 JGR X JGR X Relative Jump to X if Greater
  202. 103 JNLER X JGR X Relative Jump to X if Not Less or Equal
  203. 104 JGER X JGER X Relative Jump to X if Greater or Equal
  204. 104 JNLR X JGER X Relative Jump to X if Not Less
  205. 105 JLR X JLR X Relative Jump to X if Less
  206. 105 JNGER X JLR X Relative Jump to X if Not Greater or Equal
  207. 106 JLER X JLER X Relative Jump to X if Less or Equal
  208. 106 JNGR X JLER X Relative Jump to X if Not Greater
  209. 107 JER X JER X Relative Jump to X if Equal
  210. 107 JZR X JER X Relative Jump to X if Zero
  211. 108 LNEG X ??? ???
  212. 110 EXTRET POP CPUSTATE Returns from External Interrupt
  213. 111 IDLE IDLE ???
  214. 112 NOP NOP No Operation
  215. 114 PUSHA PUSH ???
  216. 115 POPA POP ???
  217. 116 STD2 ??? ???
  218. 117 LEAVE ESP=EBP-1; POP EBP Leaves Stack Frame
  219. 118 STM MF=1 Enables Extended Memory Mode
  220. 119 CLM MF=0 Disables Extended Memory Mode
  221. 120 CPUGET X,Y X=CPU(Y) Reads CPU Register Y to X
  222. 121 CPUSET X,Y CPU(X)=Y Writes Y to CPU Register X
  223. 122 SPP X,Y P(X)F(Y)=1 Sets Page X Flag Y (Y=0:Read; Y=1:Write; Y=2:Code)
  224. 123 CPP X,Y P(X)F(Y)=0 Clears Page X Flag Y
  225. 124 SRL X,Y PRL(X)=Y Sets Page X RunLevel to Y
  226. 125 GRL X,Y X=PRL(Y)? Gets Page Y RunLevel to X
  227. 126 LEA X,Y ??? ???
  228. 127 BLOCK X,Y BlockStart=X;BSize=Y Sets Block Data
  229. 128 CMPAND X,Y CMPR = X AND Y Puts X AND Y to CMPR
  230. 129 CMPOR X,Y CMPR = X OR Y Puts X OR Y to CMPR
  231. 130 MSHIFT X,Y ESI[0,X-1] SHF Y Shifts X bytes from ESI by Y (relative, positive = right)
  232. 131 SMAP X,Y SMAP X,Y Remaps Page X to Page Y
  233. 132 GMAP X,Y GMAP X,Y??? ???
  234. 133 RSTACK X,Y X = [SS+Y] Reads from Stack+Y to X
  235. 134 SSTACK X,Y [SS+X] = Y Writes Y to Stack+X
  236. 135 ENTER X PUSH EBP; EBP=ESP+1; ESP=ESP-X Enters into Stack Frame
  237. 250 VADD X,Y Adds Vectors
  238. 251 VSUB X,Y Subtracts Vectors
  239. 252 VMUL X,Y Multiplies Vectors
  240. 253 VDOT X,Y Vector-related
  241. 254 VCROSS X,Y Vector-related
  242. 255 VMOV X,Y Copies Vector Y to X
  243. 256 VNORM X,Y Vector-related
  244. 257 VCOLORNORM X,Y Vector-related
  245. 259 LOOPXY X,Y If EDX>0 then IP=X, if ECX>0 then ECX-- else EDX--; ECX=Y
  246. 260 MADD X,Y Adds Matrixes
  247. 261 MSUB X,Y Subtracts Matrixes
  248. 262 MMUL X,Y Multiplies Matrixes
  249. 263 MROTATE X,Y Rotates Y to Matrix
  250. 264 MSCALE X,Y Scales Y to Matrix
  251. 265 MPERSPECTIVE X,Y Matrix-related
  252. 266 MTRANSLATE X,Y Matrix-related
  253. 267 MLOOKAT X,Y Matrix-related
  254. 268 MMOV X,Y Copies Matrix Y to X
  255. 269 VLEN X,Y Vector-related
  256. 270 MIDENT X Identifies Matrix X
  257. 273 VMODE X VMODE = X Sets VMODE to X
  258. 295 VDIV X,Y Divides Vectors
  259. 296 VTRANSFORM X,Y Vector-related
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement