Basic scroll case speed-up
This commit is contained in:
parent
c5b0e00e04
commit
275e0d7ec8
|
@ -1,7 +1,10 @@
|
|||
.public restart_cli
|
||||
.public io_copy_down
|
||||
.public io_copy_up
|
||||
|
||||
.extern proc_shell_address
|
||||
.extern _Vfp
|
||||
.extern _Dp
|
||||
.extern _DirectPageStart
|
||||
|
||||
#ifndef __CALYPSI_DATA_MODEL_SMALL__
|
||||
|
@ -11,6 +14,42 @@
|
|||
.section stack
|
||||
.section farcode
|
||||
|
||||
;
|
||||
; void io_copy_down(uint16_t count, uint16_t dest, uint16_t src)
|
||||
;
|
||||
io_copy_down: pha
|
||||
phx
|
||||
phy
|
||||
phb
|
||||
|
||||
ldy dp:.tiny (_Dp)
|
||||
ldx dp:.tiny (_Dp+4)
|
||||
mvn #0xf0, #0xf0
|
||||
|
||||
plb
|
||||
ply
|
||||
plx
|
||||
pla
|
||||
rtl
|
||||
|
||||
;
|
||||
; void io_copy_up(uint16_t count, uint16_t dest, uint16_t src)
|
||||
;
|
||||
io_copy_up: pha
|
||||
phx
|
||||
phy
|
||||
phb
|
||||
|
||||
ldy dp:.tiny (_Dp)
|
||||
ldx dp:.tiny (_Dp+4)
|
||||
mvp #0xf0, #0xf0
|
||||
|
||||
plb
|
||||
ply
|
||||
plx
|
||||
pla
|
||||
rtl
|
||||
|
||||
;
|
||||
; Reset the stack to the initial value.
|
||||
; Reset the direct page and data bank registers
|
||||
|
|
|
@ -406,15 +406,44 @@ static short txt_f256_set_color(unsigned char foreground, unsigned char backgrou
|
|||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Scroll the screen for the most common case: full screen scrolls up by one full row.
|
||||
*/
|
||||
static void txt_f256_scroll_simple() {
|
||||
uint16_t rows = f256_max_size.height;
|
||||
uint16_t columns = f256_max_size.width;
|
||||
uint16_t count = (rows - 1) * columns;
|
||||
|
||||
// Move the rows up
|
||||
uint16_t text_dest = (uint16_t)((uint32_t)tvky_text_matrix & 0xffff);
|
||||
uint16_t text_src = text_dest + columns;
|
||||
io_copy_down(count, text_dest, text_src);
|
||||
|
||||
uint16_t color_dest = (uint16_t)((uint32_t)tvky_color_matrix & 0xffff);
|
||||
uint16_t color_src = color_dest + columns;
|
||||
io_copy_down(count, color_dest, color_src);
|
||||
|
||||
// Clear the bottom line
|
||||
for (uint16_t i = count; i < rows * columns; i++) {
|
||||
tvky_text_matrix[i] = ' ';
|
||||
tvky_color_matrix[i] = f256_color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scroll the text in the current region
|
||||
*
|
||||
* Supports the general case
|
||||
*
|
||||
* @param screen the number of the text device
|
||||
* @param horizontal the number of columns to scroll (negative is left, positive is right)
|
||||
* @param vertical the number of rows to scroll (negative is down, positive is up)
|
||||
*/
|
||||
static void txt_f256_scroll(short horizontal, short vertical) {
|
||||
short x, x0, x1, x2, x3, dx;
|
||||
static void txt_f256_scroll_complex(short horizontal, short vertical) {
|
||||
short x, x0, x1, x2, x3, dx;
|
||||
short y, y0, y1, y2, y3, dy;
|
||||
|
||||
/*
|
||||
|
@ -468,6 +497,18 @@ static void txt_f256_scroll(short horizontal, short vertical) {
|
|||
row_src += delta_y;
|
||||
int offset_dst = row_dst + x0 - dx;
|
||||
int offset_src = row_src + horizontal + x0 - dx;
|
||||
|
||||
// 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 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);
|
||||
|
||||
for (x = x0; x != x2; x += dx) {
|
||||
offset_dst += dx;
|
||||
offset_src += dx;
|
||||
|
@ -499,6 +540,22 @@ static void txt_f256_scroll(short horizontal, short vertical) {
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Scroll the text in the current region
|
||||
*
|
||||
* @param horizontal the number of columns to scroll (negative is left, positive is right)
|
||||
* @param vertical the number of rows to scroll (negative is down, positive is up)
|
||||
*/
|
||||
static void txt_f256_scroll(short horizontal, short vertical) {
|
||||
// If we're scrolling up one, and the region is the full screen, use a faster scrolling routine
|
||||
if ((horizontal == 0) && (vertical == 1) &&
|
||||
(f256_region.origin.x == 0) && (f256_region.origin.y == 0) &&
|
||||
(f256_region.size.width == f256_max_size.width) && (f256_region.size.height == f256_max_size.height)) {
|
||||
txt_f256_scroll_simple();
|
||||
} else {
|
||||
txt_f256_scroll_complex(horizontal, vertical);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the current region with a character in the current color
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
#define VER_MAJOR 1
|
||||
#define VER_MINOR 1
|
||||
#define VER_BUILD 9
|
||||
#define VER_BUILD 11
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue