POV-Ray : Newsgroups : povray.off-topic : Does anybody know this? : Does anybody know this? Server Time
14 Nov 2024 20:27:16 EST (-0500)
  Does anybody know this?  
From: Orchid XP v7
Date: 30 Nov 2007 14:59:15
Message: <47506b93$1@news.povray.org>
I'm just being nosy now... How do you call OS functions on Windoze?


Back in the days of the Commodore 64, the "operating system" (I use the 
term loosely) was stored in a big ROM chip. To call the OS (assuming you 
actually wished to do such a thing!) you simply jump to the right magic 
address. Since it's in ROM, it never moves. And indeed, you could buy 
big tables of addresses and the expected parameters...


In the days of the Amiga, things became a little more complex. The OS is 
composed of "libraries". Some of these are burned into ROM, while others 
reside in files on disk. But even the ones in ROM are in a slightly 
different place depending on exactly which model of Amiga you have.

All is not lost, however. Memory address 0x00000004 contains a base 
pointer to a "jump table". If you take this base address and add on what 
they call a "library vector offset" (LVO), you can access any function 
provided by the Exec library. And, again, for a large sum of money, you 
could buy a file containing either C or assembly declarations of all the 
function names and their corresponding LVOs.

The two important functions provided by Exec are of course OpenLibrary() 
and CloseLibrary(). The former takes a pointer to a zero-terminated 
string indicating the desired library name, and an integer indicating 
the minimum acceptable library version. On return, there's a status code 
indicating whether the library could be opened, and if so, what version 
was actually found, and a base pointer to its jump table. Now again you 
need to know the LVOs for the functions you want to call.

(If the library is on disk, Exec will load it for you. When you close 
it, Exec might unload it if nobody else is using it.)


How does this stuff work with Windoze? (Or Linux, for that matter...)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.