9 #define mybug(col,var) __asm__ __volatile__("move.l #"#col",0xf9002000+"#var"" :: );
11 #define mybug(col,var)
19 #define rkprintf(x...) scr_RawPutChars(tab, snprintf(tab,126, x))
21 extern unsigned long _end
;
22 extern unsigned long _edata
;
23 extern struct mac68k_init_stuff init_stuff
;
27 void setcursor(unsigned char col
, unsigned char row
);
28 void clearscreen(void);
29 void screen_init(void);
30 void scr_RawPutChars(char *chr
, int lim
);
32 void screen_init(void)
35 init_stuff
.vidaddr
= 0xf9000e00;
36 init_stuff
.vidrow
= 832;
37 init_stuff
.vidwidth
= 832;
38 init_stuff
.vidheight
= 624;
39 init_stuff
.viddepth
= 8;
42 if(init_stuff
.vidaddr
)
46 init_stuff
.chrrows
= init_stuff
.vidheight
/ 10 - 1;
47 init_stuff
.chrcols
= init_stuff
.vidwidth
/ 8 - 1;
48 init_stuff
.currow
= 0;
49 init_stuff
.curcol
= 0;
53 for(j
=0;j
<=init_stuff
.vidheight
;j
++)
55 k
=j
*init_stuff
.vidrow
;
56 for(i
=0;i
<=init_stuff
.vidrow
;i
++)
58 *(volatile unsigned char *)(init_stuff
.vidaddr
+i
+k
) = (unsigned char)i
;
67 unsigned char font_lut2
[16] = {
68 0x00, 0x03, 0x0c, 0x0f,
69 0x30, 0x33, 0x3c, 0x3f,
70 0xc0, 0xc3, 0xcc, 0xcf,
71 0xf0, 0xf3, 0xfc, 0xff
73 unsigned char font_lut4
[4] = {
74 0x00, 0x0f, 0xf0, 0xff
76 unsigned char i
,j
,k
,m
,temp
;
82 temp
= ~(Font6x10
[j
*10+i
]);
84 switch(init_stuff
.viddepth
)
87 init_stuff
.fontbyte
[j
][i
][0] = temp
;
90 init_stuff
.fontbyte
[j
][i
][1] = font_lut2
[temp
&0x0f];
92 init_stuff
.fontbyte
[j
][i
][0] = font_lut2
[temp
&0x0f];
95 init_stuff
.fontbyte
[j
][i
][3] = font_lut4
[temp
&0x03];
97 init_stuff
.fontbyte
[j
][i
][2] = font_lut4
[temp
&0x03];
99 init_stuff
.fontbyte
[j
][i
][1] = font_lut4
[temp
&0x03];
101 init_stuff
.fontbyte
[j
][i
][0] = font_lut4
[temp
&0x03];
104 for(k
=0,m
=7;k
<8;k
++,m
--)
108 init_stuff
.fontbyte
[j
][i
][m
] = 0xff;
112 init_stuff
.fontbyte
[j
][i
][m
] = 0x00;
121 void setcursor(unsigned char col
, unsigned char row
)
123 init_stuff
.curcol
= col
;
124 init_stuff
.currow
= row
;
129 unsigned long caddr
,pixel32
;
131 unsigned short pixel16
;
137 init_stuff
.curcol
= 0;
140 caddr
= init_stuff
.vidaddr
+ (init_stuff
.curcol
*init_stuff
.viddepth
) + (init_stuff
.currow
*10*init_stuff
.vidrow
);
144 switch(init_stuff
.viddepth
)
150 memcpy((unsigned long *)(caddr
), &(init_stuff
.fontbyte
[c
][i
][0]),init_stuff
.viddepth
);
155 temp
= init_stuff
.fontbyte
[c
][i
][m
];
156 pixel16
= ~((0x01<<15)|(temp
<<11)|(temp
<<6)|((0xf1&temp
)>>3));
157 *(volatile unsigned short *)(caddr
+m
*2) = pixel16
;
164 temp
= init_stuff
.fontbyte
[c
][i
][m
];
165 pixel32
= ~(0xff<<24|(temp
<< 16)|(temp
<< 8)|temp
);
167 *(volatile unsigned long *)(caddr
+m
*4) = pixel32
;
173 caddr
+= init_stuff
.vidrow
;
176 if(init_stuff
.curcol
< init_stuff
.chrcols
)
182 init_stuff
.curcol
= 0;
187 void clearscreen(void)
191 for(j
=0;j
<=init_stuff
.vidheight
;j
++)
193 k
=j
*init_stuff
.vidrow
;
194 for(i
=0;i
<=init_stuff
.vidrow
;i
+=4)
196 *(volatile unsigned long *)(init_stuff
.vidaddr
+i
+k
) = (unsigned long)0xffffffff;
201 void scr_RawPutChars(char *chr
, int lim
)
205 for (i
=0; i
<lim
; i
++)
209 #define scc_b_ctrl 0x0
210 #define scc_a_ctrl 0x2
211 #define scc_b_data 0x4
212 #define scc_a_data 0x6
216 unsigned char *sccbase
= (unsigned char *)0x50f0c020;
218 while(0x4 & sccbase
[scc_b_ctrl
]);
220 sccbase
[scc_b_data
] = c
;