Hardware
Struct · namespace Amiga · AmigaOS only · Since 0.15
struct HardwareDirect access to the custom chips: registers, taking the machine over, the vertical blank, chip memory and the mouse button. All functions are static.
Static methods
Section titled “Static methods”| 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. |
Register
Section titled “Register”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).
WriteLong
Section titled “WriteLong”static void WriteLong(Custom reg, void* address)A 32-bit register pair (COP1LCH/COP1LCL, BPL1PTH/BPL1PTL, …): the high word, then the low word.
TakeOver
Section titled “TakeOver”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.
Restore
Section titled “Restore”static void Restore()Gives the machine back: the system’s copper list, DMA, interrupts, display and multitasking.
StartCopper
Section titled “StartCopper”static void StartCopper(void* list)Starts the copper on a list in chip memory (and switches on copper DMA).
IsTakenOver
Section titled “IsTakenOver”static bool IsTakenOver()Whether the machine is taken over: between Hardware.TakeOver and Hardware.Restore.
Since 0.20
RasterLine
Section titled “RasterLine”static int RasterLine()The current raster line (0..312 on PAL).
WaitVBlank
Section titled “WaitVBlank”static void WaitVBlank()Waits for the vertical blank: until the beam is at line 300, below the visible picture.
LeftMouseButton
Section titled “LeftMouseButton”static bool LeftMouseButton()Whether the left mouse button is pressed (port 1: CIA-A, PRA bit 6, low while pressed).
AllocChip
Section titled “AllocChip”static void* AllocChip(int size)Chip memory (for copper lists, bitplanes, sprites and sounds), cleared; FreeChip gives it back.
FreeChip
Section titled “FreeChip”static void FreeChip(void* memory, int size)Gives back chip memory from Hardware.AllocChip; size must be the same.