25 static short int X = 0, Y = 0;
26 static short int MX = 80, MY = 40;
27 static u32 bgcolor = 0, fontcolor = 0xffffff, cursorcolor = 0xffffff;
28 static short int cursor = 1;
50 static int debug_detect_signal()
54 return ((romname[4] ==
'E') ? 1 : 0);
57 static void Init_GS(
int interlace,
int omode,
int ffmd)
64 SetGsCrt(interlace, omode, ffmd);
67 static void SetVideoMode(
void)
84 static inline void Dma02Wait(
void)
89 static void DmaReset(
void)
92 *((vu32 *)0x1000a080) = 0;
114 static inline void progdma(
void *addr,
int size)
121 void scr_setbgcolor(u32 color)
126 void scr_setfontcolor(u32 color)
131 void scr_setcursorcolor(u32 color)
139 {0x100000000000800E, 0xE, 0xA0000, 0x4C, 0x8C, 0x4E},
143 {0x40, 1, 0x1a, 1, 0x46, 0, 0x45, 0x70000,
144 0x47, 0x30000, 0x47, 6, 0, 0x3F80000000000000, 1, 0x79006C00, 5,
145 0x87009400, 5, 0x70000, 0x47}
151 Init_GS(1, debug_detect_signal() == 1 ? 3 : 2, 0);
161 void scr_putchar(
int x,
int y, u32 color,
int ch)
164 {0x1000000000000004, 0xE, 0xA000000000000, 0x50},
170 {0x52, 0, 0x53, 0x800000000008010, 0}
178 ((
struct t_setupchar *)UNCACHED_SEG(&setupchar))->x = x;
179 ((
struct t_setupchar *)UNCACHED_SEG(&setupchar))->y = y;
184 for (i = l = 0; i < 8; i++, l += 8, font++) {
185 for (j = 0; j < 8; j++) {
186 pixel = ((*font & (128 >> j))) ? color : bgcolor;
187 *(u32 *)UNCACHED_SEG(&charmap[l + j]) = pixel;
193 progdma(charmap, (8 * 8 * 4) / 16);
197 void scr_clearchar(
int X,
int Y)
199 scr_putchar(X * 8, Y * 8, bgcolor,
' ');
202 void scr_clearline(
int Y)
205 for (i = 0; i < MX; i++)
206 scr_putchar(i * 8, Y * 8, bgcolor,
' ');
209 void scr_printf(
const char *format, ...)
212 va_start(opt, format);
213 scr_vprintf(format, opt);
217 void scr_vprintf(
const char *format, va_list opt)
223 bufsz = vsnprintf(buff,
sizeof(buff), format, opt);
225 for (i = 0; i < bufsz; i++) {
237 for (j = 0; j < 5; j++) {
238 scr_putchar(X * 7, Y * 8, fontcolor,
' ');
247 scr_putchar(X * 7, Y * 8, fontcolor, c);
259 scr_putchar(X * 7, Y * 8, cursorcolor, 219);
262 void scr_setXY(
int x,
int y)
264 if (x < MX && x >= 0)
266 if (y < MY && y >= 0)
283 for (y = 0; y < MY; y++)
288 void scr_setCursor(
int enable)