Ever wondered what those "reserved" instructions did in the ZCPU? Wonder no more! The undocumented nature of these instructions usually means one of two things: either A) Black_Phoenix was too lazy to update the documentation for these instructions, or B) the instructions are currently not working as designed. Some of the instructions ARE documented in the code, so they may or may not actually be working; however, these instructions should be considered incomplete and thier use should be avoided until they are properly documented. Some aren't even recognized by the mneumonic-opcode table yet. And without further ado, the list of lost instructions:
Opcode: 016
Mnemonic: RD X,Y
Function: X = MEMORY[Y]
Observation: Seems to read the byte at memory[Y] and put it into X.
Opcode: 017
Mnemonic: WD X,Y
Function: MEMORY[X] = Y
Observation: Opposite of RD.
Opcode: 046
Mnemonic: STD
Function:
Observation: Enables debug mode. This causes the CPU to spew its state into the console on every cycle.
Opcode: 072
Mnemonic: CJMP X
Function:
Observation: The code is identical to CALL.
Opcode: 100
Mnemonic: STATESTORE X
Function:
Observation: Same as PUSHA (see below), except it writes the registers to the pointer given in X instead of in the stack.
Opcode: 109
Mnemonic: STATERESTORE X
Function:
Observation: Opposite of STATESTORE.
Opcode: 113
Mnemonic: RLADD
Function:
Observation: Puts LADD into EAX. This was presumably obsoleted by CPUGET.
Opcode: 114
Mnemonic: PUSHA
Function:
Observation: Pushes all of the GP registers (EAX-EDX,EDI/SI/BP/SP) onto the stack in one fell swoop.
Opcode: 115
Mnemonic: POPA
Function:
Observation: Opposite of PUSHA. ESP is not POPped here, so this pair of instructions is obviously broken right now.
Opcode: 127
Mnemonic: BLOCK X,Y
Function: SETUP_DATA_BLOCK([X..X+Y-1])
Observation: Sets the BLOCKSTART and BLOCKSIZE registers to these values, and otherwise does nothing else.
Opcode: 128
Mnemonic: CMPAND X,Y
Function: CMPR = CMPR AND (X - Y)
Observation: Sets CMPR to the non-absolute difference between X and Y if CMPR is not zero.
Opcode: 129
Mnemonic: CMPOR X,Y
Function: CMPR = CMPR OR (X - Y)
Observation: Same as above, except only acts if CMPR IS zero.
Opcode: 130
Mnemonic: MSHIFT X
Function: SHIFT DATA (see lua code)
Observation: Seems to move a whole block of data in memory, with ESI being the starting point and X being the size. It also takes a second param, but this isn't documented. I'm guessing this is like MCOPY.
Opcode: 131
Mnemonic: SMAP X,Y
Function: PAGE[X].MappedTo = Y
Observation: This one looks like it -may- be one of the instructions relating to virtual memory that I've been asking for. It maps page X to page Y so reading/writing page X means page Y is read/written instead.
Opcode: 132
Mnemonic: GMAP X,Y
Function: X = PAGE[Y].MappedTo
Observation: Puts what page Y is mapped to into X.
Opcode: 133
Mnemonic: RSTACK X,Y
Function: X = STACK[Y]
Observation: Reads a value from memory[SS+Y] into X. Presumably setting Y to ESP lets you read the current top value.
Opcode: 134
Mnemonic: SSTACK X,Y
Function: STACK[X] = Y
Observation: Opposite of above. Both these instructions let you read/write the stack in a "controlled" manner without PUSHing/POPping.
Opcode: 138
Mnemonic: BREAKPOINT
Function:
Observation: Causes execution in EmuFox to stop (sets clk to 0 technically). Does nothing in Garry's Mod.
Opcode: 139
Mnemonic: CLD
Function:
Observation: Opposite of STD.
NOTE TO PEDANTIC AND INSUFFERABLE FAGGOTS (such as TomyLobo): "Observation" is what I perceive the code to do and may or may not reflect what the code actually does or is intended to do.
Last edited by CCFreak2K; 01-16-2010 at 05:52 AM. Reason: Changed observation for POPA.
I would say it's not POPA that is broken, but rather PUSHA, if it really pushes ESP. Pushing ESP makes no sense, neither does popping (these operations use ESP to determine where to push values or pop them from).
My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
My tutorials: applyTorque - Quaternions - PID controllers
Some other things I made: FT Chip - RK4 Solar System
If I've read documentation correctly, pushing values from registers takes that value out of the register. Or is it simply this?:
Code:mov [SS+ESP],esp
Bookmarks