From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/CONTRIB/SNIP/scroll.c | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 reference/C/CONTRIB/SNIP/scroll.c (limited to 'reference/C/CONTRIB/SNIP/scroll.c') diff --git a/reference/C/CONTRIB/SNIP/scroll.c b/reference/C/CONTRIB/SNIP/scroll.c new file mode 100755 index 0000000..e5a94f7 --- /dev/null +++ b/reference/C/CONTRIB/SNIP/scroll.c @@ -0,0 +1,47 @@ +/*--------------------------[ scroll ]--------------------------*/ +/* Scroll the active page up or down a number of lines */ +/* Public domain code by Jeff Dunlop: */ +/*--------------------------------------------------------------*/ +/* input: */ +/* dx = direction */ +/* num_lines = number of lines to scroll, 0 = clear coords */ +/* attr = attribute of blank line(s) */ +/* y1, x1, y2, x2 = corner coordinates of scroll window */ +/* local: */ +/* regs = register union for ISR */ +/*--------------------------------------------------------------*/ + +#include +#include "scrnmacs.h" + +void scroll(int direction, + int num_lines, + int vattrib, + int ulrow, + int ulcomumn, + int lrrow, + int lrcolumn) +{ + union REGS regs; + + /* + BH = attribute to be used on blank line + CH = row of upper left corner of scroll window + CL = column of upper left corner of scroll window + DH = row of lower right corner of scroll window + DL = column of lower right corner of scroll window + */ + + regs.h.al = (unsigned char)num_lines; + regs.h.bh = (unsigned char)vattrib; + regs.h.ch = (unsigned char)ulrow; + regs.h.cl = (unsigned char)ulcomumn; + regs.h.dh = (unsigned char)lrrow; + regs.h.dl = (unsigned char)lrcolumn; + + if (direction == SCROLL_UP) + regs.h.ah = 0x06; + else regs.h.ah = 0x07; + + int86(0x10, ®s, ®s); +} -- cgit v1.2.3-54-g00ecf