They do a "weighted average" of what you made over the years that you were old enough to work, and that gets related to what you paid into in Social Security taxes and what your employer paid in for you. Any year that you didn't work brings down your benefit amount. However, any time that you didn't work from the date of the onset of your disability is not counted against your benefit.
When you apply for SSDI, you are also applying for SSI. You may get one or the other, or both. If you get a very low amount for SSDI, you might get some SSI.
Here's some info on SSI:
"Everyone on SSI disability (Supplemental Security Income) is eligible for the same base amount, $733. But your actual monthly SSI payment will depend on whether you have any countable income, whether you are married . . . . . . . While the federal benefit rate is the same through the United States, many states add a "state supplemental payment" onto the federal benefit. The payment varies from $10 to $200, depending on the state."
From:
How Much Can You Receive in SSI Disability? | Disability Secrets