MEGA65 / mega65-core

MEGA65 FPGA core
Other
240 stars 85 forks source link

Add Flip X/Y flags to RRB GOTO command #597

Open M3wP opened 2 years ago

M3wP commented 2 years ago

After building a real-world, multi RRB layer test, I find that an inordinate amount of time is spent updating a layer when needing to flip the object in the layer -- more than double the time usually required to draw it.

All of the colour RAM for that layer, the whole screen's worth, needs to be updated to ensure an object can be placed in it arbitrarily. Use of DMA might not give speed improvements since there is usually only a small to medium number of tiles (four?) in a layer's width. Ideally, the colour RAM would only need to be updated in order to change colours.

Adding the Flip X/Y flags to the GOTO command (as defaults for the following layer) would allow updating only a single byte per row and could be done only as required, giving quite a substantial speed improvement. It would nearly halve the time required to redraw a layer when flipping it and a redraw routine could handle the state more efficiently.

There is a precedent for this enhancement. The GOTO command already supports defaulting the Bold and Reverse flags in order to quickly change the palette used for a whole layer instead of having to change the colour RAM for each character tile. This enhancement would be in keeping with existing philosophy.

There are more than a few free bits in the structure and this change would require two.