GTA: Modification Area
Would you like to react to this message? Create an account in a few clicks or log in to continue.
GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
San Andreas OpCodes EmptySun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
San Andreas OpCodes EmptyThu Oct 14, 2010 1:03 am by findmy012

» Mission Question
San Andreas OpCodes EmptyThu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
San Andreas OpCodes EmptyThu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
San Andreas OpCodes EmptySat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
San Andreas OpCodes EmptyFri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
San Andreas OpCodes EmptyFri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
San Andreas OpCodes EmptyTue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
San Andreas OpCodes EmptyMon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))
Log in

I forgot my password



April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     

Calendar Calendar


You are not connected. Please login or register

San Andreas OpCodes

Go down  Message [Page 1 of 1]

1San Andreas OpCodes Empty San Andreas OpCodes Sun Feb 22, 2009 12:15 am

gtasbigfoot

gtasbigfoot
Admin

OpCodes



Each instruction is represented by a number – opcode, which is UINT16.
By that number the game engine(.exe) identifies an action to perform. And the opcode will do what it is made for, if used correctly.

Here is how a opcode in SCM looks like:

Opcode 0001

Code:

0100 04 00

Opcode 0002

Code:

0200 04 @Label



  • First 4 digits is the opcode number in a little-endian format.
  • Second part is the data type
  • Third part is a parameter(s) value




When a mission script is disassembled, the opcodes are written in a readable format, in which humans, can read better. The examples above will look something like this:

Opcode 0001

Code:

wait 0

Opcode 0002

Code:

jump @Label


The comment opcode words(wait, jump,) are made only so the user can understand the opcode better. The game does not know what the words mean, it knows the data number(0001: for example) and it knows the parameters and this is the only thing which is important(for example you do not need the word "wait" you can just put 0001: 0) (0001 is the data, and 0 is the parameter of that opcode for example). So when a mission script is assembled the commands are written back in raw byte form.

An opcode is UINT16 number. It means the minimum opcode is 0000 and maximum opcode is 0xFFFF. However due to a specific of the SCM language, any numbers above 0x7FFF denote negative conditional opcodes. The original un-modded game supports a way smaller amount of opcodes (maximum 0A4E for San Andreas).

Data types


Data type is a single byte written before any parameter. The purpose of it is to tell to the game how much bytes to read next and what kind of data it is, that depends on what opcode it is.

Code:


--Data type--            --Parameter Length (bytes)--
00                      0    
01                      4    
02                      2    
03                      2    
04                      1    
05                      2    
06                      4    
07                      6    
08                      6    
09                      8
10                      2
11                      2    
12                      6
13                      6
14                      1+x    
15                      16    
16                      2    
17                      2
18                      6
19                      6


Parameters


The games engine knows amount of parameters for each opcode, (and it knows the data type, as stated above as well). The parameter of a opcode, could be one of the following:



  • Immediate values

    - integer numbers
    - floating-point numbers
    - short strings (up to 7 characters and null-terminator byte)
    - San Andreas long strings (up to 15 characters and length byte)

  • Variables

    - global variables
    - local variables

  • Arrays

    - For information on arrays see here.



Integer:

Code:

0006: 0@ = 0

Floating-point value:

Code:

0007: 0@ = 0.0

Short string:

Code:

15@s

Long string:

Code:

15@v

Global variable:

Code:

$

Local variable:

Code:

@

You can see this topic for information on them.

Arrays

http://gtamodding.com

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum