mirror of
https://github.com/alfishe/amiga-bootcamp.git
synced 2026-06-13 00:26:28 +00:00
Add Copper ISA Complete Reference Manual
New file: 08_graphics/copper/copper_reference.md - Full instruction set reference with opcode encoding table - Bit-level encoding for MOVE, WAIT, SKIP (7-bit masks) - Beam position encoding: V counter (8-bit), H counter (7-bit) - Copper control registers (COP1LC, COP2LC, COPJMP, COPCON, DMACON) - Copper list structure, dual lists, SKIP-based double buffering - DMA timing budget calculations per scanline - Register reference for all copper-writable targets - OCS/ECS/AGA differences (AGA 24-bit color via BPLCON3 LOCT) - Programming models: bare metal, OS-friendly UCopList, self-modifying - Common patterns: rainbow, split screen, status bar, sprite mux - Debugging: 8 common pitfalls with symptoms and fixes - Mermaid fetch-execute cycle diagram Updated files: - 08_graphics/README.md: add copper_reference.md to index - 08_graphics/copper/copper.md: cross-reference link, fix MOVE/WAIT encoding, fix UCopList CMOVE syntax - 08_graphics/copper/copper_programming.md: cross-reference link, fix horizontal resolution (2 color clocks, not 4)
This commit is contained in:
parent
a0fc3e05db
commit
2283178f09
4 changed files with 1031 additions and 10 deletions
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
The **Copper** is a simple coprocessor in the Amiga custom chips that executes a list of instructions synchronized to the video beam. It can write to any custom chip register at any beam position, enabling per-scanline color changes, split screens, and hardware-level display effects without CPU intervention.
|
||||
|
||||
For the complete ISA reference with full bit-level encoding, beam position details, control registers, timing, and debugging guidance, see **[copper_reference.md](copper_reference.md)** — the Copper ISA Complete Reference Manual.
|
||||
|
||||
---
|
||||
|
||||
## Instruction Format
|
||||
|
|
@ -15,8 +17,9 @@ The Copper has only three instructions, each 32 bits (one longword):
|
|||
### MOVE — Write a Register
|
||||
|
||||
```
|
||||
[register_offset (9 bits)] [value (16 bits)]
|
||||
Bit layout: 0RRRRRRRR00000000 VVVVVVVVVVVVVVVV
|
||||
[register_offset] [value (16 bits)]
|
||||
Word 1: 0000000R RRRRRRR0 (Offset)
|
||||
Word 2: VVVVVVVV VVVVVVVV (Data)
|
||||
```
|
||||
|
||||
- Register offset is relative to `$DFF000` (custom chip base)
|
||||
|
|
@ -26,8 +29,11 @@ Bit layout: 0RRRRRRRR00000000 VVVVVVVVVVVVVVVV
|
|||
### WAIT — Wait for Beam Position
|
||||
|
||||
```
|
||||
[vpos (8 bits)] [hpos (7 bits)] [1] [vmask (7 bits)] [hmask (7 bits)] [0]
|
||||
Bit layout: VVVVVVVVHHHHHH01 vvvvvvvvhhhhhhh0
|
||||
[vpos (8 bits)] [hpos (7 bits)] [1]
|
||||
Word 1: VVVVVVVV HHHHHHH1
|
||||
|
||||
[BFD (1 bit)] [vmask (7 bits)] [hmask (7 bits)] [0]
|
||||
Word 2: Bvvvvvvv hhhhhhh0
|
||||
```
|
||||
|
||||
- Pauses until the beam reaches at least the specified (vpos, hpos)
|
||||
|
|
@ -86,13 +92,16 @@ The OS manages copper lists through `GfxBase`:
|
|||
Applications can inject copper instructions into the system list via `UCopList`:
|
||||
|
||||
```c
|
||||
#include <hardware/custom.h>
|
||||
extern struct Custom custom;
|
||||
|
||||
struct UCopList *ucl = AllocMem(sizeof(struct UCopList), MEMF_PUBLIC|MEMF_CLEAR);
|
||||
|
||||
CINIT(ucl, 100); /* init, max 100 instructions */
|
||||
CWAIT(ucl, 44, 0); /* wait for line 44 */
|
||||
CMOVE(ucl, *((UWORD *)0xDFF180), 0x0F00); /* COLOR00 = red */
|
||||
CMOVE(ucl, custom.color[0], 0x0F00); /* COLOR00 = red */
|
||||
CWAIT(ucl, 100, 0);
|
||||
CMOVE(ucl, *((UWORD *)0xDFF180), 0x000F); /* COLOR00 = blue */
|
||||
CMOVE(ucl, custom.color[0], 0x000F); /* COLOR00 = blue */
|
||||
CEND(ucl); /* end of list */
|
||||
|
||||
viewport->UCopIns = ucl;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue