Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve scroll region function #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stevesims
Copy link
Contributor

fixes scrolling background colour issue - the new area of screen will now always be filled with the current text background colour

also adds support for movement directions 4-7, which move dependent upon the currently set cursor behaviour bits (see VDU 23,16)

adds support for movement amount of 0, to indicate move by 1 character in the given direction (as per Acorn’s implementation)

fixes #58

fixes scrolling background colour issue - the new area of screen will now always be filled with the current text background colour

also adds support for movement directions 4-7, which move dependent upon the currently set cursor behaviour bits (see VDU 23,16)

adds support for movement amount of 0, to indicate move by 1 character in the given direction (as per Acorn’s implementation)
@@ -69,21 +69,21 @@ char getScreenChar(uint16_t px, uint16_t py) {
// Now scan the screen and get the 8 byte pixel representation in charData
//
for (uint8_t y = 0; y < 8; y++) {
charRow = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the whitespace changes in this PR... inconsistent formatting bugs me....

@@ -716,23 +716,47 @@ void setLegacyModes(bool legacy) {
void scrollRegion(Rect * region, uint8_t direction, int16_t movement) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only real changes in this PR are within this function

} else {
if (direction == 3) ttxt_instance.scroll();
} else {
canvas->setPenColor(tbg);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is the fix for #58

break;
case 3: // Up
canvas->scroll(0, -movement);
case 4: // positive X
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acorn's version of this command supports directions 4-7, whose behaviour varies depending on the current cursorBehaviour variable, as set via VDU 23,16
since we have partial support for cursorBehaviour it makes some sense to implement these values

Comment on lines +751 to +757
if (movement == 0) {
if (moveX != 0) {
movement = fontW;
} else {
movement = fontH;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acorn's version of this command differs to ours with respect to how the movement value is interpreted. they only support 0 and 1, where 0 indicates movement by a single character, and 1 by a single byte (which means a variable number of pixels depending on screen mode). values greater than 1 are treated as if they were 1

our version treats the movement value as a number of pixels. this adds in support for 0 to indicate "whole character", which gives us slightly better compatibility with Acorn's version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant