?? progc.c
字號:
/*#include "process/seg.h" #This file is include in task.h*/
#include "common/CAsm.h"
#include "common/printf.h"
/*#incldue "common/timer.h"*/
#include "common/kEcho.h"
#include "mm/mm.h"
#include "intr/intr.h"
#include "dev/char/keyboard.h"
#include "dev/blk/hd.h"
#define Video ((char *)0xb8000)
unsigned long MemSize;
long cr0;
char **KM_Array,tstr[128],tst[128];
struct hd_para hd0_para;
void default_intr_fun(void)
{
s_intr();
kprint(60,2,"Undefine interrupt err!!");
for(;;);
eH_intr();
e_intr();
iret();
return;
}
void timer_intr(void)
{
s_intr();
hd_rw();
echoHex(00,24,cr0);
echoHex(10,24,MemSize);
(*(long *)(0xb8000+158))+=1; /*Test if it do its work!:)*/
e_intr();
eH_intr();
iret();
}
#include "process/task1.h"
#include "process/task.h"
#include "process/pm.h"
#include "process/schedule.h"
HDOP hd_tmp[0x10];
void main()
{
int i;
/*copy the hard disk parameter,which we save in the right position*/
MemSize=*((long*)0x91000);
MemSize&=0x0000ffff;
MemSize<<=10;
hd0_para.cyl=*((short *)0x91010);
hd0_para.head=*((char *)0x91012)-1;
hd0_para.rs=*((short *)0x91013);
hd0_para.wpcom=((unsigned long)(*((short*)0x91015)))>>4;
hd0_para.l_ecc=*((char *)0x91017);
hd0_para.ctrl=*((char *)0x91018);
hd0_para.std_timeout=*((char *)0x91019);
hd0_para.format_timeout=*((char*)0x9101a);
hd0_para.detect_timeout=*((char*)0x9101b);
hd0_para.lzone=*((short*)0x9101c);
hd0_para.sect=*((char *)0x9101e);
/*cls();*/ /*clear the screen*/
/*translate from k to byte.
/*init all interupt gate to default*/
for(i=0;i<256;i++)
set_intr_gate(i,default_intr_fun);
set_intr_gate(0x00,i_div_err);
set_intr_gate(0x01,i_debug);
set_intr_gate(0x02,i_nmi);
/*set_intr_gate(0x03,i_break_point);*/
set_intr_gate(0x04,i_overflow);
set_intr_gate(0x05,i_bounds);
set_intr_gate(0x06,i_invalid_op);
set_intr_gate(0x07,i_dev_not_avail);
set_intr_gate(0x08,i_double_fault);
/*set_intr_gate(0x09,i_reserve);*/
set_intr_gate(0x0a,i_invalid_Tss);
set_intr_gate(0x0b,i_segment);
set_intr_gate(0x0c,i_stack);
set_intr_gate(0x0d,i_general);
set_intr_gate(0x0e,i_page);
set_intr_gate(0x21,hi_key);
/* set the time interupt handling routing*/
set_intr_gate(0x20,timer_intr);
set_intr_gate(0x2e,hi_hd);
/* devices init */
mm_init();
init_keyboard();
init_hd(&hd0_para);
/*print the system message: */
/*
echoHex(0,24,MemSize);
echoHex(10,24,(long)hd0_para.sect);
echoHex(20,24,cr0);
echoHex(30,24,*((long *)(1<<20)));
kprint(0,0,KM_Array[0x10]);
echoHex(2,1,hd0_para.head);
kprint(0,2,KM_Array[0x11]);
echoHex(2,3,hd0_para.sect);
kprint(0,4,KM_Array[0x12]);
echoHex(2,5,MemSize);
kprint(0,6,KM_Array[0x13]);
echoHex(2,7,cr0);
echoHex(12,1,hd0_para.wpcom>>2);
*/
sti();
/*
export_b(0x70,0x12);
echoHex(0,23,import_b(0x71));
*/
/*init_task();*/
/*createT0T1();*/
/*
echoHex( 0,20,taskqueque[2].tss.ldt);
echoHex(10,20,taskqueque[2].tss.IOMap);
*/
/*sched();*/
/*i/=0;*/
/*echoHex(10,20,*((long*)(0x01<<22)+4));*/
tstr[40]=0;
tstr[42]=0;
i=0;
for(;;){ /*test*/
i=i%10;
/*echoHex(60,5+i,mm_getpage() );*/
kprintf("It is a test.\n");
tstr[41]=get_kb_ascii();
if(tstr[41]!=0){
cls();
if(tstr[41]!='\n'&&tstr[41]!='\r')
tstr[tstr[42]]=tstr[41];
else
tstr[tstr[42]]=' ';
if(tstr[41]==13||tstr[41]==10){
tstr[42]=0;
tstr[0]='_';
}else{
tstr[42]=++tstr[42]%40;
tstr[tstr[42]]='_';
}
hd_tmp[i].op_secs=4;
hd_tmp[i].s_sect=i+1;
hd_tmp[i].cyl=0;
hd_tmp[i].head=1;
hd_tmp[i].drive=0;
hd_tmp[i].hd_buf=(short *)(0xb8000+((i%8)<<9));
hd_tmp[i].cmd=0x20;
hd_read(&hd_tmp[i]);
}
kprint(39,24,tstr);
kprintf(tstr);
i++;
}
/* Iniate the system */
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -