Subversion Repositories Kolibri OS

Rev

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

Rev 7136 Rev 8175
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 7136 $
8
$Revision: 8175 $
9
 
9
 
10
struc VBE_VGAInfo {
10
struc VBE_VGAInfo {
11
  .VESASignature          dd ?    ; char
11
  .VESASignature          dd ?    ; char
12
  .VESAVersion            dw ?    ; short
12
  .VESAVersion            dw ?    ; short
13
  .OemStringPtr           dd ?    ; char *
13
  .OemStringPtr           dd ?    ; char *
14
  .Capabilities           dd ?    ; ulong
14
  .Capabilities           dd ?    ; ulong
15
  .VideoModePtr           dd ?    ; ulong
15
  .VideoModePtr           dd ?    ; ulong
16
  .TotalMemory            dw ?    ; short
16
  .TotalMemory            dw ?    ; short
17
  ; VBE 2.0+
17
  ; VBE 2.0+
18
  .OemSoftwareRev         db ?    ; short
18
  .OemSoftwareRev         db ?    ; short
19
  .OemVendorNamePtr       dw ?    ; char *
19
  .OemVendorNamePtr       dw ?    ; char *
20
  .OemProductNamePtr      dw ?    ; char *
20
  .OemProductNamePtr      dw ?    ; char *
21
  .OemProductRevPtr       dw ?    ; char *
21
  .OemProductRevPtr       dw ?    ; char *
22
  .reserved               rb 222  ; char
22
  .reserved               rb 222  ; char
23
  .OemData                rb 256  ; char
23
  .OemData                rb 256  ; char
24
}
24
}
25
 
25
 
26
struc VBE_ModeInfo {
26
struc VBE_ModeInfo {
27
  .ModeAttributes         dw ?    ; short
27
  .ModeAttributes         dw ?    ; short
28
  .WinAAttributes         db ?    ; char
28
  .WinAAttributes         db ?    ; char
29
  .WinBAttributes         db ?    ; char
29
  .WinBAttributes         db ?    ; char
30
  .WinGranularity         dw ?    ; short
30
  .WinGranularity         dw ?    ; short
31
  .WinSize                dw ?    ; short
31
  .WinSize                dw ?    ; short
32
  .WinASegment            dw ?    ; ushort
32
  .WinASegment            dw ?    ; ushort
33
  .WinBSegment            dw ?    ; ushort
33
  .WinBSegment            dw ?    ; ushort
34
  .WinFuncPtr             dd ?    ; void *
34
  .WinFuncPtr             dd ?    ; void *
35
  .BytesPerScanLine       dw ?    ; short
35
  .BytesPerScanLine       dw ?    ; short
36
  .XRes                   dw ?    ; short
36
  .XRes                   dw ?    ; short
37
  .YRes                   dw ?    ; short
37
  .YRes                   dw ?    ; short
38
  .XCharSize              db ?    ; char
38
  .XCharSize              db ?    ; char
39
  .YCharSize              db ?    ; char
39
  .YCharSize              db ?    ; char
40
  .NumberOfPlanes         db ?    ; char
40
  .NumberOfPlanes         db ?    ; char
41
  .BitsPerPixel           db ?    ; char
41
  .BitsPerPixel           db ?    ; char
42
  .NumberOfBanks          db ?    ; char
42
  .NumberOfBanks          db ?    ; char
43
  .MemoryModel            db ?    ; char
43
  .MemoryModel            db ?    ; char
44
  .BankSize               db ?    ; char
44
  .BankSize               db ?    ; char
45
  .NumberOfImagePages     db ?    ; char
45
  .NumberOfImagePages     db ?    ; char
46
  .res1                   db ?    ; char
46
  .res1                   db ?    ; char
47
  .RedMaskSize            db ?    ; char
47
  .RedMaskSize            db ?    ; char
48
  .RedFieldPosition       db ?    ; char
48
  .RedFieldPosition       db ?    ; char
49
  .GreenMaskSize          db ?    ; char
49
  .GreenMaskSize          db ?    ; char
50
  .GreenFieldPosition     db ?    ; char
50
  .GreenFieldPosition     db ?    ; char
51
  .BlueMaskSize           db ?    ; char
51
  .BlueMaskSize           db ?    ; char
52
  .BlueFieldPosition      db ?    ; char
52
  .BlueFieldPosition      db ?    ; char
53
  .RsvedMaskSize          db ?    ; char
53
  .RsvedMaskSize          db ?    ; char
54
  .RsvedFieldPosition     db ?    ; char
54
  .RsvedFieldPosition     db ?    ; char
55
  .DirectColorModeInfo    db ?    ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
55
  .DirectColorModeInfo    db ?    ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
56
  ; VBE 2.0+
56
  ; VBE 2.0+
57
  .PhysBasePtr            dd ?    ; ulong
57
  .PhysBasePtr            dd ?    ; ulong
58
  .OffScreenMemOffset     dd ?    ; ulong
58
  .OffScreenMemOffset     dd ?    ; ulong
59
  .OffScreenMemSize       dw ?    ; short
59
  .OffScreenMemSize       dw ?    ; short
60
  ; VBE 3.0+
60
  ; VBE 3.0+
61
  .LinbytesPerScanLine    dw ?    ; short
61
  .LinbytesPerScanLine    dw ?    ; short
62
  .BankNumberOfImagePages db ?    ; char
62
  .BankNumberOfImagePages db ?    ; char
63
  .LinNumberOfImagePages  db ?    ; char
63
  .LinNumberOfImagePages  db ?    ; char
64
  .LinRedMaskSize         db ?    ; char
64
  .LinRedMaskSize         db ?    ; char
65
  .LinRedFieldPosition    db ?    ; char
65
  .LinRedFieldPosition    db ?    ; char
66
  .LingreenMaskSize       db ?    ; char
66
  .LingreenMaskSize       db ?    ; char
67
  .LinGreenFieldPosition  db ?    ; char
67
  .LinGreenFieldPosition  db ?    ; char
68
  .LinBlueMaskSize        db ?    ; char
68
  .LinBlueMaskSize        db ?    ; char
69
  .LinBlueFieldPosition   db ?    ; char
69
  .LinBlueFieldPosition   db ?    ; char
70
  .LinRsvdMaskSize        db ?    ; char
70
  .LinRsvdMaskSize        db ?    ; char
71
  .LinRsvdFieldPosition   db ?    ; char
71
  .LinRsvdFieldPosition   db ?    ; char
72
  .MaxPixelClock          dd ?    ; ulong
72
  .MaxPixelClock          dd ?    ; ulong
73
  .res2                   rb 190  ; char
73
  .res2                   rb 190  ; char
74
}
74
}
75
 
75
 
76
virtual at $A000
76
virtual at $A000
77
  vi VBE_VGAInfo
77
  vi VBE_VGAInfo
78
  mi VBE_ModeInfo
78
  mi VBE_ModeInfo
79
modes_table:
79
modes_table:
80
end virtual
80
end virtual
81
cursor_pos  dw 0         ;временное хранение курсора.
81
cursor_pos  dw 0         ;временное хранение курсора.
82
cursor_pos_old  dw 0
82
cursor_pos_old  dw 0
83
home_cursor dw 0    ;current shows rows a table
83
home_cursor dw 0    ;current shows rows a table
84
end_cursor  dw 0     ;end of position current shows rows a table
84
end_cursor  dw 0     ;end of position current shows rows a table
85
scroll_start dw 0    ;start position of scroll bar
85
scroll_start dw 0    ;start position of scroll bar
86
scroll_end  dw 0     ;end position of scroll bar
86
scroll_end  dw 0     ;end position of scroll bar
87
long_v_table = 9   ;long of visible video table
87
long_v_table = 9   ;long of visible video table
88
size_of_step = 10
88
size_of_step = 10
89
scroll_area_size = long_v_table - 2
89
scroll_area_size = long_v_table - 2
90
int2str:
90
int2str:
91
        dec     bl
91
        dec     bl
92
        jz      @f
92
        jz      @f
93
        xor     edx, edx
93
        xor     edx, edx
94
        div     ecx
94
        div     ecx
95
        push    edx
95
        push    edx
96
        call    int2str
96
        call    int2str
97
        pop     eax
97
        pop     eax
98
    @@:
98
    @@:
99
        or      al, 0x30
99
        or      al, 0x30
100
        mov     [ds:di], al
100
        mov     [ds:di], al
101
        inc     di
101
        inc     di
102
        ret
102
        ret
103
 
103
 
104
int2strnz:
104
int2strnz:
105
        cmp     eax, ecx
105
        cmp     eax, ecx
106
        jb      @f
106
        jb      @f
107
        xor     edx, edx
107
        xor     edx, edx
108
        div     ecx
108
        div     ecx
109
        push    edx
109
        push    edx
110
        call    int2strnz
110
        call    int2strnz
111
        pop     eax
111
        pop     eax
112
    @@:
112
    @@:
113
        or      al, 0x30
113
        or      al, 0x30
114
        mov     [es:di], al
114
        mov     [es:di], al
115
        inc     di
115
        inc     di
116
        ret
116
        ret
117
 
117
 
118
;-------------------------------------------------------
118
;-------------------------------------------------------
119
;Write message about incorrect v_mode and write message about jmp on swith v_mode
119
;Write message about incorrect v_mode and write message about jmp on swith v_mode
120
v_mode_error:
120
v_mode_error:
121
        _setcursor 19,2
121
        _setcursor 19,2
122
        mov     si, fatalsel
122
        mov     si, fatalsel
123
        call    printplain
123
        call    printplain
124
        _setcursor 20,2
124
        _setcursor 20,2
125
        mov     si, pres_key
125
        mov     si, pres_key
126
        call    printplain
126
        call    printplain
127
        xor     eax, eax
127
        xor     eax, eax
128
        int     16h
128
        int     16h
129
        jmp     cfgmanager.d
129
        jmp     cfgmanager.d
130
;-------------------------------------------------------
130
;-------------------------------------------------------
131
;
131
;
132
 
132
 
133
 
133
 
134
 
134
 
135
;-------------------------------------------------------
135
;-------------------------------------------------------
136
print_vesa_info:
136
print_vesa_info:
137
        _setcursor 5,2
137
        _setcursor 5,2
138
 
138
 
139
        mov     [es:vi.VESASignature], 'VBE2'
139
        mov     [es:vi.VESASignature], 'VBE2'
140
        mov     ax, 0x4F00
140
        mov     ax, 0x4F00
141
        mov     di, vi     ;0xa000
141
        mov     di, vi     ;0xa000
142
        int     0x10
142
        int     0x10
143
        or      ah, ah
143
        or      ah, ah
144
        jz      @f
144
        jz      @f
145
        mov     [es:vi.VESASignature], 'VESA'
145
        mov     [es:vi.VESASignature], 'VESA'
146
        mov     ax, $4F00
146
        mov     ax, $4F00
147
        mov     di, vi
147
        mov     di, vi
148
        int     0x10
148
        int     0x10
149
        or      ah, ah
149
        or      ah, ah
150
        jnz     .exit
150
        jnz     .exit
151
  @@:
151
  @@:
152
        cmp     [es:vi.VESASignature], 'VESA'
152
        cmp     [es:vi.VESASignature], 'VESA'
153
        jne     .exit
153
        jne     .exit
154
        cmp     [es:vi.VESAVersion], 0x0100
154
        cmp     [es:vi.VESAVersion], 0x0100
155
        jb      .exit
155
        jb      .exit
156
        jmp     .vesaok2
156
        jmp     .vesaok2
157
 
157
 
158
  .exit:
158
  .exit:
159
        mov     si, novesa
159
        mov     si, novesa
160
        call    printplain
160
        call    printplain
161
        ret
161
        ret
162
 
162
 
163
  .vesaok2:
163
  .vesaok2:
164
        mov     ax, [es:vi.VESAVersion]
164
        mov     ax, [es:vi.VESAVersion]
165
        add     ax, '00'
165
        add     ax, '00'
166
 
166
 
167
        mov     [s_vesa.ver], ah
167
        mov     [s_vesa.ver], ah
168
        mov     [s_vesa.ver+2], al
168
        mov     [s_vesa.ver+2], al
169
        mov     si, s_vesa
169
        mov     si, s_vesa
170
        call    printplain
170
        call    printplain
171
 
171
 
172
        _setcursor 4,2
172
        _setcursor 4,2
173
        mov     si, word[es:vi.OemStringPtr]
173
        mov     si, word[es:vi.OemStringPtr]
174
        mov     di, si
174
        mov     di, si
175
 
175
 
176
        push    ds
176
        push    ds
177
        mov     ds, word[es:vi.OemStringPtr+2]
177
        mov     ds, word[es:vi.OemStringPtr+2]
178
        call    printplain
178
        call    printplain
179
        pop     ds
179
        pop     ds
180
 
180
 
181
        ret
181
        ret
182
;-----------------------------------------------------------------------------
182
;-----------------------------------------------------------------------------
183
 
183
 
184
calc_vmodes_table:
184
calc_vmodes_table:
185
        pushad
185
        pushad
186
 
186
 
187
;        push    0
187
;        push    0
188
;        pop     es
188
;        pop     es
189
 
189
 
190
        lfs     si, [es:vi.VideoModePtr]
190
        lfs     si, [es:vi.VideoModePtr]
191
 
191
 
192
        mov     bx, modes_table
192
        mov     bx, modes_table
193
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
193
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
194
        mov     word [es:bx], 640
194
        mov     word [es:bx], 640
195
        mov     word [es:bx+2], 480
195
        mov     word [es:bx+2], 480
196
        mov     word [es:bx+6], 0x13
196
        mov     word [es:bx+6], 0x13
197
        
197
        
198
        mov     word [es:bx+10], 640
198
        mov     word [es:bx+10], 640
199
        mov     word [es:bx+12], 480
199
        mov     word [es:bx+12], 480
200
        mov     word [es:bx+16], 0x12
200
        mov     word [es:bx+16], 0x12
201
        add     bx, 20
201
        add     bx, 20
202
  .next_mode:
202
  .next_mode:
203
        mov     cx, word [fs:si]; mode number
203
        mov     cx, word [fs:si]; mode number
204
        cmp     cx, -1
204
        cmp     cx, -1
205
        je      .modes_ok.2
205
        je      .modes_ok.2
206
 
206
 
207
        mov     ax, 0x4F01
207
        mov     ax, 0x4F01
208
        mov     di, mi
208
        mov     di, mi
209
        int     0x10
209
        int     0x10
210
 
210
 
211
        or      ah, ah
211
        or      ah, ah
212
        jnz     .modes_ok.2;vesa_info.exit
212
        jnz     .modes_ok.2;vesa_info.exit
213
 
213
 
214
        test    [es:mi.ModeAttributes], 00000001b  ;videomode support ?
214
        test    [es:mi.ModeAttributes], 00000001b  ;videomode support ?
215
        jz      @f
215
        jz      @f
216
        test    [es:mi.ModeAttributes], 00010000b  ;picture ?
216
        test    [es:mi.ModeAttributes], 00010000b  ;picture ?
217
        jz      @f
217
        jz      @f
218
        test    [es:mi.ModeAttributes], 10000000b  ;LFB ?
218
        test    [es:mi.ModeAttributes], 10000000b  ;LFB ?
219
        jz      @f
219
        jz      @f
220
 
220
 
221
        cmp     [es:mi.BitsPerPixel], 16   ;List only supported videomodes (16, 24 and 32 bpp)
221
        cmp     [es:mi.BitsPerPixel], 16   ;List only supported videomodes (16, 24 and 32 bpp)
222
        jb      @f
222
        jb      @f
223
 
223
 
224
; 16 bpp might actually be 15 bpp
224
; 16 bpp might actually be 15 bpp
225
        cmp     [es:mi.BitsPerPixel], 16 
225
        cmp     [es:mi.BitsPerPixel], 16 
226
        jne     .l0
226
        jne     .l0
227
        cmp     [es:mi.GreenMaskSize], 5
227
        cmp     [es:mi.GreenMaskSize], 5
228
        jne     .l0
228
        jne     .l0
229
;        mov     [es:mi.BitsPerPixel],15
229
;        mov     [es:mi.BitsPerPixel],15
230
        jmp     @f                         ; 15 bpp isnt supported ATM
230
        jmp     @f                         ; 15 bpp isnt supported ATM
231
 
231
 
232
 
232
 
233
.l0:
233
.l0:
234
        cmp     [es:mi.XRes], 640
234
        cmp     [es:mi.XRes], 640
235
        jb      @f
235
        jb      @f
236
        cmp     [es:mi.YRes], 480
236
        cmp     [es:mi.YRes], 480
237
        jb      @f
237
        jb      @f
238
;        cmp     [es:mi.BitsPerPixel],8
238
;        cmp     [es:mi.BitsPerPixel],8
239
;        jb      @f
239
;        jb      @f
240
 
240
 
241
        mov     ax, [es:mi.XRes]
241
        mov     ax, [es:mi.XRes]
242
        mov     [es:bx+0], ax              ; +0[2] : resolution X
242
        mov     [es:bx+0], ax              ; +0[2] : resolution X
243
        mov     ax, [es:mi.YRes]
243
        mov     ax, [es:mi.YRes]
244
        mov     [es:bx+2], ax              ; +2[2] : resolution Y
244
        mov     [es:bx+2], ax              ; +2[2] : resolution Y
245
        mov     ax, [es:mi.ModeAttributes]
245
        mov     ax, [es:mi.ModeAttributes]
246
        mov     [es:bx+4], ax              ; +4[2] : attributes
246
        mov     [es:bx+4], ax              ; +4[2] : attributes
247
 
247
 
248
        cmp     [s_vesa.ver], '2'
248
        cmp     [s_vesa.ver], '2'
249
;        jb      .lp1
249
;        jb      .lp1
250
        jb      @f    ; We do not use Vesa 1.2 mode is now
250
        jb      @f    ; We do not use Vesa 1.2 mode is now
251
 
251
 
252
        or      cx, 0x4000 ; use LFB
252
        or      cx, 0x4000 ; use LFB
253
.lp1:
253
.lp1:
254
        mov     [es:bx+6], cx              ; +6 : mode number
254
        mov     [es:bx+6], cx              ; +6 : mode number
255
        movzx   ax, byte [es:mi.BitsPerPixel]
255
        movzx   ax, byte [es:mi.BitsPerPixel]
256
        mov     word [es:bx+8], ax              ; +8 : bits per pixel
256
        mov     word [es:bx+8], ax              ; +8 : bits per pixel
257
        add     bx, size_of_step                ; size of record
257
        add     bx, size_of_step                ; size of record
258
 
258
 
259
    @@:
259
    @@:
260
        add     si, 2
260
        add     si, 2
261
        jmp     .next_mode
261
        jmp     .next_mode
262
 
262
 
263
  .modes_ok.2:
263
  .modes_ok.2:
264
 
264
 
265
        mov     word[es:bx], -1 ;end video table
265
        mov     word[es:bx], -1 ;end video table
266
        mov     word[end_cursor], bx    ;save end cursor position
266
        mov     word[end_cursor], bx    ;save end cursor position
267
;;;;;;;;;;;;;;;;;;
267
;;;;;;;;;;;;;;;;;;
268
;Sort array
268
;Sort array
269
;        mov     si,modes_table
269
;        mov     si,modes_table
270
;.new_mode:
270
;.new_mode:
271
;        mov     ax,word [es:si]
271
;        mov     ax,word [es:si]
272
;        cmp     ax,-1
272
;        cmp     ax,-1
273
;        je      .exxit
273
;        je      .exxit
274
;        add     ax,word [es:si+2]
274
;        add     ax,word [es:si+2]
275
;        add     ax,word [es:si+8]
275
;        add     ax,word [es:si+8]
276
;        mov     bp,si
276
;        mov     bp,si
277
;.again:
277
;.again:
278
;        add     bp,12
278
;        add     bp,12
279
;        mov     bx,word [es:bp]
279
;        mov     bx,word [es:bp]
280
;        cmp     bx,-1
280
;        cmp     bx,-1
281
;        je      .exit
281
;        je      .exit
282
;        add     bx,word [es:bp+2]
282
;        add     bx,word [es:bp+2]
283
;        add     bx,word [es:bp+8]
283
;        add     bx,word [es:bp+8]
284
;
284
;
285
;        cmp     ax,bx
285
;        cmp     ax,bx
286
;        ja      .loops
286
;        ja      .loops
287
;        jmp     .again
287
;        jmp     .again
288
;.loops:
288
;.loops:
289
;        push    dword [es:si]
289
;        push    dword [es:si]
290
;        push    dword [es:si+4]
290
;        push    dword [es:si+4]
291
;        push    dword [es:si+8]
291
;        push    dword [es:si+8]
292
;        push    dword [es:bp]
292
;        push    dword [es:bp]
293
;        push    dword [es:bp+4]
293
;        push    dword [es:bp+4]
294
;        push    dword [es:bp+8]
294
;        push    dword [es:bp+8]
295
;
295
;
296
;        pop     dword [es:si+8]
296
;        pop     dword [es:si+8]
297
;        pop     dword [es:si+4]
297
;        pop     dword [es:si+4]
298
;        pop     dword [es:si]
298
;        pop     dword [es:si]
299
;        pop     dword [es:bp+8]
299
;        pop     dword [es:bp+8]
300
;        pop     dword [es:bp+4]
300
;        pop     dword [es:bp+4]
301
;        pop     dword [es:bp]
301
;        pop     dword [es:bp]
302
;        jmp     .new_mode
302
;        jmp     .new_mode
303
;
303
;
304
;.exit:  add     si,12
304
;.exit:  add     si,12
305
;        jmp     .new_mode
305
;        jmp     .new_mode
306
;.exxit:
306
;.exxit:
307
        popad
307
        popad
308
        ret
308
        ret
309
 
309
 
310
;-----------------------------------------------------------------------------
310
;-----------------------------------------------------------------------------
311
 
311
 
312
draw_current_vmode:
312
draw_current_vmode:
313
        push    0
313
        push    0
314
        pop     es
314
        pop     es
315
 
315
 
316
        mov     si, word [cursor_pos]
316
        mov     si, word [cursor_pos]
317
 
317
 
318
        cmp     word [es:si+6], 0x12
318
        cmp     word [es:si+6], 0x12
319
        je      .no_vesa_0x12
319
        je      .no_vesa_0x12
320
 
320
 
321
        cmp     word [es:si+6], 0x13
321
        cmp     word [es:si+6], 0x13
322
        je      .no_vesa_0x13
322
        je      .no_vesa_0x13
323
 
323
 
324
if defined extended_primary_loader
324
if defined extended_primary_loader
325
        mov     di, config_file_variables
325
        mov     di, config_file_variables
326
else
326
else
327
        mov     di, loader_block_error
327
        mov     di, loader_block_error
328
end if
328
end if
329
        movzx   eax, word[es:si+0]
329
        movzx   eax, word[es:si+0]
330
        mov     ecx, 10
330
        mov     ecx, 10
331
        call    int2strnz
331
        call    int2strnz
332
        mov     byte[es:di], 'x'
332
        mov     byte[es:di], 'x'
333
        inc     di
333
        inc     di
334
        movzx   eax, word[es:si+2]
334
        movzx   eax, word[es:si+2]
335
        call    int2strnz
335
        call    int2strnz
336
        mov     byte[es:di], 'x'
336
        mov     byte[es:di], 'x'
337
        inc     di
337
        inc     di
338
        movzx   eax, word[es:si+8]
338
        movzx   eax, word[es:si+8]
339
        call    int2strnz
339
        call    int2strnz
340
        mov     dword[es:di], 0x00000d0a
340
        mov     dword[es:di], 0x00000d0a
341
if defined extended_primary_loader
341
if defined extended_primary_loader
342
        mov     si, config_file_variables
342
        mov     si, config_file_variables
343
else
343
else
344
        mov     si, loader_block_error
344
        mov     si, loader_block_error
345
end if
345
end if
346
        push    ds
346
        push    ds
347
        push    es
347
        push    es
348
        pop     ds
348
        pop     ds
349
        call    printplain
349
        call    printplain
350
        pop     ds
350
        pop     ds
351
        ret
351
        ret
352
.no_vesa_0x13:
352
.no_vesa_0x13:
353
        mov     si, mode0
353
        mov     si, mode0
354
        jmp     .print
354
        jmp     .print
355
.no_vesa_0x12:
355
.no_vesa_0x12:
356
        mov     si, mode9
356
        mov     si, mode9
357
.print:
357
.print:
358
        call    printplain
358
        call    printplain
359
        ret
359
        ret
360
;-----------------------------------------------------------------------------
360
;-----------------------------------------------------------------------------
361
check_first_parm:
361
check_first_parm:
362
if defined extended_primary_loader
362
if defined extended_primary_loader
363
        mov     cx, [number_vm]
363
        mov     cx, [number_vm]
364
        jcxz    .novbemode
364
        jcxz    .novbemode
365
        mov     si, modes_table
365
        mov     si, modes_table
366
.findvbemode:
366
.findvbemode:
367
        cmp     [es:si+6], cx
367
        cmp     [es:si+6], cx
368
        jnz     @f
368
        jnz     @f
369
        cmp     word [es:si+8], 32
369
        cmp     word [es:si+8], 32
370
        je      .ok_found_mode
370
        je      .ok_found_mode
371
        cmp     word [es:si+8], 24
371
        cmp     word [es:si+8], 24
372
        je      .ok_found_mode
372
        je      .ok_found_mode
373
        cmp     word [es:si+8], 16
373
        cmp     word [es:si+8], 16
374
        je      .ok_found_mode
374
        je      .ok_found_mode
375
@@:
375
@@:
376
        add     si, size_of_step
376
        add     si, size_of_step
377
        cmp     word [es:si], -1
377
        cmp     word [es:si], -1
378
        jnz     .findvbemode
378
        jnz     .findvbemode
379
.novbemode:
379
.novbemode:
380
        mov     ax, [x_save]
380
        mov     ax, [x_save]
381
        test    ax, ax
381
        test    ax, ax
382
        jz      .zerro
382
        jz      .zerro
383
        mov     bx, [y_save]
383
        mov     bx, [y_save]
384
        mov     si, modes_table
384
        mov     si, modes_table
385
        call    .loops
385
        call    .loops
386
        test    ax, ax
386
        test    ax, ax
387
        jz      .ok_found_mode
387
        jz      .ok_found_mode
388
else
388
else
389
        mov     si, word [preboot_graph]
389
        mov     si, word [preboot_graph]
390
        test    si, si
390
        test    si, si
391
        jnz     .no_zero         ;if no zero
391
        jnz     .no_zero         ;if no zero
392
end if
392
end if
393
.zerro:
393
.zerro:
394
;        mov     ax,modes_table
394
;        mov     ax,modes_table
395
;        mov     word [cursor_pos],ax
395
;        mov     word [cursor_pos],ax
396
;        mov     word [home_cursor],ax
396
;        mov     word [home_cursor],ax
397
;        mov     word [preboot_graph],ax
397
;        mov     word [preboot_graph],ax
398
;SET default video of mode first probe will fined a move of work 1024x768@32
398
;SET default video of mode first probe will fined a move of work 1024x768@32
399
        mov     cx, 32
399
        mov     cx, 32
400
  .find_mode:
400
  .find_mode:
401
        mov     ax, 1024
401
        mov     ax, 1024
402
        mov     bx, 768
402
        mov     bx, 768
403
        mov     si, modes_table
403
        mov     si, modes_table
404
        call    .loops
404
        call    .loops
405
        test    ax, ax
405
        test    ax, ax
406
        jz      .ok_found_mode
406
        jz      .ok_found_mode
407
        mov     ax, 800
407
        mov     ax, 800
408
        mov     bx, 600
408
        mov     bx, 600
409
        mov     si, modes_table
409
        mov     si, modes_table
410
        call    .loops
410
        call    .loops
411
        test    ax, ax
411
        test    ax, ax
412
        jz      .ok_found_mode
412
        jz      .ok_found_mode
413
        mov     ax, 640
413
        mov     ax, 640
414
        mov     bx, 480
414
        mov     bx, 480
415
        mov     si, modes_table
415
        mov     si, modes_table
416
        call    .loops
416
        call    .loops
417
        test    ax, ax
417
        test    ax, ax
418
        jz      .ok_found_mode
418
        jz      .ok_found_mode
419
        sub     cx, 8
419
        sub     cx, 8
420
        jnz     .find_mode
420
        jnz     .find_mode
421
 
421
 
422
        mov     si, modes_table
422
        mov     si, modes_table
423
if ~ defined extended_primary_loader
423
if ~ defined extended_primary_loader
424
        jmp     .ok_found_mode
424
        jmp     .ok_found_mode
425
 
425
 
426
 
426
 
427
 
427
 
428
.no_zero:
428
.no_zero:
429
        mov     bp, word [number_vm]
429
        mov     bp, word [number_vm]
430
        cmp     bp, word [es:si+6]
430
        cmp     bp, word [es:si+6]
431
        jz      .ok_found_mode
431
        jz      .ok_found_mode
432
        mov     ax, word [x_save]
432
        mov     ax, word [x_save]
433
        mov     bx, word [y_save]
433
        mov     bx, word [y_save]
434
        mov     si, modes_table
434
        mov     si, modes_table
435
        call    .loops
435
        call    .loops
436
        test    ax, ax
436
        test    ax, ax
437
        jz      .ok_found_mode
437
        jz      .ok_found_mode
438
 
438
 
439
        mov     si, modes_table
439
        mov     si, modes_table
440
;        cmp     ax,modes_table
440
;        cmp     ax,modes_table
441
;        jb      .zerro           ;check on correct if bellow
441
;        jb      .zerro           ;check on correct if bellow
442
;        cmp     ax,word [end_cursor]
442
;        cmp     ax,word [end_cursor]
443
;        ja      .zerro           ;check on correct if anymore
443
;        ja      .zerro           ;check on correct if anymore
444
end if
444
end if
445
 
445
 
446
.ok_found_mode:
446
.ok_found_mode:
447
        mov     word [home_cursor], si
447
        mov     word [home_cursor], si
448
;        mov     word [cursor_pos],si
448
;        mov     word [cursor_pos],si
449
        mov     word [preboot_graph], si
449
        mov     word [preboot_graph], si
450
        mov     ax, si
450
        mov     ax, si
451
 
451
 
452
        mov     ecx, long_v_table
452
        mov     ecx, long_v_table
453
 
453
 
454
.loop:
454
.loop:
455
        add     ax, size_of_step
455
        add     ax, size_of_step
456
        cmp     ax, word [end_cursor]
456
        cmp     ax, word [end_cursor]
457
        jae     .next_step
457
        jae     .next_step
458
        loop    .loop
458
        loop    .loop
459
.next_step:
459
.next_step:
460
        sub     ax, size_of_step*long_v_table
460
        sub     ax, size_of_step*long_v_table
461
        cmp     ax, modes_table
461
        cmp     ax, modes_table
462
        jae     @f
462
        jae     @f
463
        mov     ax, modes_table
463
        mov     ax, modes_table
464
@@:
464
@@:
465
 
465
 
466
        mov     word [home_cursor], ax
466
        mov     word [home_cursor], ax
467
        mov     si, [preboot_graph]
467
        mov     si, [preboot_graph]
468
        mov     word [cursor_pos], si
468
        mov     word [cursor_pos], si
469
 
469
 
470
        push    word [es:si]
470
        push    word [es:si]
471
        pop     word [x_save]
471
        pop     word [x_save]
472
        push    word [es:si+2]
472
        push    word [es:si+2]
473
        pop     word [y_save]
473
        pop     word [y_save]
474
        push    word [es:si+6]
474
        push    word [es:si+6]
475
        pop     word [number_vm]
475
        pop     word [number_vm]
476
 
476
 
477
        ret
477
        ret
478
;;;;;;;;;;;;;;;;;;;;;;;;;;;
478
;;;;;;;;;;;;;;;;;;;;;;;;;;;
479
.loops:
479
.loops:
480
        cmp     ax, word [es:si]
480
        cmp     ax, word [es:si]
481
        jne     .next
481
        jne     .next
482
        cmp     bx, word [es:si+2]
482
        cmp     bx, word [es:si+2]
483
        jne     .next
483
        jne     .next
-
 
484
        jcxz    @f
484
        cmp     cx, word [es:si+8]
485
        cmp     cx, word [es:si+8]
485
        jne     .next
486
        jne     .next
-
 
487
@@:
486
        xor     ax, ax
488
        xor     ax, ax
487
        ret
489
        ret
488
.next:
490
.next:
489
        add     si, size_of_step
491
        add     si, size_of_step
490
        cmp     word [es:si], -1
492
        cmp     word [es:si], -1
491
        je      .exit
493
        je      .exit
492
        jmp     .loops
494
        jmp     .loops
493
.exit:
495
.exit:
494
        or      ax, -1
496
        or      ax, -1
495
        ret
497
        ret
496
 
498
 
497
 
499
 
498
;-----------------------------------------------------------------------------
500
;-----------------------------------------------------------------------------
499
 
501
 
500
;default_vmode:
502
;default_vmode:
501
 
503
 
502
;-----------------------------------------------------------------------------
504
;-----------------------------------------------------------------------------
503
draw_vmodes_table:
505
draw_vmodes_table:
504
        _setcursor 9, 2
506
        _setcursor 9, 2
505
        mov     si, gr_mode
507
        mov     si, gr_mode
506
        call    printplain
508
        call    printplain
507
 
509
 
508
        mov     si, _st
510
        mov     si, _st
509
        call    printplain
511
        call    printplain
510
 
512
 
511
        push    word [cursor_pos]
513
        push    word [cursor_pos]
512
        pop     ax
514
        pop     ax
513
        push    word [home_cursor]
515
        push    word [home_cursor]
514
        pop     si
516
        pop     si
515
        mov     cx, si
517
        mov     cx, si
516
 
518
 
517
        cmp     ax, si
519
        cmp     ax, si
518
        je      .ok
520
        je      .ok
519
        jb      .low
521
        jb      .low
520
 
522
 
521
 
523
 
522
        add     cx, size_of_step*long_v_table
524
        add     cx, size_of_step*long_v_table
523
 
525
 
524
        cmp     ax, cx
526
        cmp     ax, cx
525
        jb      .ok
527
        jb      .ok
526
 
528
 
527
        sub     cx, size_of_step*long_v_table
529
        sub     cx, size_of_step*long_v_table
528
        add     cx, size_of_step
530
        add     cx, size_of_step
529
        cmp     cx, word[end_cursor]
531
        cmp     cx, word[end_cursor]
530
        jae     .ok
532
        jae     .ok
531
        add     si, size_of_step
533
        add     si, size_of_step
532
        push    si
534
        push    si
533
        pop     word [home_cursor]
535
        pop     word [home_cursor]
534
        jmp     .ok
536
        jmp     .ok
535
 
537
 
536
 
538
 
537
.low:
539
.low:
538
        sub     cx, size_of_step
540
        sub     cx, size_of_step
539
        cmp     cx, modes_table
541
        cmp     cx, modes_table
540
        jb      .ok
542
        jb      .ok
541
        push    cx
543
        push    cx
542
        push    cx
544
        push    cx
543
        pop     word [home_cursor]
545
        pop     word [home_cursor]
544
        pop     si
546
        pop     si
545
 
547
 
546
 
548
 
547
.ok:
549
.ok:
548
; calculate scroll position
550
; calculate scroll position
549
        push    si
551
        push    si
550
        mov     ax, [end_cursor]
552
        mov     ax, [end_cursor]
551
        sub     ax, modes_table
553
        sub     ax, modes_table
552
        mov     bx, size_of_step
554
        mov     bx, size_of_step
553
        cwd
555
        cwd
554
        div     bx
556
        div     bx
555
        mov     si, ax          ; si = size of list
557
        mov     si, ax          ; si = size of list
556
        mov     ax, [home_cursor]
558
        mov     ax, [home_cursor]
557
        sub     ax, modes_table
559
        sub     ax, modes_table
558
        cwd
560
        cwd
559
        div     bx
561
        div     bx
560
        mov     di, ax
562
        mov     di, ax
561
        mov     ax, scroll_area_size*long_v_table
563
        mov     ax, scroll_area_size*long_v_table
562
        cwd
564
        cwd
563
        div     si
565
        div     si
564
        test    ax, ax
566
        test    ax, ax
565
        jnz     @f
567
        jnz     @f
566
        inc     ax
568
        inc     ax
567
@@:
569
@@:
568
        cmp     al, scroll_area_size
570
        cmp     al, scroll_area_size
569
        jb      @f
571
        jb      @f
570
        mov     al, scroll_area_size
572
        mov     al, scroll_area_size
571
@@:
573
@@:
572
        mov     cx, ax
574
        mov     cx, ax
573
; cx = scroll height
575
; cx = scroll height
574
; calculate scroll pos
576
; calculate scroll pos
575
        xor     bx, bx          ; initialize scroll pos
577
        xor     bx, bx          ; initialize scroll pos
576
        sub     al, scroll_area_size+1
578
        sub     al, scroll_area_size+1
577
        neg     al
579
        neg     al
578
        sub     si, long_v_table-1
580
        sub     si, long_v_table-1
579
        jbe     @f
581
        jbe     @f
580
        mul     di
582
        mul     di
581
        div     si
583
        div     si
582
        mov     bx, ax
584
        mov     bx, ax
583
@@:
585
@@:
584
        inc     bx
586
        inc     bx
585
        imul    ax, bx, size_of_step
587
        imul    ax, bx, size_of_step
586
        add     ax, [home_cursor]
588
        add     ax, [home_cursor]
587
        mov     [scroll_start], ax
589
        mov     [scroll_start], ax
588
        imul    cx, size_of_step
590
        imul    cx, size_of_step
589
        add     ax, cx
591
        add     ax, cx
590
        mov     [scroll_end], ax
592
        mov     [scroll_end], ax
591
        pop     si
593
        pop     si
592
        mov     bp, long_v_table              ;show rows
594
        mov     bp, long_v_table              ;show rows
593
.@@_next_bit:
595
.@@_next_bit:
594
;clear cursor
596
;clear cursor
595
        mov     ax, '  '
597
        mov     ax, '  '
596
        mov     word[ds:_r1+21], ax
598
        mov     word[ds:_r1+21], ax
597
        mov     word[ds:_r1+50], ax
599
        mov     word[ds:_r1+50], ax
598
 
600
 
599
        mov     word[ds:_r2+21], ax
601
        mov     word[ds:_r2+21], ax
600
        mov     word[ds:_r2+45], ax
602
        mov     word[ds:_r2+45], ax
601
 
603
 
602
        mov     word[ds:_rs+21], ax
604
        mov     word[ds:_rs+21], ax
603
        mov     word[ds:_rs+46], ax
605
        mov     word[ds:_rs+46], ax
604
; draw string
606
; draw string
605
        cmp     word [es:si+6], 0x12
607
        cmp     word [es:si+6], 0x12
606
        je      .show_0x12
608
        je      .show_0x12
607
        cmp     word [es:si+6], 0x13
609
        cmp     word [es:si+6], 0x13
608
        je      .show_0x13
610
        je      .show_0x13
609
 
611
 
610
        movzx   eax, word[es:si]
612
        movzx   eax, word[es:si]
611
        cmp     ax, -1
613
        cmp     ax, -1
612
        je      .@@_end
614
        je      .@@_end
613
        mov     di, _rs+23
615
        mov     di, _rs+23
614
        mov     ecx, 10
616
        mov     ecx, 10
615
        mov     bl, 4
617
        mov     bl, 4
616
        call    int2str
618
        call    int2str
617
        movzx   eax, word[es:si+2]
619
        movzx   eax, word[es:si+2]
618
        inc     di
620
        inc     di
619
        mov     bl, 4
621
        mov     bl, 4
620
        call    int2str
622
        call    int2str
621
 
623
 
622
        movzx   eax, word[es:si+8]
624
        movzx   eax, word[es:si+8]
623
        inc     di
625
        inc     di
624
        mov     bl, 2
626
        mov     bl, 2
625
        call    int2str
627
        call    int2str
626
 
628
 
627
        cmp     si, word [cursor_pos]
629
        cmp     si, word [cursor_pos]
628
        jne     .next
630
        jne     .next
629
;draw   cursor
631
;draw   cursor
630
        mov     word[ds:_rs+21], '>>'
632
        mov     word[ds:_rs+21], '>>'
631
        mov     word[ds:_rs+46], '<<'
633
        mov     word[ds:_rs+46], '<<'
632
 
634
 
633
 
635
 
634
 
636
 
635
.next:
637
.next:
636
        push    si
638
        push    si
637
        mov     si, _rs
639
        mov     si, _rs
638
.@@_sh:
640
.@@_sh:
639
; add to the string pseudographics for scrollbar
641
; add to the string pseudographics for scrollbar
640
        pop     bx
642
        pop     bx
641
        push    bx
643
        push    bx
642
        mov     byte [si+53], ' '
644
        mov     byte [si+53], ' '
643
        cmp     bx, [scroll_start]
645
        cmp     bx, [scroll_start]
644
        jb      @f
646
        jb      @f
645
        cmp     bx, [scroll_end]
647
        cmp     bx, [scroll_end]
646
        jae     @f
648
        jae     @f
647
        mov     byte [si+53], 0xDB ; filled bar
649
        mov     byte [si+53], 0xDB ; filled bar
648
@@:
650
@@:
649
        push    bx
651
        push    bx
650
        add     bx, size_of_step
652
        add     bx, size_of_step
651
        cmp     bx, [end_cursor]
653
        cmp     bx, [end_cursor]
652
        jnz     @f
654
        jnz     @f
653
        mov     byte [si+53], 31 ; 'down arrow' symbol
655
        mov     byte [si+53], 31 ; 'down arrow' symbol
654
@@:
656
@@:
655
        sub     bx, [home_cursor]
657
        sub     bx, [home_cursor]
656
        cmp     bx, size_of_step*long_v_table
658
        cmp     bx, size_of_step*long_v_table
657
        jnz     @f
659
        jnz     @f
658
        mov     byte [si+53], 31 ; 'down arrow' symbol
660
        mov     byte [si+53], 31 ; 'down arrow' symbol
659
@@:
661
@@:
660
        pop     bx
662
        pop     bx
661
        cmp     bx, [home_cursor]
663
        cmp     bx, [home_cursor]
662
        jnz     @f
664
        jnz     @f
663
        mov     byte [si+53], 30 ; 'up arrow' symbol
665
        mov     byte [si+53], 30 ; 'up arrow' symbol
664
@@:
666
@@:
665
        call    printplain
667
        call    printplain
666
        pop     si
668
        pop     si
667
        add     si, size_of_step
669
        add     si, size_of_step
668
 
670
 
669
        dec     bp
671
        dec     bp
670
        jnz     .@@_next_bit
672
        jnz     .@@_next_bit
671
 
673
 
672
.@@_end:
674
.@@_end:
673
        mov     si, _bt
675
        mov     si, _bt
674
        call    printplain
676
        call    printplain
675
        ret
677
        ret
676
.show_0x13:
678
.show_0x13:
677
        push    si
679
        push    si
678
 
680
 
679
        cmp     si, word [cursor_pos]
681
        cmp     si, word [cursor_pos]
680
        jne     @f
682
        jne     @f
681
        mov     word[ds:_r1+21], '>>'
683
        mov     word[ds:_r1+21], '>>'
682
        mov     word[ds:_r1+50], '<<'
684
        mov     word[ds:_r1+50], '<<'
683
@@:
685
@@:
684
        mov     si, _r1
686
        mov     si, _r1
685
        jmp     .@@_sh
687
        jmp     .@@_sh
686
.show_0x12:
688
.show_0x12:
687
        push    si
689
        push    si
688
        cmp     si, word [cursor_pos]
690
        cmp     si, word [cursor_pos]
689
        jne     @f
691
        jne     @f
690
 
692
 
691
        mov     word[ds:_r2+21], '>>'
693
        mov     word[ds:_r2+21], '>>'
692
        mov     word[ds:_r2+45], '<<'
694
        mov     word[ds:_r2+45], '<<'
693
@@:
695
@@:
694
        mov     si, _r2
696
        mov     si, _r2
695
        jmp     .@@_sh
697
        jmp     .@@_sh
696
 
698
 
697
;-----------------------------------------------------------------------------
699
;-----------------------------------------------------------------------------
698
;Clear arrea of current video page (0xb800)
700
;Clear arrea of current video page (0xb800)
699
clear_vmodes_table:
701
clear_vmodes_table:
700
        pusha
702
        pusha
701
       ; draw frames
703
       ; draw frames
702
        push    es
704
        push    es
703
        push    0xb800
705
        push    0xb800
704
        pop     es
706
        pop     es
705
        mov     di, 1444
707
        mov     di, 1444
706
        xor     ax, ax
708
        xor     ax, ax
707
        mov     ah, 1*16+15
709
        mov     ah, 1*16+15
708
        mov     cx, 77
710
        mov     cx, 77
709
        mov     bp, 12
711
        mov     bp, 12
710
.loop_start:
712
.loop_start:
711
        rep stosw
713
        rep stosw
712
        mov     cx, 77
714
        mov     cx, 77
713
        add     di, 6
715
        add     di, 6
714
        dec     bp
716
        dec     bp
715
        jns     .loop_start
717
        jns     .loop_start
716
        pop     es
718
        pop     es
717
        popa
719
        popa
718
        ret
720
        ret
719
 
721
 
720
;-----------------------------------------------------------------------------
722
;-----------------------------------------------------------------------------
721
 
723
 
722
set_vmode:
724
set_vmode:
723
        push    0 ;0;x1000
725
        push    0 ;0;x1000
724
        pop     es
726
        pop     es
725
 
727
 
726
        mov     si, word [preboot_graph]           ;[preboot_graph]
728
        mov     si, word [preboot_graph]           ;[preboot_graph]
727
        mov     cx, word [es:si+6]           ; number of mode
729
        mov     cx, word [es:si+6]           ; number of mode
728
        
730
        
729
 
731
 
730
        mov     ax, word [es:si+0]           ; resolution X
732
        mov     ax, word [es:si+0]           ; resolution X
731
        mov     bx, word [es:si+2]           ; resolution Y
733
        mov     bx, word [es:si+2]           ; resolution Y
732
 
734
 
733
 
735
 
734
        mov     word [es:BOOT_LO.x_res], ax             ; resolution X
736
        mov     word [es:BOOT_LO.x_res], ax             ; resolution X
735
        mov     word [es:BOOT_LO.y_res], bx             ; resolution Y
737
        mov     word [es:BOOT_LO.y_res], bx             ; resolution Y
736
        mov     word [es:BOOT_LO.vesa_mode], cx         ; number of mode
738
        mov     word [es:BOOT_LO.vesa_mode], cx         ; number of mode
737
 
739
 
738
        cmp     cx, 0x12
740
        cmp     cx, 0x12
739
        je      .mode0x12_0x13
741
        je      .mode0x12_0x13
740
        cmp     cx, 0x13
742
        cmp     cx, 0x13
741
        je      .mode0x12_0x13
743
        je      .mode0x12_0x13
742
 
744
 
743
 
745
 
744
;        cmp     byte [s_vesa.ver], '2'
746
;        cmp     byte [s_vesa.ver], '2'
745
;        jb      .vesa12
747
;        jb      .vesa12
746
 
748
 
747
;  VESA 2 and Vesa 3
749
;  VESA 2 and Vesa 3
748
 
750
 
749
        mov     ax, 0x4f01
751
        mov     ax, 0x4f01
750
        and     cx, 0xfff
752
        and     cx, 0xfff
751
        mov     di, mi;0xa000
753
        mov     di, mi;0xa000
752
        int     0x10
754
        int     0x10
753
        ; LFB
755
        ; LFB
754
        mov     eax, [es:mi.PhysBasePtr];di+0x28]
756
        mov     eax, [es:mi.PhysBasePtr];di+0x28]
755
        mov     [es:BOOT_LO.lfb], eax
757
        mov     [es:BOOT_LO.lfb], eax
756
        ; ---- vbe voodoo
758
        ; ---- vbe voodoo
757
        BytesPerLine = 0x10
759
        BytesPerLine = 0x10
758
        mov     ax, [es:di+BytesPerLine]
760
        mov     ax, [es:di+BytesPerLine]
759
        mov     [es:BOOT_LO.pitch], ax
761
        mov     [es:BOOT_LO.pitch], ax
760
        ; BPP
762
        ; BPP
761
        cmp     [es:mi.BitsPerPixel], 16
763
        cmp     [es:mi.BitsPerPixel], 16
762
        jne     .l0
764
        jne     .l0
763
        cmp     [es:mi.GreenMaskSize], 5
765
        cmp     [es:mi.GreenMaskSize], 5
764
        jne     .l0
766
        jne     .l0
765
        mov     [es:mi.BitsPerPixel], 15
767
        mov     [es:mi.BitsPerPixel], 15
766
.l0:
768
.l0:
767
        mov     al, byte [es:di+0x19]
769
        mov     al, byte [es:di+0x19]
768
        mov     [es:BOOT_LO.bpp], al
770
        mov     [es:BOOT_LO.bpp], al
769
        jmp     .exit
771
        jmp     .exit
770
 
772
 
771
.mode0x12_0x13:
773
.mode0x12_0x13:
772
        mov     byte [es:BOOT_LO.bpp], 32
774
        mov     byte [es:BOOT_LO.bpp], 32
773
        or      dword [es:BOOT_LO.lfb], 0xFFFFFFFF; 0x800000
775
        or      dword [es:BOOT_LO.lfb], 0xFFFFFFFF; 0x800000
774
 
776
 
775
 
777
 
776
;  VESA 1.2 PM BANK SWITCH ADDRESS
778
;  VESA 1.2 PM BANK SWITCH ADDRESS
777
 
779
 
778
;.vesa12:
780
;.vesa12:
779
;        mov     ax, 0x4f0A
781
;        mov     ax, 0x4f0A
780
;        xor     bx, bx
782
;        xor     bx, bx
781
;        int     0x10
783
;        int     0x10
782
;        xor     eax, eax
784
;        xor     eax, eax
783
;        xor     ebx, ebx
785
;        xor     ebx, ebx
784
;        mov     ax, es
786
;        mov     ax, es
785
;        shl     eax, 4
787
;        shl     eax, 4
786
;        mov     bx, di
788
;        mov     bx, di
787
;        add     eax, ebx
789
;        add     eax, ebx
788
;        movzx   ebx, word[es:di]
790
;        movzx   ebx, word[es:di]
789
;        add     eax, ebx
791
;        add     eax, ebx
790
;        push    0x0000
792
;        push    0x0000
791
;        pop     es
793
;        pop     es
792
;        mov     [es:BOOT_LO.bank_sw], eax
794
;        mov     [es:BOOT_LO.bank_sw], eax
793
  .exit:
795
  .exit:
794
        ret
796
        ret
795
 
797
 
796
;=============================================================================
798
;=============================================================================
797
;=============================================================================
799
;=============================================================================
798
;=============================================================================
800
;=============================================================================
799
@@:
801
@@:
800
>
802
>
801
@@:
803
@@:
802
>
804
>
803
@@:
805
@@:
804
>
806
>
805
@@:
807
@@:
806
>
808
>
807
 
809
 
808
 
810
 
809
 
811
 
810
.next:
812
.next:
811
>
813
>
812
 
814
 
813
 
815
 
814
 
816
 
815
.next:
817
.next:
816
>
818
>