Andrus,
There is a Windows API call that will return the amount of available physical RAM which can then be used as the parameter in the sysy(3050) call.
See the article:
Playing Tricks on Your Memory by Gary DeWitt FoxTalk, January 1998
This is available for a small fee from http;//www.pinpub.com
Regards,
MarkA