OpCode

From SimsWiki
Jump to: navigation, search

OpCodes and Operands

Each node, or instruction, in a BHAV is summarised in a line in the display that also shows the linkage. This doesn't always capture the full detail of the instruction that is coded for that node. For that we must select the node and look in the Instructions Setting panel on the right of the display.

Node Summary and full Instruction Settings detail


OpCode

The Resource Chooser
Each instruction in a BHAV begins with a 2 byte Operation Code, or OpCode. It is selected from the pull down box in the Instruction Settings panel. Clicking on the arrow next to that box brings up the Resource Chooser, or if you already know the hexadecimal value of your OpCode, you can just type it in the box. It can either be a primitive, which is a built in instruction or another BHAV where there are Global ones and then your own private BHAVs in this package. The global BHAVs you can select include completely Globals ones that any object can use; those that are part of Semi-Globals file you have selected for this object, and if you are part of a group (i.e. your object’s group is not set to 0xFFFFFFFF) the group BHAVs. If your group is 0xFFFFFFFF, this tab will contain the same BHAVs as the ones for this package. All these various resources a numbered consistently, so you can tell what kind of resource it is from its OpCode number.
Resource Numbering
Resource classification Numbering Notes
Primitives 0x0000 - 0x00FF also known as 'canned', 'inline', or 'built-in' functions
Globals 0x0100 - 0x0FFF Global functions can be used by any object in the game
Locals 0x1000 - 0x1FFF Locals are specific to this object
SemiGlobal 0x2000 - 0x2FFF Semi-Globals are used by a group of related objects


Operands

The values for the Operands are completely dependant on which OpCode is chosen. Each OpCode is decribed with its relevant Operands in the sections linked from the table.

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox