Subversion Repositories Kolibri OS

Rev

Rev 9958 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9958 Rev 10051
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
7
;;  BOOTCODE.INC                                                ;;
7
;;  BOOTCODE.INC                                                ;;
8
;;                                                              ;;
8
;;                                                              ;;
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
 
-
 
14
$Revision: 9958 $
-
 
Line 15... Line 13...
15
 
13
 
16
 
14
 
17
;==========================================================================
15
;==========================================================================
18
;
16
;
Line 803... Line 801...
803
        push    word [es:bp+2]
801
        push    word [es:bp+2]
804
        pop     word [y_save]
802
        pop     word [y_save]
805
        push    word [es:bp+6]
803
        push    word [es:bp+6]
806
        pop     word [number_vm]
804
        pop     word [number_vm]
807
        mov     word [preboot_graph], bp          ;save choose
805
        mov     word [preboot_graph], bp          ;save choose
808
        
806
 
809
        jmp     .d
807
        jmp     .d
Line 810... Line 808...
810
 
808
 
811
.change_b:                      ; b) preboot_biosdisk  = use BIOS disks through V86 emulation?
809
.change_b:                      ; b) preboot_biosdisk  = use BIOS disks through V86 emulation?
812
;        _setcursor 16,0
810
;        _setcursor 16,0
Line 1010... Line 1008...
1010
        mov     al, [preboot_debug]
1008
        mov     al, [preboot_debug]
1011
        mov     [es:BOOT_LO.debug_print], al       ;// 0x901E
1009
        mov     [es:BOOT_LO.debug_print], al       ;// 0x901E
Line 1012... Line 1010...
1012
 
1010
 
1013
; Start the first app (right now it's LAUNCHER) after kernel is loaded?
1011
; Start the first app (right now it's LAUNCHER) after kernel is loaded?
1014
        mov     al, [preboot_launcher]
1012
        mov     al, [preboot_launcher]
Line 1015... Line 1013...
1015
        mov     [es:BOOT_LO.launcher_start], al    ;// 0x901D        
1013
        mov     [es:BOOT_LO.launcher_start], al    ;// 0x901D
Line 1016... Line 1014...
1016
 
1014
 
1017
; BOOT DEVICE
1015
; BOOT DEVICE
Line 1166... Line 1164...
1166
        mov     bx, 0xB000
1164
        mov     bx, 0xB000
Line 1167... Line 1165...
1167
 
1165
 
1168
; and copy them to extended memory
1166
; and copy them to extended memory
1169
        mov     si, movedesc
1167
        mov     si, movedesc
1170
        mov     [si+8*2+3], bh          ; from
1168
        mov     [si+8*2+3], bh          ; from
1171
        
1169
 
1172
        mov     ax, word [BPB_BytsPerSec]
1170
        mov     ax, word [BPB_BytsPerSec]
1173
        shr     ax, 1                   ; words per sector
1171
        shr     ax, 1                   ; words per sector
1174
        mov     cx, word [BPB_RsvdSecCnt]
1172
        mov     cx, word [BPB_RsvdSecCnt]
1175
        add     cx, word [BPB_FATSz16]
1173
        add     cx, word [BPB_FATSz16]
1176
        mul     cx
1174
        mul     cx
1177
        push    ax                      ; save to stack count of words in boot+FAT
1175
        push    ax                      ; save to stack count of words in boot+FAT
1178
        xchg    ax, cx
1176
        xchg    ax, cx
1179
        
1177
 
1180
        push    es
1178
        push    es
1181
        push    ds
1179
        push    ds
1182
        pop     es
1180
        pop     es
1183
        mov     ah, 0x87
1181
        mov     ah, 0x87
Line 1200... Line 1198...
1200
 
1198
 
1201
; copy first FAT to second copy
1199
; copy first FAT to second copy
1202
; TODO: BPB_NumFATs !!!!!
1200
; TODO: BPB_NumFATs !!!!!
1203
        add     bx, word [BPB_BytsPerSec]       ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
1201
        add     bx, word [BPB_BytsPerSec]       ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
1204
        mov     byte [si+8*2+3], bh     ; bx - begin of FAT
1202
        mov     byte [si+8*2+3], bh     ; bx - begin of FAT
1205
        
1203
 
1206
        mov     ax, word [BPB_BytsPerSec]
1204
        mov     ax, word [BPB_BytsPerSec]
1207
        shr     ax, 1                   ; words per sector
1205
        shr     ax, 1                   ; words per sector
1208
        mov     cx, word [BPB_FATSz16]
1206
        mov     cx, word [BPB_FATSz16]
1209
        mul     cx
1207
        mul     cx
Line 1215... Line 1213...
1215
        mov     ah, 0x87
1213
        mov     ah, 0x87
1216
        int     0x15
1214
        int     0x15
1217
        pop     es
1215
        pop     es
1218
        test    ah, ah
1216
        test    ah, ah
1219
        jnz     sayerr_floppy
1217
        jnz     sayerr_floppy
1220
        
1218
 
1221
        mov     ax, cx
1219
        mov     ax, cx
1222
        shl     ax, 1
1220
        shl     ax, 1
1223
        and     eax, 0ffffh             ; ax - count of bytes in FAT
1221
        and     eax, 0ffffh             ; ax - count of bytes in FAT
1224
        add     dword [si+8*3+2], eax
1222
        add     dword [si+8*3+2], eax
1225
        
1223
 
1226
; reading RootDir
1224
; reading RootDir
1227
; TODO: BPB_NumFATs
1225
; TODO: BPB_NumFATs
1228
        add     bx, ax
1226
        add     bx, ax
1229
        add     bx, 100h
1227
        add     bx, 100h
1230
        and     bx, 0ff00h                      ; bx - place in buffer to write RootDir
1228
        and     bx, 0ff00h                      ; bx - place in buffer to write RootDir
Line 1245... Line 1243...
1245
 
1243
 
1246
        mov     word [FirstDataSector], ax
1244
        mov     word [FirstDataSector], ax
1247
        pop     bx
1245
        pop     bx
1248
        push    bx
1246
        push    bx
1249
        add     word [FirstDataSector], bx      ; Begin of data region of floppy
1247
        add     word [FirstDataSector], bx      ; Begin of data region of floppy
1250
        
1248
 
1251
; read RootDir
1249
; read RootDir
1252
        call    conv_abs_to_THS
1250
        call    conv_abs_to_THS
1253
        pop     ax
1251
        pop     ax
1254
        pop     bx                              ; place in buffer to write
1252
        pop     bx                              ; place in buffer to write