Rev 3777 | Rev 3797 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3777 | Rev 3796 | ||
---|---|---|---|
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: 3777 $ |
14 | $Revision: 3796 $ |
15 | 15 | ||
16 | 16 | ||
Line 45... | Line 45... | ||
45 | test al, al |
45 | test al, al |
46 | jnz @b |
46 | jnz @b |
47 | popa |
47 | popa |
48 | ret |
48 | ret |
Line 49... | Line -... | ||
49 | - | ||
- | 49 | ||
50 | getkey: |
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 |
54 | mov ah, 0 ; If 'int 16h' is called with 'ah' equal to zero, the BIOS will not return control |
55 | int 16h |
55 | int 16h ; to the caller until a key is available in the system type ahead buffer. On return, |
56 | cmp al, bl |
56 | cmp al, bl ; 'al' contains the ASCII code for the key read from the buffer and 'ah' contains |
57 | jb getkey |
57 | jb getkey ; the keyboard scan code. Here we compare 'al' with the range of accepted characters. |
58 | cmp al, bh |
58 | cmp al, bh ; If the key pressed is not in the range, continue waiting for another key. |
59 | ja getkey |
59 | ja getkey |
60 | push ax |
60 | push ax ; If the pressed key is in the accepted range, save it on the stack and echo to screen. |
61 | call putchar |
61 | call putchar |
62 | pop ax |
62 | pop ax |
63 | and ax, 0Fh |
63 | and ax, 0Fh ; ASCII code for '0' is 48 (110000b). 0F4=1111b. (110000b AND 1111b) = 0 |
64 | jnz @f |
64 | jnz @f ; So if key '0' was entered, return 10 in 'ax' |
65 | mov al, 10 |
65 | mov al, 10 |
66 | @@: |
66 | @@: |
Line 67... | Line 67... | ||
67 | ret |
67 | ret |
Line 777... | Line 777... | ||
777 | ; e) preboot_device = from where to boot? |
777 | ; e) preboot_device = from where to boot? |
778 | _setcursor 16,0 |
778 | _setcursor 16,0 |
779 | mov si, bdev |
779 | mov si, bdev |
780 | call print |
780 | call print |
781 | if defined extended_primary_loader |
781 | if defined extended_primary_loader |
782 | mov bx, '12' |
782 | mov bx, '12' ; range accepted for answer: 1-2 |
783 | else |
783 | else |
784 | mov bx, '14' |
784 | mov bx, '14' ; range accepted for answer: 1-4 |
785 | end if |
785 | end if |
786 | call getkey |
786 | call getkey |
787 | mov [preboot_device], al |
787 | mov [preboot_device], al |
788 | _setcursor 14,0 |
788 | _setcursor 14,0 |
789 | .d: |
789 | .d: |
Line 873... | Line 873... | ||
873 | 873 | ||
874 | .change_b: ; b) preboot_biosdisk = use BIOS disks through V86 emulation? |
874 | .change_b: ; b) preboot_biosdisk = use BIOS disks through V86 emulation? |
875 | _setcursor 16,0 |
875 | _setcursor 16,0 |
876 | ; mov si, ask_dma // (earlier was: preboot_dma = use DMA access?) |
876 | ; mov si, ask_dma // (earlier was: preboot_dma = use DMA access?) |
877 | ; call print |
877 | ; call print |
878 | ; mov bx, '13' |
878 | ; mov bx, '13' ; range accepted for answer: 1-3 |
879 | ; call getkey |
879 | ; call getkey |
880 | ; mov [preboot_dma], al |
880 | ; mov [preboot_dma], al |
881 | mov si, ask_bd |
881 | mov si, ask_bd |
882 | call print |
882 | call print |
883 | mov bx, '12' |
883 | mov bx, '12' ; range accepted for answer: 1-2 |
884 | call getkey |
884 | call getkey |
885 | mov [preboot_biosdisk], al |
885 | mov [preboot_biosdisk], al |
886 | _setcursor 11,0 |
886 | _setcursor 11,0 |
887 | jmp .d |
887 | jmp .d |
888 | ;.change_c: ; // VRR is an obsolete functionality, used only with CRT monitors |
888 | ;.change_c: ; // VRR is an obsolete functionality, used only with CRT monitors |
889 | ; _setcursor 16,0 |
889 | ; _setcursor 16,0 |
890 | ; mov si, vrrmprint |
890 | ; mov si, vrrmprint |
891 | ; call print |
891 | ; call print |
892 | ; mov bx, '12' |
892 | ; mov bx, '12' ; range accepted for answer: 1-2 |
893 | ; call getkey |
893 | ; call getkey |
894 | ; mov [preboot_vrrm], al |
894 | ; mov [preboot_vrrm], al |
895 | ; _setcursor 12,0 |
895 | ; _setcursor 12,0 |
896 | ; jmp .d |
896 | ; jmp .d |
897 | .change_c: ; c) preboot_debug = duplicates kernel debug output to the screen |
897 | .change_c: ; c) preboot_debug = duplicates kernel debug output to the screen |
898 | _setcursor 16,0 |
898 | _setcursor 16,0 |
899 | mov si, ask_debug |
899 | mov si, ask_debug |
900 | call print |
900 | call print |
901 | mov bx, '12' |
901 | mov bx, '12' ; range accepted for answer: 1-2 |
902 | call getkey |
902 | call getkey |
903 | mov [preboot_debug], al |
903 | mov [preboot_debug], al |
904 | _setcursor 12,0 |
904 | _setcursor 12,0 |
905 | jmp .d |
905 | jmp .d |
906 | .change_d: ; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? |
906 | .change_d: ; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? |
907 | _setcursor 16,0 |
907 | _setcursor 16,0 |
908 | mov si, ask_launcher |
908 | mov si, ask_launcher |
909 | call print |
909 | call print |
910 | mov bx, '12' |
910 | mov bx, '12' ; range accepted for answer: 1-2 |
911 | call getkey |
911 | call getkey |
912 | mov [preboot_launcher], al |
912 | mov [preboot_launcher], al |
913 | _setcursor 13,0 |
913 | _setcursor 13,0 |
914 | jmp .d |
914 | jmp .d |