Rev 283 | Rev 321 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ha | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; |
||
3 | ;; Kolibri OS - based on source code Menuet OS, but not 100% compatible. |
||
4 | ;; |
||
5 | ;; See file COPYING or GNU.TXT for details with these additional details: |
||
6 | ;; - All code written in 32 bit x86 assembly language |
||
7 | ;; - No external code (eg. bios) at process execution time |
||
8 | ;; |
||
9 | ;; |
||
10 | ;; Compile with last version FASM |
||
11 | ;; |
||
12 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
164 | serge | 13 | include "proc32.inc" |
7 | me_root | 14 | include "kglobals.inc" |
1 | ha | 15 | include "lang.inc" |
16 | |||
164 | serge | 17 | include "const.inc" |
1 | ha | 18 | |
164 | serge | 19 | ;WinMapAddress equ 0x460000 |
20 | ;display_data = 0x460000 |
||
21 | |||
1 | ha | 22 | max_processes equ 255 |
23 | |||
164 | serge | 24 | ;window_data equ 0x0000 |
25 | ;tss_data equ 0xD20000 |
||
1 | ha | 26 | tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 |
164 | serge | 27 | ;draw_data equ 0xC00000 |
28 | ;sysint_stack_data equ 0xC03000 |
||
1 | ha | 29 | |
164 | serge | 30 | ;twdw equ (0x3000-window_data) |
1 | ha | 31 | |
32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
33 | ;; |
||
34 | ;; Included files: |
||
35 | ;; |
||
36 | ;; Kernel16.inc |
||
37 | ;; - Booteng.inc English text for bootup |
||
38 | ;; - Bootcode.inc Hardware setup |
||
39 | ;; - Pci16.inc PCI functions |
||
40 | ;; |
||
41 | ;; Kernel32.inc |
||
42 | ;; - Sys32.inc Process management |
||
43 | ;; - Shutdown.inc Shutdown and restart |
||
44 | ;; - Fat32.inc Read / write hd |
||
45 | ;; - Vesa12.inc Vesa 1.2 driver |
||
46 | ;; - Vesa20.inc Vesa 2.0 driver |
||
47 | ;; - Vga.inc VGA driver |
||
48 | ;; - Stack.inc Network interface |
||
49 | ;; - Mouse.inc Mouse pointer |
||
50 | ;; - Scincode.inc Window skinning |
||
51 | ;; - Pci32.inc PCI functions |
||
52 | ;; |
||
53 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
54 | |||
55 | |||
56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
57 | ;; ;; |
||
58 | ;; 16 BIT ENTRY FROM BOOTSECTOR ;; |
||
59 | ;; ;; |
||
60 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
61 | |||
62 | use16 |
||
82 | halyavin | 63 | org 0x0 |
1 | ha | 64 | jmp start_of_code |
65 | |||
66 | ; mike.dld { |
||
90 | mario79 | 67 | org $+0x10000 |
1 | ha | 68 | db 0 |
69 | dd servetable-0x10000 |
||
70 | draw_line dd __sys_draw_line |
||
71 | disable_mouse dd __sys_disable_mouse |
||
72 | draw_pointer dd __sys_draw_pointer |
||
114 | mikedld | 73 | ;//mike.dld, 2006-08-02 [ |
74 | ;drawbar dd __sys_drawbar |
||
75 | drawbar dd __sys_drawbar.forced |
||
76 | ;//mike.dld, 2006-08-02 ] |
||
1 | ha | 77 | putpixel dd __sys_putpixel |
78 | ; } mike.dld |
||
79 | |||
202 | diamond | 80 | version db 'Kolibri OS version 0.6.3.0 ',13,10,13,10,0 |
1 | ha | 81 | ;dd endofcode-0x10000 |
82 | |||
83 | ;db 'Boot02' |
||
84 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
||
85 | include "boot/preboot.inc" |
||
86 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
||
87 | |||
88 | preboot_lfb db 0 |
||
89 | preboot_bootlog db 0 |
||
90 | |||
91 | |||
92 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
93 | ;; ;; |
||
94 | ;; 16 BIT INCLUDED FILES ;; |
||
95 | ;; ;; |
||
96 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
97 | |||
7 | me_root | 98 | include "kernel16.inc" |
1 | ha | 99 | |
100 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
101 | ;; ;; |
||
102 | ;; SWITCH TO 32 BIT PROTECTED MODE ;; |
||
103 | ;; ;; |
||
104 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
105 | |||
3 | halyavin | 106 | os_data = os_data_l-gdts ; GDTs |
107 | os_code = os_code_l-gdts |
||
1 | ha | 108 | int_code equ int_code_l-gdts |
109 | int_data equ int_data_l-gdts |
||
110 | tss0sys equ tss0sys_l-gdts |
||
111 | graph_data equ 3+graph_data_l-gdts |
||
112 | tss0 equ tss0_l-gdts |
||
113 | app_code equ 3+app_code_l-gdts |
||
114 | app_data equ 3+app_data_l-gdts |
||
115 | |||
116 | |||
117 | |||
118 | ; CR0 Flags - Protected mode and Paging |
||
119 | |||
168 | serge | 120 | mov ecx, CR0_PE |
1 | ha | 121 | |
122 | ; Enabling 32 bit protected mode |
||
123 | |||
124 | sidt [cs:old_ints_h-0x10000] |
||
125 | |||
126 | cli ; disable all irqs |
||
127 | cld |
||
128 | mov al,255 ; mask all irqs |
||
129 | out 0xa1,al |
||
130 | out 0x21,al |
||
131 | l.5: in al, 0x64 ; Enable A20 |
||
132 | test al, 2 |
||
133 | jnz l.5 |
||
134 | mov al, 0xD1 |
||
135 | out 0x64, al |
||
136 | l.6: in al, 0x64 |
||
137 | test al, 2 |
||
138 | jnz l.6 |
||
139 | mov al, 0xDF |
||
140 | out 0x60, al |
||
149 | diamond | 141 | l.7: in al, 0x64 |
142 | test al, 2 |
||
143 | jnz l.7 |
||
144 | mov al, 0xFF |
||
145 | out 0x64, al |
||
1 | ha | 146 | lgdt [cs:gdts-0x10000] ; Load GDT |
147 | mov eax, cr0 ; Turn on paging // protected mode |
||
148 | or eax, ecx |
||
149 | and eax, 10011111b *65536*256 + 0xffffff ; caching enabled |
||
150 | mov cr0, eax |
||
77 | diamond | 151 | jmp $+2 |
164 | serge | 152 | org $+0x10000 |
1 | ha | 153 | mov ax,os_data ; Selector for os |
154 | mov ds,ax |
||
155 | mov es,ax |
||
156 | mov fs,ax |
||
157 | mov gs,ax |
||
158 | mov ss,ax |
||
12 | halyavin | 159 | mov esp,0x3ec00 ; Set stack |
1 | ha | 160 | jmp pword os_code:B32 ; jmp to enable 32 bit mode |
161 | |||
183 | diamond | 162 | if gdte >= $ |
163 | error 'GDT overlaps with used code!' |
||
164 | end if |
||
165 | |||
1 | ha | 166 | use32 |
167 | |||
183 | diamond | 168 | include 'unpacker.inc' |
169 | |||
1 | ha | 170 | iglobal |
171 | boot_memdetect db 'Determining amount of memory',0 |
||
172 | boot_fonts db 'Fonts loaded',0 |
||
173 | boot_tss db 'Setting TSSs',0 |
||
174 | boot_cpuid db 'Reading CPUIDs',0 |
||
175 | boot_devices db 'Detecting devices',0 |
||
176 | boot_timer db 'Setting timer',0 |
||
177 | boot_irqs db 'Reprogramming IRQs',0 |
||
178 | boot_setmouse db 'Setting mouse',0 |
||
179 | boot_windefs db 'Setting window defaults',0 |
||
180 | boot_bgr db 'Calculating background',0 |
||
181 | boot_resirqports db 'Reserving IRQs & ports',0 |
||
182 | boot_setrports db 'Setting addresses for IRQs',0 |
||
183 | boot_setostask db 'Setting OS task',0 |
||
184 | boot_allirqs db 'Unmasking all IRQs',0 |
||
185 | boot_tsc db 'Reading TSC',0 |
||
186 | boot_pal_ega db 'Setting EGA/CGA 320x200 palette',0 |
||
187 | boot_pal_vga db 'Setting VGA 640x480 palette',0 |
||
188 | boot_mtrr db 'Setting MTRR',0 |
||
189 | boot_tasking db 'All set - press ESC to start',0 |
||
190 | endg |
||
191 | |||
192 | iglobal |
||
193 | boot_y dd 10 |
||
194 | endg |
||
195 | |||
196 | boot_log: |
||
197 | pushad |
||
198 | |||
199 | mov eax,10*65536 |
||
200 | mov ax,word [boot_y] |
||
201 | add [boot_y],dword 10 |
||
139 | diamond | 202 | mov ebx,0x80ffffff ; ASCIIZ string with white color |
1 | ha | 203 | mov ecx,esi |
204 | mov edi,1 |
||
205 | call dtext |
||
206 | |||
207 | mov [novesachecksum],1000 |
||
117 | mario79 | 208 | call checkVga_N13 |
1 | ha | 209 | |
210 | cmp [preboot_blogesc],byte 1 |
||
211 | je .bll2 |
||
212 | |||
213 | cmp esi,boot_tasking |
||
214 | jne .bll2 |
||
215 | ; begin ealex 04.08.05 |
||
216 | ; in al,0x61 |
||
217 | ; and al,01111111b |
||
41 | mikedld | 218 | ; out 0x61,al |
1 | ha | 219 | ; end ealex 04.08.05 |
220 | .bll1: in al,0x60 ; wait for ESC key press |
||
221 | cmp al,129 |
||
222 | jne .bll1 |
||
223 | |||
224 | .bll2: popad |
||
225 | |||
226 | ret |
||
227 | |||
228 | iglobal |
||
143 | diamond | 229 | firstapp db '/rd/1/LAUNCHER',0 |
202 | diamond | 230 | char db 'FONTS/CHAR.MT',0 |
231 | char2 db 'FONTS/CHAR2.MT',0 |
||
1 | ha | 232 | bootpath db '/KOLIBRI ' |
233 | bootpath2 db 0 |
||
314 | diamond | 234 |