title: "vbmCopyToBuffer" description: TRSE built-in method (from IDE help)
vbmCopyToBuffer
Systems: VIC20
Parameters: a,b,b
vbmCopyToBuffer( [address], [byte-w], [byte-h] );
- [address] - address of the buffer
- [byte-w] - width - number of character columns to copy
- [byte-h] - height - number of pixels high to copy
Description
Copies a portion of the bitmap pointed to by the built in zero page pointer called screenmemory to a buffer in memory. The buffer can be copied back somewhere on the bitmap with the vbmCoptFromBuffer command. Typically uses to save the bitmap area behind a sprite before it is drawn so that the background can later be restored.
The buffer in memory should be large enough to store the copied bitmap. Simply multiply the number of columns by the height in pixels to work out how many bytes you will need.
Please note, only copy 1 column at a time if using the vbmScrollLeft or vbmScrollRight as this command uses a simple addition of 192 to get to the next column.
Example
// set the screenmemory pointer to a location on the bitmap to start copying from
screenmemory := $1100; // can also use vbmSetPosition1 and vbmSetColumn
// copy 2 character columns of 8 pixels to a buffer at address $a000
vbmCopyToBuffer( ^$a000 , 2, 8);