You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
c/init_graphics.c

106 lines
1.6 KiB

2 years ago
#include <linux/kernel.h>
#include<asm/io.h>
#include "linux/tty.h"
#define memstart 0xA0000
#define memsize 64000
#define cursor_side 3
#define width 320
#define height 200
#define barrier_width 10
int volatile jumpp;
struct message *headd;
static int n=0;
int sys_get_message()
{
if(jumpp>0) --jumpp;
return jumpp;
}
int sys_init_graphics()
{
int i,j,x,y;
char *p=0xA0000;
if(n==0)
{
outb(0x05,0x3CE);
outb(0x40,0x3CF);//
outb(0x06,0x3CE);
outb(0x05,0x3CF);//
outb(0x04,0x3C4);
outb(0x08,0x3C5);//
outb(0x01,0x3D4);
outb(0x4F,0x3D5);//
outb(0x03,0x3D4);
outb(0x82,0x3D5);//
outb(0x07,0x3D4);
outb(0x1F,0x3D5);//
outb(0x12,0x3D4);
outb(0x8F,0x3D5);//
outb(0x17,0x3D4);
outb(0xA3,0x3D5);//
outb(0x14,0x3D4);
outb(0x40,0x3D5);//
outb(0x13,0x3D4);
outb(0x28,0x3D5);//
outb(0x0C,0x3D4);//
outb(0x00,0x3D5);//
outb(0x0D,0x3D4);//
outb(0x00,0x3D5);//
n=1;
}
p=memstart;
for(i=0;i<memsize;i++) *p++=11;
x=10;
y=10;
for(i=x-cursor_side;i<=x+cursor_side;i++)
for(j=y-cursor_side;j<=y+cursor_side;j++){
p=(char *) memstart+j*width+i;
*p=7;
}
return 0;
}
int sys_repaint(int x,int y,int h)
{
int i,j,w;
char *p;
i=x;
j=y;
p=0xA0000;
w=barrier_width;
if(i+w>=320 || i<20 ) return 0;
if(i==33 || j==33){
p=0xA0000;
for(i=0;i<memsize;i++) *p++=3;
return 0;
}
else if(i==44 || j==44 ){
p=0xA0000;
for(i=0;i<memsize;i++) *p++=4;
return 0;
}else{
for(i=x;i<=x+w;i++){
for(j=y;j<=y+h;j++){
p=0xA0000+j*320+i;
*p=12;
}
}
}
return 0;
}