Fill a Scan Line
Open this program in the workbench.
Write 320 eight-bit pixels, all 0x5A, starting at local byte address 0x00100000. Use an address delta of 640 bytes. Local memory is configured, the range is reserved for this operation, and the drawing engines are idle on entry.
Register Assignment
| Register | Value | Use | Required write-to-fill gap |
|---|---|---|---|
a0 / %128 | 0x00000001 | Format: one byte per pixel | 3 instructions |
a1 / %129 | 0xFFFFFFFF | Write mask | 1 instruction |
a2 / %130 | 0x5A5A5A5A | Eight-bit color replicated four times | 2 instructions |
%200 | 0x00100000 | S2 even: starting byte address | — |
%201 | 0x00000140 | S2 odd: 320 pixels | — |
%202 | 0x00000280 | S1 scalar: next-line address delta | — |
%16 is the hardwired all-ones constant and %0 is zero. With SDRAM, mask bits 0, 8, 16 and 24 enable all four bytes; with SGRAM every mask bit enables its write bit. No Pixel Engine format register is needed for this Fill Engine operation.
Sources: Technical Spec, p.7, Technical Spec, p.21, Technical Spec, p.23
Assembly
The final color write has three intervening instructions before fill, exceeding its hazard of two. Format and write mask have seven and six intervening instructions respectively. The waits are counted from the last write of each parameter.
fill %200,%200,%202 encodes as 0xE8C8C8CA. S2 starts at even index 200; its odd word supplies length. The instruction writes %200 = 0x00100280 for the next scan line. The filled range is 0x00100000..0x0010013F.
Fill launches in one cycle after any required engine wait and runs independently. The completion loop tests Flag.PixelBusy, which includes Fill, Triangle and Pixel. Host reads of the written range must wait for rendering idle to preserve coherency.
The program disables triangle shadowing before using a0..a2 as fill parameters. It uses solid fill, so the conflicting cbrush depth descriptions do not apply. FIFO is not an operand of fill.
Sources: Technical Spec, p.8, Technical Spec, p.11, Technical Spec, p.21, Technical Spec, p.22, Technical Spec, p.23, Technical Spec, p.25, Technical Spec, p.38
Fill reference · a0 format · a1 mask · a2 color · Examples