:asm_PutOnAddressRelativeAddressToAddress
{
 Description: 
    Writes at the specified address a relative adress to second adress.
 Type: SET
  
 Parameters:
   Passed:
     0@ - source adress
     1@ - size of written adress (1, 2, 4)
     2@ - source virtual protect
     3@ - destination adress
     
 
 Example:
  0AB1: call_scm_func @asm_PutOnAddressRelativeAddressToAddress 4 source_adress 2@ source_size 4 source_virtual_protect true destination 0x004912DC     
}
0062: 3@ -= 0@  // (int)
0062: 3@ -= 1@  // (int)
0A8C: write_memory 0@ size 1@ value 3@ virtual_protect 2@
0AB2: ret 0

:asm_PutOnAddressRelativeAddressToLabel
{
 Description: 
    Writes at the specified adress a relative adress to second adress.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10) 
     1@ - source adress
     2@ - size of written adress (1, 2, 4)
     3@ - source virtual protect
     4@ - destination label
     
 
 Example:
  0AB1: call_scm_func @asm_PutOnAddressRelativeAddressToLabel 5 script_content 1@ source_adress 2@ source_size 4 source_virtual_protect true destination @label     
}
0062: 0@ -= 4@  // (int)    // destination: label adress
0062: 0@ -= 1@  // (int)

0062: 0@ -= 2@  // (int)
                                    
0A8C: write_memory 1@ size 2@ value 0@ virtual_protect 3@
0AB2: ret 0

:asm_PutOnLabelRelativeAddressToAddress
{
 Description: 
    Writes at the specified label a relative adress to second adress.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source label
     2@ - size of written adress (1, 2, 4)
     3@ - destination adress    
 
 Example:
  0AB1: call_scm_func @asm_PutOnLabelRelativeAddressToAddress 4 script_content 0@ source_label @function_adress source_size 4 destination 0x004912DC     
}
0062: 0@ -= 1@  // (int) 
0062: 3@ -= 0@  // (int) 
0062: 3@ -= 2@  // (int) 
0A8C: write_memory 0@ size 2@ value 3@ virtual_protect false
0AB2: ret 0

:asm_PutOnLabelRelativeAddressToLabel
{
 Description: 
    Writes at the specified label a relative adress to second label.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source label
     2@ - size of written adress (1, 2, 4)
     3@ - destination label    
 
 Example:
  0AB1: call_scm_func @asm_PutOnLabelRelativeAddressToLabel 4 script_content 0@ source_label @function_source source_size 4 destination @function_destination     
}
0062: 0@ -= 1@  // (int)    // source adress
0062: 1@ -= 3@  // (int)    // difference
0062: 1@ -= 2@  // (int)    // -= size

0A8C: write_memory 0@ size 2@ value 1@ virtual_protect false
0AB2: ret 0

:asm_PutOnAddressAbsoluteAddressToAddress
:asm_PutOnAddressAnyValue
{
 Description: 
    Writes at the specified adress any adress/value
 Type: SET
  
 Parameters:
   Passed:
     0@ - source adress
     1@ - size of written adress (1, 2, 4)
     2@ - source virtual protect
     3@ - destination adress
     
 
 Example:
  0AB1: call_scm_func @asm_PutOnAddressAbsoluteAddressToAddress 4 source_adress 2@ source_size 4 source_virtual_protect true destination 0x004912DC     
}
0A8C: write_memory 0@ size 1@ value 3@ virtual_protect 2@
0AB2: ret 0

:asm_PutOnAddressAbsoluteAddressToLabel
{
 Description: 
    Writes at the specified adress an absolute adress to label.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source adress
     2@ - source virtual protect
     3@ - destination label    
 
 Example:
  0AB1: call_scm_func @asm_PutOnAddressAbsoluteAddressToLabel 4 script_content 0@ source_adress 0x466D44 source_virtual_protect true destination @function_destination     
}
0062: 0@ -= 3@  // (int)    // destination adress
0A8C: write_memory 1@ size 4 value 0@ virtual_protect 2@
0AB2: ret 0

:asm_PutOnLabelAbsoluteAddressToLabel
{
 Description: 
    Writes at the specified label an absolute adress to label.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source label
     2@ - destination label    
 
 Example:
  0AB1: call_scm_func @asm_PutOnLabelAbsoluteAddressToLabel 3 script_content 0@ source_label @function_source destination @function_destination     
}
0A8F: 2@ = 0@ - 2@ // int   // destination adress
0062: 0@ -= 1@  // (int)    // source adress
0A8C: write_memory 0@ size 4 value 2@ virtual_protect false
0AB2: ret 0

:asm_PutOnLabelAbsoluteAddressToAddress
:asm_PutOnLabelAnyValue
{
 Description: 
    Writes at the specified label an absolute adress to second adress.
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source label
     2@ - size of written adress (1, 2, 4)
     3@ - destination adress    
 
 Example:
  0AB1: call_scm_func @asm_PutOnLabelAbsoluteAddressToAddress 4 script_content 0@ source_label @function_source source_size 4 destination 0x400000     
}
0062: 0@ -= 1@  // (int)    // source adress
0A8C: write_memory 0@ size 2@ value 3@ virtual_protect false
0AB2: ret 0

:asm_GetStructOffsetLabeltoLabel
{
 Description: 
    Calculates offset between first and second lable
 Type: SET
  
 Parameters:
   Passed: 
     0@ - first label
     1@ - second label
 
 Example:
  0AB1: call_scm_func @asm_GetStructOffsetLabeltoLabel 2 base_label @vehicles second_label @vehicles_properties store_offset 5@
}
0062: 0@ -= 1@  // (int)  
0AB2: ret 1 0@ 

:asm_PutOnAddressJmpFarToLabel
{
 Description: 
    Writes at the specified label ASM jmp far with relative address to label (0xE9 + relative address)
 Type: SET
  
 Parameters:
   Passed:
     0@ - adress of script content (current_thread_pointer + 0x10)  
     1@ - source address
     2@ - source virtual protect
     3@ - destination label    
 
 Example:
  0AB1: call_scm_func @asm_PutOnAddressJmpFarToLabel 4 script_content 0@ source_address 2@ source_virtual_protect true destination @function_destination     
} 
0062: 0@ -= 3@  // (int)    // destination adress
0A8C: write_memory 1@ size 1 value 0xE9 virtual_protect 2@
1@ += 1
0062: 0@ -= 1@  // (int)    // difference
0@ -= 4
0A8C: write_memory 1@ size 4 value 0@ virtual_protect 2@
0AB2: ret 0