           # /*
           #  * Car script, handling any added logic
           #  */
           #  
           # #include "racer.oxs"
           # //
           # // Racer / Onyx link
           # // DO NOT CHANGE THIS FILE!
           # // (c) 2012 Cruden B.V.
           # //
           # 
           # // Events inside the engine
           # // OBSOLETE since 8-6-2012
           # const int EVENT_MOTION_OUTPUT=1;    // Just before sending output to motion (~100Hz)
           # [ Constant 'EVENT_MOTION_OUTPUT' with value 1 / 0x1 ]
           # const int EVENT_PHYSICS_STEP=2;     // Running at full physics speed (1000Hz);
           # [ Constant 'EVENT_PHYSICS_STEP' with value 2 / 0x2 ]
           # const int EVENT_FRAME=3;            // Just before painting a frame (~60Hz)
           # [ Constant 'EVENT_FRAME' with value 3 / 0x3 ]
           # const int EVENT_FRAME_3D=4;         // After 3D is painted, just before switching to 2D (not yet implemented)
           # [ Constant 'EVENT_FRAME_3D' with value 4 / 0x4 ]
           # const int EVENT_FRAME_2D=5;         // After 2D is painted; paint extra 2D things now
           # [ Constant 'EVENT_FRAME_2D' with value 5 / 0x5 ]
           # 
           # // Base types
           # class Vector3
           # {
           #   float x,y,z;
           # [ Member variable 'x' at virtual data address 0x0, size 4 bytes, scopeDepth 2 ]
           # [ Member variable 'y' at virtual data address 0x4, size 4 bytes, scopeDepth 2 ]
           # [ Member variable 'z' at virtual data address 0x8, size 4 bytes, scopeDepth 2 ]
           # };
           # class Vector2
           # {
           #   float x,y;
           # [ Member variable 'x' at virtual data address 0x0, size 4 bytes, scopeDepth 2 ]
           # [ Member variable 'y' at virtual data address 0x4, size 4 bytes, scopeDepth 2 ]
           # };
           # 
           # // Time
           # int GetSimTime() engine;      // Returns simulation time in milliseconds
           # [ Engine function 'GetSimTime' has index 7 ]
           # 
           # // Physics
           # void ResetMovables() engine;  // Restore all movables to their default position
           # [ Engine function 'ResetMovables' has index 8 ]
           # 
           # // Rendering
           # float GetFPS() engine;        // Returns frames per second
           # [ Engine function 'GetFPS' has index 9 ]
           # void  PaintText(stringdata s,float x,float y) engine;
           # [ Argument 's' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'x' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'y' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'PaintText' has index 10 ]
           # 
           # // Controllers - raw access (the future will see a controller engine in the middle)
           # int MouseGetX() engine;
           # [ Engine function 'MouseGetX' has index 11 ]
           # int MouseGetY() engine;
           # [ Engine function 'MouseGetY' has index 12 ]
           # int MouseGetButtons() engine;
           # [ Engine function 'MouseGetButtons' has index 13 ]
           # int IsKeyPressed(int n) engine;
           # [ Argument 'n' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'IsKeyPressed' has index 14 ]
           # 
           # // Key codes for IsKeyPressed()
           # const int KEY_T=84;
           # [ Constant 'KEY_T' with value 84 / 0x54 ]
           # 
           # // Generic system interface
           # int   GetSystemInt(stringdata s) engine;            // Retrieve values
           # [ Argument 's' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'GetSystemInt' has index 20 ]
           # float GetSystemFloat(stringdata s) engine;
           # [ Argument 's' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'GetSystemFloat' has index 21 ]
           # void  SetSystemInt(stringdata s,int n) engine;      // Set parameters
           # [ Argument 's' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'n' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'SetSystemInt' has index 18 ]
           # void  SetSystemFloat(stringdata s,float f) engine;
           # [ Argument 's' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'f' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'SetSystemFloat' has index 19 ]
           # 
           # // Motion platforms
           # //   Overrule outgoing signals to motion (EVENT_MOTION_OUTPUT)
           # void MotionSetAngularVelocity(float vx,float vy,float vz) engine;
           # [ Argument 'vx' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'vy' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'vz' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'MotionSetAngularVelocity' has index 15 ]
           # void MotionSetAcc(float ax,float ay,float az) engine;
           # [ Argument 'ax' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'ay' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'az' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'MotionSetAcc' has index 16 ]
           # void MotionSetAngularAcc(float ax,float ay,float az) engine;
           # [ Argument 'ax' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'ay' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'az' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'MotionSetAngularAcc' has index 17 ]
           # 
           # // World/entities
           # void EntitySetPosition(handle hEntity,Vector3 pos) engine;
           # [ Argument 'hEntity' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'pos' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'EntitySetPosition' has index 22 ]
           # void EntitySetRotation(handle hEntity,float yaw,float pitch,float roll) engine;
           # [ Argument 'hEntity' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'yaw' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'pitch' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'roll' at stack-relative address 12, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'EntitySetRotation' has index 23 ]
           # 
           # //
           # // Car simulation specific
           # //
           # 
           # // Cars - private interface (should get some kind of 'private' property)
           # handle CarGetGenericModel(handle h,int n) engine;
           # [ Argument 'h' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'n' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'CarGetGenericModel' has index 24 ]
           # 
           # // Cars - public interface
           # class Car
           # {
           #   handle h;
           # [ Member variable 'h' at virtual data address 0x0, size 4 bytes, scopeDepth 2 ]
           #   handle GetGenericModel(int n)
           # [ Argument 'n' at stack-relative address 0, size 4 bytes, scopeDepth 3 ]
           #   {
           # [ Member function 'GetGenericModel' starts at code address 0x0 ]
           #     return CarGetGenericModel(h,n);
           # [ Implicit 'this' at stack-relative address 0xfffffff0, size 0 bytes, scopeDepth 3 ]
00000000   push_bp                # Save stack pointer for local variables and arguments
00000004   mov_bp_sp              # BP=SP (function args and locals are relative to BP)
00000008   push_this              # Save 'this' register
0000000c   set_this       0xfffffff0        # Recover 'this' from stack (relative to BP)
00000014   pusha_this     0x0        # Virtual address (lvalue) of member 'h'
0000001c   deref                  # lvalue to rvalue
00000020   pusha_bp       0xfffffff4        # Virtual address (lvalue) of local 'n'
00000028   deref                  # lvalue to rvalue
0000002c   call_engine    0x18        # CarGetGenericModel()
00000034   pop_eax                # Pop engine return value into EAX
00000038   push_eax               # Make EAX available on stack (return value)
0000003c   pop_eax                # Put top of stack in EAX register
00000040   pop_this               # Restore 'this' register
00000044   mov_sp_bp              # SP=BP (free up local variables)
00000048   pop_bp                 # Restore stack pointer for local variables and arguments
0000004c   return         
           #   }
           # };
           # 
           # // Generic models
           # void GenModSetPosition(handle hGM,Vector3 position) engine;
           # [ Argument 'hGM' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'position' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'GenModSetPosition' has index 26 ]
           # void GenModSetRotation(handle hGM,float yaw,float pitch,float roll) engine;
           # [ Argument 'hGM' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'yaw' at stack-relative address 4, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'pitch' at stack-relative address 8, size 4 bytes, scopeDepth 2 ]
           # [ Argument 'roll' at stack-relative address 12, size 4 bytes, scopeDepth 2 ]
           # [ Engine function 'GenModSetRotation' has index 25 ]
           # 
           # 
           # handle hCar;
           # [ Variable 'hCar' at virtual data address 0x0, size 4 bytes, scopeDepth 1 ]
           # 
           # void OnInit(handle h)
           # [ Argument 'h' at stack-relative address 0, size 4 bytes, scopeDepth 2 ]
           # {
           # [ Function 'OnInit' starts at code address 0x50 ]
           #   echo("OnInit of car");
00000050   push_bp                # Save stack pointer for local variables and arguments
00000054   mov_bp_sp              # BP=SP (function args and locals are relative to BP)
00000058   pusha_cstr     0x0        # Constant string 'OnInit of car'
00000060   echo_stringdata
           #   hCar=h;
00000064   pusha_global   0x0        # Virtual address (lvalue) of global 'hCar'
0000006c   pusha_bp       0xfffffff4        # Virtual address (lvalue) of local 'h'
00000074   deref                  # lvalue to rvalue
00000078   assign         
0000007c   pop                    # Pop end result of expression
           # }
           # 
           # void OnFrame()
00000080   mov_sp_bp              # SP=BP (free up local variables)
00000084   pop_bp                 # Restore stack pointer for local variables and arguments
00000088   return                 # Implicit return from function call
           # {
           # [ Function 'OnFrame' starts at code address 0x8c ]
           #   float t=GetSimTime();
0000008c   push_bp                # Save stack pointer for local variables and arguments
00000090   mov_bp_sp              # BP=SP (function args and locals are relative to BP)
           # [ Local variable 't' at stack-relative address 0x0, size 4 bytes, scopeDepth 2 ]
00000094   reserve_stack  0x4        # Reserve space for variable
0000009c   pusha_bp       0x0        # Initialization of local 't'
000000a4   call_engine    0x7        # GetSimTime()
000000ac   pop_eax                # Pop engine return value into EAX
000000b0   push_eax               # Make EAX available on stack (return value)
000000b4   int2float              # Implicitly convert 'int' to 'float'
000000b8   assign         
000000bc   pop                    # Pop initialization expression
           #   //echo("OnFrame");
           #   //echo(t);
           # }
           # 
000000c0   mov_sp_bp              # SP=BP (free up local variables)
000000c4   pop_bp                 # Restore stack pointer for local variables and arguments
000000c8   return                 # Implicit return from function call
main:
000000cc   exit           0x0
           # Constant strings
00000000   "OnInit of car"
           # Functions defined
00000000   "GetGenericModel"
00000050   "OnInit"
0000008c   "OnFrame"
           # Global scope variable space: 4 bytes
           # Main code starts at 0xcc
