diff --git a/src/dev/txt_f256.c b/src/dev/txt_f256.c index 4b47a50..40f8471 100644 --- a/src/dev/txt_f256.c +++ b/src/dev/txt_f256.c @@ -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 */ diff --git a/src/version.h b/src/version.h index c182d22..d722354 100644 --- a/src/version.h +++ b/src/version.h @@ -7,6 +7,6 @@ #define VER_MAJOR 1 #define VER_MINOR 1 -#define VER_BUILD 11 +#define VER_BUILD 12 #endif