POV-Ray : Newsgroups : povray.off-topic : Tell me it isn't so! : Re: Tell me it isn't C Server Time
15 Nov 2024 06:13:59 EST (-0500)
  Re: Tell me it isn't C  
From: scott
Date: 23 Jul 2009 03:22:35
Message: <4a680fbb@news.povray.org>
> The way this works on the Amiga is that you can't just *call* an OS 
> function. First you have to look up its base address in a table. 
> Basically, memory address 0x00000004 contains a pointer to a table. Every 
> OS function has a unique ID which is an offset into this table, which 
> enables you to lookup the function's base pointer. And then you can jump 
> to it. All of which takes about two-dozen assembly instructions...

On the Acorn there was an instruction called SWI (software interrupt) for 
calling OS and other module functions.  In the assembler it took a number or 
a string as a parameter (the assembler converted the string to the correct 
number), which defined the specific function you wanted to call.  I assume 
when the CPU got to the SWI instruction it jumped to a few lines of OS code 
which figured out where to actually jump to execute the instruction.

When you loaded "modules" to the OS (they were like services under windows) 
each module could register some functions with the OS.  Then you could call 
them with the SWI instruction.  It was pretty easy to use.

You could easily hack the system though by redirecting the interrupt handler 
to your code, calling the real OS handler, then passing control back to the 
calling program.  Of course in your code you could then check for certain 
functions (like reading the contents of a folder) and modify the results :-)


Post a reply to this message

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