13

I was reading Richard Downer's excellent response about how Amiga libraries work and one sentence in particular got my attention:

Yes, a pointer to exec.library is always at $4, and this is (in theory, but not in practice) the only fixed address you should ever use in AmigaOS.

I only ever knew about $4! So what are other addresses/data in a fixed memory location in AmigaOS?

(Of course, I'm not talking about hardware registers; this question is specifically about software related addresses and memory areas)

  • 2
    Actually I was referring to the hardware registers! If you're doing things fully cooperating with the OS then $4 is indeed the only fixed register. But if you're writing games or demos, then you'll cooperate with the OS up to a point, and then starting hitting hardware registers directly to get the best graphics performance. This was very common, the vast majority of games doing this, so many programmers would be using the fixed addresses of the custom chip registers. Games that kept the OS around were very rare (games like Civilization and Sim City). – Richard Downer Jan 31 '17 at 13:48
  • 2
    Still, are we indeed sure $4 is the only absolute address ever used by the operating system? The only other fixed memory location that now comes to me is $0, during an Alert(), set to ascii 'HELP' to trigger a post-reset early Guru Meditation in case the system is so compromised not to be able to show the message without first resetting. – user180940 Jan 31 '17 at 21:50
14

Actually, the $4 fixed address, more properly referred to as ExecBase, really is the only intentional, consistent fixed software "entry point". ExecBase serves as an entry point to the Exec library. exec.library has an interface to support enumeration of the other system software that is present, such that those interfaces (GfxBase, IntuitionBase, Dos, etc.) can be located and accessed. The locations of the other system software can and will move from release to release, but the ExecBase at $4 stays.

You could use ExecBase to locate, for example, the entry point (GfxBase) for graphics.library in a dynamic sense. However, the static address value you determine for GfxBase is not expected to be the same on some other iteration of the system software, and could also change based on hardware version and configuration. It's a dynamic system, by design.

  • Pretty cool. No segmented addressing, and no traditional memory map. – user12 Jan 31 '17 at 5:00
  • and no TRAPs to call the OS. – Jean-François Fabre Dec 29 '17 at 19:34
5

$0 is also a reserved address. It has two uses. The first is to prevent the rather common error of dereferencing a null pointer from immediately corrupting the OS. The second is to help ensure that a software failure message (the famous "guru meditation") appears on screen if the machine is forced to reboot before the ROM routines can display it. In that case the ROM checks address $0 for "HELP" and displays the guru during boot.

Other fixed addresses on the Amiga are the custom chip registers, but in later versions of the OS they are all abstracted away with library functions to access them. In earlier versions it was common to check certain registers to determine what features the machine had, such as the ECS chipset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.