Rev 4150 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4150 | Rev 4151 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | #include <macros.h> |
3 | #include <macros.h> |
4 | 4 | ||
5 | #define VESA_INFO_SIZE 1024 |
5 | #define VESA_INFO_SIZE 1024 |
6 | 6 | ||
7 | #define VESA_MODE_ATTRIBUTES_OFFSET 0 |
7 | #define VESA_MODE_ATTRIBUTES_OFFSET 0 |
8 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
8 | #define VESA_MODE_LIST_PTR_OFFSET 14 |
9 | #define VESA_MODE_SCANLINE_OFFSET 16 |
9 | #define VESA_MODE_SCANLINE_OFFSET 16 |
10 | #define VESA_MODE_WIDTH_OFFSET 18 |
10 | #define VESA_MODE_WIDTH_OFFSET 18 |
11 | #define VESA_MODE_HEIGHT_OFFSET 20 |
11 | #define VESA_MODE_HEIGHT_OFFSET 20 |
12 | #define VESA_MODE_BPP_OFFSET 25 |
12 | #define VESA_MODE_BPP_OFFSET 25 |
- | 13 | #define VESA_MODE_RED_MASK_OFFSET 31 |
|
- | 14 | #define VESA_MODE_RED_POS_OFFSET 32 |
|
- | 15 | #define VESA_MODE_GREEN_MASK_OFFSET 33 |
|
- | 16 | #define VESA_MODE_GREEN_POS_OFFSET 34 |
|
- | 17 | #define VESA_MODE_BLUE_MASK_OFFSET 35 |
|
- | 18 | #define VESA_MODE_BLUE_POS_OFFSET 36 |
|
13 | #define VESA_MODE_PHADDR_OFFSET 40 |
19 | #define VESA_MODE_PHADDR_OFFSET 40 |
14 | 20 | ||
15 | #define VESA_END_OF_MODES 0xffff |
21 | #define VESA_END_OF_MODES 0xffff |
16 | 22 | ||
17 | #define VESA_OK 0x4f |
23 | #define VESA_OK 0x4f |
18 | 24 | ||
19 | #define VESA_GET_INFO 0x4f00 |
25 | #define VESA_GET_INFO 0x4f00 |
20 | #define VESA_GET_MODE_INFO 0x4f01 |
26 | #define VESA_GET_MODE_INFO 0x4f01 |
21 | #define VESA_SET_MODE 0x4f02 |
27 | #define VESA_SET_MODE 0x4f02 |
22 | #define VESA_SET_PALETTE 0x4f09 |
28 | #define VESA_SET_PALETTE 0x4f09 |
23 | 29 | ||
24 | .code32 |
30 | .code32 |
25 | vesa_init: |
31 | vesa_init: |
26 | jmp $gdtselector(VESA_INIT_DES), $vesa_init_real - vesa_init |
32 | jmp $gdtselector(VESA_INIT_DES), $vesa_init_real - vesa_init |
27 | 33 | ||
Line 275... | Line 281... | ||
275 | 281 | ||
276 | pop %di |
282 | pop %di |
277 | 283 | ||
278 | vga_not_set: |
284 | vga_not_set: |
279 | 285 | ||
- | 286 | # store mode parameters |
|
- | 287 | # eax = bpp[8] scanline[16] |
|
- | 288 | # ebx = width[16] height[16] |
|
- | 289 | # edx = red_mask[8] red_pos[8] green_mask[8] green_pos[8] |
|
280 | mov VESA_MODE_PHADDR_OFFSET(%di), %esi |
290 | # esi = blue_mask[8] blue_pos[8] |
- | 291 | # edi = linear frame buffer |
|
- | 292 | ||
281 | mov VESA_MODE_WIDTH_OFFSET(%di), %ax |
293 | mov VESA_MODE_BPP_OFFSET(%di), %al |
- | 294 | xor %ah, %ah |
|
282 | shl $16, %eax |
295 | shl $16, %eax |
283 | mov VESA_MODE_HEIGHT_OFFSET(%di), %ax |
296 | mov VESA_MODE_SCANLINE_OFFSET(%di), %ax |
- | 297 | ||
284 | mov VESA_MODE_BPP_OFFSET(%di), %bl |
298 | mov VESA_MODE_WIDTH_OFFSET(%di), %bx |
285 | xor %bh, %bh |
- | |
286 | shl $16, %ebx |
299 | shl $16, %ebx |
287 | mov VESA_MODE_SCANLINE_OFFSET(%di), %bx |
300 | mov VESA_MODE_HEIGHT_OFFSET(%di), %bx |
- | 301 | ||
- | 302 | mov VESA_MODE_BLUE_MASK_OFFSET(%di), %dl |
|
- | 303 | shl $8, %edx |
|
- | 304 | mov VESA_MODE_BLUE_POS_OFFSET(%di), %dl |
|
288 | mov %eax, %edi |
305 | mov %edx, %esi |
- | 306 | ||
- | 307 | mov VESA_MODE_RED_MASK_OFFSET(%di), %dl |
|
- | 308 | shl $8, %edx |
|
- | 309 | mov VESA_MODE_RED_POS_OFFSET(%di), %dl |
|
- | 310 | shl $8, %edx |
|
- | 311 | mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl |
|
- | 312 | shl $8, %edx |
|
- | 313 | mov VESA_MODE_GREEN_POS_OFFSET(%di), %dl |
|
- | 314 | ||
- | 315 | mov VESA_MODE_PHADDR_OFFSET(%di), %edi |
|
289 | 316 | ||
290 | vesa_leave_real: |
317 | vesa_leave_real: |
291 | 318 | ||
292 | mov %cr0, %eax |
319 | mov %cr0, %ecx |
293 | or $1, %eax |
320 | or $1, %ecx |
294 | mov %eax, %cr0 |
321 | mov %ecx, %cr0 |
295 | 322 | ||
296 | jmp vesa_leave_real2 |
323 | jmp vesa_leave_real2 |
297 | 324 | ||
298 | vesa_leave_real2: |
325 | vesa_leave_real2: |
299 | 326 |