Details | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
1490 | Kulich | 1 | void putdec(int c) |
1477 | alone | 2 | { |
1490 | Kulich | 3 | int div; |
4 | int hassent = 0; |
||
5 | for (div = 100; div > 0; div /= 10) { |
||
6 | int disp = c / div; |
||
1477 | alone | 7 | c %= div; |
1490 | Kulich | 8 | if ((disp != 0) || (hassent) || (div == 1)) { |
1477 | alone | 9 | hassent = 1; |
1490 | Kulich | 10 | putchar('0' + disp); |
1477 | alone | 11 | } |
12 | } |
||
13 | } |
||
14 | |||
1490 | Kulich | 15 | |
16 | |||
1477 | alone | 17 | void AT(int X, int Y) |
18 | { |
||
19 | putchar(27); |
||
20 | putchar('['); |
||
21 | putdec(Y); |
||
22 | putchar(';'); |
||
23 | putdec(X); |
||
24 | putchar('H'); |
||
25 | } |
||
26 | |||
27 | void ATRIB( int color) |
||
28 | { |
||
29 | putchar(27); |
||
30 | putchar('['); |
||
31 | putdec(color); |
||
32 | putchar('m'); |
||
33 | } |
||
34 | |||
35 | |||
1490 | Kulich | 36 | |
1477 | alone | 37 | void BOX(unsigned char Xbox, unsigned char Ybox, unsigned char Wbox, unsigned char Hbox, unsigned char Cbox) |
38 | { |
||
39 | unsigned char x,y; |
||
40 | ATRIB(Cbox); |
||
41 | for (y = 0; y < Hbox;y++) |
||
42 | { |
||
43 | AT (Xbox,Ybox + y); |
||
44 | for (x = 0; x < Wbox;x++) |
||
45 | { |
||
46 | putchar(' '); |
||
47 | } |
||
48 | } |
||
49 | } |