Subversion Repositories Kolibri OS

Rev

Rev 2288 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2288 Rev 3539
1
; Copyright (c) 2008-2009, 
1
; Copyright (c) 2008-2009, 
2
; All rights reserved.
2
; All rights reserved.
3
;
3
;
4
; Redistribution and use in source and binary forms, with or without
4
; Redistribution and use in source and binary forms, with or without
5
; modification, are permitted provided that the following conditions are met:
5
; modification, are permitted provided that the following conditions are met:
6
;       * Redistributions of source code must retain the above copyright
6
;       * Redistributions of source code must retain the above copyright
7
;       notice, this list of conditions and the following disclaimer.
7
;       notice, this list of conditions and the following disclaimer.
8
;       * Redistributions in binary form must reproduce the above copyright
8
;       * Redistributions in binary form must reproduce the above copyright
9
;       notice, this list of conditions and the following disclaimer in the
9
;       notice, this list of conditions and the following disclaimer in the
10
;       documentation and/or other materials provided with the distribution.
10
;       documentation and/or other materials provided with the distribution.
11
;       * Neither the name of the  nor the
11
;       * Neither the name of the  nor the
12
;       names of its contributors may be used to endorse or promote products
12
;       names of its contributors may be used to endorse or promote products
13
;       derived from this software without specific prior written permission.
13
;       derived from this software without specific prior written permission.
14
;
14
;
15
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname  ''AS IS'' AND ANY
15
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname  ''AS IS'' AND ANY
16
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
18
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
19
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
;*****************************************************************************
25
;*****************************************************************************
26
 
26
 
27
;start of the project 13.02.2008 year.
27
;start of the project 13.02.2008 year.
28
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
;Secondary Loader copyright Alexey Teplov nickname 
29
;Secondary Loader copyright Alexey Teplov nickname 
30
;if you need log preproc
30
;if you need log preproc
31
;/////////////
31
;/////////////
32
;include 'listing.inc'
32
;include 'listing.inc'
33
;enable listing
33
;enable listing
34
;////////////
34
;////////////
35
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
36
;start of code:                                                               ;
36
;start of code:                                                               ;
37
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38
use16
38
use16
39
                  org   0x0
39
                  org   0x0
40
        jmp     start
40
        jmp     start
41
include 'sl_equ.inc'            ; â ôàéëå ðàçìåùåíû âñå equ ïðåäîïðåäåëåíèÿ
41
include 'sl_equ.inc'            ; в файле размещены все equ предопределения
42
include 'boot_st.inc'
42
include 'boot_st.inc'
43
include 'debug_msg.inc'         ;here is message from debug
43
include 'debug_msg.inc'         ;here is message from debug
44
include 'parse_dat.inc'
44
include 'parse_dat.inc'
45
include 'sl_proc.inc'
45
include 'sl_proc.inc'
46
include 'parse.inc'
46
include 'parse.inc'
47
include 'parse_loader.inc'
47
include 'parse_loader.inc'
48
include 'parse_any.inc'
48
include 'parse_any.inc'
49
include 'parse_def_sect.inc'
49
include 'parse_def_sect.inc'
50
include 'parse_err.inc'
50
include 'parse_err.inc'
51
 
51
 
52
file_data  dw 0x0,ini_data_  ;ôîðìàò: ñìåùåíèå: ñåãìåíò ò.ê. èñïîëüçóåòñÿ les
52
file_data  dw 0x0,ini_data_  ;формат: смещение: сегмент т.к. используется les
53
size_data  dw 16 ;16 áëîêîâ ïî 4 êá ò.å ïðåäåë äî 64 êá
53
size_data  dw 16 ;16 блоков по 4 кб т.е предел до 64 кб
54
name_ini_f db 'kord/startos.ini',0 
54
name_ini_f db 'kord/startos.ini',0 
55
 
55
 
56
;////////////
56
;////////////
57
loader_callback dd ?
57
loader_callback dd ?
58
load_drive dw ?
58
load_drive dw ?
59
load_ft    dw ?
59
load_ft    dw ?
60
;Start code
60
;Start code
61
 
61
 
62
start:
62
start:
63
; Save far pointer to callback procedure, ds:si is point
63
; Save far pointer to callback procedure, ds:si is point
64
        mov     word [cs:loader_callback], si
64
        mov     word [cs:loader_callback], si
65
        mov     word [cs:loader_callback+2], ds
65
        mov     word [cs:loader_callback+2], ds
66
; Save type of drive
66
; Save type of drive
67
        mov     word [cs:load_drive], ax
67
        mov     word [cs:load_drive], ax
68
; Save type of FT
68
; Save type of FT
69
        mov     word [cs:load_ft], bx
69
        mov     word [cs:load_ft], bx
70
; set up stack
70
; set up stack
71
        mov     ax, cs
71
        mov     ax, cs
72
        mov     ss, ax
72
        mov     ss, ax
73
        xor     sp, sp
73
        xor     sp, sp
74
; set up segment registers
74
; set up segment registers
75
        mov     ds, ax
75
        mov     ds, ax
76
        mov     es, ax
76
        mov     es, ax
77
; just to be sure: force DF=0, IF=1
77
; just to be sure: force DF=0, IF=1
78
        cld
78
        cld
79
        sti
79
        sti
80
 
80
 
81
; set videomode
81
; set videomode
82
        mov     ax, 3
82
        mov     ax, 3
83
        int     0x10
83
        int     0x10
84
 
84
 
85
        mov     si, version
85
        mov     si, version
86
        call    printplain
86
        call    printplain
87
        mov     al, '#'
87
        mov     al, '#'
88
        mov     cx, 80
88
        mov     cx, 80
89
;input cx=size al=char áóäåò âûâäåí ñèìâîë ñêîëüêî ðàç óêàçàíî â cx
89
;input cx=size al=char будет вывден символ сколько раз указано в cx
90
@@:
90
@@:
91
        call    putchar
91
        call    putchar
92
        loop    @b
92
        loop    @b
93
 
93
 
94
  if DEBUG
94
  if DEBUG
95
        pushad
95
        pushad
96
        mov     ax, cs
96
        mov     ax, cs
97
        shl     eax, 4  ; â äåñÿòè÷íîé ñèñòåìå  àäðåñ ñåãìåíòà
97
        shl     eax, 4  ; в десятичной системе  адрес сегмента
98
        mov     cx, 0xa
98
        mov     cx, 0xa
99
        mov     di, cseg_msg
99
        mov     di, cseg_msg
100
        call    decode
100
        call    decode
101
;***************
101
;***************
102
        mov     si, cseg_msg
102
        mov     si, cseg_msg
103
        call    printplain
103
        call    printplain
104
        popad
104
        popad
105
  end if
105
  end if
106
 
106
 
107
 
107
 
108
  if DEBUG
108
  if DEBUG
109
        mov     si, stack_msg
109
        mov     si, stack_msg
110
        call    printplain
110
        call    printplain
111
  end if
111
  end if
112
 
112
 
113
; Require 586 or higher processor (cpuid and rdtsc,rdmsr/wrmsr commands)
113
; Require 586 or higher processor (cpuid and rdtsc,rdmsr/wrmsr commands)
114
; install int 6 (#UD) handler
114
; install int 6 (#UD) handler
115
        xor     bx, bx
115
        xor     bx, bx
116
        mov     ds, bx
116
        mov     ds, bx
117
        push    word [bx+6*4+2]
117
        push    word [bx+6*4+2]
118
        push    word [bx+6*4]
118
        push    word [bx+6*4]
119
        mov     word [bx+6*4], ud16
119
        mov     word [bx+6*4], ud16
120
        mov     word [bx+6*4+2], cs
120
        mov     word [bx+6*4+2], cs
121
; issue CPUID command
121
; issue CPUID command
122
        xor     eax, eax        ; N.B.: will cause #UD before 386
122
        xor     eax, eax        ; N.B.: will cause #UD before 386
123
        cpuid                   ; N.B.: will cause #UD before later 486s
123
        cpuid                   ; N.B.: will cause #UD before later 486s
124
        test    eax, eax
124
        test    eax, eax
125
        jz      cpubad
125
        jz      cpubad
126
; get processor features
126
; get processor features
127
        xor     eax, eax
127
        xor     eax, eax
128
        inc     ax
128
        inc     ax
129
        cpuid
129
        cpuid
130
        test    dl, 10h         ; CPUID[1].edx[4] - TSC support
130
        test    dl, 10h         ; CPUID[1].edx[4] - TSC support
131
        jz      cpubad
131
        jz      cpubad
132
        test    dl, 20h         ; CPUID[1].edx[5] - MSR support
132
        test    dl, 20h         ; CPUID[1].edx[5] - MSR support
133
        jnz     cpugood
133
        jnz     cpugood
134
 
134
 
135
ud16:   ; #UD handler, called if processor did not recognize some commands
135
ud16:   ; #UD handler, called if processor did not recognize some commands
136
cpubad:
136
cpubad:
137
; restore int 6 (#UD) handler
137
; restore int 6 (#UD) handler
138
        pop     word [6*4]
138
        pop     word [6*4]
139
        pop     word [6*4+2]
139
        pop     word [6*4+2]
140
; say error
140
; say error
141
        push    cs
141
        push    cs
142
        pop     ds
142
        pop     ds
143
        mov     si, badprocessor
143
        mov     si, badprocessor
144
sayerr:
144
sayerr:
145
        call    printplain
145
        call    printplain
146
        jmp     $
146
        jmp     $
147
 
147
 
148
cpugood:
148
cpugood:
149
; restore int 6 (#UD) handler
149
; restore int 6 (#UD) handler
150
        pop     dword [6*4]
150
        pop     dword [6*4]
151
        push    cs
151
        push    cs
152
        pop     ds
152
        pop     ds
153
 
153
 
154
; set up esp
154
; set up esp
155
        movzx   esp, sp
155
        movzx   esp, sp
156
 
156
 
157
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
158
; init memory
158
; init memory
159
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
159
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
160
 
160
 
161
 
161
 
162
 
162
 
163
 
163
 
164
; Load  startos.ini
164
; Load  startos.ini
165
        mov     cx, loop_read_startos_file      ;êîë-âî ïîïûòîê ÷òåíèÿ ôàéëà êîíôèãóðàöèè startos.ini
165
        mov     cx, loop_read_startos_file      ;кол-во попыток чтения файла конфигурации startos.ini
166
align 4
166
align 4
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
168
;  Load startos.ini                                                           ;
168
;  Load startos.ini                                                           ;
169
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
169
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170
load_startos_file:
170
load_startos_file:
171
 
171
 
172
        xor     ax, ax
172
        xor     ax, ax
173
        mov     di, file_data
173
        mov     di, file_data
174
        inc     ax        ;function 1 - read file
174
        inc     ax        ;function 1 - read file
175
        push    cx
175
        push    cx
176
        call    far dword [loader_callback]
176
        call    far dword [loader_callback]
177
        pop     cx
177
        pop     cx
178
        push    cs
178
        push    cs
179
        push    cs
179
        push    cs
180
        pop     ds
180
        pop     ds
181
        pop     es
181
        pop     es
182
 
182
 
183
        test    bx, bx
183
        test    bx, bx
184
        jz      check_conf_file
184
        jz      check_conf_file
185
        dec     cx
185
        dec     cx
186
        jnz     load_startos_file
186
        jnz     load_startos_file
187
 
187
 
188
;SET DEFAULT Not use ini file 
188
;SET DEFAULT Not use ini file 
189
error_ini:
189
error_ini:
190
        mov     si, error_ini_f1    ;Error: cannot load ini file, buffer is full
190
        mov     si, error_ini_f1    ;Error: cannot load ini file, buffer is full
191
        dec     bx
191
        dec     bx
192
        jz      err_show_ini
192
        jz      err_show_ini
193
        mov     si, error_ini_f2    ;Error: ini file not found
193
        mov     si, error_ini_f2    ;Error: ini file not found
194
        dec     bx
194
        dec     bx
195
        jz      err_show_ini
195
        jz      err_show_ini
196
        mov     si, error_ini_f3    ;Error: cannot read ini file
196
        mov     si, error_ini_f3    ;Error: cannot read ini file
197
        dec     bx
197
        dec     bx
198
        jz      err_show_ini
198
        jz      err_show_ini
199
 
199
 
200
        mov     si, error_ini_nf    ;Error: unrecognized error when loading ini file
200
        mov     si, error_ini_nf    ;Error: unrecognized error when loading ini file
201
err_show_ini:
201
err_show_ini:
202
        call    printplain
202
        call    printplain
203
        mov     si, error_ini_common
203
        mov     si, error_ini_common
204
        call    printplain
204
        call    printplain
205
; wait for keypress
205
; wait for keypress
206
        xor     ax, ax
206
        xor     ax, ax
207
        int     16h
207
        int     16h
208
 
208
 
209
ini_loaded:
209
ini_loaded:
210
 
210
 
211
        jmp     $
211
        jmp     $
212
 
212
 
213
align 4
213
align 4
214
check_conf_file:
214
check_conf_file:
215
;Check config file in current dir
215
;Check config file in current dir
216
        push    ax      ;save size file
216
        push    ax      ;save size file
217
  if DEBUG
217
  if DEBUG
218
        mov     cx, 0x0a
218
        mov     cx, 0x0a
219
        mov     di, show_decode
219
        mov     di, show_decode
220
        call    decode
220
        call    decode
221
;Show size
221
;Show size
222
        mov     si, show_string
222
        mov     si, show_string
223
        call    printplain
223
        call    printplain
224
  end if
224
  end if
225
 
225
 
226
 
226
 
227
;Show message
227
;Show message
228
        mov     si, load_ini
228
        mov     si, load_ini
229
        call    printplain
229
        call    printplain
230
 
230
 
231
        pop     cx      ;restore size file
231
        pop     cx      ;restore size file
232
use_parse               ;parsing startos.ini
232
use_parse               ;parsing startos.ini
233
;
233
;
234
        jmp     ini_loaded
234
        jmp     ini_loaded
235
 
235
 
236
;;;;;;;;;;;;;;;;;;;;;;;;;;;
236
;;;;;;;;;;;;;;;;;;;;;;;;;;;
237
;DATA
237
;DATA
238
;;;;;;;;;;;;;;;;;;;;;;;;;;;
238
;;;;;;;;;;;;;;;;;;;;;;;;;;;
239
; table for move to extended memory (int 15h, ah=87h)
239
; table for move to extended memory (int 15h, ah=87h)
240
align 4
240
align 4
241
table_15_87:
241
table_15_87:
242
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
242
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
243
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
243
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
244
 
244
 
245
        db      0xff,0xff
245
        db      0xff,0xff
246
        db      0x0,0x10 
246
        db      0x0,0x10 
247
        db      0x00,0x93,0x0,0x0
247
        db      0x00,0x93,0x0,0x0
248
 
248
 
249
        db      0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
249
        db      0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
250
 
250
 
251
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
251
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
252
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
252
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
253
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
253
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
254
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
254
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
255
 
255
 
256
fat12_buffer:
256
fat12_buffer:
257
.BS_jmpBoot             db 0x90,0x90,0x90       ;3 áàéòà   NOP èíñòðóêöèÿ - íè÷åãî íå äåëàòü 
257
.BS_jmpBoot             db 0x90,0x90,0x90       ;3 байта   NOP инструкция - ничего не делать 
258
.BS_OEMName             db 'K SyS 64'   ;8 áàéò
258
.BS_OEMName             db 'K SyS 64'   ;8 байт
259
.BPB_BytsPerSec         dw      512     ;êîë-âî áàéòîâ â ñåêòîðå ìîæåò áûòü ëþáîå 512 1024 2048 4096 2 áàéòà
259
.BPB_BytsPerSec         dw      512     ;кол-во байтов в секторе может быть любое 512 1024 2048 4096 2 байта
260
.BPB_SecPerClus         db      0x1     ;êîë-âî ñåêòîðîâ â êëàñòåðå
260
.BPB_SecPerClus         db      0x1     ;кол-во секторов в кластере
261
.BPB_RsvdSecCnt         dw      0x1     ;äëÿ FAt12/16 òîëüêî 1, äëÿ FAT32 îáû÷íî 32     
261
.BPB_RsvdSecCnt         dw      0x1     ;для FAt12/16 только 1, для FAT32 обычно 32     
262
.BPB_NumFATs            db      0x1     ;êîë-âî ôàò òàáëèö, íà òîò ñëó÷àé åñëè áóäåò ñáðîñ íà äèñêåòó îáðàçà ðàì äèñêà
262
.BPB_NumFATs            db      0x1     ;кол-во фат таблиц, на тот случай если будет сброс на дискету образа рам диска
263
.BPB_RootEntCnt         dw      512     ;äëÿ ìàê ñîâìåñòèìîñòè ñ fat16 
263
.BPB_RootEntCnt         dw      512     ;для мак совместимости с fat16 
264
.BPB_TotSec16           dw      0x0     ;êë-âî ñåêòîðîâ
264
.BPB_TotSec16           dw      0x0     ;кл-во секторов
265
.BPB_Media              db      0xF0
265
.BPB_Media              db      0xF0
266
.BPB_FATSz16            dw      0x0
266
.BPB_FATSz16            dw      0x0
267
.BPB_SecPerTrk          dw      0x0     ;ñîäåðæèò ãåîìåòðèþ äèñêà äëÿ RAMFS íà êàê áû áåç ðàçíèöû, ïîêà ïóñòîå ïîëå, ïîçæå âíåñòè ðåàëüíûå çíà÷åíèÿ.
267
.BPB_SecPerTrk          dw      0x0     ;содержит геометрию диска для RAMFS на как бы без разницы, пока пустое поле, позже внести реальные значения.
268
.BPB_NumHeads           dw      0x0
268
.BPB_NumHeads           dw      0x0
269
.BPB_HiddSec            dd      0x0     ;êîë-âî ñêðûòûõ ñåêòîðîâ
269
.BPB_HiddSec            dd      0x0     ;кол-во скрытых секторов
270
.BPB_TotSec32           dd      0x0
270
.BPB_TotSec32           dd      0x0
271
.BS_DrvNum              db      'R'     ;îò ñëîâà RAM
271
.BS_DrvNum              db      'R'     ;от слова RAM
272
.BS_Reserved1           db      0x0
272
.BS_Reserved1           db      0x0
273
.BS_BootSig             db      0x29
273
.BS_BootSig             db      0x29
274
.BS_VolID               db      'RFKS'  
274
.BS_VolID               db      'RFKS'  
275
.BS_VolLab              db      'RAM DISK FS'   ;11 ñèìâîëîâ
275
.BS_VolLab              db      'RAM DISK FS'   ;11 символов
276
.BS_FilSysType          db      'FAT12   '      ;8 ñèìâîëîâ
276
.BS_FilSysType          db      'FAT12   '      ;8 символов
277
;62 áàéòà ñòðóêòóðà fat12.
277
;62 байта структура fat12.
278
db (512-($-fat12_buffer))dup(0x90)
278
db (512-($-fat12_buffer))dup(0x90)
279
 
279
 
280
 
280
 
281
 
281
 
282
;ñòðóêòóðà äëÿ äèððåêòîðèè fat
282
;структура для дирректории fat
283
struc FAT_32_entry ;Byte Directory Entry Structure
283
struc FAT_32_entry ;Byte Directory Entry Structure
284
{
284
{
285
.DIR_Name       rb      11
285
.DIR_Name       rb      11
286
.DIR_Attr       db      ?
286
.DIR_Attr       db      ?
287
.DIR_NTRes      db      ?
287
.DIR_NTRes      db      ?
288
.DIR_CrtTimeTenth db    ?
288
.DIR_CrtTimeTenth db    ?
289
.DIR_CrtTime    dw      ?
289
.DIR_CrtTime    dw      ?
290
.DIR_CrtDate    dw      ?
290
.DIR_CrtDate    dw      ?
291
.DIR_LstAccDate dw      ?
291
.DIR_LstAccDate dw      ?
292
.DIR_FstClusHI  dw      ?
292
.DIR_FstClusHI  dw      ?
293
.DIR_WrtTime    dw      ?
293
.DIR_WrtTime    dw      ?
294
.DIR_WrtDate    dw      ?
294
.DIR_WrtDate    dw      ?
295
.DIR_FstClusLO  dw      ?
295
.DIR_FstClusLO  dw      ?
296
.DIR_FileSize   dd      ?
296
.DIR_FileSize   dd      ?
297
 
297
 
298
 
298
 
299
}
299
}
300
;Òóò áóäóò ðàñïîëîãàòñüÿ äàííûå, êîòîðûå çàòðóäíèòåëüíî ðàñïîëîãàòü â ñòåêîâîé îáëàñòè....
300
;Тут будут распологатсья данные, которые затруднительно распологать в стековой области....
301
;;;
301
;;;
302
;timer
302
;timer
303
shot_name_fat   rb      11      ;âðåìåííûé áóôåð äëÿ fat12, â íåì õðàíÿòüñÿ èìåíà ôàéëîâ ïðèâåäåííûå ê ïðàâèëàì FAT /* âäàëüíåéøåì ïåðåíåñòè â ñòýê
303
shot_name_fat   rb      11      ;временный буфер для fat12, в нем храняться имена файлов приведенные к правилам FAT /* вдальнейшем перенести в стэк
304
 
304
 
305
if DEBUG
305
if DEBUG
306
                rb      1       ;íóæåí äëÿ îòëàäêè è âûâîäà èìåíè ôàéëà ïîñëå ïðåîáðàçîâàíèÿ
306
                rb      1       ;нужен для отладки и вывода имени файла после преобразования
307
dest_name_fat   db      24 dup('_');12
307
dest_name_fat   db      24 dup('_');12
308
db      0x0
308
db      0x0
309
end if
309
end if
310
 
310
 
311
value_timeout   rw      1       ;value to timeout
311
value_timeout   rw      1       ;value to timeout
312
old_timer       rd      1       ;ñòàðîå çíà÷åíèå âåêòîðà òàéìåðà
312
old_timer       rd      1       ;старое значение вектора таймера
313
start_timer     rd      1       ;çíà÷åíèå òàéìåðà
313
start_timer     rd      1       ;значение таймера
314
timer_          rd      1       ;íîâîå çíà÷åíèå âåêòîðà òàéìåðà ò.å. SL
314
timer_          rd      1       ;новое значение вектора таймера т.е. SL
315
start_stack     rw      1       ;save stack 
315
start_stack     rw      1       ;save stack 
316
save_bp_from_timer rw   1       ;save bp from timer
316
save_bp_from_timer rw   1       ;save bp from timer