To add to the megasquirt nutshell. (please correct me if im wrong with any of this)
The megasquirt works by knowing a few charactoristics about your engine (from the sensors,) doing some math, and then the output of said math is sent to the injectors. First it knows how fast your engine is turning in rpm (no sensor, just a wire from dizzy to computer) and it knows the size of your engine (you input this value from your laptop.) With this, the megasquirt does some geometry (that thing you slept in) to find the exact amount of "volume" of Air that your engine *COULD* move through it at a given rpm. Example: a particular engine is calculated to move 100 "units" of air at 1000rpm, and 200 "units" of air at 2000rpm and so on. With this number, the computer can do the math to find out how much fuel is needed to turn 100 "units" of air into a 14.7:1 air-fuel ratio, or any combination of "units" or air-fuel ratios. Example: to make 100 "units" of air turn into a 14.7:1 air-fuel ratio, you need 10 "units" of fuel. So the injectors inject 10 units of fuel and WAM BAM you have fuel injection.
However, the numbers that the comptuer first gets are a
LIE and are totally useless

. This number is assuming that the engine is making %100 "Volumetric Efficiency." All volumetric efficiency means is how "efficient" that the combustion chamber is filling up with air. Example: If a single cylinder engine of 100cubic inches takes an intake stroke and gets 50cubic inches of air on that stroke, it has a volumetric efficiency of %50.
So now we must know the volumetric efficiency for the entire rpm range of your engine under the entire load range (load range is messured by a MAP sensor). Its not as hard as it sounds. This is done by you tuning a "volumatric efficiency table" on your laptop or pc. I wont get into how we find those numbers now. Example: we find that at 1000rpm we are %50 efficient, and at 2000rpm we are %65 efficient. So now the computer takes the numbers it found originaly (the useless ones) and scale them down by %50 and %65, respectively.
I hope this helps.