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