Skip to content
CShift0.32

Amiga

AmigaOS only (--target m68k-amigaos)

Programming the Amiga’s custom chips directly (only for amigaos targets): taking the machine over from the operating system and giving it back, waiting for the vertical blank, chip memory, the copper and the mouse button (Hardware); bitmaps, the blitter, copper lists, sprites and a screen to draw on (Screen, Bitmap, Blitter, CopperList, Sprite).

using Amiga;
Hardware.TakeOver(); // the OS stops drawing; DMA and interrupts are ours
Hardware.StartCopper(list); // a copper list in chip memory (Hardware.AllocChip)
while (!Hardware.LeftMouseButton())
{
Hardware.WaitVBlank();
... // Hardware.Write(Custom.COLOR00, 0x0F00), ...
}
Hardware.Restore(); // the OS display, DMA and interrupts are back

The registers are written with volatile accesses (Memory.VolatileWrite), so every write reaches the chips.

Type Description
Bitmap A picture in chip memory: Depth bitplanes of Width x Height pixels, one after the other (plane p starts at Plane(p)).
SystemFont The font of the system (GfxBase->DefaultFont, in ROM): Topaz 8, or the one set in the preferences.
Blitter The blitter: draws into chip memory while the CPU goes on.
CopperList A copper list in chip memory: MOVEs to the custom chip registers and WAITs for raster lines.
Sprite A hardware sprite: 16 pixels wide, as high as needed, three colors (sprites 0 and 1 use the colors 17-19, 2 and 3 21-23, 4 and 5 25-27, 6 and 7 29-31).
Screen A low resolution PAL screen: a bitmap (two with double buffering) shown by a copper list that also sets the palette and the sprites.
Hardware Direct access to the custom chips: registers, taking the machine over, the vertical blank, chip memory and the mouse button.
Custom The custom chip registers: their offsets from 0xDFF000, for Hardware.Write, Hardware.Read and copper lists (CopperList.Move).
Name Description
DmaSet The bit of Custom.DMACON that switches the given channels on (otherwise off).
DmaMaster DMACON: all DMA (the master switch).
DmaBitplanes DMACON: the bitplanes.
DmaCopper DMACON: the copper.
DmaBlitter DMACON: the blitter.
DmaSprites DMACON: the sprites.
MemChip Hardware.AllocChip: chip memory (MEMF_CHIP), which the custom chips can reach.
MemClear Memory that is cleared (MEMF_CLEAR).
const int DmaSet = 32768

The bit of Custom.DMACON that switches the given channels on (otherwise off).

Since 0.15

const int DmaMaster = 512

DMACON: all DMA (the master switch).

Since 0.15

const int DmaBitplanes = 256

DMACON: the bitplanes.

Since 0.15

const int DmaCopper = 128

DMACON: the copper.

Since 0.15

const int DmaBlitter = 64

DMACON: the blitter.

Since 0.15

const int DmaSprites = 32

DMACON: the sprites.

Since 0.15

const int MemChip = 2

Hardware.AllocChip: chip memory (MEMF_CHIP), which the custom chips can reach.

Since 0.15

const int MemClear = 65536

Memory that is cleared (MEMF_CLEAR).

Since 0.15