Subversion Repositories Kolibri OS

Rev

Rev 103 | Rev 140 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 103 Rev 134
Line 148... Line 148...
148
    stosd
148
    stosd
149
    add    eax, 1000h
149
    add    eax, 1000h
150
    loop    @b
150
    loop    @b
151
    ret
151
    ret
Line -... Line 152...
-
 
152
 
-
 
153
boot_read_floppy:
-
 
154
        push    si
-
 
155
        xor     si, si
-
 
156
        mov     ah, 2   ; read
-
 
157
@@:
-
 
158
        push    ax
-
 
159
        int     0x13
-
 
160
        pop     ax
-
 
161
        jnc     @f
-
 
162
        inc     si
-
 
163
        cmp     si, 10
-
 
164
        jb      @b
-
 
165
        mov     si, badsect-0x10000
-
 
166
sayerr_plain:
-
 
167
        call    printplain
-
 
168
        jmp     $
-
 
169
@@:
-
 
170
        pop     si
-
 
171
        ret
152
 
172
 
153
; 16-bit data
173
; 16-bit data
154
; videomodes table
174
; videomodes table
155
		org $+0x10000
175
		org $+0x10000
156
gr_table:
176
gr_table:
Line 208... Line 228...
208
 
228
 
209
; set videomode
229
; set videomode
210
    mov    ax, 3
230
    mov    ax, 3
Line -... Line 231...
-
 
231
        int  0x10
211
        int  0x10
232
 
212
 
233
if lang eq ru
213
 ; Load & set russian VGA font (RU.INC)
234
 ; Load & set russian VGA font (RU.INC)
214
        mov  bp,RU_FNT1-10000h   ; RU_FNT1 - First part
235
        mov  bp,RU_FNT1-10000h   ; RU_FNT1 - First part
215
          mov  bx,1000h            ; 768 bytes
236
          mov  bx,1000h            ; 768 bytes
Line 223... Line 244...
223
        mov  cx,20h              ; 32 symbols
244
        mov  cx,20h              ; 32 symbols
224
        mov  dx,0E0h             ; 224 - position of first symbol
245
        mov  dx,0E0h             ; 224 - position of first symbol
225
        mov  ax,1100h
246
        mov  ax,1100h
226
          int  10h
247
          int  10h
227
 ; End set VGA russian font
248
 ; End set VGA russian font
-
 
249
end if
Line 228... Line 250...
228
 
250
 
229
; draw frames
251
; draw frames
230
    push    0xb800
252
    push    0xb800
231
    pop    es
253
    pop    es
Line 958... Line 980...
958
        mov     si,diskload-0x10000
980
        mov     si,diskload-0x10000
959
        call    print
981
        call    print
960
        xor    ax, ax            ; reset drive
982
        xor    ax, ax            ; reset drive
961
        xor    dx, dx
983
        xor    dx, dx
962
        int     0x13
984
        int     0x13
-
 
985
; now load floppy image to memory
-
 
986
; at first load boot sector and first FAT table
963
        mov     cx,0x0001               ; startcyl,startsector
987
        mov     cx, 0x0001      ; startcyl,startsector
964
        xor    dx, dx            ; starthead,drive
988
        xor     dx, dx          ; starthead,drive
965
        push    word 80*2               ; read no of sect
989
        mov     al, 1+9         ; no of sectors to read
966
       reads:
-
 
967
        pusha
-
 
968
        xor     si,si
-
 
969
       newread:
-
 
970
        mov     bx,0xa000               ; es:bx -> data area
990
        mov     bx, 0xB000      ; es:bx -> data area
971
        mov     ax,0x0200+18            ; read, no of sectors to read
-
 
972
        int     0x13
-
 
973
        test    ah, ah
-
 
974
        jz      goodread
991
        call    boot_read_floppy
975
        inc    si
-
 
976
        cmp     si,10
-
 
977
        jnz     newread
-
 
978
        mov     si,badsect-0x10000
992
; and copy them to extended memory
979
sayerr_plain:
-
 
980
        call    printplain
-
 
981
        jmp     $
-
 
982
       goodread:
-
 
983
        ; move -> 1mb
-
 
984
        mov     si,movedesc-0x10000
993
        mov     si, movedesc-0x10000
-
 
994
        mov     [si+8*2+3], bh
985
        push    es
995
        push    es
986
        push    ds
996
        push    ds
987
        pop     es
997
        pop     es
988
        mov     cx,256*18
998
        mov     cx, 256*10
989
        mov     ah,0x87
999
        mov     ah, 0x87
990
        int     0x15
1000
        int     0x15
991
        pop    es
1001
        test    ah, ah
992
 
-
 
993
        test    ah,ah                  ; was the move successfull ?
-
 
994
        je      goodmove
1002
        jz      @f
-
 
1003
sayerr_floppy:
995
        mov     dx,0x3f2              ; floppy motor off
1004
        mov     dx, 0x3f2
996
        mov     al,0
1005
        mov     al, 0
997
        out     dx,al
1006
        out     dx, al
998
        mov     si,memmovefailed-0x10000
1007
        mov     si, memmovefailed-0x10000
999
        jmp    sayerr_plain
1008
        jmp     sayerr_plain
-
 
1009
@@:
-
 
1010
        add     dword [si+8*3+2], 512*10
-
 
1011
; copy FAT to second copy
-
 
1012
        mov     byte [si+8*2+3], 0xB2
-
 
1013
        mov     cx, 256*9
-
 
1014
        mov     ah, 0x87
-
 
1015
        int     0x15
1000
      goodmove:
1016
        pop     es
-
 
1017
        test    ah, ah
-
 
1018
        jnz     sayerr_floppy
-
 
1019
        add     dword [si+8*3+2], 512*9
-
 
1020
; calculate total number of sectors to read
-
 
1021
        mov     ax, 1+9+14      ; boot+FAT+root
-
 
1022
        mov     di, 0xB203
-
 
1023
.calc_loop:
-
 
1024
        test    word [es:di], 0xFFF
-
 
1025
        jz      @f
-
 
1026
        inc     ax
-
 
1027
@@:
-
 
1028
        test    word [es:di+1], 0xFFF0
-
 
1029
        jz      @f
-
 
1030
        inc     ax
1001
 
1031
@@:
-
 
1032
        add     di, 3
-
 
1033
        cmp     di, 0xB200+1440*3
-
 
1034
        jb      .calc_loop
-
 
1035
        push    ax
-
 
1036
        mov     bp, 1+9         ; already read sectors
-
 
1037
; now read rest
-
 
1038
        mov     byte [si+8*2+3], 0xA0
-
 
1039
        mov     di, 2-14        ; absolute sector-31
-
 
1040
        mov     cx, 0x0002      ; cylinder=0, sector=2
-
 
1041
        mov     dx, 0x0100      ; head=1, disk=0
-
 
1042
.read_loop:
-
 
1043
; determine whether sector must be read
-
 
1044
        cmp     di, 2
-
 
1045
        jl      .read
-
 
1046
        mov     bx, di
-
 
1047
        shr     bx, 1
-
 
1048
        jnc     .even
1002
    add    dword [movedesc-0x10000+0x18+2], 512*18
1049
        test    word [es:bx+di+0xB200], 0xFFF0
-
 
1050
        jmp     @f
-
 
1051
.even:
-
 
1052
        test    word [es:bx+di+0xB200], 0xFFF
-
 
1053
@@:
-
 
1054
        jz      .skip
-
 
1055
.read:
-
 
1056
        mov     bx, 0xA000
-
 
1057
        mov     al, 1           ; 1 sector
-
 
1058
        call    boot_read_floppy
-
 
1059
        inc     bp
-
 
1060
        push    es
-
 
1061
        push    ds
-
 
1062
        pop     es
-
 
1063
        pusha
-
 
1064
        mov     cx, 256
-
 
1065
        mov     ah, 0x87
-
 
1066
        int     0x15
-
 
1067
        test    ah, ah
1003
        popa
1068
        popa
-
 
1069
        pop     es
-
 
1070
        jnz     sayerr_floppy
-
 
1071
.skip:
-
 
1072
        add     dword [si+8*3+2], 512
-
 
1073
        inc     cx
-
 
1074
        cmp     cl, 19
-
 
1075
        jnz     @f
-
 
1076
        mov     cl, 1
1004
        inc     dh
1077
        inc     dh
1005
        cmp     dh,2
1078
        cmp     dh, 2
1006
        jnz     bb2
1079
        jnz     @f
1007
        mov     dh,0
1080
        mov     dh, 0
1008
        inc     ch
1081
        inc     ch
1009
        pusha                        ; print prosentage
-
 
1010
        mov     si,pros-0x10000
-
 
1011
    shr    ch, 2
-
 
1012
    mov    al, '5'
-
 
1013
    test    ch, 1
-
 
1014
    jnz    @f
-
 
1015
    mov    al, '0'
-
 
1016
@@:
1082
@@:
1017
    mov    [si+1], al
-
 
1018
    shr    ch, 1
-
 
1019
    add    ch, '0'
-
 
1020
    mov    [si], ch
-
 
1021
        call    printplain
-
 
1022
        popa
-
 
1023
       bb2:
-
 
1024
        pop     ax
1083
        pop     ax
1025
        dec     ax
-
 
1026
        push    ax
1084
        push    ax
-
 
1085
        pusha
-
 
1086
; draw percentage
-
 
1087
; total sectors: ax
-
 
1088
; read sectors: bp
-
 
1089
        xchg    ax, bp
-
 
1090
        mov     cx, 100
-
 
1091
        mul     cx
-
 
1092
        div     bp
-
 
1093
        aam
-
 
1094
        xchg    al, ah
-
 
1095
        add     ax, '00'
-
 
1096
        mov     si, pros-0x10000
-
 
1097
        cmp     [si], ax
-
 
1098
        jz      @f
-
 
1099
        mov     [si], ax
-
 
1100
        call    printplain
-
 
1101
@@:
-
 
1102
        popa
-
 
1103
        inc     di
-
 
1104
        cmp     di, 2880-31
-
 
1105
        jnz     .read_loop
-
 
1106
 
-
 
1107
;        mov     cx, 0x0001      ; startcyl,startsector
-
 
1108
;        xor     dx, dx          ; starthead,drive
-
 
1109
;        push    word 80*2               ; read no of sect
-
 
1110
;       reads:
-
 
1111
;        pusha
-
 
1112
;        xor     si,si
-
 
1113
;       newread:
-
 
1114
;        mov     bx,0xa000               ; es:bx -> data area
-
 
1115
;        mov     ax,0x0200+18            ; read, no of sectors to read
-
 
1116
;        int     0x13
-
 
1117
;        test    ah, ah
-
 
1118
;        jz      goodread
-
 
1119
;        inc    si
-
 
1120
;        cmp     si,10
-
 
1121
;        jnz     newread
-
 
1122
;        mov     si,badsect-0x10000
-
 
1123
;sayerr_plain:
-
 
1124
;        call    printplain
-
 
1125
;        jmp     $
-
 
1126
;       goodread:
-
 
1127
;        ; move -> 1mb
-
 
1128
;        mov     si,movedesc-0x10000
-
 
1129
;        push    es
-
 
1130
;        push    ds
-
 
1131
;        pop     es
-
 
1132
;        mov     cx,256*18
-
 
1133
;        mov     ah,0x87
-
 
1134
;        int     0x15
-
 
1135
;        pop    es
-
 
1136
;
-
 
1137
;        test    ah,ah                  ; was the move successfull ?
-
 
1138
;        je      goodmove
-
 
1139
;        mov     dx,0x3f2              ; floppy motor off
-
 
1140
;        mov     al,0
-
 
1141
;        out     dx,al
-
 
1142
;        mov     si,memmovefailed-0x10000
-
 
1143
;        jmp    sayerr_plain
-
 
1144
;      goodmove:
-
 
1145
;
-
 
1146
;    add    dword [movedesc-0x10000+0x18+2], 512*18
-
 
1147
;        popa
-
 
1148
;        inc     dh
-
 
1149
;        cmp     dh,2
-
 
1150
;        jnz     bb2
-
 
1151
;        mov     dh,0
-
 
1152
;        inc     ch
-
 
1153
;        pusha                        ; print prosentage
-
 
1154
;        mov     si,pros-0x10000
-
 
1155
;    shr    ch, 2
-
 
1156
;    mov    al, '5'
-
 
1157
;    test    ch, 1
-
 
1158
;    jnz    @f
-
 
1159
;    mov    al, '0'
-
 
1160
;@@:
-
 
1161
;    mov    [si+1], al
-
 
1162
;    shr    ch, 1
-
 
1163
;    add    ch, '0'
-
 
1164
;    mov    [si], ch
-
 
1165
;        call    printplain
-
 
1166
;        popa
-
 
1167
;       bb2:
-
 
1168
;        pop     ax
-
 
1169
;        dec     ax
-
 
1170
;        push    ax
1027
        jnz     reads
1171
;        jnz     reads
1028
       readdone:
1172
;       readdone:
1029
        pop     ax
1173
;        pop     ax
1030
        mov     si,backspace2-0x10000
1174
        mov     si,backspace2-0x10000
1031
        call    printplain
1175
        call    printplain
1032
        mov     si,okt-0x10000
1176
        mov     si,okt-0x10000
1033
        call    printplain
1177
        call    printplain
1034
       no_sys_on_floppy:
1178
       no_sys_on_floppy: