FSUIPC: Lua Tutorial
For Microsoft Flight Simulator and GoFlight Equipment

 

Home
About Lua
Executing Code
Binary
Hexadecimal
Bits & Bytes
Memory Offsets
Variables
The Code
The Editor
Get Started
FlightSim
Cleaning Up
Assignments

 

Memory Offsets

    Just like if you were to tell me how to find your phone number in the phone book... I'd need to know your name and sometimes your address. Then I can call you and we can talk about Flight Simming!!!

    Well, computer memory isn't quite as easy as looking up a phone number. Instead of pages with numbers, computers use "addresses" with a bunch of weird crap.

What is a memory address? Just like your address... it's a location.  Your home address consists of a house number, street name, city, state and zip code. Computer memory is simpler than that. It's just a series of numbers and letters.

    My home address is 11705. Open the calculator again and enter your home address number. Click the Hex button.  Mine comes out as 2DB9. In addition to "where to look", we need to know "how much" to look at. That's called the size of the address.

    Each two spots is one byte, my address take up for spots (2DB9) so you could say it's a 2 byte address. Some people have bigger addresses and some smaller.  Just like computers.

    So let's look at some real memory offsets... open up the Offsets Status pdf file. Now let's see where in FS they keep track of the status of the aicraft doors. Do a search for "doors". Hopefully you will end up on page 49 looking at a line saying...

This byte shows doors that are open, one bit per door:

    Good you found it... Look in the far left column... what do you see?  3367! That's right!!!  3367 is the hexadecimal address for the doors.  Now, how big is that address. Yep, It's one byte.  Want another?

    How about the Surface Temp? You may find two places where it says Surface Temp, but that's not it. We want memory address 0EC0. How big is it?  2 bytes, so that's a word. Is it signed or unsigned? It doesn't say, but I know the temp can go below zero so it's safe to say its a signed word (SW). So how do we know if a located is signed or unsigned. Open the FSInterrogator2std and scroll down to 0EC0. It states S16, which means Signed 16-bit. That's it's way of saying a Signed Word (SW).

So do you have a grasp of memory offsets? I hope so...

 


Written by
Joseph "Skittles" Cardana
skittles(at)anadrac.com
Updated: 2011-08-25 07:59