Rev 3964 | Rev 3999 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3964 | Rev 3989 | ||
---|---|---|---|
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: 3964 $ |
14 | $Revision: 3989 $ |
15 | 15 | ||
16 | 16 | ||
Line 49... | Line 49... | ||
49 | 49 | ||
50 | getkey: ; Use BIOS INT 16h to read a key from the keyboard |
50 | getkey: ; Use BIOS INT 16h to read a key from the keyboard |
51 | ; get number in range [bl,bh] (bl,bh in ['0'..'9']) |
51 | ; get number in range [bl,bh] (bl,bh in ['0'..'9']) |
52 | ; in: bx=range |
52 | ; in: bx=range |
53 | ; out: ax=digit (1..9, 10 for 0) |
53 | ; out: ax=digit (1..9, 10 for 0) |
54 | mov ah, 0 ; If 'int 16h' is called with 'ah' equal to zero, the BIOS will not return control |
54 | mov ah, 0 ; If 'int 16h' is called with 'ah' equal to zero, the BIOS will not return control to the caller |
55 | int 16h ; to the caller until a key is available in the system type ahead buffer. On return, |
55 | int 16h ; until a key is available in the system type ahead buffer. On return, 'al' contains the ASCII |
- | 56 | cmp al, 27 ; code for the key read from the buffer and 'ah' contains the keyboard scan code. (27=>ESC) |
|
56 | cmp al, bl ; 'al' contains the ASCII code for the key read from the buffer and 'ah' contains |
57 | jz @f ; If ESC is pressed, return (user doesn't want to change any value). |
57 | jb getkey ; the keyboard scan code. Here we compare 'al' with the range of accepted characters. |
58 | cmp al, bl ; Compare 'al' (ASCII code of key pressed) with 'bl' (lowest accepted char from the range). |
- | 59 | jb getkey ; ASCII code is below lowest accepted value => continue waiting for another key. |
|
58 | cmp al, bh ; If the key pressed is not in the range, continue waiting for another key. |
60 | cmp al, bh ; Compare 'al' (ASCII code of key pressed) with 'bh' (highest accepted char from the range). |
59 | ja getkey |
61 | ja getkey ; ASCII code is above highest accepted value => continue waiting for another key. |
60 | push ax ; If the pressed key is in the accepted range, save it on the stack and echo to screen. |
62 | push ax ; If the pressed key is in the accepted range, save it on the stack and echo to screen. |
61 | call putchar |
63 | call putchar |
- | 64 | pop ax |
|
62 | pop ax |
65 | and ax, 0Fh ; Convert ASCII code to number: '1'->1, '2'->2, etc. 0Fh=1111b. |
63 | and ax, 0Fh ; ASCII code for '0' is 48 (110000b). 0F4=1111b. (110000b AND 1111b) = 0 |
66 | jnz @f ; ASCII code for '0' is 48 (110000b). (110000b AND 1111b) = 0 |
64 | jnz @f ; So if key '0' was entered, return 10 in 'ax' |
- | |
65 | mov al, 10 |
67 | mov al, 10 ; So if key '0' was entered, return 10 in 'ax' |
66 | @@: |
68 | @@: |
Line 67... | Line 69... | ||
67 | ret |
69 | ret |
68 | 70 | ||
Line 77... | Line 79... | ||
77 | { |
79 | { |
78 | mov dx, row*256 + column |
80 | mov dx, row*256 + column |
79 | call setcursor |
81 | call setcursor |
80 | } |
82 | } |
Line -... | Line 83... | ||
- | 83 | ||
- | 84 | macro _ask_question question,range,variable_to_set |
|
- | 85 | { |
|
- | 86 | _setcursor 16,0 |
|
- | 87 | mov si, question ; Print the question |
|
- | 88 | call print |
|
- | 89 | mov bx, range ; range accepted for answer |
|
- | 90 | call getkey |
|
- | 91 | cmp al, 27 ; If ESC was pressed, do not change the value |
|
- | 92 | jz .esc_pressed |
|
- | 93 | mov [variable_to_set], al |
|
- | 94 | } |
|
81 | 95 | ||
82 | boot_read_floppy: |
96 | boot_read_floppy: |
83 | push si |
97 | push si |
84 | xor si, si |
98 | xor si, si |
85 | mov ah, 2 ; read |
99 | mov ah, 2 ; read |
Line 773... | Line 787... | ||
773 | cmp al, 'd' ; start launcher after kernel is loaded? |
787 | cmp al, 'd' ; start launcher after kernel is loaded? |
774 | jz .change_d |
788 | jz .change_d |
775 | cmp al, 'e' ; select boot origin |
789 | cmp al, 'e' ; select boot origin |
776 | jnz .show_remarks |
790 | jnz .show_remarks |
777 | ; e) preboot_device = from where to boot? |
791 | ; e) preboot_device = from where to boot? |
778 | _setcursor 16,0 |
- | |
779 | mov si, bdev |
- | |
780 | call print |
- | |
781 | if defined extended_primary_loader |
792 | if defined extended_primary_loader |
782 | mov bx, '12' ; range accepted for answer: 1-2 |
793 | _ask_question bdev,'12',preboot_device ; range accepted for answer: 1-2 |
783 | else |
794 | else |
784 | mov bx, '14' ; range accepted for answer: 1-4 |
795 | _ask_question bdev,'14',preboot_device ; range accepted for answer: 1-4 |
785 | end if |
796 | end if |
786 | call getkey |
- | |
787 | mov [preboot_device], al |
- | |
788 | _setcursor 14,0 |
797 | _setcursor 14,0 |
- | 798 | ||
789 | .d: |
799 | .d: |
790 | if ~ defined extended_primary_loader |
800 | if ~ defined extended_primary_loader |
791 | mov [.bSettingsChanged], 1 |
801 | mov [.bSettingsChanged], 1 |
792 | end if |
802 | end if |
- | 803 | .esc_pressed: |
|
793 | call clear_vmodes_table ;clear vmodes_table |
804 | call clear_vmodes_table ;clear vmodes_table |
794 | jmp .printcfg |
805 | jmp .printcfg |
- | 806 | ||
795 | .change_a: |
807 | .change_a: |
796 | call clear_vmodes_table ;clear vmodes_table |
808 | call clear_vmodes_table ;clear vmodes_table |
797 | .loops: |
809 | .loops: |
798 | call draw_vmodes_table |
810 | call draw_vmodes_table |
799 | _setcursor 25,0 ; out of screen |
811 | _setcursor 25,0 ; out of screen |
Line 801... | Line 813... | ||
801 | int 0x16 |
813 | int 0x16 |
802 | ; call clear_table_cursor ;clear current position of cursor |
814 | ; call clear_table_cursor ;clear current position of cursor |
Line 803... | Line 815... | ||
803 | 815 | ||
Line -... | Line 816... | ||
- | 816 | mov si, word [cursor_pos] |
|
- | 817 | ||
- | 818 | cmp al, 27 ; If ESC was pressed, do not change the value |
|
804 | mov si, word [cursor_pos] |
819 | jz .esc_pressed ; Just exit the resolution selection box |
805 | 820 | ||
806 | cmp ah, 0x48;x,0x48E0 ; up |
821 | cmp ah, 0x48;x,0x48E0 ; up |
807 | jne .down |
822 | jne .down |
808 | cmp si, modes_table |
823 | cmp si, modes_table |
Line 871... | Line 886... | ||
871 | mov word [preboot_graph], bp ;save choose |
886 | mov word [preboot_graph], bp ;save choose |
Line 872... | Line 887... | ||
872 | 887 | ||
Line 873... | Line 888... | ||
873 | jmp .d |
888 | jmp .d |
874 | 889 | ||
875 | .change_b: ; b) preboot_biosdisk = use BIOS disks through V86 emulation? |
890 | .change_b: ; b) preboot_biosdisk = use BIOS disks through V86 emulation? |
876 | _setcursor 16,0 |
891 | ; _setcursor 16,0 |
877 | ; mov si, ask_dma // (earlier was: preboot_dma = use DMA access?) |
892 | ; mov si, ask_dma // (earlier was: preboot_dma = use DMA access?) |
878 | ; call print |
893 | ; call print |
879 | ; mov bx, '13' ; range accepted for answer: 1-3 |
894 | ; mov bx, '13' ; range accepted for answer: 1-3 |
880 | ; call getkey |
- | |
881 | ; mov [preboot_dma], al |
- | |
882 | mov si, ask_bd |
895 | ; call getkey |
883 | call print |
- | |
884 | mov bx, '12' ; range accepted for answer: 1-2 |
- | |
885 | call getkey |
896 | ; mov [preboot_dma], al |
886 | mov [preboot_biosdisk], al |
897 | _ask_question ask_bd,'12',preboot_biosdisk ; range accepted for answer: 1-2 |
887 | _setcursor 11,0 |
898 | _setcursor 11,0 |
888 | jmp .d |
899 | jmp .d |
889 | ;.change_c: ; // VRR is an obsolete functionality, used only with CRT monitors |
900 | ;.change_c: ; // VRR is an obsolete functionality, used only with CRT monitors |
Line 894... | Line 905... | ||
894 | ; call getkey |
905 | ; call getkey |
895 | ; mov [preboot_vrrm], al |
906 | ; mov [preboot_vrrm], al |
896 | ; _setcursor 12,0 |
907 | ; _setcursor 12,0 |
897 | ; jmp .d |
908 | ; jmp .d |
898 | .change_c: ; c) preboot_debug = duplicates kernel debug output to the screen |
909 | .change_c: ; c) preboot_debug = duplicates kernel debug output to the screen |
899 | _setcursor 16,0 |
- | |
900 | mov si, ask_debug |
- | |
901 | call print |
- | |
902 | mov bx, '12' ; range accepted for answer: 1-2 |
910 | _ask_question ask_debug,'12',preboot_debug ; range accepted for answer: 1-2 |
903 | call getkey |
- | |
904 | mov [preboot_debug], al |
- | |
905 | _setcursor 12,0 |
911 | _setcursor 12,0 |
906 | jmp .d |
912 | jmp .d |
907 | .change_d: ; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? |
913 | .change_d: ; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? |
908 | _setcursor 16,0 |
- | |
909 | mov si, ask_launcher |
- | |
910 | call print |
- | |
911 | mov bx, '12' ; range accepted for answer: 1-2 |
914 | _ask_question ask_launcher,'12',preboot_launcher ; range accepted for answer: 1-2 |
912 | call getkey |
- | |
913 | mov [preboot_launcher], al |
- | |
914 | _setcursor 13,0 |
915 | _setcursor 13,0 |
915 | jmp .d |
916 | jmp .d |
916 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
917 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
917 | .say_on_off: |
918 | .say_on_off: |
918 | pushf |
919 | pushf |