parent
d923c30d9b
commit
e2b0d6db45
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
# 1 "mouse.S"
|
||||
# 1 "<built-in>"
|
||||
# 1 "<command-line>"
|
||||
# 1 "mouse.S"
|
||||
.globl mouse_interrupt
|
||||
mouse_interrupt:
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
push %ds
|
||||
|
||||
#prepare for call readmouse
|
||||
movl $0x10,%eax
|
||||
mov %ax,%ds
|
||||
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
#EOI
|
||||
movb $0x20,%al #8259A 操作命令字 EOI
|
||||
outb %al,$0xA0 #send EOI to 8259a second
|
||||
outb %al,$0x20 #send EOI to 8259a first
|
||||
|
||||
|
||||
pop %ds
|
||||
popl %edx
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
popl %eax
|
||||
iret
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,105 @@
|
||||
#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
|
||||
struct message *headd;
|
||||
static int ff=0;
|
||||
int sys_init_graphics()
|
||||
{
|
||||
int i,j,x,y;
|
||||
char *p=0xA0000;
|
||||
if(ff==0)
|
||||
{
|
||||
outb(0x05,0x3CE);
|
||||
outb(0x40,0x3CF);/* shift256=1*/
|
||||
outb(0x06,0x3CE);
|
||||
outb(0x05,0x3CF);/*0101 0xA0000*/
|
||||
outb(0x04,0x3C4);
|
||||
outb(0x08,0x3C5);/*0000 jilian*/
|
||||
|
||||
|
||||
outb(0x01,0x3D4);
|
||||
outb(0x4F,0x3D5);/* end horizontal display=79 ??*/
|
||||
outb(0x03,0x3D4);
|
||||
outb(0x82,0x3D5);/*display enable skew=0*/
|
||||
|
||||
outb(0x07,0x3D4);
|
||||
outb(0x1F,0x3D5);/*vertical display end No8,9 bit=1,0*/
|
||||
outb(0x12,0x3D4);
|
||||
outb(0x8F,0x3D5);/*vertical display end low 7b =0x8F*/
|
||||
outb(0x17,0x3D4);
|
||||
outb(0xA3,0x3D5);/*SLDIV=1 ,scanline clock/2*/
|
||||
|
||||
|
||||
|
||||
outb(0x14,0x3D4);
|
||||
outb(0x40,0x3D5);/*DW=1*/
|
||||
outb(0x13,0x3D4);
|
||||
outb(0x28,0x3D5);/*Offset=40, 20:become long*/
|
||||
|
||||
outb(0x0C,0x3D4);/**/
|
||||
outb(0x00,0x3D5);/**/
|
||||
outb(0x0D,0x3D4);/**/
|
||||
outb(0x00,0x3D5);/*Start Address=0xA0000*/
|
||||
ff=1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
p=memstart;
|
||||
for(i=0;i<memsize;i++) *p++=3;
|
||||
//3-blue 4-red 12-purple
|
||||
|
||||
x=50;
|
||||
y=40;
|
||||
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=12;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_get_message(struct message * msg)
|
||||
{
|
||||
msg=headd;
|
||||
if(headd->mid!=1)return 0;
|
||||
headd=headd->next;
|
||||
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;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
#define __LIBRARY__
|
||||
#include<unistd.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<assert.h>
|
||||
|
||||
_syscall1(void ,get_message ,struct message ,* msg)
|
||||
|
||||
int main()
|
||||
{
|
||||
struct message *msg;
|
||||
int i;
|
||||
for(i=0;i<10;i++)
|
||||
{
|
||||
get_message(msg);
|
||||
printf("mid:%d pid:%d\n",msg->mid,msg->pid);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
#define __LIBRARY__
|
||||
#include<stdio.h>
|
||||
#include<unistd.h>
|
||||
#include<stdlib.h>
|
||||
#include<errno.h>
|
||||
#include<time.h>
|
||||
#include<linux/tty.h>
|
||||
#define vga_graph_memstart 0xA0000
|
||||
#define vga_graph_memsize 64000
|
||||
#define cursor_side 6
|
||||
#define vga_width 320
|
||||
#define vga_height 200
|
||||
|
||||
#define BIRD_X 120
|
||||
#define BIRD_Y 100
|
||||
#define BIRD_WIDTH 10
|
||||
#define BIRD_HEIGHT 8
|
||||
#define MAX 40
|
||||
|
||||
char *p;
|
||||
int i,j,x_pos,y_pos,k;
|
||||
struct message *msg;
|
||||
int cnt;
|
||||
int bird_y;
|
||||
int px[MAX];
|
||||
int py[MAX];
|
||||
int h[MAX];
|
||||
char *pp;
|
||||
int ii,jj;
|
||||
int nn;
|
||||
|
||||
_syscall0(int,init_graphics)
|
||||
_syscall1(int,get_message,struct message * ,msg)
|
||||
_syscall3(int,repaint,int ,x,int ,y,int ,h)
|
||||
int main()
|
||||
{
|
||||
x_pos=20;
|
||||
y_pos=20;
|
||||
bird_y=BIRD_Y;
|
||||
init_graphics();
|
||||
px[0]=BIRD_X;
|
||||
py[0]=bird_y;
|
||||
h[0]=BIRD_HEIGHT;
|
||||
cnt=30;
|
||||
for(i=1;i<cnt;i++)
|
||||
{
|
||||
if(i%2==0)
|
||||
{
|
||||
px[i]=120+20*i;
|
||||
py[i]=0;
|
||||
h[i]=90+i*2;
|
||||
}
|
||||
else
|
||||
{
|
||||
px[i]=30+20*i;
|
||||
h[i]=h[i-1]-13*i%17;
|
||||
py[i]=200-1-h[i];
|
||||
}
|
||||
}
|
||||
msg=NULL;
|
||||
nn=50;
|
||||
while(--nn)
|
||||
{
|
||||
repaint(px[0],py[0],h[0]);
|
||||
for(i=1;i<cnt;i++)
|
||||
{
|
||||
px[i]-=20;
|
||||
repaint(px[i],py[i],h[i]);
|
||||
}
|
||||
k=3;
|
||||
while(k>0)
|
||||
{
|
||||
--k;
|
||||
get_message(msg);
|
||||
if(msg!=NULL)py[0]-=10;
|
||||
sleep(2);
|
||||
}
|
||||
sleep(4);
|
||||
for(k=1;k<cnt;k++)
|
||||
{
|
||||
if(k%2==0)
|
||||
if(px[0]+6>px[k] && px[0]+6<px[k]+10 && py[0]<h[k])
|
||||
{
|
||||
repaint(44,44,44);
|
||||
return 0;
|
||||
}else{
|
||||
if(px[0]+6>px[k] && px[0]+6<px[k]+10 && py[0]+6+h[k]>199)
|
||||
{
|
||||
repaint(44,44,44);
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
repaint(44,44,44);
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
#define __LIBRARY__
|
||||
#include<stdio.h>
|
||||
#include<unistd.h>
|
||||
#include<errno.h>
|
||||
#include<time.h>
|
||||
|
||||
#define vga_graph_memstart 0xA0000
|
||||
#define vga_graph_memsize 64000
|
||||
#define cursor_side 6
|
||||
|
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
#define __LIBRARY__
|
||||
#include<unistd.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<assert.h>
|
||||
|
||||
_syscall1(void ,get_message ,struct message ,* msg)
|
||||
|
||||
int main()
|
||||
{
|
||||
struct message *msg;
|
||||
int i;
|
||||
for(i=0;i<10;i++)
|
||||
{
|
||||
get_message(msg);
|
||||
printf("mid:%d pid:%d\n",msg->mid,msg->pid);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
#define __LIBRARY__
|
||||
#include<unistd.h>
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<assert.h>
|
||||
#include"linux/tty.h"
|
||||
|
||||
_syscall1(void ,get_message ,struct message ,* msg)
|
||||
|
||||
int main()
|
||||
{
|
||||
struct message *msg;
|
||||
int i;
|
||||
for(i=0;i<10;i++)
|
||||
{
|
||||
get_message(msg);
|
||||
printf("mid:%d pid:%d\n",msg->mid,msg->pid);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Why isn't this a .c file? Enquiring minds....
|
||||
*/
|
||||
|
||||
extern int sys_setup();
|
||||
extern int sys_exit();
|
||||
extern int sys_fork();
|
||||
extern int sys_read();
|
||||
extern int sys_write();
|
||||
extern int sys_open();
|
||||
extern int sys_close();
|
||||
extern int sys_waitpid();
|
||||
extern int sys_creat();
|
||||
extern int sys_link();
|
||||
extern int sys_unlink();
|
||||
extern int sys_execve();
|
||||
extern int sys_chdir();
|
||||
extern int sys_time();
|
||||
extern int sys_mknod();
|
||||
extern int sys_chmod();
|
||||
extern int sys_chown();
|
||||
extern int sys_break();
|
||||
extern int sys_stat();
|
||||
extern int sys_lseek();
|
||||
extern int sys_getpid();
|
||||
extern int sys_mount();
|
||||
extern int sys_umount();
|
||||
extern int sys_setuid();
|
||||
extern int sys_getuid();
|
||||
extern int sys_stime();
|
||||
extern int sys_ptrace();
|
||||
extern int sys_alarm();
|
||||
extern int sys_fstat();
|
||||
extern int sys_pause();
|
||||
extern int sys_utime();
|
||||
extern int sys_stty();
|
||||
extern int sys_gtty();
|
||||
extern int sys_access();
|
||||
extern int sys_nice();
|
||||
extern int sys_ftime();
|
||||
extern int sys_sync();
|
||||
extern int sys_kill();
|
||||
extern int sys_rename();
|
||||
extern int sys_mkdir();
|
||||
extern int sys_rmdir();
|
||||
extern int sys_dup();
|
||||
extern int sys_pipe();
|
||||
extern int sys_times();
|
||||
extern int sys_prof();
|
||||
extern int sys_brk();
|
||||
extern int sys_setgid();
|
||||
extern int sys_getgid();
|
||||
extern int sys_signal();
|
||||
extern int sys_geteuid();
|
||||
extern int sys_getegid();
|
||||
extern int sys_acct();
|
||||
extern int sys_phys();
|
||||
extern int sys_lock();
|
||||
extern int sys_ioctl();
|
||||
extern int sys_fcntl();
|
||||
extern int sys_mpx();
|
||||
extern int sys_setpgid();
|
||||
extern int sys_ulimit();
|
||||
extern int sys_uname();
|
||||
extern int sys_umask();
|
||||
extern int sys_chroot();
|
||||
extern int sys_ustat();
|
||||
extern int sys_dup2();
|
||||
extern int sys_getppid();
|
||||
extern int sys_getpgrp();
|
||||
extern int sys_setsid();
|
||||
extern int sys_sigaction();
|
||||
extern int sys_sgetmask();
|
||||
extern int sys_ssetmask();
|
||||
extern int sys_setreuid();
|
||||
extern int sys_setregid();
|
||||
extern int sys_sigpending();
|
||||
extern int sys_sigsuspend();
|
||||
extern int sys_sethostname();
|
||||
extern int sys_setrlimit();
|
||||
extern int sys_getrlimit();
|
||||
extern int sys_getrusage();
|
||||
extern int sys_gettimeofday();
|
||||
extern int sys_settimeofday();
|
||||
extern int sys_getgroups();
|
||||
extern int sys_setgroups();
|
||||
extern int sys_select();
|
||||
extern int sys_symlink();
|
||||
extern int sys_lstat();
|
||||
extern int sys_readlink();
|
||||
extern int sys_uselib();
|
||||
|
||||
|
||||
extern int sys_execve2();
|
||||
extern int sys_getdents();
|
||||
extern int sys_something();
|
||||
extern int sys_sleep();
|
||||
extern long sys_getcwd();
|
||||
extern int sys_init_graphics();
|
||||
extern int sys_get_message();
|
||||
extern int sys_repaint();
|
||||
|
||||
fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read,
|
||||
sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link,
|
||||
sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod,
|
||||
sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount,
|
||||
sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm,
|
||||
sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access,
|
||||
sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir,
|
||||
sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid,
|
||||
sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys,
|
||||
sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit,
|
||||
sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid,
|
||||
sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask,
|
||||
sys_setreuid,sys_setregid, sys_sigsuspend, sys_sigpending, sys_sethostname,
|
||||
sys_setrlimit, sys_getrlimit, sys_getrusage, sys_gettimeofday,
|
||||
sys_settimeofday, sys_getgroups, sys_setgroups, sys_select, sys_symlink,
|
||||
sys_lstat, sys_readlink, sys_uselib, sys_execve2, sys_getdents, sys_something ,sys_sleep, sys_getcwd
|
||||
,sys_init_graphics,sys_get_message,sys_repaint
|
||||
};
|
||||
|
||||
/* So we don't have to do any more manual updating.... */
|
||||
int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr);
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 'tty.h' defines some structures used by tty_io.c and some defines.
|
||||
*
|
||||
* NOTE! Don't touch this without checking that nothing in rs_io.s or
|
||||
* con_io.s breaks. Some constants are hardwired into the system (mainly
|
||||
* offsets into 'tty_queue'
|
||||
*/
|
||||
|
||||
#ifndef _TTY_H
|
||||
#define _TTY_H
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#define TTY_BUF_SIZE 1024
|
||||
|
||||
struct tty_queue {
|
||||
unsigned long data;
|
||||
unsigned long head;
|
||||
unsigned long tail;
|
||||
struct task_struct * proc_list;
|
||||
char buf[TTY_BUF_SIZE];
|
||||
};
|
||||
|
||||
#define INC(a) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))
|
||||
#define DEC(a) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))
|
||||
#define EMPTY(a) ((a).head == (a).tail)
|
||||
#define LEFT(a) (((a).tail-(a).head-1)&(TTY_BUF_SIZE-1))
|
||||
#define LAST(a) ((a).buf[(TTY_BUF_SIZE-1)&((a).head-1)])
|
||||
#define FULL(a) (!LEFT(a))
|
||||
#define CHARS(a) (((a).head-(a).tail)&(TTY_BUF_SIZE-1))
|
||||
#define GETCH(queue,c) \
|
||||
(void)({c=(queue).buf[(queue).tail];INC((queue).tail);})
|
||||
#define PUTCH(c,queue) \
|
||||
(void)({(queue).buf[(queue).head]=(c);INC((queue).head);})
|
||||
|
||||
#define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
|
||||
#define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
|
||||
#define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
|
||||
#define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
|
||||
#define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
|
||||
#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
|
||||
#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
|
||||
#define SUSPEND_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
|
||||
|
||||
struct tty_struct {
|
||||
struct termios termios;
|
||||
int pgrp;
|
||||
int stopped;
|
||||
void (*write)(struct tty_struct * tty);
|
||||
struct tty_queue read_q;
|
||||
struct tty_queue write_q;
|
||||
struct tty_queue secondary;
|
||||
};
|
||||
|
||||
extern struct tty_struct tty_table[];
|
||||
|
||||
|
||||
|
||||
struct message{
|
||||
int mid;
|
||||
int pid;
|
||||
struct message *next;
|
||||
};
|
||||
struct message *headd;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* intr=^C quit=^| erase=del kill=^U
|
||||
eof=^D vtime=\0 vmin=\1 sxtc=\0
|
||||
start=^Q stop=^S susp=^Z eol=\0
|
||||
reprint=^R discard=^U werase=^W lnext=^V
|
||||
eol2=\0
|
||||
*/
|
||||
#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
|
||||
|
||||
void rs_init(void);
|
||||
void con_init(void);
|
||||
void tty_init(void);
|
||||
|
||||
int tty_read(unsigned c, char * buf, int n);
|
||||
int tty_write(unsigned c, char * buf, int n);
|
||||
|
||||
void rs_write(struct tty_struct * tty);
|
||||
void con_write(struct tty_struct * tty);
|
||||
|
||||
void copy_to_cooked(struct tty_struct * tty);
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,290 @@
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H
|
||||
#include<linux/tty.h>
|
||||
/* ok, this may be a joke, but I'm working on it */
|
||||
#define _POSIX_VERSION 198808L
|
||||
|
||||
#define _POSIX_CHOWN_RESTRICTED /* only root can do a chown (I think..) */
|
||||
#define _POSIX_NO_TRUNC /* no pathname truncation (but see in kernel) */
|
||||
#define _POSIX_VDISABLE '\0' /* character to disable things like ^C */
|
||||
/*#define _POSIX_SAVED_IDS */ /* we'll get to this yet */
|
||||
/*#define _POSIX_JOB_CONTROL */ /* we aren't there quite yet. Soon hopefully */
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
/* access */
|
||||
#define F_OK 0
|
||||
#define X_OK 1
|
||||
#define W_OK 2
|
||||
#define R_OK 4
|
||||
|
||||
/* lseek */
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
/* _SC stands for System Configuration. We don't use them much */
|
||||
#define _SC_ARG_MAX 1
|
||||
#define _SC_CHILD_MAX 2
|
||||
#define _SC_CLOCKS_PER_SEC 3
|
||||
#define _SC_NGROUPS_MAX 4
|
||||
#define _SC_OPEN_MAX 5
|
||||
#define _SC_JOB_CONTROL 6
|
||||
#define _SC_SAVED_IDS 7
|
||||
#define _SC_VERSION 8
|
||||
|
||||
/* more (possibly) configurable things - now pathnames */
|
||||
#define _PC_LINK_MAX 1
|
||||
#define _PC_MAX_CANON 2
|
||||
#define _PC_MAX_INPUT 3
|
||||
#define _PC_NAME_MAX 4
|
||||
#define _PC_PATH_MAX 5
|
||||
#define _PC_PIPE_BUF 6
|
||||
#define _PC_NO_TRUNC 7
|
||||
#define _PC_VDISABLE 8
|
||||
#define _PC_CHOWN_RESTRICTED 9
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <utime.h>
|
||||
|
||||
#ifdef __LIBRARY__
|
||||
|
||||
#define __NR_setup 0 /* used only by init, to get system going */
|
||||
#define __NR_exit 1
|
||||
#define __NR_fork 2
|
||||
#define __NR_read 3
|
||||
#define __NR_write 4
|
||||
#define __NR_open 5
|
||||
#define __NR_close 6
|
||||
#define __NR_waitpid 7
|
||||
#define __NR_creat 8
|
||||
#define __NR_link 9
|
||||
#define __NR_unlink 10
|
||||
#define __NR_execve 11
|
||||
#define __NR_chdir 12
|
||||
#define __NR_time 13
|
||||
#define __NR_mknod 14
|
||||
#define __NR_chmod 15
|
||||
#define __NR_chown 16
|
||||
#define __NR_break 17
|
||||
#define __NR_stat 18
|
||||
#define __NR_lseek 19
|
||||
#define __NR_getpid 20
|
||||
#define __NR_mount 21
|
||||
#define __NR_umount 22
|
||||
#define __NR_setuid 23
|
||||
#define __NR_getuid 24
|
||||
#define __NR_stime 25
|
||||
#define __NR_ptrace 26
|
||||
#define __NR_alarm 27
|
||||
#define __NR_fstat 28
|
||||
#define __NR_pause 29
|
||||
#define __NR_utime 30
|
||||
#define __NR_stty 31
|
||||
#define __NR_gtty 32
|
||||
#define __NR_access 33
|
||||
#define __NR_nice 34
|
||||
#define __NR_ftime 35
|
||||
#define __NR_sync 36
|
||||
#define __NR_kill 37
|
||||
#define __NR_rename 38
|
||||
#define __NR_mkdir 39
|
||||
#define __NR_rmdir 40
|
||||
#define __NR_dup 41
|
||||
#define __NR_pipe 42
|
||||
#define __NR_times 43
|
||||
#define __NR_prof 44
|
||||
#define __NR_brk 45
|
||||
#define __NR_setgid 46
|
||||
#define __NR_getgid 47
|
||||
#define __NR_signal 48
|
||||
#define __NR_geteuid 49
|
||||
#define __NR_getegid 50
|
||||
#define __NR_acct 51
|
||||
#define __NR_phys 52
|
||||
#define __NR_lock 53
|
||||
#define __NR_ioctl 54
|
||||
#define __NR_fcntl 55
|
||||
#define __NR_mpx 56
|
||||
#define __NR_setpgid 57
|
||||
#define __NR_ulimit 58
|
||||
#define __NR_uname 59
|
||||
#define __NR_umask 60
|
||||
#define __NR_chroot 61
|
||||
#define __NR_ustat 62
|
||||
#define __NR_dup2 63
|
||||
#define __NR_getppid 64
|
||||
#define __NR_getpgrp 65
|
||||
#define __NR_setsid 66
|
||||
#define __NR_sigaction 67
|
||||
#define __NR_sgetmask 68
|
||||
#define __NR_ssetmask 69
|
||||
#define __NR_setreuid 70
|
||||
#define __NR_setregid 71
|
||||
#define __NR_sigsuspend 72
|
||||
#define __NR_sigpending 73
|
||||
#define __NR_sethostname 74
|
||||
#define __NR_setrlimit 75
|
||||
#define __NR_getrlimit 76
|
||||
#define __NR_getrusage 77
|
||||
#define __NR_gettimeofday 78
|
||||
#define __NR_settimeofday 79
|
||||
#define __NR_getgroups 80
|
||||
#define __NR_setgroups 81
|
||||
#define __NR_select 82
|
||||
#define __NR_symlink 83
|
||||
#define __NR_lstat 84
|
||||
#define __NR_readlink 85
|
||||
#define __NR_uselib 86
|
||||
|
||||
|
||||
|
||||
#define __NR_execve2 87
|
||||
#define __NR_getdents 88
|
||||
#define __NR_something 89
|
||||
#define __NR_sleep 90
|
||||
#define __NR_getcwd 91
|
||||
#define __NR_init_graphics 92
|
||||
#define __NR_get_message 93
|
||||
#define __NR_repaint 94
|
||||
|
||||
#define _syscall0(type,name) \
|
||||
type name(void) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (__NR_##name)); \
|
||||
if (__res >= 0) \
|
||||
return (type) __res; \
|
||||
errno = -__res; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define _syscall1(type,name,atype,a) \
|
||||
type name(atype a) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (__NR_##name),"b" ((long)(a))); \
|
||||
if (__res >= 0) \
|
||||
return (type) __res; \
|
||||
errno = -__res; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define _syscall2(type,name,atype,a,btype,b) \
|
||||
type name(atype a,btype b) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
|
||||
if (__res >= 0) \
|
||||
return (type) __res; \
|
||||
errno = -__res; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
|
||||
type name(atype a,btype b,ctype c) \
|
||||
{ \
|
||||
long __res; \
|
||||
__asm__ volatile ("int $0x80" \
|
||||
: "=a" (__res) \
|
||||
: "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
|
||||
if (__res>=0) \
|
||||
return (type) __res; \
|
||||
errno=-__res; \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#endif /* __LIBRARY__ */
|
||||
|
||||
extern int errno;
|
||||
|
||||
int access(const char * filename, mode_t mode);
|
||||
int acct(const char * filename);
|
||||
int alarm(int sec);
|
||||
int brk(void * end_data_segment);
|
||||
void * sbrk(ptrdiff_t increment);
|
||||
int chdir(const char * filename);
|
||||
int chmod(const char * filename, mode_t mode);
|
||||
int chown(const char * filename, uid_t owner, gid_t group);
|
||||
int chroot(const char * filename);
|
||||
int close(int fildes);
|
||||
int creat(const char * filename, mode_t mode);
|
||||
int dup(int fildes);
|
||||
int execve(const char * filename, char ** argv, char ** envp);
|
||||
int execv(const char * pathname, char ** argv);
|
||||
int execvp(const char * file, char ** argv);
|
||||
int execl(const char * pathname, char * arg0, ...);
|
||||
int execlp(const char * file, char * arg0, ...);
|
||||
int execle(const char * pathname, char * arg0, ...);
|
||||
volatile void exit(int status);
|
||||
volatile void _exit(int status);
|
||||
int fcntl(int fildes, int cmd, ...);
|
||||
int fork(void);
|
||||
int getpid(void);
|
||||
int getuid(void);
|
||||
int geteuid(void);
|
||||
int getgid(void);
|
||||
int getegid(void);
|
||||
int ioctl(int fildes, int cmd, ...);
|
||||
int kill(pid_t pid, int signal);
|
||||
int link(const char * filename1, const char * filename2);
|
||||
int lseek(int fildes, off_t offset, int origin);
|
||||
int mknod(const char * filename, mode_t mode, dev_t dev);
|
||||
int mount(const char * specialfile, const char * dir, int rwflag);
|
||||
int nice(int val);
|
||||
int open(const char * filename, int flag, ...);
|
||||
int pause(void);
|
||||
int pipe(int * fildes);
|
||||
int read(int fildes, char * buf, off_t count);
|
||||
int setpgrp(void);
|
||||
int setpgid(pid_t pid,pid_t pgid);
|
||||
int setuid(uid_t uid);
|
||||
int setgid(gid_t gid);
|
||||
void (*signal(int sig, void (*fn)(int)))(int);
|
||||
int stat(const char * filename, struct stat * stat_buf);
|
||||
int fstat(int fildes, struct stat * stat_buf);
|
||||
int stime(time_t * tptr);
|
||||
int sync(void);
|
||||
time_t time(time_t * tloc);
|
||||
time_t times(struct tms * tbuf);
|
||||
int ulimit(int cmd, long limit);
|
||||
mode_t umask(mode_t mask);
|
||||
int umount(const char * specialfile);
|
||||
int uname(struct utsname * name);
|
||||
int unlink(const char * filename);
|
||||
int ustat(dev_t dev, struct ustat * ubuf);
|
||||
int utime(const char * filename, struct utimbuf * times);
|
||||
pid_t waitpid(pid_t pid,int * wait_stat,int options);
|
||||
pid_t wait(int * wait_stat);
|
||||
int write(int fildes, const char * buf, off_t count);
|
||||
int dup2(int oldfd, int newfd);
|
||||
int getppid(void);
|
||||
pid_t getpgrp(void);
|
||||
pid_t setsid(void);
|
||||
|
||||
|
||||
char* getcwd(char *buf,size_t size);
|
||||
int something(void);
|
||||
int sleep(unsigned int seconds);
|
||||
int execve2(const char *path,char *argv[],char *envp[]);
|
||||
int init_graphics(void);
|
||||
int get_message(struct message *msg);
|
||||
int repaint(int x,int y,int h);
|
||||
|
||||
#define __always_inline inline __attribute__((always_inline))
|
||||
|
||||
#endif
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
# 1 "mouse.S"
|
||||
# 1 "<built-in>"
|
||||
# 1 "<command-line>"
|
||||
# 1 "mouse.S"
|
||||
.globl mouse_interrupt
|
||||
mouse_interrupt:
|
||||
pushl %eax
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
push %ds
|
||||
|
||||
#prepare for call readmouse
|
||||
movl $0x10,%eax
|
||||
mov %ax,%ds
|
||||
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
xor %eax,%eax
|
||||
inb $0x60,%al
|
||||
pushl %eax
|
||||
call readmouse
|
||||
addl $4,%esp
|
||||
|
||||
#EOI
|
||||
movb $0x20,%al #8259A 操作命令字 EOI
|
||||
outb %al,$0xA0 #send EOI to 8259a second
|
||||
outb %al,$0x20 #send EOI to 8259a first
|
||||
|
||||
|
||||
pop %ds
|
||||
popl %edx
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
popl %eax
|
||||
iret
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,105 @@
|
||||
#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
|
||||
struct message *headd;
|
||||
static int ff=0;
|
||||
int sys_init_graphics()
|
||||
{
|
||||
int i,j,x,y;
|
||||
char *p=0xA0000;
|
||||
if(ff==0)
|
||||
{
|
||||
outb(0x05,0x3CE);
|
||||
outb(0x40,0x3CF);/* shift256=1*/
|
||||
outb(0x06,0x3CE);
|
||||
outb(0x05,0x3CF);/*0101 0xA0000*/
|
||||
outb(0x04,0x3C4);
|
||||
outb(0x08,0x3C5);/*0000 jilian*/
|
||||
|
||||
|
||||
outb(0x01,0x3D4);
|
||||
outb(0x4F,0x3D5);/* end horizontal display=79 ??*/
|
||||
outb(0x03,0x3D4);
|
||||
outb(0x82,0x3D5);/*display enable skew=0*/
|
||||
|
||||
outb(0x07,0x3D4);
|
||||
outb(0x1F,0x3D5);/*vertical display end No8,9 bit=1,0*/
|
||||
outb(0x12,0x3D4);
|
||||
outb(0x8F,0x3D5);/*vertical display end low 7b =0x8F*/
|
||||
outb(0x17,0x3D4);
|
||||
outb(0xA3,0x3D5);/*SLDIV=1 ,scanline clock/2*/
|
||||
|
||||
|
||||
|
||||
outb(0x14,0x3D4);
|
||||
outb(0x40,0x3D5);/*DW=1*/
|
||||
outb(0x13,0x3D4);
|
||||
outb(0x28,0x3D5);/*Offset=40, 20:become long*/
|
||||
|
||||
outb(0x0C,0x3D4);/**/
|
||||
outb(0x00,0x3D5);/**/
|
||||
outb(0x0D,0x3D4);/**/
|
||||
outb(0x00,0x3D5);/*Start Address=0xA0000*/
|
||||
ff=1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
p=memstart;
|
||||
for(i=0;i<memsize;i++) *p++=3;
|
||||
//3-blue 4-red 12-purple
|
||||
|
||||
x=50;
|
||||
y=40;
|
||||
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=12;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_get_message(struct message * msg)
|
||||
{
|
||||
msg=headd;
|
||||
if(headd->mid!=1)return 0;
|
||||
headd=headd->next;
|
||||
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;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue