www.pudn.com > fxvmm210.zip > FXVMM.DOX


FXúVM Manager API - The Dox (sort of) 
 
First off all - I HATE WRITING DOX ! (yes I know everybody says that, 
but imagine this, here I am sitting behind gertrude (that's the name 
of my computer - yes I need proffessional help), the X-files is on,  
the french-fries are smelling awfully good, I hear cheering people on 
the street having _a_lot_ more fun than me ...  ... now that's 
a good reason ain't it ? - although the fact that people are actually 
reading this crap does cheer me up (a bit, just teeny weeny bit)) 
 
Okay then, here we go .... 
 
Here we are in 1995, almost 1996, and what am I presenting you here with ? 
Is it the newest 32Bit Flat Memory Manager ? - Nope ...  
I present an amazing (virtual) memory manager, but .... it's in 16bit ...  
Now you might ask yourself 16bit why ? - Well to be honest for a couple of  
reasons, first it's faster - yes it is ! Don't let anybody tell you that 32Bit  
applications are faster per-se, 'caus they're not ! Well ... there are a few  
points to clarify here ... the application itself (i.e. the code) is probably  
(well almost certainly) faster than it's 16bit counterpart, since it's using  
the native 32Bit structure of the 386+ CPU. So what remains then ?, well the  
memory. In 32Bit protected mode the memory is like one big chunk of core.  
For the programmer this is damn easy, he (or she) will never run out of  
memory, as long as he/she stays within the DOS extenders limitations (mostly 4G  
bytes). Apart from that allocating the memory is also pretty easy since there's 
just one pool to allocate from. Also the difference between static and dynamic 
memory gets blurry in the 32Bit protected world. In the normal DOS mode things 
are a tad different, we only have 640K to allocate ... bummer eh ? - well it  
has been for ten years, then people started allocating EMS, then came XMS, and 
more sorts of exotic sounding memory types. Now although it was nice for the  
programmer ,he had more memory to use, it was a royal pain in tha butt to  
actually do it in a nice way. Why you ask ? Well since the programmer had to  
decide where to put what ... a big chunk ... hmmm put it in XMS ... a small  
chunk hmm let's put it in conventional memory ... hmm have to reallocate that  
little chunk ? bummer ... yup ... bummer is the word ... Now there were some  
Virtual Memory Managers around (the Virtual Memory Manager is just a nice word  
for  that-thingie-that-gets-me-the-memory-I-need-from-all-sorts-of-wierd-places- 
I-didn't-know-they-even-existed). When I started programming (geez - remember 
them green monochrome screens, the tape drivers _inside_ the actual computer -  
the good 'oll days ...) I soon became aware of the fact that writing code 
in DOS was a pain, at least if it concerned allocating the so hard needed core. 
So these Virtual Memory Managers were pretty handy ... that is if you could 
afford 'm ... now this is the crux of the whole story, I've been looking 
for a proper 16Bit memory manager for years, and sure there are tons of 'm, 
but _none_ with source code, and all were either shareware-crappy-thingies or 
crippled. This really bummed me off, I thought ; my dear, there's even source 
code for DOS, you can get a complete UNIX clone in source, heck, ya can 
even get a complete 32Bit compiler and linkage package - and all for free ! 
Now I've been somebody who has been enjoying all those goodies for years, 
the first copy of GCC (remember that one ?) really got that sparkle light  
burnin' in my eyes. It's just a nice concept that you can actually go into the  
code look at what it does, change some things for your own needs (and fix bugs) 
... yeah well. I have a total respect for people who release this sort a stuff 
so I though, to hell with it, I'm releasing my FXVMM aswell. Now there are 
a few things you should now ... I intentially wrote the API for my own 
needs (wich was a graphix compression app), and haven't really done anything 
with this code since. So there are some pretty enoying things about it, well 
actually only two ... (one) I wrote it in the large memory model, and (yes, 
that's two) I wrote it for Borland C++ 3.1 ... If ya wanna change it to 
a different memory model you shouldn't have that big of a problem, but if 
ya wanna compile it with anything else than borland 3.1+ you do. The assembly 
code is _heavily_ dependent on the standerd Borland C++ libs, (notice 
that strange _TurboFloat thingie ;), In other words if ya have Borland, 
keep on reading, if ya don't delete this file immediately and go out and 
buy a proper compiler (ehmm, like Borland). Another thing about the source, 
if you look closely at the .asm files you'll notice that it's full of _CRAP_ 
that is, the code itself isn't crappy, just that the labels and some of 
the vars are completely non-logical, for the assembler this ain't no problem, 
for you as the reader of the .asm files it might be. I lost some of the source 
so I had to dis & re -assamble some of it wich lead to some wierd code ... ;(  
The C source is pretty much readable and I even added some comments ! (yes I  
had a good day that day) Well anyway, here's how the API goes about his ways ... 
 
First of all you have to initialize the API by calling the _fxvmm_open_api()  
function, wich either returns TRUE for success or FALSE on failure. 
The you have to set up an allocation strategy, wich basically means that you 
tell the API in wich order it should allocate memory. After doing that we 
can start allocating and using the memory thru the API, after we're done with 
the allocated memory we have to free it with _fxvmm_free(), wich will deallocate 
the specifeid buffer. On exit we should _always_ close the API by calling 
the _fxvmm_close_api() function wich also returns TRUE or FALSE.  
 
How to start using the API, well I think the easiest way is to look at 
the example code, and start reading the various source files, after 
a while you will get the grips of using the API, it really isn't that 
difficult !, we make this deal, you go and hack your way into 
the source, and If you have a problem or run into a really wierd bug, 
ya just leave me an email. Now I'm incredibly busy at the moment, so It 
might take a while before I find the time to answer your question, however 
I'll make sure you get a response ... If you update any of the source or 
make changes in it wich could benefit anybody please make it available to 
everybody, hell you could even rip my name out and tell it's completely yours 
(I _really_ wouldn't like that - but - it happended before), as long as you 
make sure that it's freely available ! If you start selling it, than I would 
be forced to come over and kick your butt (and that's nicest thing i'll do ;) 
No please, let's keep the flow of source and information open and free ... 
We've got this TV program here wich says 'Whatever you do to the WEB, the WEB 
will do to you' - a lot of truth !, oh yeah another thing, if you make any 
changes to this package, please keep the name the same, simply for the fact that 
people will recognize it as an update instead of a new package.  
 
Enjoy ! 
 
 
Frequently Asked Questions  
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
[Q] Dear flux, why is my penis so small ? 
[A] uhm ... no I meant Frequently Asked questions about FXVMM ... hehe 
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
[Q] Sometimes my application (wich uses FXúVM Manager) crashes horribly ... 
    (the computer starts smokin' and the monitor explodes), can I sue you ? 
[A] Nope, read the Legal stuff 
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
[Q] Does FXVMM run under Windows95 or OS/2 
[A] Yup ! (it's DPMI and VCPI compliant) 
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
[Q] I have seen lot's of C functions inside the .asm files - why ? 
[A] Well, a lot of functions are borrowed from the standard C libraries, 
    this to keep the code as small as possible, the downside to this is 
    that it makes the source highly non-portable, however when I designed 
    this API portability was not my main goal, speed & size were ... 
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
[Q] What's the maximum amount of memory the API can allocate ? 
[A] 128Meg 
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 
 
Some greets fly to .... 
 
MikMak    - the MikMod still amazes me _bigtime_ ! 
BelGarion - Hope to see you soon dude... 
Ravian    - My demo will be out soon ! 
TRAN      - Though shallt be praised for thy 32 bittus headeros ! 
Angelo    - I look forward to working with you ! 
 
All the members of D^FENCE ! (We'll be releasing a cool demo soon !) 
 
How to contact me ... 
 
I ain't gonna give ya my snail mail adress anymore since nobody seems to 
use it anyway ... 
 
Internet: flux@stack.urc.tue.nl 
 
Last words ... 
 
I know this isn't much of a documentation, yes I know, I know, but hey you 
got the source code !, after all exploring yourself is much more fun than 
reading dox files isn't it ? 
 
Last last words ... 
 
If you are really, really happy with this package and you feel like rewarding 
me you could always send me a cool postcard !, or order a pizza for me, or 
send my a copy of your Watcom compiler (maybe we can trade ?, I got a cool 
stamp collection ;) 
 
Bye ..., flux, 23th of November 1995