Here's how it's done:
http://developers.facebook.com/docs/plugins/registration/
This pops up an iframe that has in it a form prefilled with your facebook data. It also supports custom fields. You can fill out or change any fields you want to and then submit the form as a signed request to the server.
If a user only has a Facebook account, they can just register with this to create an associated ASM account.
When an ASM account is already logged in, we should be able to use the same form with different parameters to associate the two accounts.
Edit: Code is here: http://pkinsky.com/register.html