Rev 7129 | Rev 8089 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7129 | Rev 7132 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | ;; KolibriOS 16-bit loader, ;; |
9 | ;; KolibriOS 16-bit loader, ;; |
10 | ;; based on bootcode for MenuetOS ;; |
10 | ;; based on bootcode for MenuetOS ;; |
11 | ;; ;; |
11 | ;; ;; |
12 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 13... | Line 13... | ||
13 | 13 | ||
Line 14... | Line 14... | ||
14 | $Revision: 7129 $ |
14 | $Revision: 7132 $ |
15 | 15 | ||
16 | 16 | ||
Line 280... | Line 280... | ||
280 | ; if bootloader sets ax = 'KL', then ds:si points to loader block |
280 | ; if bootloader sets ax = 'KL', then ds:si points to loader block |
281 | cmp ax, 'KL' |
281 | cmp ax, 'KL' |
282 | jnz @f |
282 | jnz @f |
283 | mov word [cs:cfgmanager.loader_block], si |
283 | mov word [cs:cfgmanager.loader_block], si |
284 | mov word [cs:cfgmanager.loader_block+2], ds |
284 | mov word [cs:cfgmanager.loader_block+2], ds |
285 | mov word [es:BOOT_KERNEL_RESTART], kernel_restart_bootblock |
285 | mov word [es:BOOT_LO.kernel_restart], kernel_restart_bootblock |
286 | @@: |
286 | @@: |
287 | ; \end{diamond}[02.12.2005] |
287 | ; \end{diamond}[02.12.2005] |
Line 288... | Line 288... | ||
288 | 288 | ||
289 | ; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk |
289 | ; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk |
290 | ; (see comment to BOOT_BX_FROM_LOAD and loader_doc.txt) |
290 | ; (see comment to BOOT_LO.bx_from_load and loader_doc.txt) |
291 | mov word [es:BOOT_BX_FROM_LOAD], 'r1' ; default value: /rd/1 |
291 | mov word [es:BOOT_LO.bx_from_load], 'r1' ; default value: /rd/1 |
292 | cmp cx, 'HA' |
292 | cmp cx, 'HA' |
293 | jnz no_hd_load |
293 | jnz no_hd_load |
294 | cmp dx, 'RD' |
294 | cmp dx, 'RD' |
295 | jnz no_hd_load |
295 | jnz no_hd_load |
296 | mov [es:BOOT_BX_FROM_LOAD], bx |
296 | mov [es:BOOT_LO.bx_from_load], bx |
Line 297... | Line 297... | ||
297 | no_hd_load: |
297 | no_hd_load: |
298 | 298 | ||
299 | ; set up stack |
299 | ; set up stack |
Line 439... | Line 439... | ||
439 | loopz @b |
439 | loopz @b |
440 | in al, 0x60 |
440 | in al, 0x60 |
441 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
441 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
442 | sti |
442 | sti |
443 | ; --------------- APM --------------------- |
443 | ; --------------- APM --------------------- |
444 | and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found) |
444 | and word [es:BOOT_LO.apm_version], 0 ; ver = 0.0 (APM not found) |
445 | mov ax, 0x5300 |
445 | mov ax, 0x5300 |
446 | xor bx, bx |
446 | xor bx, bx |
447 | int 0x15 |
447 | int 0x15 |
448 | jc apm_end ; APM not found |
448 | jc apm_end ; APM not found |
449 | test cx, 2 |
449 | test cx, 2 |
450 | jz apm_end ; APM 32-bit protected-mode interface not supported |
450 | jz apm_end ; APM 32-bit protected-mode interface not supported |
451 | mov [es:BOOT_APM_VERSION], ax ; Save APM Version |
451 | mov [es:BOOT_LO.apm_version], ax ; Save APM Version |
452 | mov [es:BOOT_APM_FLAGS], cx ; Save APM flags |
452 | mov [es:BOOT_LO.apm_flags], cx ; Save APM flags |
Line 453... | Line 453... | ||
453 | 453 | ||
454 | ; Write APM ver ---- |
454 | ; Write APM ver ---- |
455 | and ax, 0xf0f |
455 | and ax, 0xf0f |
456 | add ax, '00' |
456 | add ax, '00' |
Line 466... | Line 466... | ||
466 | int 0x15 |
466 | int 0x15 |
467 | mov ax, 0x5303 ; Connect 32 bit mode interface |
467 | mov ax, 0x5303 ; Connect 32 bit mode interface |
468 | xor bx, bx |
468 | xor bx, bx |
469 | int 0x15 |
469 | int 0x15 |
Line 470... | Line 470... | ||
470 | 470 | ||
471 | mov [es:BOOT_APM_ENTRY], ebx |
471 | mov [es:BOOT_LO.apm_entry], ebx |
472 | mov [es:BOOT_APM_CODE_32], ax |
472 | mov [es:BOOT_LO.apm_code_32], ax |
473 | mov [es:BOOT_APM_CODE_16], cx |
473 | mov [es:BOOT_LO.apm_code_16], cx |
Line 474... | Line 474... | ||
474 | mov [es:BOOT_APM_DATA_16], dx |
474 | mov [es:BOOT_LO.apm_data_16], dx |
475 | 475 | ||
Line 476... | Line 476... | ||
476 | apm_end: |
476 | apm_end: |
Line 949... | Line 949... | ||
949 | 949 | ||
Line 950... | Line 950... | ||
950 | call set_vmode |
950 | call set_vmode |
951 | 951 | ||
952 | ; GRAPHICS ACCELERATION |
952 | ; GRAPHICS ACCELERATION |
Line 953... | Line 953... | ||
953 | ; force yes |
953 | ; force yes |
Line 954... | Line 954... | ||
954 | mov [es:BOOT_MTRR], byte 1 |
954 | mov [es:BOOT_LO.mtrr], byte 1 |
955 | 955 | ||
Line 956... | Line 956... | ||
956 | ; DMA ACCESS TO HD |
956 | ; DMA ACCESS TO HD |
957 | 957 | ||
958 | mov al, [preboot_dma] |
958 | mov al, [preboot_dma] |
Line 959... | Line 959... | ||
959 | mov [es:BOOT_DMA], al |
959 | mov [es:BOOT_LO.dma], al |
960 | 960 | ||
961 | ; Set kernel DEBUG mode - if nonzero, duplicates debug output to the screen. |
961 | ; Set kernel DEBUG mode - if nonzero, duplicates debug output to the screen. |
Line 962... | Line 962... | ||
962 | mov al, [preboot_debug] |
962 | mov al, [preboot_debug] |
Line 963... | Line 963... | ||
963 | mov [es:BOOT_DEBUG_PRINT], al ;// 0x901E |
963 | mov [es:BOOT_LO.debug_print], al ;// 0x901E |
964 | 964 | ||
965 | ; Start the first app (right now it's LAUNCHER) after kernel is loaded? |
965 | ; Start the first app (right now it's LAUNCHER) after kernel is loaded? |
Line 966... | Line 966... | ||
966 | mov al, [preboot_launcher] |
966 | mov al, [preboot_launcher] |
967 | mov [es:BOOT_LAUNCHER_START], al ;// 0x901D |
967 | mov [es:BOOT_LO.launcher_start], al ;// 0x901D |
Line 968... | Line 968... | ||
968 | 968 | ||
Line 969... | Line 969... | ||
969 | ; BOOT DEVICE |
969 | ; BOOT DEVICE |
970 | 970 | ||
971 | mov al, [preboot_device] |
971 | mov al, [preboot_device] |
972 | dec al |
972 | dec al |
973 | mov [es:BOOT_DEV], al |
973 | mov [es:BOOT_LO.dev], al |
974 | 974 | ||
Line 1302... | Line 1302... | ||
1302 | mov dx, 0x3f2 ; floppy motor off |
1302 | mov dx, 0x3f2 ; floppy motor off |
1303 | mov al, 0 |
1303 | mov al, 0 |
1304 | out dx, al |
1304 | out dx, al |
Line 1305... | Line 1305... | ||
1305 | 1305 | ||
1306 | if defined extended_primary_loader |
1306 | if defined extended_primary_loader |
1307 | cmp [es:BOOT_DEV], 1 |
1307 | cmp [es:BOOT_LO.dev], 1 |
1308 | jne no_sys_from_primary |
1308 | jne no_sys_from_primary |
1309 | ; load kolibri.img using callback from primary loader |
1309 | ; load kolibri.img using callback from primary loader |
1310 | and word [movedesc + 24 + 2], 0 |
1310 | and word [movedesc + 24 + 2], 0 |
1311 | mov byte [movedesc + 24 + 4], 10h |
1311 | mov byte [movedesc + 24 + 4], 10h |
Line 1341... | Line 1341... | ||
1341 | ; SET GRAPHICS |
1341 | ; SET GRAPHICS |
Line 1342... | Line 1342... | ||
1342 | 1342 | ||
1343 | xor ax, ax |
1343 | xor ax, ax |
Line 1344... | Line 1344... | ||
1344 | mov es, ax |
1344 | mov es, ax |
1345 | 1345 | ||
1346 | mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200 |
1346 | mov ax, [es:BOOT_LO.vesa_mode] ; vga & 320x200 |
1347 | mov bx, ax |
1347 | mov bx, ax |
1348 | cmp ax, 0x13 |
1348 | cmp ax, 0x13 |
1349 | je setgr |
1349 | je setgr |