added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / m68k-pp-native / boot-elf / gfx.c
blob7188bc15149ce46906502b46869c97768c78ed98
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <registers.h>
8 void pause(LONG x)
10 LONG i = 0,a = 1;
11 while (i < x) {
12 a *=a*a;
13 i++;
17 void drawlinehoriz(int y)
19 LONG lssa = RREG_L(LSSA);
20 LONG height = RREG_W(LYMAX);
21 LONG width = RREG_W(LXMAX)>>3;
22 LONG x = 0;
24 if (y < 0 || y >= height)
25 return;
27 while (x <= width) {
28 *(BYTE *)(lssa+((width+1)*y)+x) = 0xff;
29 x++;
34 void drawlinevert(int x)
36 LONG lssa = RREG_L(LSSA);
37 LONG height = RREG_W(LYMAX);
38 LONG width = RREG_W(LXMAX);
39 LONG y = 0;
41 if (x < 0 || x >= width)
42 return;
43 width >>= 3;
44 while (y < height) {
45 *(BYTE *)(lssa+((width+1)*y)+(x>>3)) |= 1<<(7-(x&7));
46 y++;
51 void setpixel(int x, int y)
53 LONG lssa = RREG_L(LSSA);
54 LONG height = RREG_W(LYMAX);
55 LONG width = RREG_W(LXMAX);
57 if (x < 0 || x >= width || y < 0 || y >= height)
58 return;
60 width>>=3;
62 *(BYTE *)(lssa+((width+1)*y)+(x>>3)) |= 1<<(7-(x&7));
66 void clearpixel(int x, int y)
68 LONG lssa = RREG_L(LSSA);
69 LONG height = RREG_W(LYMAX);
70 LONG width = RREG_W(LXMAX);
72 if (x < 0 || x >= width || y < 0 || y >= height)
73 return;
75 width>>=3;
77 *(BYTE *)(lssa+((width+1)*y)+(x>>3)) &= ~(1<<(7-(x&7)));
81 void clearscreen(int value)
83 LONG lssa = RREG_L(LSSA);
84 LONG height = RREG_W(LYMAX);
85 LONG width = RREG_W(LXMAX)>>3;
86 LONG y = 0,x;
88 while (y < height) {
89 x = 0;
90 while (x <= width) {
91 *(BYTE *)(lssa+((width+1)*y)+x) = value;
92 x++;
94 y++;
98 void flashscreen(int loop)
100 int i = 0, d;
101 while (i < loop) {
102 clearscreen(0);
103 d = 0;
104 while (d < 10000)
105 d++;
106 clearscreen(255);
107 d = 0;
108 while (d < 10000)
109 d++;
110 i++;
114 void drawcross(void)
116 clearscreen(0);
117 drawlinehoriz(80);
118 drawlinevert(80);
119 pause(100000);
122 void showsuccess(void)
124 LONG height = RREG_W(LXMAX);
126 LONG c = 0;
127 while (c < height) {
128 drawlinehoriz(c);
129 c++;
130 pause(10000);
132 clearscreen(0);