Skip to main content

copy

Function copy 

Source
pub fn copy(access: Access<'_>, dst: u16, src: &[u8])
Available on crate feature cgb only.
Expand description

Copy src to dst in video memory, stopping the CPU until it is done.

The copier does not wait for the PPU. The Access settles where the transfer starts, not where it ends, so a block long enough to outlast the window is still being written while the lines it reaches are drawn, and those come out garbled: size one to the window, or switch the display off.

Nothing runs while it works, which makes a source in a switchable bank safe here in a way it is not in stream.

ยงPanics

If src is empty, longer than MAX_LEN, not a whole number of BLOCK_LENs, or misaligned; if dst is outside 0x8000..0xA000, is misaligned, or has no room; or if a stream is still running, which this would stop rather than join.