Skip to content
CShift0.32

Hardware

Struct · namespace Amiga · AmigaOS only · Since 0.15

struct Hardware

Direct access to the custom chips: registers, taking the machine over, the vertical blank, chip memory and the mouse button. All functions are static.

Name Description
Register The address of a custom chip register.
Write Writes value (16 bits) to the register reg.
Read Reads the register reg (16 bits).
WriteLong A 32-bit register pair (COP1LCH/COP1LCL, BPL1PTH/BPL1PTL, …): the high word, then the low word.
TakeOver Takes the machine over: multitasking and the OS display stop, DMA and interrupts are switched off (then StartCopper and the program’s own DMA).
Restore Gives the machine back: the system’s copper list, DMA, interrupts, display and multitasking.
StartCopper Starts the copper on a list in chip memory (and switches on copper DMA).
IsTakenOver Whether the machine is taken over: between Hardware.TakeOver and Hardware.Restore.
RasterLine The current raster line (0..312 on PAL).
WaitVBlank Waits for the vertical blank: until the beam is at line 300, below the visible picture.
LeftMouseButton Whether the left mouse button is pressed (port 1: CIA-A, PRA bit 6, low while pressed).
AllocChip Chip memory (for copper lists, bitplanes, sprites and sounds), cleared; FreeChip gives it back.
FreeChip Gives back chip memory from Hardware.AllocChip; size must be the same.
static uint16* Register(Custom reg)

The address of a custom chip register.

static void Write(Custom reg, int value)

Writes value (16 bits) to the register reg.

static int Read(Custom reg)

Reads the register reg (16 bits).

static void WriteLong(Custom reg, void* address)

A 32-bit register pair (COP1LCH/COP1LCL, BPL1PTH/BPL1PTL, …): the high word, then the low word.

static bool TakeOver()

Takes the machine over: multitasking and the OS display stop, DMA and interrupts are switched off (then StartCopper and the program’s own DMA). False if graphics.library cannot be opened.

static void Restore()

Gives the machine back: the system’s copper list, DMA, interrupts, display and multitasking.

static void StartCopper(void* list)

Starts the copper on a list in chip memory (and switches on copper DMA).

static bool IsTakenOver()

Whether the machine is taken over: between Hardware.TakeOver and Hardware.Restore.

Since 0.20

static int RasterLine()

The current raster line (0..312 on PAL).

static void WaitVBlank()

Waits for the vertical blank: until the beam is at line 300, below the visible picture.

static bool LeftMouseButton()

Whether the left mouse button is pressed (port 1: CIA-A, PRA bit 6, low while pressed).

static void* AllocChip(int size)

Chip memory (for copper lists, bitplanes, sprites and sounds), cleared; FreeChip gives it back.

static void FreeChip(void* memory, int size)

Gives back chip memory from Hardware.AllocChip; size must be the same.