-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtestz6scroll.inf
More file actions
68 lines (61 loc) · 2.38 KB
/
Copy pathtestz6scroll.inf
File metadata and controls
68 lines (61 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
! A z6 test for window-local scrolling.
!
! Window 0 is filled with a pattern of '#'. A small window 1 is then opened in
! the middle of it and given more lines than it can hold, so it has to scroll.
! A correct interpreter scrolls window 1's rectangle and nothing else: the
! window shows the LAST lines printed, and the '#' pattern around it -- above,
! below, and on both sides of every one of its rows -- is untouched.
!
! Both windows are made unbuffered so that no [MORE] prompt interrupts the
! test; printing then goes straight to the screen, which is the path the
! window's own scrolling hangs off.
! A v6 unit is whatever the interpreter says a character cell is worth
! (property 13): a cell under the old model, an art pixel under the pixel one.
! So the layout below is written in CELLS and converted, exactly as testz6.inf
! does - passing cell counts raw made window 1 six PIXELS tall on a pixel-unit
! interpreter, which is no rows at all, and a window with no rows is not a
! scrolling test.
Global fw = 1;
Global fh = 1;
[ ux c; return (c - 1) * fw + 1; ]; ! 1-based cell column -> 1-based units
[ uy r; return (r - 1) * fh + 1; ]; ! 1-based cell row -> 1-based units
[ cw n; return n * fw; ]; ! a width or count in cells -> units
[ ch n; return n * fh; ];
[main i j w h;
#iftrue (#version_number == 6);
@get_wind_prop 0 13 -> i; ! height in the high byte, width in the low
fh = i / 256;
fw = i % 256;
if (fw == 0) fw = 1;
if (fh == 0) fh = 1;
@erase_window (-1);
w = $21->0; ! screen width in characters
h = $20->0; ! screen height in characters
@window_style 0 8 2; ! clear bit 3 (buffered): no [MORE] prompts
@window_style 1 8 2;
@window_style 0 3 1; ! set bits 0 and 1: wrapping and scrolling
@window_style 1 3 1;
! Fill window 0 (the whole screen) with the pattern, leaving the last row
! empty so that the fill itself never reaches the bottom and scrolls.
@set_window 0;
@set_cursor 1 1;
for (i = 1: i <= h - 1: i++) {
for (j = 1: j <= w: j++) { print "#"; }
}
! A small window in the middle of the pattern: six rows by twenty columns,
! at row 9, column 11.
i = ch(6); j = cw(20);
@window_size 1 i j;
i = uy(9); j = ux(11);
@move_window 1 i j;
@set_window 1;
@erase_window 1;
! Ten lines into six rows: the last four must scroll it.
for (i = 1: i <= 10: i++) {
print "line ", i, "^";
}
@set_window 0;
@read_char 1 -> i;
#endif;
print "done!^";
];