Rev 3539 | Rev 3711 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3539 | Rev 3702 | ||
---|---|---|---|
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: 3539 $ |
14 | $Revision: 3702 $ |
15 | 15 | ||
16 | 16 | ||
Line 385... | Line 385... | ||
385 | ; set up esp |
385 | ; set up esp |
386 | movzx esp, sp |
386 | movzx esp, sp |
Line 387... | Line 387... | ||
387 | 387 | ||
388 | push 0 |
388 | push 0 |
- | 389 | pop es |
|
389 | pop es |
390 | xor ax,ax |
- | 391 | and word [es:BOOT_IDE_BASE_ADDR], ax ;0 |
|
- | 392 | and word [es:BOOT_IDE_BAR0_16], ax ;0 |
|
- | 393 | and word [es:BOOT_IDE_BAR1_16], ax ;0 |
|
- | 394 | and word [es:BOOT_IDE_BAR2_16], ax ;0 |
|
390 | and word [es:BOOT_IDE_BASE_ADDR], 0 |
395 | and word [es:BOOT_IDE_BAR3_16], ax ;0 |
391 | ; \begin{Mario79} |
396 | ; \begin{Mario79} |
392 | ; find HDD IDE DMA PCI device |
397 | ; find HDD IDE DMA PCI device |
393 | ; check for PCI BIOS |
398 | ; check for PCI BIOS |
394 | mov ax, 0xB101 |
399 | mov ax, 0xB101 |
Line 400... | Line 405... | ||
400 | ; class 1 = mass storage |
405 | ; class 1 = mass storage |
401 | ; subclass 1 = IDE controller |
406 | ; subclass 1 = IDE controller |
402 | ; a) class 1, subclass 1, programming interface 0x80 |
407 | ; a) class 1, subclass 1, programming interface 0x80 |
403 | mov ax, 0xB103 |
408 | mov ax, 0xB103 |
404 | mov ecx, 1*10000h + 1*100h + 0x80 |
409 | mov ecx, 1*10000h + 1*100h + 0x80 |
- | 410 | mov [es:BOOT_IDE_PI_16], cx |
|
405 | xor si, si ; device index = 0 |
411 | xor si, si ; device index = 0 |
406 | int 0x1A |
412 | int 0x1A |
407 | jnc .found |
413 | jnc .found_1 |
408 | ; b) class 1, subclass 1, programming interface 0x8A |
414 | ; b) class 1, subclass 1, programming interface 0x8f |
409 | mov ax, 0xB103 |
415 | mov ax, 0xB103 |
410 | mov ecx, 1*10000h + 1*100h + 0x8A |
416 | mov ecx, 1*10000h + 1*100h + 0x8f |
- | 417 | mov [es:BOOT_IDE_PI_16], cx |
|
411 | xor si, si ; device index = 0 |
418 | xor si, si ; device index = 0 |
412 | int 0x1A |
419 | int 0x1A |
413 | jnc .found |
420 | jnc .found |
414 | ; c) class 1, subclass 1, programming interface 0x85 |
421 | ; c) class 1, subclass 1, programming interface 0x85 |
415 | mov ax, 0xB103 |
422 | mov ax, 0xB103 |
416 | mov ecx, 1*10000h + 1*100h + 0x85 |
423 | mov ecx, 1*10000h + 1*100h + 0x85 |
- | 424 | mov [es:BOOT_IDE_PI_16], cx |
|
417 | xor si, si |
425 | xor si, si ; device index = 0 |
418 | int 0x1A |
426 | int 0x1A |
419 | jc .nopci |
427 | jnc .found |
- | 428 | ; d) class 1, subclass 1, programming interface 0x8A |
|
- | 429 | mov ax, 0xB103 |
|
- | 430 | mov ecx, 1*10000h + 1*100h + 0x8A |
|
- | 431 | mov [es:BOOT_IDE_PI_16], cx |
|
- | 432 | xor si, si ; device index = 0 |
|
- | 433 | int 0x1A |
|
- | 434 | jnc .found |
|
- | 435 | ||
- | 436 | jmp .nopci |
|
420 | .found: |
437 | .found_1: |
421 | ; get memory base |
438 | ; get memory base BAR4 |
422 | mov ax, 0xB10A |
439 | mov ax, 0xB10A |
423 | mov di, 0x20 ; memory base is config register at 0x20 |
440 | mov di, 0x20 ; memory base is config register at 0x20 |
- | 441 | push cx |
|
424 | int 0x1A |
442 | int 0x1A |
425 | jc .nopci |
443 | jc .no_BAR4 ;.nopci |
426 | and cx, 0xFFF0 ; clear address decode type |
444 | and cx, 0xFFF0 ; clear address decode type |
427 | mov [es:BOOT_IDE_BASE_ADDR], cx |
445 | mov [es:BOOT_IDE_BASE_ADDR], cx |
- | 446 | .no_BAR4: |
|
- | 447 | pop cx |
|
- | 448 | .found: |
|
- | 449 | ; get memory base BAR0 |
|
- | 450 | mov ax, 0xB10A |
|
- | 451 | mov di, 0x10 ; memory base is config register at 0x20 |
|
- | 452 | push cx |
|
- | 453 | int 0x1A |
|
- | 454 | jc .no_BAR0 ;.nopci |
|
- | 455 | mov [es:BOOT_IDE_BAR0_16], cx |
|
- | 456 | .no_BAR0: |
|
- | 457 | pop cx |
|
- | 458 | ; get memory base BAR1 |
|
- | 459 | mov ax, 0xB10A |
|
- | 460 | mov di, 0x14 ; memory base is config register at 0x20 |
|
- | 461 | push cx |
|
- | 462 | int 0x1A |
|
- | 463 | jc .no_BAR1 ;.nopci |
|
- | 464 | mov [es:BOOT_IDE_BAR1_16], cx |
|
- | 465 | .no_BAR1: |
|
- | 466 | pop cx |
|
- | 467 | ; get memory base BAR2 |
|
- | 468 | mov ax, 0xB10A |
|
- | 469 | mov di, 0x18 ; memory base is config register at 0x20 |
|
- | 470 | push cx |
|
- | 471 | int 0x1A |
|
- | 472 | jc .no_BAR2 ;.nopci |
|
- | 473 | mov [es:BOOT_IDE_BAR2_16], cx |
|
- | 474 | .no_BAR2: |
|
- | 475 | pop cx |
|
- | 476 | ; get memory base BAR3 |
|
- | 477 | mov ax, 0xB10A |
|
- | 478 | mov di, 0x1C ; memory base is config register at 0x20 |
|
- | 479 | push cx |
|
- | 480 | int 0x1A |
|
- | 481 | jc .no_BAR3 ;.nopci |
|
- | 482 | mov [es:BOOT_IDE_BAR3_16], cx |
|
- | 483 | .no_BAR3: |
|
- | 484 | pop cx |
|
428 | .nopci: |
485 | .nopci: |
429 | ; \end{Mario79} |
486 | ; \end{Mario79} |
Line 430... | Line 487... | ||
430 | 487 | ||
431 | mov al, 0xf6 ; Сброс клавиатуры, разрешить сканирование |
488 | mov al, 0xf6 ; Сброс клавиатуры, разрешить сканирование |
Line 548... | Line 605... | ||
548 | end if |
605 | end if |
549 | .preboot_device_inited: |
606 | .preboot_device_inited: |
550 | ; following 4 lines set variables to 1 if its current value is 0 |
607 | ; following 4 lines set variables to 1 if its current value is 0 |
551 | cmp byte [di+preboot_dma-preboot_device], 1 |
608 | cmp byte [di+preboot_dma-preboot_device], 1 |
552 | adc byte [di+preboot_dma-preboot_device], 0 |
609 | adc byte [di+preboot_dma-preboot_device], 0 |
553 | cmp byte [di+preboot_biosdisk-preboot_device], 1 |
610 | ; cmp byte [di+preboot_biosdisk-preboot_device], 1 |
554 | adc byte [di+preboot_biosdisk-preboot_device], 0 |
611 | ; adc byte [di+preboot_biosdisk-preboot_device], 0 |
555 | ;; default value for VRR is OFF |
612 | ;; default value for VRR is OFF |
556 | ; cmp byte [di+preboot_vrrm-preboot_device], 0 |
613 | ; cmp byte [di+preboot_vrrm-preboot_device], 0 |
557 | ; jnz @f |
614 | ; jnz @f |
558 | ; mov byte [di+preboot_vrrm-preboot_device], 2 |
615 | ; mov byte [di+preboot_vrrm-preboot_device], 2 |
559 | ;@@: |
616 | ;@@: |