WAITVID
Instruction: Pause a cog's execution until its Video Generator is available to take pixel data.
WAITVID Colors, < # > Pixels
- Colors (d-field) is the register with four byte-sized color values, each describing the four possible colors of the pixel patterns in Pixels.
- Pixels (s-field) is the register or a 9-bit literal whose value is the next 16-pixel by 2-bit (or 32-pixel by 1-bit) pixel pattern to display.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– | Z Result | C Result | Result | Clocks |
111111 000i 1111 ddddddddd sssssssss | D + S = 0 | Unsigned overflow | Not Written | 4+1 |
1 WAITVID consumes 4 clocks itself; however, complete data handoff requires 7 clocks (6 at some frequencies) between frames. The combination of CTRA PLL frequency and VSCL FrameClocks must provide an effective 7 (or 6) system clocks.
Concise Truth Table:
In | Out | ||||||
Destination | Source | Z | C | Effects | Destination1 | Z | C |
$0000_0002; 2 | $FFFF_FFFD; -3 | - | - | wr wz wc | $FFFF_FFFF; -1 | 0 | 0 |
$0000_0002; 2 | $FFFF_FFFE; -2 | - | - | wr wz wc | $0000_0000; 0 | 1 | 1 |
$0000_0002; 2 | $FFFF_FFFF; -1 | - | - | wr wz wc | $0000_0001; 1 | 0 | 1 |
$0000_0002; 2 | $0000_0000; 0 | - | - | wr wz wc | $0000_0002; 2 | 0 | 0 |
1 Destination is not written unless the WR effect is given.
Explanation
WAITVID, "Wait for Video Generator," is one of four wait instructions (WAITCNT, WAITPEQ, WAITPNE, and WAITVID) used to pause execution of a cog until a condition is met. The WAITVID instruction pauses the cog until its Video Generator hardware is ready for the next pixel data, then the Video Generator accepts that data (Colors and Pixels) and the cog continues execution with the next instruction. The WAITVID instruction behaves similar to Spin's WAITVID command; see WAITVID.
If the WZ effect is specified, the Z flag will be set (1) if the Colors and Pixels are equal.
Make sure to start the cog's Video Generator module and Counter A before executing the WAITVID command or it will wait forever. See VCFG, VSCL, and CTRA, CTRB.
Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.