Window scrolling speed up

Tweaked the case where we are scrolling only part of the window to use MVN/MVP to move lines.
This commit is contained in:
Peter Weingartner 2024-12-24 22:27:11 -05:00
parent 275e0d7ec8
commit 83d3c74839
2 changed files with 29 additions and 13 deletions

View file

@ -409,6 +409,22 @@ static short txt_f256_set_color(unsigned char foreground, unsigned char backgrou
extern void io_copy_down(uint16_t count, uint16_t dest, uint16_t src);
extern void io_copy_up(uint16_t count, uint16_t dest, uint16_t src);
/**
* Copy data in the I/O space using the MVN/MVP instructions
*
* @param count the number of bytes to copy
* @param dest the address within the I/O bank to copy to
* @param src the address within the I/O bank to copy from
*/
static void io_copy(uint16_t count, uint16_t dest, uint16_t src) {
if (dest < src) {
io_copy_down(count, dest, src);
} else {
io_copy_up(count, dest, src);
}
}
/**
* Scroll the screen for the most common case: full screen scrolls up by one full row.
*/
@ -501,20 +517,20 @@ static void txt_f256_scroll_complex(short horizontal, short vertical) {
// Move the rows up
uint16_t count = x2 - x0;
// uint16_t text_dest = (uint16_t)((uint32_t)tvky_text_matrix & 0xffff) + offset_dst;
// uint16_t text_src = (uint16_t)((uint32_t)tvky_text_matrix & 0xffff) + offset_src;
// txt_f256_copy(text_dest, text_src, count);
uint16_t text_dest = (uint16_t)((uint32_t)tvky_text_matrix & 0xffff) + offset_dst;
uint16_t text_src = (uint16_t)((uint32_t)tvky_text_matrix & 0xffff) + offset_src;
io_copy(count, text_dest, text_src);
// uint16_t color_dest = (uint16_t)((uint32_t)tvky_color_matrix & 0xffff) + offset_dst;
// uint16_t color_src = (uint16_t)((uint32_t)tvky_color_matrix & 0xffff) + offset_src;
// txt_f256_copy(color_dest, color_src, count);
uint16_t color_dest = (uint16_t)((uint32_t)tvky_color_matrix & 0xffff) + offset_dst;
uint16_t color_src = (uint16_t)((uint32_t)tvky_color_matrix & 0xffff) + offset_src;
io_copy(count, color_dest, color_src);
for (x = x0; x != x2; x += dx) {
offset_dst += dx;
offset_src += dx;
tvky_text_matrix[offset_dst] = tvky_text_matrix[offset_src];
tvky_color_matrix[offset_dst] = tvky_color_matrix[offset_src];
}
// for (x = x0; x != x2; x += dx) {
// offset_dst += dx;
// offset_src += dx;
// tvky_text_matrix[offset_dst] = tvky_text_matrix[offset_src];
// tvky_color_matrix[offset_dst] = tvky_color_matrix[offset_src];
// }
}
/* Clear the rectangles */

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 1
#define VER_MINOR 1
#define VER_BUILD 11
#define VER_BUILD 12
#endif