Last active
August 25, 2016 18:39
-
-
Save jacobly0/628a0077fbffe819b25f123d21e91ddb to your computer and use it in GitHub Desktop.
Screen Shift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ShiftUp(unsigned amt) { | |
char *dst = currDrawingBuff + xmin + ymin * lcdWidth; | |
char *src = dst + amt * lcdWidth; | |
unsigned times = ymax - ymin - amt; | |
do { | |
ldir(dst, src, xmax - xmin); | |
dst += lcdWidth; | |
src += lcdWidth; | |
} while (--times); | |
} | |
void ShiftDown(unsigned amt) { | |
char *dst = currDrawingBuff + (xmax - 1) + (ymax - 1) * lcdWidth; | |
char *src = dst - amt * lcdWidth; | |
unsigned times = ymax - ymin - amt; | |
do { | |
lddr(dst, src, xmax - xmin); | |
dst -= lcdWidth; | |
src -= lcdWidth; | |
} while (--times); | |
} | |
void ShiftLeft(unsigned amt) { | |
char *dst = currDrawingBuff + xmin + ymin * lcdWidth; | |
char *src = dst + amt; | |
unsigned times = ymax - ymin; | |
do { | |
ldir(dst, src, xmax - xmin - amt); | |
dst += lcdWidth; | |
src += lcdWidth; | |
} while (--times); | |
} | |
void ShiftRight(unsigned amt) { | |
char *dst = currDrawingBuff + (xmax - 1) + (ymax - 1) * lcdWidth; | |
char *src = dst - amt; | |
unsigned times = ymax - ymin; | |
do { | |
lddr(dst, src, xmax - xmin - amt); | |
dst -= lcdWidth; | |
src -= lcdWidth; | |
} while (--times); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment