OSDN Git Service

projects clean up 1
[pinoc/pinoc.git] / tryos / tryos_test / pinoc_x86 / test / PINoC / boot / src / bootld.cpp
1 #include "../../../common/typedef.h"
2 #include "../head/lowCall16.h"
3 #include "../head/segment_descriptor.h"
4 #include "../head/realmode.h"
5
6
7 vo waitkeybord();
8 vo io_A20GATE();
9 vo io_PROTECTMODE();
10
11 /*******************************************************************************
12                 メイン関数
13  *******************************************************************************/
14 vo main16()
15 {
16         lowcall16 low16;
17
18
19
20 #if DEBUG
21         low16.io_debug16();
22 #endif
23
24         // VBEへ
25         if(low16.vbe_mode())
26                 low16.vga_mode();
27
28
29         // メモリの使用可能領域を2^32まで拡張
30         io_A20GATE();
31
32 //      RGB color;
33 //      color.B = 0xFF;
34 //      color.G = 0xCC;
35 //      color.R = 0xCC;
36 //
37 //      RGB color2;
38 //      color2.B = 0x99;
39 //      color2.G = 0x99;
40 //      color2.R = 0x99;
41 //
42 //      RGB color3;
43 //      color3.B = 0x66;
44 //      color3.G = 0x66;
45 //      color3.R = 0x66;
46 //
47 //      // 1024x768     24bit/32bit
48 //      io_RGBwrite16(1024, 768, 0, 0, color);
49 //      io_RGBwrite16(1024, 1, 0, 768 - 27, color3);
50 //      io_RGBwrite16(1024, 26, 0, 768 - 26, color2);
51 //      io_RGBwrite16(64, 22, 2, 768 - 26 + 1, color3);
52
53         // ジャンプ先にHLTLOOPを設定
54         *(u1*)0x6500 = (u1)0xf4;
55         *(u2*)0x6501 = (u2)0xfdeb;
56
57         *(u1*)0x6000 = (u1)0xf4;
58         *(u2*)0x6001 = (u2)0xfdeb;
59
60         *(u8*)0x9008 = (u8)0x00cf9a006000FFFF;
61         *(u8*)0x9010 = (u8)0x00cf9a006500FFFF;
62
63         // GDTRとIDTRの設定をします。  -> 6byte
64         segment_descriptor sd;
65         sd.LGDT16(0x00FF, 0x00009000);
66         sd.LIDT16(0x00FF, 0x00008500);
67
68
69         /*--------------------------------------------------------------------------------
70                         パイプラインフラッシュの後、スタックを設定し、main32()へjmpします
71          --------------------------------------------------------------------------------*/
72         io_PROTECTMODE();
73
74 }
75 #include "../head/32mode.hpp"
76
77