Skip to content

System Takeover

Understand the resources an exclusive Amiga caller owns, using the executed boot example and an explicit reset-to-leave lifetime.

Direct hardware access needs an owner. If AmigaOS and a game both replace the Copper list, change DMA or consume the same interrupt, neither can rely on its setup staying in place.

Our small game-loop caller uses an exclusive, reset-to-leave arrangement on an A500 OCS PAL boot ADF. This is its executed startup:

Exclusive caller startup

demo.asm, excerpt
start:
    lea $dff000,a5
    move.w #$7fff,$09a(a5)
    move.w #$7fff,$09c(a5)
    move.w #$7fff,$096(a5)
    bclr #7,$bfe201
    clr.w updates
    clr.w slow
    move.w #$cafe,ready

It sets A5 to the custom register base, clears custom interrupt enables and pending requests, stops DMA, and configures the joystick’s CIA input. The surrounding program then establishes its own display or audio state. These instructions are not a complete AmigaOS save/restore routine, and must not be pasted into a shared desktop program followed by RTS.

Choose the lifetime first

For a bootable game, resetting to leave is a simple, explicit contract. The complete caller shows display setup, input and sound under that contract.

For an application that coexists with AmigaOS, obtain the relevant resources through the OS. An application that temporarily takes over and later returns also needs a real restoration plan: task scheduling, display view/Copper state, interrupt servers or vectors it changes, CIA state and every resource it borrowed. Restoring two enable words cannot reconstruct all of that.

Keep any changed vectors associated with the CPU’s actual vector base. A plain 68000 fixes it at zero; later CPUs may use VBR and require privileged access to inspect it. A handler needs the correct exception return and acknowledgement as well as its address in a vector slot.

Read set/clear writes as operations

For DMACON and INTENA, bit 15 selects set or clear. One bits identify the controls to change; zero bits leave other controls alone.

Write to DMACON Effect
$0001 Clear channel 0 audio DMA
$8001 Set channel 0 audio DMA; master DMA must also be enabled
$8201 Set master DMA and channel 0 audio DMA
$8380 Set master, Copper and bitplane DMA
$83E0 Also set blitter and sprite DMA
$7FFF Clear all writable enables; read-only status bits are unaffected

Enable a display or audio consumer only after its pointers, lengths and data are valid. Disable it and wait for outstanding activity before freeing or repurposing that memory. Blitter priority can reduce the CPU’s available bus slots; it does not make every CPU cycle disappear.

Code status: an excerpt from an executed exclusive caller. Its record establishes the named A500 boot configuration. It does not establish a general OS takeover, compatibility with every Amiga model or a clean return to the desktop.