Difference between revisions of "BHAV"

From SimsWiki
Jump to: navigation, search
m (Added categories)
m (We don't need two identicle articles on the smae topic)
Line 1: Line 1:
{{OldWikiEntry}} ====""SimAntics"" Behavioural Function====
+
#REDIRECT [[42484156]]
 
+
__All BHAVs have a similar basic format:__
+
64 - Filename (null terminated)
+
12 - Header
+
''var'' - Instruction 1
+
''var'' - Instruction 2
+
''var'' - Instruction n
+
...
+
 
+
__Each header also uses a similar format:__
+
2 - signature (0x8000 through 0x8009)
+
2 - count (number of instructions in file)
+
1 - tree type (deprecated)
+
1 - args (number of Parameters passed to the subroutine)
+
1 - locals (number of local variables used in the subroutine)
+
1 - header flag (deprecated)
+
4 - Tree Version # (signed integer)
+
 
+
 
+
The signature also defines the structure of the individual
+
instructions, as follows:
+
*  8000, 8001 & 8002 (instruction length: 12 bytes)
+
- 2 - Function/OpCode
+
- 1 - Goto on True
+
- 1 - Goto on False
+
- 8 - Operands
+
*  8003 & 8004 (instruction length: 20 bytes)
+
- 2 - Function/OpCode
+
- 1 - Goto on True
+
- 1 - Goto on False
+
- 16 - Operands
+
*  8005 & 8006 (instruction length: 21 bytes)
+
- 2 - Function/OpCode
+
- 1 - Goto on True
+
- 1 - Goto on False
+
- 1 - Node Version (Flag - 0x00 or 0x01)
+
- 16 - Operands
+
*  8007 & 8008 (instruction length: 23 bytes)
+
- 2 - Function/OpCode
+
- 2 - Goto on True
+
- 2 - Goto on False
+
- 1 - Node Version (Flag - 0x00 or 0x01)
+
- 16 - Operands
+
*  8009 (instruction length: 24 bytes)
+
- 2 - Function/OpCode
+
- 2 - Goto on True
+
- 2 - Goto on False
+
- 1 - Node Version (Flag - 0x00 or 0x01)
+
- 16 - Operands
+
- 1 - Cacheflags
+
 
+
Notes:
+
The 1-byte Goto statements in 8001-8006 appear to be the same as
+
  was used in TS1: 0xFD as Error, 0xFE as True, and 0xFF as False.
+
 
+
The 2-byte Goto statements in 8007 appear to be using
+
  0xFFFC as Error, 0xFFFD as True, and 0xFFFE as False.
+
 
+
The 8007 format can contain more than 256 seperate instructions,
+
  thus the use of 2-byte Goto statements.
+
 
+
Number of each signature type (0x8000 - 0x8007) contained in objects.package:
+
0x8000 - 1
+
0x8001 - 2
+
0x8002 - 25
+
0x8003 - 75
+
0x8004 - 4
+
0x8005 - 285
+
0x8006 - 1,357
+
0x8007 - 15,507
+
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 
[[Category:InternalFormats]]
 
[[Category:InternalFormats]]
 
[[Category:FormatsByName]]
 
[[Category:FormatsByName]]

Revision as of 21:05, 11 July 2006

  1. REDIRECT 42484156
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox