POV-Ray : Newsgroups : povray.off-topic : Does anybody know this? : Re: Does anybody know this? Server Time
14 Nov 2024 20:28:34 EST (-0500)
  Re: Does anybody know this?  
From: John VanSickle
Date: 30 Nov 2007 16:35:47
Message: <47508233@news.povray.org>
Orchid XP v7 wrote:
> 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...

Commodore released a manual for the C64 that had EVERYTHING about the 
machine, including schematics.  It contained everything you needed to 
write any application.

> 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.

Addison-Wesley released a very extensive set of docs for the Amiga, 
consisting of five volumes.  One concerned programming at the hardware 
level, another dealt with the Exec library, a third with the Intuition 
library, and the last with all of the others (Graphics, Layers, Sound, 
etc.).  I'm pretty sure the vector table offsets for every OS call were 
in these books.

> 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...)

For Windows, I think that the library code is mostly in DLLs, and that 
your linker will add the appropriate OS calls to get any needed DLLs 
into memory.

Dunno how it works in Linux.

Regards,
John


Post a reply to this message

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