Subversion Repositories Kolibri OS

Rev

Rev 129 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 129 Rev 384
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                        ;;
2
;;                                                        ;;
3
;;  VGA.INC                                               ;;
3
;;  VGA.INC                                               ;;
4
;;                                                        ;;
4
;;                                                        ;;
5
;;  640x480 mode 0x12 VGA functions for MenuetOS          ;;
5
;;  640x480 mode 0x12 VGA functions for MenuetOS          ;;
6
;;                                                        ;;
6
;;                                                        ;;
7
;;  Paul Butcher, paul.butcher@asa.co.uk                  ;;
7
;;  Paul Butcher, paul.butcher@asa.co.uk                  ;;
8
;;                                                        ;;
8
;;                                                        ;;
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10
 
10
 
11
 
11
 
12
 
12
 
13
paletteVGA:
13
paletteVGA:
14
 
14
 
15
;16 colour palette
15
;16 colour palette
16
       mov    dx,0x3c8
16
       mov    dx,0x3c8
17
       mov    al,0
17
       mov    al,0
18
       out    dx,al
18
       out    dx,al
19
 
19
 
20
       mov    ecx,16
20
       mov    ecx,16
21
       mov    dx,0x3c9
21
       mov    dx,0x3c9
22
       xor    eax,eax
22
       xor    eax,eax
23
 
23
 
24
     palvganew:
24
     palvganew:
25
 
25
 
26
       mov al,0
26
       mov al,0
27
       test ah,4
27
       test ah,4
28
       jz palvgalbl1
28
       jz palvgalbl1
29
       add al,31
29
       add al,31
30
       test ah,8
30
       test ah,8
31
       jz palvgalbl1
31
       jz palvgalbl1
32
       add al,32
32
       add al,32
33
     palvgalbl1:
33
     palvgalbl1:
34
       out dx,al  ; red 0,31 or 63
34
       out dx,al  ; red 0,31 or 63
35
       mov al,0
35
       mov al,0
36
       test ah,2
36
       test ah,2
37
       jz palvgalbl2
37
       jz palvgalbl2
38
       add al,31
38
       add al,31
39
       test ah,8
39
       test ah,8
40
       jz palvgalbl2
40
       jz palvgalbl2
41
       add al,32
41
       add al,32
42
     palvgalbl2:
42
     palvgalbl2:
43
       out dx,al  ; blue 0,31 or 63
43
       out dx,al  ; blue 0,31 or 63
44
       mov al,0
44
       mov al,0
45
       test ah,1
45
       test ah,1
46
       jz palvgalbl3
46
       jz palvgalbl3
47
       add al,31
47
       add al,31
48
       test ah,8
48
       test ah,8
49
       jz palvgalbl3
49
       jz palvgalbl3
50
       add al,32
50
       add al,32
51
     palvgalbl3:
51
     palvgalbl3:
52
       out dx,al  ; green 0,31 or 63
52
       out dx,al  ; green 0,31 or 63
53
       add ah,1
53
       add ah,1
54
       loop palvganew
54
       loop palvganew
55
;       mov    dx, 3ceh
55
;       mov    dx, 3ceh
56
;       mov    ax, 0005h 
56
;       mov    ax, 0005h
57
;       out    dx, ax        
57
;       out    dx, ax
58
       ret
58
       ret
59
 
59
 
60
palette320x200:
60
palette320x200:
61
 
61
 
62
       mov   edx,0x3c8
62
       mov   edx,0x3c8
63
       xor   eax, eax
63
       xor   eax, eax
64
       out   dx,al
64
       out   dx,al
65
       mov   ecx,256
65
       mov   ecx,256
66
       mov   edx,0x3c9
66
       mov   edx,0x3c9
67
       xor   eax,eax
67
       xor   eax,eax
68
 
68
 
69
     palnew:
69
     palnew:
70
       mov   al,0
70
       mov   al,0
71
       test  ah,64
71
       test  ah,64
72
       jz    pallbl1
72
       jz    pallbl1
73
       add   al,21
73
       add   al,21
74
     pallbl1:
74
     pallbl1:
75
       test  ah,128
75
       test  ah,128
76
       jz    pallbl2
76
       jz    pallbl2
77
       add   al,42
77
       add   al,42
78
     pallbl2:
78
     pallbl2:
79
       out   dx,al
79
       out   dx,al
80
       mov   al,0
80
       mov   al,0
81
       test  ah,8
81
       test  ah,8
82
       jz    pallbl3
82
       jz    pallbl3
83
       add   al,8
83
       add   al,8
84
     pallbl3:
84
     pallbl3:
85
       test  ah,16
85
       test  ah,16
86
       jz    pallbl4
86
       jz    pallbl4
87
       add   al,15
87
       add   al,15
88
     pallbl4:
88
     pallbl4:
89
       test  ah,32
89
       test  ah,32
90
       jz    pallbl5
90
       jz    pallbl5
91
       add   al,40
91
       add   al,40
92
     pallbl5:
92
     pallbl5:
93
       out   dx,al
93
       out   dx,al
94
       mov   al,0
94
       mov   al,0
95
       test  ah,1
95
       test  ah,1
96
       jz    pallbl6
96
       jz    pallbl6
97
       add   al,8
97
       add   al,8
98
     pallbl6:
98
     pallbl6:
99
       test  ah,2
99
       test  ah,2
100
       jz    pallbl7
100
       jz    pallbl7
101
       add   al,15
101
       add   al,15
102
     pallbl7:
102
     pallbl7:
103
       test  ah,4
103
       test  ah,4
104
       jz    pallbl8
104
       jz    pallbl8
105
       add   al,40
105
       add   al,40
106
     pallbl8:
106
     pallbl8:
107
       out   dx,al
107
       out   dx,al
108
       add   ah,1
108
       add   ah,1
109
       loop  palnew
109
       loop  palnew
110
 
110
 
111
       ret
111
       ret
112
 
112
 
113
uglobal
113
uglobal
114
  novesachecksum dd 0x0
114
  novesachecksum dd 0x0
115
  EGA_counter    db  0
115
  EGA_counter    db  0
116
  VGA_drawing_screen db 0
116
  VGA_drawing_screen db 0
117
  VGA_8_pixels: 
117
  VGA_8_pixels:
118
     rb 16
118
     rb 16
119
  temp:
119
  temp:
120
     .cx dd 0
120
     .cx dd 0
121
endg
121
endg
122
 
122
 
123
checkVga_N13:
123
checkVga_N13:
124
 
124
 
125
        cmp    [0xfe0c],dword 0x13
125
        cmp    [SCR_MODE],dword 0x13
126
        jne   @f
126
        jne   @f
127
 
127
 
128
;      cnvl:
128
;      cnvl:
129
        pushad
129
        pushad
130
        cmp   [EGA_counter],1
130
        cmp   [EGA_counter],1
131
        je   novesal
131
        je   novesal
132
        mov    ecx,[0xfb0a]
132
        mov    ecx,[MOUSE_X]
133
        cmp    ecx,[novesachecksum]
133
        cmp    ecx,[novesachecksum]
134
        jne    novesal
134
        jne    novesal
135
        popad
135
        popad
136
      @@:
136
      @@:
137
        ret
137
        ret
138
 
138
 
139
      novesal:
139
      novesal:
140
        mov    [novesachecksum],ecx
140
        mov    [novesachecksum],ecx
141
        mov    ecx,0
141
        mov    ecx,0
142
        movzx  eax,word [0xfb0c]
142
        movzx  eax,word [0xfb0c]
143
        cmp    eax,100
143
        cmp    eax,100
144
        jge    m13l3
144
        jge    m13l3
145
        mov    eax,100
145
        mov    eax,100
146
      m13l3:
146
      m13l3:
147
        cmp    eax,480-100
147
        cmp    eax,480-100
148
        jbe    m13l4
148
        jbe    m13l4
149
        mov    eax,480-100
149
        mov    eax,480-100
150
      m13l4:
150
      m13l4:
151
        sub    eax,100
151
        sub    eax,100
152
        imul   eax,640*4
152
        imul   eax,640*4
153
        add    ecx,eax
153
        add    ecx,eax
154
        movzx  eax,word [0xfb0a]
154
        movzx  eax,word [MOUSE_X]
155
        cmp    eax,160
155
        cmp    eax,160
156
        jge    m13l1
156
        jge    m13l1
157
        mov    eax,160
157
        mov    eax,160
158
      m13l1:
158
      m13l1:
159
        cmp    eax,640-160
159
        cmp    eax,640-160
160
        jbe    m13l2
160
        jbe    m13l2
161
        mov    eax,640-160
161
        mov    eax,640-160
162
      m13l2:
162
      m13l2:
163
        sub    eax,160
163
        sub    eax,160
164
        shl    eax,2
164
        shl    eax,2
165
        add    ecx,eax
165
        add    ecx,eax
166
        mov    esi,[0xfe80]
166
        mov    esi,[LFBAddress]
167
        add    esi,ecx
167
        add    esi,ecx
168
        mov    edi,0xa0000
168
        mov    edi,VGABasePtr
169
        mov    edx,200
169
        mov    edx,200
170
        mov    ecx,320
170
        mov    ecx,320
171
        cld
171
        cld
172
     m13pix:
172
     m13pix:
173
        lodsd
173
        lodsd
174
        cmp    eax,0
174
        cmp    eax,0
175
        je    .save_pixel
175
        je    .save_pixel
176
        push   eax
176
        push   eax
177
        mov    ebx,eax
177
        mov    ebx,eax
178
        and    eax,(128+64+32)      ; blue
178
        and    eax,(128+64+32)      ; blue
179
        shr    eax,5
179
        shr    eax,5
180
        and    ebx,(128+64+32)*256  ; green
180
        and    ebx,(128+64+32)*256  ; green
181
        shr    ebx,8+2
181
        shr    ebx,8+2
182
        add    eax,ebx
182
        add    eax,ebx
183
        pop    ebx
183
        pop    ebx
184
        and    ebx,(128+64)*256*256 ; red
184
        and    ebx,(128+64)*256*256 ; red
185
        shr    ebx,8+8
185
        shr    ebx,8+8
186
        add    eax,ebx
186
        add    eax,ebx
187
     .save_pixel:
187
     .save_pixel:
188
        stosb
188
        stosb
189
        loop   m13pix
189
        loop   m13pix
190
        mov    ecx,320
190
        mov    ecx,320
191
        add    esi,4*(640-320)
191
        add    esi,4*(640-320)
192
        dec    edx
192
        dec    edx
193
        jnz    m13pix
193
        jnz    m13pix
194
        mov    [EGA_counter],0
194
        mov    [EGA_counter],0
195
        popad
195
        popad
196
        ret
196
        ret
197
 
197
 
198
VGA_drawbackground:
198
VGA_drawbackground:
199
; draw all  
199
; draw all
200
        cmp    [0xfe0c],dword 0x12
200
        cmp    [SCR_MODE],dword 0x12
201
        jne     .end
201
        jne     .end
202
        pushad
202
        pushad
203
        mov    esi,[0xfe80]
203
        mov    esi,[LFBAddress]
204
        mov    edi,0xa0000
204
        mov    edi,VGABasePtr
205
        mov    ebx,640/32  ; 640*480/(8*4)
205
        mov    ebx,640/32  ; 640*480/(8*4)
206
        mov    edx,480
206
        mov    edx,480
207
     @@:
207
     @@:
208
        push   ebx edx esi edi
208
        push   ebx edx esi edi
209
        shl    edx,9           
209
        shl    edx,9
210
        lea    edx,[edx+edx*4]
210
        lea    edx,[edx+edx*4]
211
        add    esi,edx
211
        add    esi,edx
212
        shr    edx,5
212
        shr    edx,5
213
        add    edi,edx
213
        add    edi,edx
214
        call   VGA_draw_long_line
214
        call   VGA_draw_long_line
215
        pop    edi esi edx ebx
215
        pop    edi esi edx ebx
216
        dec    edx
216
        dec    edx
217
        jnz    @r
217
        jnz    @r
218
        call   VGA_draw_long_line_1
218
        call   VGA_draw_long_line_1
219
        popad
219
        popad
220
    .end:
220
    .end:
221
        ret
221
        ret
222
 
222
 
223
VGA_draw_long_line:
223
VGA_draw_long_line:
224
        mov    dx,3ceh
224
        mov    dx,3ceh
225
        mov    ax,0ff08h
225
        mov    ax,0ff08h
226
        cli
226
        cli
227
        out    dx, ax 
227
        out    dx, ax
228
        mov    ax,0005h
228
        mov    ax,0005h
229
        out    dx, ax
229
        out    dx, ax
230
    m12pix:
230
    m12pix:
231
        call   VGA_draw_32_pixels
231
        call   VGA_draw_32_pixels
232
        dec    ebx
232
        dec    ebx
233
        jnz    m12pix
233
        jnz    m12pix
234
        mov    dx,3c4h
234
        mov    dx,3c4h
235
        mov    ax,0ff02h
235
        mov    ax,0ff02h
236
        out    dx,ax
236
        out    dx,ax
237
        mov    dx,3ceh
237
        mov    dx,3ceh
238
        mov    ax,0205h
238
        mov    ax,0205h
239
        out    dx,ax
239
        out    dx,ax
240
        mov    dx,3ceh
240
        mov    dx,3ceh
241
        mov    al,08h
241
        mov    al,08h
242
        out    dx,al
242
        out    dx,al
243
        sti
243
        sti
244
        ret
244
        ret
245
 
245
 
246
VGA_draw_32_pixels:
246
VGA_draw_32_pixels:
247
        xor    eax,eax
247
        xor    eax,eax
248
        mov    ebp,VGA_8_pixels
248
        mov    ebp,VGA_8_pixels
249
        mov    [ebp],eax
249
        mov    [ebp],eax
250
        mov    [ebp+4],eax
250
        mov    [ebp+4],eax
251
        mov    [ebp+8],eax
251
        mov    [ebp+8],eax
252
        mov    [ebp+12],eax
252
        mov    [ebp+12],eax
253
        mov    ch,4
253
        mov    ch,4
254
    .main_loop:
254
    .main_loop:
255
        mov    cl,8
255
        mov    cl,8
256
    .convert_pixels_to_VGA:
256
    .convert_pixels_to_VGA:
257
        lodsd   ; eax = 24bit colour
257
        lodsd   ; eax = 24bit colour
258
        cmp    eax,0
258
        cmp    eax,0
259
        je     .end
259
        je     .end
260
        rol    eax,8
260
        rol    eax,8
261
        mov    al,ch
261
        mov    al,ch
262
        ror    eax,8
262
        ror    eax,8
263
        mov    ch,1
263
        mov    ch,1
264
        dec    cl
264
        dec    cl
265
        shl    ch,cl
265
        shl    ch,cl
266
        cmp    al,85
266
        cmp    al,85
267
        jbe     .p13green
267
        jbe     .p13green
268
        or     [ebp],ch
268
        or     [ebp],ch
269
        cmp    al,170
269
        cmp    al,170
270
        jbe     .p13green
270
        jbe     .p13green
271
        or     [ebp+12],ch
271
        or     [ebp+12],ch
272
    .p13green:
272
    .p13green:
273
        cmp    ah,85
273
        cmp    ah,85
274
        jbe     .p13red
274
        jbe     .p13red
275
        or     [ebp+4],ch
275
        or     [ebp+4],ch
276
        cmp    ah,170
276
        cmp    ah,170
277
        jbe     .p13red
277
        jbe     .p13red
278
        or     [ebp+12],ch
278
        or     [ebp+12],ch
279
    .p13red:
279
    .p13red:
280
        shr    eax,8
280
        shr    eax,8
281
        cmp    ah,85
281
        cmp    ah,85
282
        jbe     .p13cont
282
        jbe     .p13cont
283
        or     [ebp+8],ch
283
        or     [ebp+8],ch
284
        cmp    ah,170
284
        cmp    ah,170
285
        jbe     .p13cont
285
        jbe     .p13cont
286
        or     [ebp+12],ch
286
        or     [ebp+12],ch
287
    .p13cont:
287
    .p13cont:
288
        ror    eax,8
288
        ror    eax,8
289
        mov    ch,ah
289
        mov    ch,ah
290
        inc    cl
290
        inc    cl
291
    .end:
291
    .end:
292
        dec    cl
292
        dec    cl
293
        jnz    .convert_pixels_to_VGA
293
        jnz    .convert_pixels_to_VGA
294
        inc    ebp
294
        inc    ebp
295
        dec    ch
295
        dec    ch
296
        jnz    .main_loop
296
        jnz    .main_loop
297
        push   esi
297
        push   esi
298
        sub    ebp,4
298
        sub    ebp,4
299
        mov    esi,ebp
299
        mov    esi,ebp
300
        mov    dx, 3c4h
300
        mov    dx, 3c4h
301
        mov    ah, 1h
301
        mov    ah, 1h
302
    @@:
302
    @@:
303
        mov    al, 02h
303
        mov    al, 02h
304
        out    dx,ax
304
        out    dx,ax
305
        xchg   ax,bp
305
        xchg   ax,bp
306
        lodsd
306
        lodsd
307
        mov    [edi],eax
307
        mov    [edi],eax
308
        xchg   ax,bp
308
        xchg   ax,bp
309
        shl    ah, 1
309
        shl    ah, 1
310
        cmp    ah, 10h
310
        cmp    ah, 10h
311
        jnz    @r
311
        jnz    @r
312
        add    edi,4
312
        add    edi,4
313
        pop    esi
313
        pop    esi
314
        ret
314
        ret
315
 
315
 
316
VGA_putpixel:
316
VGA_putpixel:
317
 ; eax = x
317
 ; eax = x
318
 ; ebx = y
318
 ; ebx = y
319
        mov     ecx,eax
319
        mov     ecx,eax
320
        mov     eax, [esp+32-8+4] ; color
320
        mov     eax, [esp+32-8+4] ; color
321
        shl        ebx,9           
321
        shl        ebx,9
322
        lea        ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
322
        lea        ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
323
        lea     edx, [ebx+ecx*4]  ; + x*BytesPerPixel (Vesa2.0 32)
323
        lea     edx, [ebx+ecx*4]  ; + x*BytesPerPixel (Vesa2.0 32)
324
        mov     edi,edx
324
        mov     edi,edx
325
        add     edi, [0xfe80]     ; + LFB address
325
        add     edi, [LFBAddress]     ; + LFB address
326
        mov     [edi], eax        ; write to LFB for Vesa2.0
326
        mov     [edi], eax        ; write to LFB for Vesa2.0
327
        shr     edx,5             ; change BytesPerPixel to 1/8
327
        shr     edx,5             ; change BytesPerPixel to 1/8
328
        mov     edi,edx
328
        mov     edi,edx
329
        add     edi, 0x0a0000     ; address of pixel in VGA area
329
        add     edi, VGABasePtr     ; address of pixel in VGA area
330
        and     ecx,0x07          ; bit no. (modulo 8)
330
        and     ecx,0x07          ; bit no. (modulo 8)
331
        pushfd
331
        pushfd
332
        ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
332
        ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
333
        xor    edx,edx
333
        xor    edx,edx
334
        cmp    eax,0
334
        cmp    eax,0
335
        je     .p13cont
335
        je     .p13cont
336
        cmp    al,85
336
        cmp    al,85
337
        jbe    .p13green
337
        jbe    .p13green
338
        or     dl,0x01
338
        or     dl,0x01
339
        cmp    al,170
339
        cmp    al,170
340
        jbe    .p13green
340
        jbe    .p13green
341
        or     dl,0x08
341
        or     dl,0x08
342
.p13green:
342
.p13green:
343
        cmp    ah,85
343
        cmp    ah,85
344
        jbe    .p13red
344
        jbe    .p13red
345
        or     dl,0x02
345
        or     dl,0x02
346
        cmp    ah,170
346
        cmp    ah,170
347
        jbe    .p13red
347
        jbe    .p13red
348
        or     dl,0x08
348
        or     dl,0x08
349
.p13red: 
349
.p13red:
350
        shr    eax,8
350
        shr    eax,8
351
        cmp    ah,85
351
        cmp    ah,85
352
        jbe    .p13cont
352
        jbe    .p13cont
353
        or     dl,0x04
353
        or     dl,0x04
354
        cmp    ah,170
354
        cmp    ah,170
355
        jbe    .p13cont
355
        jbe    .p13cont
356
        or     dl,0x08
356
        or     dl,0x08
357
.p13cont:
357
.p13cont:
358
        ror    edx,8
358
        ror    edx,8
359
        inc    cl
359
        inc    cl
360
        xor    eax,eax
360
        xor    eax,eax
361
        inc    ah
361
        inc    ah
362
        shr    ax,cl
362
        shr    ax,cl
363
        mov    dx,3cfh
363
        mov    dx,3cfh
364
        cli
364
        cli
365
        out    dx,al
365
        out    dx,al
366
        mov    al,[edi]           ; dummy read
366
        mov    al,[edi]           ; dummy read
367
        rol    edx,8
367
        rol    edx,8
368
        mov    [edi],dl
368
        mov    [edi],dl
369
        popfd
369
        popfd
370
;.end:
370
;.end:
371
        ret
371
        ret
372
        
372
 
373
VGA__putimage:
373
VGA__putimage:
374
; ecx = size [x|y]
374
; ecx = size [x|y]
375
; edx = coordinates [x|y]
375
; edx = coordinates [x|y]
376
        cmp    [0xfe0c],dword 0x12
376
        cmp    [SCR_MODE],dword 0x12
377
        jne     @f
377
        jne     @f
378
         pushad
378
         pushad
379
         rol  edx,16
379
         rol  edx,16
380
         movzx eax,dx
380
         movzx eax,dx
381
         rol  edx,16
381
         rol  edx,16
382
         movzx ebx,dx
382
         movzx ebx,dx
383
         movzx edx,cx
383
         movzx edx,cx
384
         rol   ecx,16
384
         rol   ecx,16
385
         movzx ecx,cx
385
         movzx ecx,cx
386
         call  VGA_draw_bar_1
386
         call  VGA_draw_bar_1
387
         popad
387
         popad
388
@@:
388
@@:
389
         ret
389
         ret
390
 
390
 
391
VGA_draw_bar:
391
VGA_draw_bar:
392
; eax   cx
392
; eax   cx
393
; ebx   cy
393
; ebx   cy
394
; ecx   xe
394
; ecx   xe
395
; edx   ye
395
; edx   ye
396
        cmp    [0xfe0c],dword 0x12
396
        cmp    [SCR_MODE],dword 0x12
397
        jne     @f
397
        jne     @f
398
         pushad
398
         pushad
399
         sub   ecx,eax
399
         sub   ecx,eax
400
         sub   edx,ebx
400
         sub   edx,ebx
401
         and   eax,0xffff
401
         and   eax,0xffff
402
         and   ebx,0xffff
402
         and   ebx,0xffff
403
         and   ecx,0xffff
403
         and   ecx,0xffff
404
         and   edx,0xffff
404
         and   edx,0xffff
405
         call  VGA_draw_bar_1
405
         call  VGA_draw_bar_1
406
         popad
406
         popad
407
@@:
407
@@:
408
         ret
408
         ret
409
 
409
 
410
VGA_draw_bar_1:
410
VGA_draw_bar_1:
411
        mov     [temp.cx],eax
411
        mov     [temp.cx],eax
412
        mov     eax, [0x3010]
412
        mov     eax, [TASK_BASE]
413
        add     ebx, [eax-twdw + 4]
413
        add     ebx, [eax-twdw + 4]
414
        mov     eax, [eax-twdw + 0]
414
        mov     eax, [eax-twdw + 0]
415
        add     eax, [temp.cx]
415
        add     eax, [temp.cx]
416
        and     eax,0xfff8
416
        and     eax,0xfff8
417
        shl     ebx,9           
417
        shl     ebx,9
418
        lea     ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
418
        lea     ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
419
        lea     ebx, [ebx+eax*4]  ; + x*BytesPerPixel (Vesa2.0 32)
419
        lea     ebx, [ebx+eax*4]  ; + x*BytesPerPixel (Vesa2.0 32)
420
        mov     esi,ebx
420
        mov     esi,ebx
421
        add     esi, [0xfe80]     ; + LFB address
421
        add     esi, [LFBAddress]     ; + LFB address
422
        shr     ebx,5             ; change BytesPerPixel to 1/8
422
        shr     ebx,5             ; change BytesPerPixel to 1/8
423
        mov     edi,ebx
423
        mov     edi,ebx
424
        add     edi, 0x0a0000     ; address of pixel in VGA area
424
        add     edi, VGABasePtr   ; address of pixel in VGA area
425
        mov     ebx,ecx
425
        mov     ebx,ecx
426
        shr     ebx,5
426
        shr     ebx,5
427
        inc     ebx
427
        inc     ebx
428
.main_loop:
428
.main_loop:
429
        call   VGA_draw_long_line_1
429
        call   VGA_draw_long_line_1
430
        dec    edx
430
        dec    edx
431
        jnz    .main_loop
431
        jnz    .main_loop
432
        call   VGA_draw_long_line_1
432
        call   VGA_draw_long_line_1
433
        ret
433
        ret
434
 
434
 
435
VGA_draw_long_line_1:
435
VGA_draw_long_line_1:
436
        push   ebx edx esi edi
436
        push   ebx edx esi edi
437
        shl    edx,9           
437
        shl    edx,9
438
        lea    edx,[edx+edx*4]
438
        lea    edx,[edx+edx*4]
439
        add    esi,edx
439
        add    esi,edx
440
        shr    edx,5
440
        shr    edx,5
441
        add    edi,edx
441
        add    edi,edx
442
        call   VGA_draw_long_line
442
        call   VGA_draw_long_line
443
        pop    edi esi edx ebx
443
        pop    edi esi edx ebx
444
        ret
444
        ret