Subversion Repositories Kolibri OS

Rev

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

Rev 389 Rev 425
-
 
1
$Revision: 425 $
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                        ;;
3
;;                                                        ;;
3
;;  VESA20.INC                                            ;;
4
;;  VESA20.INC                                            ;;
4
;;                                                        ;;
5
;;                                                        ;;
5
;;  Vesa 2.0 functions for MenuetOS                       ;;
6
;;  Vesa 2.0 functions for MenuetOS                       ;;
6
;;                                                        ;;
7
;;                                                        ;;
7
;;  Copyright 2002 Ville Turjanmaa                        ;;
8
;;  Copyright 2002 Ville Turjanmaa                        ;;
8
;;  Alexey, kgaz@crosswindws.net                          ;;
9
;;  Alexey, kgaz@crosswindws.net                          ;;
9
;;  - Voodoo compatible graphics                          ;;
10
;;  - Voodoo compatible graphics                          ;;
10
;;  Juan M. Caravaca                                      ;;
11
;;  Juan M. Caravaca                                      ;;
11
;;  - Graphics optimimizations eg. drawline               ;;
12
;;  - Graphics optimimizations eg. drawline               ;;
12
;;                                                        ;;
13
;;                                                        ;;
13
;;  See file COPYING for details                          ;;
14
;;  See file COPYING for details                          ;;
14
;;                                                        ;;
15
;;                                                        ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16
 
17
 
17
; If you're planning to write your own video driver I suggest
18
; If you're planning to write your own video driver I suggest
18
; you replace the VESA12.INC file and see those instructions.
19
; you replace the VESA12.INC file and see those instructions.
19
 
20
 
20
;ScreenWidth             equ     0xfe00
21
;ScreenWidth             equ     0xfe00
21
;ScreenHeight            equ     0xfe04
22
;ScreenHeight            equ     0xfe04
22
;BytesPerScanLine        equ     0xfe08
23
;BytesPerScanLine        equ     0xfe08
23
;LFBAddress              equ     0xfe80
24
;LFBAddress              equ     0xfe80
24
;ScreenBPP               equ     0xfbf1
25
;ScreenBPP               equ     0xfbf1
25
;WinMapAddress           equ     0x460000
26
;WinMapAddress           equ     0x460000
26
 
27
 
27
 
28
 
28
 
29
 
29
;*************************************************
30
;*************************************************
30
; getpixel
31
; getpixel
31
;
32
;
32
; in:
33
; in:
33
; eax = x coordinate
34
; eax = x coordinate
34
; ebx = y coordinate
35
; ebx = y coordinate
35
;
36
;
36
; ret:
37
; ret:
37
; ecx = 00 RR GG BB
38
; ecx = 00 RR GG BB
38
 
39
 
39
getpixel:
40
getpixel:
40
        push    eax ebx edx edi
41
        push    eax ebx edx edi
41
        call    dword [GETPIXEL]
42
        call    dword [GETPIXEL]
42
        pop     edi edx ebx eax
43
        pop     edi edx ebx eax
43
        ret
44
        ret
44
 
45
 
45
Vesa20_getpixel24:
46
Vesa20_getpixel24:
46
        ; eax = x
47
        ; eax = x
47
        ; ebx = y
48
        ; ebx = y
48
        imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
49
        imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
49
        lea     edi, [eax+eax*2] ; edi = x*3
50
        lea     edi, [eax+eax*2] ; edi = x*3
50
        add     edi, ebx         ; edi = x*3+(y*y multiplier)
51
        add     edi, ebx         ; edi = x*3+(y*y multiplier)
51
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
52
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
52
        mov     ecx, [edi]
53
        mov     ecx, [edi]
53
        and     ecx, 0xffffff
54
        and     ecx, 0xffffff
54
        ret
55
        ret
55
 
56
 
56
 
57
 
57
Vesa20_getpixel32:
58
Vesa20_getpixel32:
58
        imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
59
        imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
59
        lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
60
        lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
60
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
61
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
61
        mov     ecx, [edi]
62
        mov     ecx, [edi]
62
        and     ecx, 0xffffff
63
        and     ecx, 0xffffff
63
        ret
64
        ret
64
 
65
 
65
;*************************************************
66
;*************************************************
66
 
67
 
67
virtual at esp
68
virtual at esp
68
 putimg:
69
 putimg:
69
   .real_sx        dd ?
70
   .real_sx        dd ?
70
   .real_sy        dd ?
71
   .real_sy        dd ?
71
   .image_sx       dd ?
72
   .image_sx       dd ?
72
   .image_sy       dd ?
73
   .image_sy       dd ?
73
   .image_cx       dd ?
74
   .image_cx       dd ?
74
   .image_cy       dd ?
75
   .image_cy       dd ?
75
   .pti            dd ?
76
   .pti            dd ?
76
   .abs_cx         dd ?
77
   .abs_cx         dd ?
77
   .abs_cy         dd ?
78
   .abs_cy         dd ?
78
   .line_increment dd ?
79
   .line_increment dd ?
79
   .winmap_newline dd ?
80
   .winmap_newline dd ?
80
   .screen_newline dd ?
81
   .screen_newline dd ?
81
   .stack_data = 4*12
82
   .stack_data = 4*12
82
   .edi         dd      ?
83
   .edi         dd      ?
83
   .esi         dd      ?
84
   .esi         dd      ?
84
   .ebp         dd      ?
85
   .ebp         dd      ?
85
   .esp         dd      ?
86
   .esp         dd      ?
86
   .ebx         dd      ?
87
   .ebx         dd      ?
87
   .edx         dd      ?
88
   .edx         dd      ?
88
   .ecx         dd      ?
89
   .ecx         dd      ?
89
   .eax         dd      ?
90
   .eax         dd      ?
90
   .ret_addr    dd      ?
91
   .ret_addr    dd      ?
91
   .arg_0       dd      ?
92
   .arg_0       dd      ?
92
end virtual
93
end virtual
93
 
94
 
94
align 16
95
align 16
95
; ebx = pointer
96
; ebx = pointer
96
; ecx = size [x|y]
97
; ecx = size [x|y]
97
; edx = coordinates [x|y]
98
; edx = coordinates [x|y]
98
; ebp = pointer to 'get' function
99
; ebp = pointer to 'get' function
99
; esi = pointer to 'init' function
100
; esi = pointer to 'init' function
100
; edi = parameter for 'get' function
101
; edi = parameter for 'get' function
101
vesa20_putimage:
102
vesa20_putimage:
102
        pushad
103
        pushad
103
        call    [disable_mouse]
104
        call    [disable_mouse]
104
 
105
 
105
        sub     esp, putimg.stack_data
106
        sub     esp, putimg.stack_data
106
 
107
 
107
        ; save pointer to image
108
        ; save pointer to image
108
        mov     [putimg.pti], ebx
109
        mov     [putimg.pti], ebx
109
 
110
 
110
        ; unpack the size
111
        ; unpack the size
111
        mov     eax, ecx
112
        mov     eax, ecx
112
        and     ecx, 0xFFFF
113
        and     ecx, 0xFFFF
113
        shr     eax, 16
114
        shr     eax, 16
114
        mov     [putimg.image_sx], eax
115
        mov     [putimg.image_sx], eax
115
        mov     [putimg.image_sy], ecx
116
        mov     [putimg.image_sy], ecx
116
 
117
 
117
        ; unpack the coordinates
118
        ; unpack the coordinates
118
        mov     eax, edx
119
        mov     eax, edx
119
        and     edx, 0xFFFF
120
        and     edx, 0xFFFF
120
        shr     eax, 16
121
        shr     eax, 16
121
        mov     [putimg.image_cx], eax
122
        mov     [putimg.image_cx], eax
122
        mov     [putimg.image_cy], edx
123
        mov     [putimg.image_cy], edx
123
 
124
 
124
        ; calculate absolute (i.e. screen) coordinates
125
        ; calculate absolute (i.e. screen) coordinates
125
        mov     eax, [TASK_BASE]
126
        mov     eax, [TASK_BASE]
126
        mov     ebx, [eax-twdw + WDATA.box.left]
127
        mov     ebx, [eax-twdw + WDATA.box.left]
127
        add     ebx, [putimg.image_cx]
128
        add     ebx, [putimg.image_cx]
128
        mov     [putimg.abs_cx], ebx
129
        mov     [putimg.abs_cx], ebx
129
        mov     ebx, [eax-twdw + WDATA.box.top]
130
        mov     ebx, [eax-twdw + WDATA.box.top]
130
        add     ebx, [putimg.image_cy]
131
        add     ebx, [putimg.image_cy]
131
        mov     [putimg.abs_cy], ebx
132
        mov     [putimg.abs_cy], ebx
132
 
133
 
133
        ; real_sx = MIN(wnd_sx-image_cx, image_sx);
134
        ; real_sx = MIN(wnd_sx-image_cx, image_sx);
134
        mov     ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
135
        mov     ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
135
; \begin{diamond}[20.08.2006]
136
; \begin{diamond}[20.08.2006]
136
; note that WDATA.box.width is one pixel less than real window x-size
137
; note that WDATA.box.width is one pixel less than real window x-size
137
        inc     ebx
138
        inc     ebx
138
; \end{diamond}[20.08.2006]
139
; \end{diamond}[20.08.2006]
139
        sub     ebx, [putimg.image_cx]
140
        sub     ebx, [putimg.image_cx]
140
        ja      @f
141
        ja      @f
141
        add     esp, putimg.stack_data
142
        add     esp, putimg.stack_data
142
        popad
143
        popad
143
        ret
144
        ret
144
      @@:
145
      @@:
145
        cmp     ebx, [putimg.image_sx]
146
        cmp     ebx, [putimg.image_sx]
146
        jbe     .end_x
147
        jbe     .end_x
147
        mov     ebx, [putimg.image_sx]
148
        mov     ebx, [putimg.image_sx]
148
      .end_x:
149
      .end_x:
149
        mov     [putimg.real_sx], ebx
150
        mov     [putimg.real_sx], ebx
150
 
151
 
151
        ; init real_sy
152
        ; init real_sy
152
        mov     ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
153
        mov     ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
153
; \begin{diamond}[20.08.2006]
154
; \begin{diamond}[20.08.2006]
154
        inc     ebx
155
        inc     ebx
155
; \end{diamond}[20.08.2006]
156
; \end{diamond}[20.08.2006]
156
        sub     ebx, [putimg.image_cy]
157
        sub     ebx, [putimg.image_cy]
157
        ja      @f
158
        ja      @f
158
        add     esp, putimg.stack_data
159
        add     esp, putimg.stack_data
159
        popad
160
        popad
160
        ret
161
        ret
161
      @@:
162
      @@:
162
        cmp     ebx, [putimg.image_sy]
163
        cmp     ebx, [putimg.image_sy]
163
        jbe     .end_y
164
        jbe     .end_y
164
        mov     ebx, [putimg.image_sy]
165
        mov     ebx, [putimg.image_sy]
165
      .end_y:
166
      .end_y:
166
        mov     [putimg.real_sy], ebx
167
        mov     [putimg.real_sy], ebx
167
 
168
 
168
        ; line increment
169
        ; line increment
169
        mov     eax, [putimg.image_sx]
170
        mov     eax, [putimg.image_sx]
170
        sub     eax, [putimg.real_sx]
171
        sub     eax, [putimg.real_sx]
171
;;        imul    eax, [putimg.source_bpp]
172
;;        imul    eax, [putimg.source_bpp]
172
;        lea     eax, [eax + eax * 2]
173
;        lea     eax, [eax + eax * 2]
173
        call    esi
174
        call    esi
174
        add     eax, [putimg.arg_0]
175
        add     eax, [putimg.arg_0]
175
        mov     [putimg.line_increment], eax
176
        mov     [putimg.line_increment], eax
176
 
177
 
177
        ; winmap new line increment
178
        ; winmap new line increment
178
        mov     eax, [ScreenWidth]
179
        mov     eax, [ScreenWidth]
179
        inc     eax
180
        inc     eax
180
        sub     eax, [putimg.real_sx]
181
        sub     eax, [putimg.real_sx]
181
        mov     [putimg.winmap_newline], eax
182
        mov     [putimg.winmap_newline], eax
182
 
183
 
183
        ; screen new line increment
184
        ; screen new line increment
184
        mov     eax, [BytesPerScanLine]
185
        mov     eax, [BytesPerScanLine]
185
        mov     ecx, [putimg.real_sx]
186
        mov     ecx, [putimg.real_sx]
186
        movzx   ebx, byte [ScreenBPP]
187
        movzx   ebx, byte [ScreenBPP]
187
        shr     ebx, 3
188
        shr     ebx, 3
188
        imul    ecx, ebx
189
        imul    ecx, ebx
189
        sub     eax, ecx
190
        sub     eax, ecx
190
        mov     [putimg.screen_newline], eax
191
        mov     [putimg.screen_newline], eax
191
 
192
 
192
        ; pointer to image
193
        ; pointer to image
193
        mov     esi, [putimg.pti]
194
        mov     esi, [putimg.pti]
194
 
195
 
195
        ; pointer to screen
196
        ; pointer to screen
196
        mov     edx, [putimg.abs_cy]
197
        mov     edx, [putimg.abs_cy]
197
        imul    edx, [BytesPerScanLine]
198
        imul    edx, [BytesPerScanLine]
198
        mov     eax, [putimg.abs_cx]
199
        mov     eax, [putimg.abs_cx]
199
        movzx   ebx, byte [ScreenBPP]
200
        movzx   ebx, byte [ScreenBPP]
200
        shr     ebx, 3
201
        shr     ebx, 3
201
        imul    eax, ebx
202
        imul    eax, ebx
202
        add     edx, eax
203
        add     edx, eax
203
        add     edx, [LFBAddress]
204
        add     edx, [LFBAddress]
204
 
205
 
205
        ; pointer to pixel map
206
        ; pointer to pixel map
206
        mov     eax, [putimg.abs_cy]
207
        mov     eax, [putimg.abs_cy]
207
        imul    eax, [ScreenWidth]
208
        imul    eax, [ScreenWidth]
208
        add     eax, [putimg.abs_cy]
209
        add     eax, [putimg.abs_cy]
209
        add     eax, [putimg.abs_cx]
210
        add     eax, [putimg.abs_cx]
210
        add     eax, WinMapAddress
211
        add     eax, WinMapAddress
211
        xchg    eax, ebp
212
        xchg    eax, ebp
212
 
213
 
213
        ; get process number
214
        ; get process number
214
        mov     ebx, [CURRENT_TASK]
215
        mov     ebx, [CURRENT_TASK]
215
 
216
 
216
        cmp     byte [ScreenBPP], 32
217
        cmp     byte [ScreenBPP], 32
217
        je      put_image_end_32
218
        je      put_image_end_32
218
 
219
 
219
;put_image_end_24:
220
;put_image_end_24:
220
        mov     edi, [putimg.real_sy]
221
        mov     edi, [putimg.real_sy]
221
        align   4
222
        align   4
222
      .new_line:
223
      .new_line:
223
        mov     ecx, [putimg.real_sx]
224
        mov     ecx, [putimg.real_sx]
224
 
225
 
225
;        push    ebp edx
226
;        push    ebp edx
226
        align   4
227
        align   4
227
          .new_x:
228
          .new_x:
228
 
229
 
229
                push    [putimg.edi]
230
                push    [putimg.edi]
230
                mov     eax, [putimg.ebp+4]
231
                mov     eax, [putimg.ebp+4]
231
                call    eax
232
                call    eax
232
                cmp     [ebp], bl
233
                cmp     [ebp], bl
233
                jne     .skip
234
                jne     .skip
234
;                mov     eax, [esi]        ; eax = RRBBGGRR
235
;                mov     eax, [esi]        ; eax = RRBBGGRR
235
                mov     [edx], ax
236
                mov     [edx], ax
236
                shr     eax, 16
237
                shr     eax, 16
237
                mov     [edx+2], al
238
                mov     [edx+2], al
238
              .skip:
239
              .skip:
239
 
240
 
240
;            add     esi, 3 ;[putimg.source_bpp]
241
;            add     esi, 3 ;[putimg.source_bpp]
241
            add     edx, 3
242
            add     edx, 3
242
            inc     ebp
243
            inc     ebp
243
 
244
 
244
            dec     ecx
245
            dec     ecx
245
            jnz     .new_x
246
            jnz     .new_x
246
;        pop     edx ebp
247
;        pop     edx ebp
247
 
248
 
248
        add     esi, [putimg.line_increment]
249
        add     esi, [putimg.line_increment]
249
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
250
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
250
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
251
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
251
        ;inc     ebp
252
        ;inc     ebp
252
 
253
 
253
        dec     edi
254
        dec     edi
254
        jnz     .new_line
255
        jnz     .new_line
255
   .finish:
256
   .finish:
256
        add     esp, putimg.stack_data
257
        add     esp, putimg.stack_data
257
        popad
258
        popad
258
ret
259
ret
259
 
260
 
260
put_image_end_32:
261
put_image_end_32:
261
        mov     edi, [putimg.real_sy]
262
        mov     edi, [putimg.real_sy]
262
        align   4
263
        align   4
263
      .new_line:
264
      .new_line:
264
        mov     ecx, [putimg.real_sx]
265
        mov     ecx, [putimg.real_sx]
265
 
266
 
266
;        push    ebp edx
267
;        push    ebp edx
267
        align   4
268
        align   4
268
          .new_x:
269
          .new_x:
269
 
270
 
270
                push    [putimg.edi]
271
                push    [putimg.edi]
271
                mov     eax, [putimg.ebp+4]
272
                mov     eax, [putimg.ebp+4]
272
                call    eax
273
                call    eax
273
                cmp     [ebp], bl
274
                cmp     [ebp], bl
274
                jne     .skip
275
                jne     .skip
275
;                mov     eax, [esi]        ; ecx = RRBBGGRR
276
;                mov     eax, [esi]        ; ecx = RRBBGGRR
276
                mov     [edx], eax
277
                mov     [edx], eax
277
              .skip:
278
              .skip:
278
 
279
 
279
;            add     esi, [putimg.source_bpp]
280
;            add     esi, [putimg.source_bpp]
280
            add     edx, 4
281
            add     edx, 4
281
            inc     ebp
282
            inc     ebp
282
 
283
 
283
            dec     ecx
284
            dec     ecx
284
            jnz     .new_x
285
            jnz     .new_x
285
;        pop     edx ebp
286
;        pop     edx ebp
286
 
287
 
287
        add     esi, [putimg.line_increment]
288
        add     esi, [putimg.line_increment]
288
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
289
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
289
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
290
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
290
        ;inc     ebp
291
        ;inc     ebp
291
 
292
 
292
        dec     edi
293
        dec     edi
293
        jnz     .new_line
294
        jnz     .new_line
294
   .finish:
295
   .finish:
295
        add     esp, putimg.stack_data
296
        add     esp, putimg.stack_data
296
        popad
297
        popad
297
        call   VGA__putimage
298
        call   VGA__putimage
298
        mov     [EGA_counter],1
299
        mov     [EGA_counter],1
299
ret
300
ret
300
 
301
 
301
 
302
 
302
;*************************************************
303
;*************************************************
303
align 4
304
align 4
304
__sys_putpixel:
305
__sys_putpixel:
305
 
306
 
306
; eax = x coordinate
307
; eax = x coordinate
307
; ebx = y coordinate
308
; ebx = y coordinate
308
; ecx = ?? RR GG BB    ; 0x01000000 negation
309
; ecx = ?? RR GG BB    ; 0x01000000 negation
309
; edi = 0x00000001 force
310
; edi = 0x00000001 force
310
 
311
 
311
;;;        mov  [novesachecksum], dword 0
312
;;;        mov  [novesachecksum], dword 0
312
 
313
 
313
        pushad
314
        pushad
314
        test  edi,1                 ; force ?
315
        test  edi,1                 ; force ?
315
        jnz   .forced
316
        jnz   .forced
316
      ; not forced:
317
      ; not forced:
317
        push  ecx               ; save 24th bit in case negative pixel wanted
318
        push  ecx               ; save 24th bit in case negative pixel wanted
318
        call  checkpixel
319
        call  checkpixel
319
        test  ecx,ecx
320
        test  ecx,ecx
320
        pop   ecx
321
        pop   ecx
321
        jnz   .exit
322
        jnz   .exit
322
      .forced:
323
      .forced:
323
        cmp   [ScreenWidth], eax
324
        cmp   [ScreenWidth], eax
324
        jb    .exit
325
        jb    .exit
325
        cmp   [ScreenHeight], ebx
326
        cmp   [ScreenHeight], ebx
326
        jb    .exit
327
        jb    .exit
327
      .ok:
328
      .ok:
328
        ; check if negation
329
        ; check if negation
329
        test  ecx,0x01000000
330
        test  ecx,0x01000000
330
        jz    .noneg
331
        jz    .noneg
331
        call  getpixel
332
        call  getpixel
332
        not   ecx
333
        not   ecx
333
        mov   [esp+32-8],ecx
334
        mov   [esp+32-8],ecx
334
      .noneg:
335
      .noneg:
335
        ; OK to set pixel
336
        ; OK to set pixel
336
        call  dword [PUTPIXEL]    ; call the real put_pixel function
337
        call  dword [PUTPIXEL]    ; call the real put_pixel function
337
      .exit:
338
      .exit:
338
        popad
339
        popad
339
 
340
 
340
        ret
341
        ret
341
 
342
 
342
align 4
343
align 4
343
Vesa20_putpixel24:
344
Vesa20_putpixel24:
344
 
345
 
345
        ; eax = x
346
        ; eax = x
346
        ; ebx = y
347
        ; ebx = y
347
 
348
 
348
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
349
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
349
        lea     edi, [eax+eax*2]  ; edi = x*3
350
        lea     edi, [eax+eax*2]  ; edi = x*3
350
        mov     eax, [esp+32-8+4]
351
        mov     eax, [esp+32-8+4]
351
        add     edi, [LFBAddress]
352
        add     edi, [LFBAddress]
352
        add     edi, ebx          ; ebx = where to put pixel in memory
353
        add     edi, ebx          ; ebx = where to put pixel in memory
353
        mov     [edi], ax
354
        mov     [edi], ax
354
        shr     eax, 16
355
        shr     eax, 16
355
        mov     [edi+2], al
356
        mov     [edi+2], al
356
 
357
 
357
        ret
358
        ret
358
 
359
 
359
 
360
 
360
align 4
361
align 4
361
Vesa20_putpixel32:
362
Vesa20_putpixel32:
362
 
363
 
363
        ; eax = x
364
        ; eax = x
364
        ; ebx = y
365
        ; ebx = y
365
 
366
 
366
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
367
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
367
        lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
368
        lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
368
        mov     eax, [esp+32-8+4] ; eax = color
369
        mov     eax, [esp+32-8+4] ; eax = color
369
        add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
370
        add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
370
        mov     [edi], eax
371
        mov     [edi], eax
371
 
372
 
372
        ret
373
        ret
373
 
374
 
374
 
375
 
375
;*************************************************
376
;*************************************************
376
 
377
 
377
;align 4
378
;align 4
378
calculate_edi:
379
calculate_edi:
379
        mov     edi, ebx
380
        mov     edi, ebx
380
        imul    edi, [ScreenWidth]
381
        imul    edi, [ScreenWidth]
381
        add     edi, ebx
382
        add     edi, ebx
382
        add     edi, eax
383
        add     edi, eax
383
ret
384
ret
384
 
385
 
385
;*************************************************
386
;*************************************************
386
 
387
 
387
; DRAWLINE
388
; DRAWLINE
388
 
389
 
389
align 4
390
align 4
390
__sys_draw_line:
391
__sys_draw_line:
391
;     inc   [mouse_pause]
392
;     inc   [mouse_pause]
392
        call    [disable_mouse]
393
        call    [disable_mouse]
393
 
394
 
394
; draw a line
395
; draw a line
395
; eax = HIWORD = x1
396
; eax = HIWORD = x1
396
;       LOWORD = x2
397
;       LOWORD = x2
397
; ebx = HIWORD = y1
398
; ebx = HIWORD = y1
398
;       LOWORD = y2
399
;       LOWORD = y2
399
; ecx = color
400
; ecx = color
400
; edi = force ?
401
; edi = force ?
401
        pusha
402
        pusha
402
 
403
 
403
dl_x1 equ esp+20
404
dl_x1 equ esp+20
404
dl_y1 equ esp+16
405
dl_y1 equ esp+16
405
dl_x2 equ esp+12
406
dl_x2 equ esp+12
406
dl_y2 equ esp+8
407
dl_y2 equ esp+8
407
dl_dx equ esp+4
408
dl_dx equ esp+4
408
dl_dy equ esp+0
409
dl_dy equ esp+0
409
 
410
 
410
        xor     edx, edx      ; clear edx
411
        xor     edx, edx      ; clear edx
411
        xor     esi, esi      ; unpack arguments
412
        xor     esi, esi      ; unpack arguments
412
        xor     ebp, ebp
413
        xor     ebp, ebp
413
        mov     si, ax        ; esi = x2
414
        mov     si, ax        ; esi = x2
414
        mov     bp, bx        ; ebp = y2
415
        mov     bp, bx        ; ebp = y2
415
        shr     eax, 16       ; eax = x1
416
        shr     eax, 16       ; eax = x1
416
        shr     ebx, 16       ; ebx = y1
417
        shr     ebx, 16       ; ebx = y1
417
 
418
 
418
        push    eax           ; save x1
419
        push    eax           ; save x1
419
        push    ebx           ; save y1
420
        push    ebx           ; save y1
420
        push    esi           ; save x2
421
        push    esi           ; save x2
421
        push    ebp           ; save y2
422
        push    ebp           ; save y2
422
 
423
 
423
        ; checking x-axis...
424
        ; checking x-axis...
424
        sub     esi, eax      ; esi = x2-x1
425
        sub     esi, eax      ; esi = x2-x1
425
        push    esi           ; save y2-y1
426
        push    esi           ; save y2-y1
426
        jl      .x2lx1        ; is x2 less than x1 ?
427
        jl      .x2lx1        ; is x2 less than x1 ?
427
        jg      .no_vline     ; x1 > x2 ?
428
        jg      .no_vline     ; x1 > x2 ?
428
        mov     edx, ebp      ; else (if x1=x2)
429
        mov     edx, ebp      ; else (if x1=x2)
429
        call    vline
430
        call    vline
430
        push    edx    ; necessary to rightly restore stack frame at .exit
431
        push    edx    ; necessary to rightly restore stack frame at .exit
431
        jmp     .exit
432
        jmp     .exit
432
.x2lx1:
433
.x2lx1:
433
        neg     esi            ; get esi absolute value
434
        neg     esi            ; get esi absolute value
434
.no_vline:
435
.no_vline:
435
 
436
 
436
        ; checking y-axis...
437
        ; checking y-axis...
437
        sub     ebp, ebx       ; ebp = y2-y1
438
        sub     ebp, ebx       ; ebp = y2-y1
438
        push    ebp            ; save y2-y1
439
        push    ebp            ; save y2-y1
439
        jl      .y2ly1         ; is y2 less than y1 ?
440
        jl      .y2ly1         ; is y2 less than y1 ?
440
        jg      .no_hline      ; y1 > y2 ?
441
        jg      .no_hline      ; y1 > y2 ?
441
        mov     edx, [dl_x2]   ; else (if y1=y2)
442
        mov     edx, [dl_x2]   ; else (if y1=y2)
442
        call    hline
443
        call    hline
443
        jmp     .exit
444
        jmp     .exit
444
.y2ly1:
445
.y2ly1:
445
        neg     ebp            ; get ebp absolute value
446
        neg     ebp            ; get ebp absolute value
446
.no_hline:
447
.no_hline:
447
 
448
 
448
 
449
 
449
        cmp     ebp, esi
450
        cmp     ebp, esi
450
        jle     .x_rules       ; |y2-y1| < |x2-x1|  ?
451
        jle     .x_rules       ; |y2-y1| < |x2-x1|  ?
451
 
452
 
452
        cmp     [dl_y2], ebx   ; make sure y1 is at the begining
453
        cmp     [dl_y2], ebx   ; make sure y1 is at the begining
453
        jge     .no_reverse1
454
        jge     .no_reverse1
454
 
455
 
455
        neg     dword [dl_dx]
456
        neg     dword [dl_dx]
456
        mov     edx, [dl_x2]
457
        mov     edx, [dl_x2]
457
        mov     [dl_x2], eax
458
        mov     [dl_x2], eax
458
        mov     [dl_x1], edx
459
        mov     [dl_x1], edx
459
        mov     edx, [dl_y2]
460
        mov     edx, [dl_y2]
460
        mov     [dl_y2], ebx
461
        mov     [dl_y2], ebx
461
        mov     [dl_y1], edx
462
        mov     [dl_y1], edx
462
 
463
 
463
.no_reverse1:
464
.no_reverse1:
464
 
465
 
465
        mov     eax, [dl_dx]
466
        mov     eax, [dl_dx]
466
        cdq                    ; extend eax sing to edx
467
        cdq                    ; extend eax sing to edx
467
        shl     eax, 16        ; using 16bit fix-point maths
468
        shl     eax, 16        ; using 16bit fix-point maths
468
        idiv    ebp            ; eax = ((x2-x1)*65536)/(y2-y1)
469
        idiv    ebp            ; eax = ((x2-x1)*65536)/(y2-y1)
469
        mov     edx, ebp       ; edx = counter (number of pixels to draw)
470
        mov     edx, ebp       ; edx = counter (number of pixels to draw)
470
        mov     ebp, 1 *65536  ; <<16   ; ebp = dy = 1.0
471
        mov     ebp, 1 *65536  ; <<16   ; ebp = dy = 1.0
471
        mov     esi, eax       ; esi = dx
472
        mov     esi, eax       ; esi = dx
472
 
473
 
473
        jmp     .y_rules
474
        jmp     .y_rules
474
.x_rules:
475
.x_rules:
475
 
476
 
476
        cmp     [dl_x2], eax    ; make sure x1 is at the begining
477
        cmp     [dl_x2], eax    ; make sure x1 is at the begining
477
        jge     .no_reverse2
478
        jge     .no_reverse2
478
 
479
 
479
        neg     dword [dl_dy]
480
        neg     dword [dl_dy]
480
        mov     edx, [dl_x2]
481
        mov     edx, [dl_x2]
481
        mov     [dl_x2], eax
482
        mov     [dl_x2], eax
482
        mov     [dl_x1], edx
483
        mov     [dl_x1], edx
483
        mov     edx, [dl_y2]
484
        mov     edx, [dl_y2]
484
        mov     [dl_y2], ebx
485
        mov     [dl_y2], ebx
485
        mov     [dl_y1], edx
486
        mov     [dl_y1], edx
486
 
487
 
487
.no_reverse2:
488
.no_reverse2:
488
 
489
 
489
        xor     edx, edx
490
        xor     edx, edx
490
        mov     eax, [dl_dy]
491
        mov     eax, [dl_dy]
491
        cdq                    ; extend eax sing to edx
492
        cdq                    ; extend eax sing to edx
492
        shl     eax, 16        ; using 16bit fix-point maths
493
        shl     eax, 16        ; using 16bit fix-point maths
493
        idiv    esi            ; eax = ((y2-y1)*65536)/(x2-x1)
494
        idiv    esi            ; eax = ((y2-y1)*65536)/(x2-x1)
494
        mov     edx, esi       ; edx = counter (number of pixels to draw)
495
        mov     edx, esi       ; edx = counter (number of pixels to draw)
495
        mov     esi, 1 *65536  ;<< 16   ; esi = dx = 1.0
496
        mov     esi, 1 *65536  ;<< 16   ; esi = dx = 1.0
496
        mov     ebp, eax       ; ebp = dy
497
        mov     ebp, eax       ; ebp = dy
497
 
498
 
498
.y_rules:
499
.y_rules:
499
 
500
 
500
        mov     eax, [dl_x1]
501
        mov     eax, [dl_x1]
501
        mov     ebx, [dl_y1]
502
        mov     ebx, [dl_y1]
502
        shl     eax, 16
503
        shl     eax, 16
503
        shl     ebx, 16
504
        shl     ebx, 16
504
 
505
 
505
align 4
506
align 4
506
 
507
 
507
.draw:
508
.draw:
508
        push    eax ebx
509
        push    eax ebx
509
        shr     eax, 16
510
        shr     eax, 16
510
        shr     ebx, 16
511
        shr     ebx, 16
511
        call    [putpixel]
512
        call    [putpixel]
512
        pop     ebx eax
513
        pop     ebx eax
513
 
514
 
514
        add     ebx, ebp        ; y = y+dy
515
        add     ebx, ebp        ; y = y+dy
515
        add     eax, esi        ; x = x+dx
516
        add     eax, esi        ; x = x+dx
516
 
517
 
517
        dec     edx
518
        dec     edx
518
        jnz     .draw
519
        jnz     .draw
519
 
520
 
520
        ; force last drawn pixel to be at (x2,y2)
521
        ; force last drawn pixel to be at (x2,y2)
521
        mov     eax, [dl_x2]
522
        mov     eax, [dl_x2]
522
        mov     ebx, [dl_y2]
523
        mov     ebx, [dl_y2]
523
        call    [putpixel]
524
        call    [putpixel]
524
.exit:
525
.exit:
525
        add     esp, 6*4
526
        add     esp, 6*4
526
        popa
527
        popa
527
;     dec   [mouse_pause]
528
;     dec   [mouse_pause]
528
     call   [draw_pointer]
529
     call   [draw_pointer]
529
ret
530
ret
530
 
531
 
531
 
532
 
532
hline:
533
hline:
533
; draw an horizontal line
534
; draw an horizontal line
534
; eax = x1
535
; eax = x1
535
; edx = x2
536
; edx = x2
536
; ebx = y
537
; ebx = y
537
; ecx = color
538
; ecx = color
538
; edi = force ?
539
; edi = force ?
539
        push    eax edx
540
        push    eax edx
540
 
541
 
541
        cmp     edx, eax      ; make sure x2 is above x1
542
        cmp     edx, eax      ; make sure x2 is above x1
542
        jge     @f
543
        jge     @f
543
        xchg    eax, edx
544
        xchg    eax, edx
544
        align   4
545
        align   4
545
   @@:
546
   @@:
546
        call    [putpixel]
547
        call    [putpixel]
547
        inc     eax
548
        inc     eax
548
        cmp     eax, edx
549
        cmp     eax, edx
549
        jle     @b
550
        jle     @b
550
 
551
 
551
        pop     edx eax
552
        pop     edx eax
552
ret
553
ret
553
 
554
 
554
 
555
 
555
vline:
556
vline:
556
; draw a vertical line
557
; draw a vertical line
557
; eax = x
558
; eax = x
558
; ebx = y1
559
; ebx = y1
559
; edx = y2
560
; edx = y2
560
; ecx = color
561
; ecx = color
561
; edi = force ?
562
; edi = force ?
562
        push    ebx edx
563
        push    ebx edx
563
 
564
 
564
        cmp     edx, ebx      ; make sure y2 is above y1
565
        cmp     edx, ebx      ; make sure y2 is above y1
565
        jge     @f
566
        jge     @f
566
        xchg    ebx, edx
567
        xchg    ebx, edx
567
        align   4
568
        align   4
568
   @@:
569
   @@:
569
        call    [putpixel]
570
        call    [putpixel]
570
        inc     ebx
571
        inc     ebx
571
        cmp     ebx, edx
572
        cmp     ebx, edx
572
        jle     @b
573
        jle     @b
573
 
574
 
574
        pop     edx ebx
575
        pop     edx ebx
575
ret
576
ret
576
 
577
 
577
 
578
 
578
;*************************************************
579
;*************************************************
579
 
580
 
580
 
581
 
581
virtual at esp
582
virtual at esp
582
      drbar:
583
      drbar:
583
        .bar_sx       dd ?
584
        .bar_sx       dd ?
584
        .bar_sy       dd ?
585
        .bar_sy       dd ?
585
        .bar_cx       dd ?
586
        .bar_cx       dd ?
586
        .bar_cy       dd ?
587
        .bar_cy       dd ?
587
        .abs_cx       dd ?
588
        .abs_cx       dd ?
588
        .abs_cy       dd ?
589
        .abs_cy       dd ?
589
        .real_sx      dd ?
590
        .real_sx      dd ?
590
        .real_sy      dd ?
591
        .real_sy      dd ?
591
        .color        dd ?
592
        .color        dd ?
592
        .line_inc_scr dd ?
593
        .line_inc_scr dd ?
593
        .line_inc_map dd ?
594
        .line_inc_map dd ?
594
        .stack_data = 4*11
595
        .stack_data = 4*11
595
end virtual
596
end virtual
596
 
597
 
597
align 4
598
align 4
598
; eax   cx
599
; eax   cx
599
; ebx   cy
600
; ebx   cy
600
; ecx   xe
601
; ecx   xe
601
; edx   ye
602
; edx   ye
602
; edi   color
603
; edi   color
603
vesa20_drawbar:
604
vesa20_drawbar:
604
 
605
 
605
        pushad
606
        pushad
606
        call    [disable_mouse]
607
        call    [disable_mouse]
607
 
608
 
608
        sub     esp, drbar.stack_data
609
        sub     esp, drbar.stack_data
609
 
610
 
610
        mov     [drbar.color], edi
611
        mov     [drbar.color], edi
611
 
612
 
612
        sub     edx, ebx
613
        sub     edx, ebx
613
        jle     .exit          ;// mike.dld, 2005-01-29
614
        jle     .exit          ;// mike.dld, 2005-01-29
614
        sub     ecx, eax
615
        sub     ecx, eax
615
        jle     .exit          ;// mike.dld, 2005-01-29
616
        jle     .exit          ;// mike.dld, 2005-01-29
616
        mov     [drbar.bar_sy], edx
617
        mov     [drbar.bar_sy], edx
617
        mov     [drbar.bar_sx], ecx
618
        mov     [drbar.bar_sx], ecx
618
 
619
 
619
        mov     [drbar.bar_cx], eax
620
        mov     [drbar.bar_cx], eax
620
        mov     [drbar.bar_cy], ebx
621
        mov     [drbar.bar_cy], ebx
621
 
622
 
622
        mov     edi, [TASK_BASE]
623
        mov     edi, [TASK_BASE]
623
        add     eax, [edi-twdw + WDATA.box.left] ; win_cx
624
        add     eax, [edi-twdw + WDATA.box.left] ; win_cx
624
        add     ebx, [edi-twdw + WDATA.box.top] ; win_cy
625
        add     ebx, [edi-twdw + WDATA.box.top] ; win_cy
625
        mov     [drbar.abs_cx], eax
626
        mov     [drbar.abs_cx], eax
626
        mov     [drbar.abs_cy], ebx
627
        mov     [drbar.abs_cy], ebx
627
 
628
 
628
        ; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
629
        ; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
629
        mov     ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
630
        mov     ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
630
; \begin{diamond}[20.08.2006]
631
; \begin{diamond}[20.08.2006]
631
; note that WDATA.box.width is one pixel less than real window x-size
632
; note that WDATA.box.width is one pixel less than real window x-size
632
        inc     ebx
633
        inc     ebx
633
; \end{diamond}[20.08.2006]
634
; \end{diamond}[20.08.2006]
634
        sub     ebx, [drbar.bar_cx]
635
        sub     ebx, [drbar.bar_cx]
635
        ja      @f
636
        ja      @f
636
  .exit:                       ;// mike.dld, 2005-01-29
637
  .exit:                       ;// mike.dld, 2005-01-29
637
        add     esp, drbar.stack_data
638
        add     esp, drbar.stack_data
638
        popad
639
        popad
639
        xor     eax, eax
640
        xor     eax, eax
640
        inc     eax
641
        inc     eax
641
 
642
 
642
        ret
643
        ret
643
      @@:
644
      @@:
644
        cmp     ebx, [drbar.bar_sx]
645
        cmp     ebx, [drbar.bar_sx]
645
        jbe     .end_x
646
        jbe     .end_x
646
        mov     ebx, [drbar.bar_sx]
647
        mov     ebx, [drbar.bar_sx]
647
      .end_x:
648
      .end_x:
648
        mov     [drbar.real_sx], ebx
649
        mov     [drbar.real_sx], ebx
649
 
650
 
650
        ; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
651
        ; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
651
        mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
652
        mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
652
; \begin{diamond}[20.08.2006]
653
; \begin{diamond}[20.08.2006]
653
        inc     ebx
654
        inc     ebx
654
; \end{diamond}
655
; \end{diamond}
655
        sub     ebx, [drbar.bar_cy]
656
        sub     ebx, [drbar.bar_cy]
656
        ja      @f
657
        ja      @f
657
        add     esp, drbar.stack_data
658
        add     esp, drbar.stack_data
658
        popad
659
        popad
659
        xor     eax, eax
660
        xor     eax, eax
660
        inc     eax
661
        inc     eax
661
 
662
 
662
        ret
663
        ret
663
      @@:
664
      @@:
664
        cmp     ebx, [drbar.bar_sy]
665
        cmp     ebx, [drbar.bar_sy]
665
        jbe     .end_y
666
        jbe     .end_y
666
        mov     ebx, [drbar.bar_sy]
667
        mov     ebx, [drbar.bar_sy]
667
      .end_y:
668
      .end_y:
668
        mov     [drbar.real_sy], ebx
669
        mov     [drbar.real_sy], ebx
669
 
670
 
670
        ; line_inc_map
671
        ; line_inc_map
671
        mov     eax, [ScreenWidth]
672
        mov     eax, [ScreenWidth]
672
        sub     eax, [drbar.real_sx]
673
        sub     eax, [drbar.real_sx]
673
        inc     eax
674
        inc     eax
674
        mov     [drbar.line_inc_map], eax
675
        mov     [drbar.line_inc_map], eax
675
 
676
 
676
        ; line_inc_scr
677
        ; line_inc_scr
677
        mov     eax, [drbar.real_sx]
678
        mov     eax, [drbar.real_sx]
678
        movzx   ebx, byte [ScreenBPP]
679
        movzx   ebx, byte [ScreenBPP]
679
        shr     ebx, 3
680
        shr     ebx, 3
680
        imul    eax, ebx
681
        imul    eax, ebx
681
        neg     eax
682
        neg     eax
682
        add     eax, [BytesPerScanLine]
683
        add     eax, [BytesPerScanLine]
683
        mov     [drbar.line_inc_scr], eax
684
        mov     [drbar.line_inc_scr], eax
684
 
685
 
685
        ; pointer to screen
686
        ; pointer to screen
686
        mov     edx, [drbar.abs_cy]
687
        mov     edx, [drbar.abs_cy]
687
        imul    edx, [BytesPerScanLine]
688
        imul    edx, [BytesPerScanLine]
688
        mov     eax, [drbar.abs_cx]
689
        mov     eax, [drbar.abs_cx]
689
;        movzx   ebx, byte [ScreenBPP]
690
;        movzx   ebx, byte [ScreenBPP]
690
;        shr     ebx, 3
691
;        shr     ebx, 3
691
        imul    eax, ebx
692
        imul    eax, ebx
692
        add     edx, eax
693
        add     edx, eax
693
        add     edx, [LFBAddress]
694
        add     edx, [LFBAddress]
694
 
695
 
695
        ; pointer to pixel map
696
        ; pointer to pixel map
696
        mov     eax, [drbar.abs_cy]
697
        mov     eax, [drbar.abs_cy]
697
        imul    eax, [ScreenWidth]
698
        imul    eax, [ScreenWidth]
698
        add     eax, [drbar.abs_cy]
699
        add     eax, [drbar.abs_cy]
699
        add     eax, [drbar.abs_cx]
700
        add     eax, [drbar.abs_cx]
700
        add     eax, WinMapAddress
701
        add     eax, WinMapAddress
701
        xchg    eax, ebp
702
        xchg    eax, ebp
702
 
703
 
703
        ; get process number
704
        ; get process number
704
        mov     ebx, [CURRENT_TASK]
705
        mov     ebx, [CURRENT_TASK]
705
 
706
 
706
        cmp     byte [ScreenBPP], 24
707
        cmp     byte [ScreenBPP], 24
707
        jne     draw_bar_end_32
708
        jne     draw_bar_end_32
708
draw_bar_end_24:
709
draw_bar_end_24:
709
        mov     eax, [drbar.color]    ;; BBGGRR00
710
        mov     eax, [drbar.color]    ;; BBGGRR00
710
        mov     bh, al                ;; bh  = BB
711
        mov     bh, al                ;; bh  = BB
711
        shr     eax, 8                ;; eax = RRGG
712
        shr     eax, 8                ;; eax = RRGG
712
; eax - color high   RRGG
713
; eax - color high   RRGG
713
; bl - process num
714
; bl - process num
714
; bh - color low    BB
715
; bh - color low    BB
715
; ecx - temp
716
; ecx - temp
716
; edx - pointer to screen
717
; edx - pointer to screen
717
; esi - counter
718
; esi - counter
718
; edi - counter
719
; edi - counter
719
 
720
 
720
        mov     esi, [drbar.real_sy]
721
        mov     esi, [drbar.real_sy]
721
        align   4
722
        align   4
722
     .new_y:
723
     .new_y:
723
        mov     edi, [drbar.real_sx]
724
        mov     edi, [drbar.real_sx]
724
        align   4
725
        align   4
725
     .new_x:
726
     .new_x:
726
 
727
 
727
        cmp     byte [ebp], bl
728
        cmp     byte [ebp], bl
728
        jne     .skip
729
        jne     .skip
729
        mov     [edx], bh
730
        mov     [edx], bh
730
        mov     [edx + 1], ax
731
        mov     [edx + 1], ax
731
      .skip:
732
      .skip:
732
 
733
 
733
        ; add pixel
734
        ; add pixel
734
        add     edx, 3
735
        add     edx, 3
735
        inc     ebp
736
        inc     ebp
736
 
737
 
737
        dec     edi
738
        dec     edi
738
        jnz     .new_x
739
        jnz     .new_x
739
 
740
 
740
        ; add line
741
        ; add line
741
        add     edx, [drbar.line_inc_scr]
742
        add     edx, [drbar.line_inc_scr]
742
        add     ebp, [drbar.line_inc_map]
743
        add     ebp, [drbar.line_inc_map]
743
 
744
 
744
    ;  drawing gradient bars
745
    ;  drawing gradient bars
745
        test    eax, 0x00800000
746
        test    eax, 0x00800000
746
        jz      @f
747
        jz      @f
747
        test    bh, bh
748
        test    bh, bh
748
        jz      @f
749
        jz      @f
749
        dec     bh
750
        dec     bh
750
      @@:
751
      @@:
751
    ; 
752
    ; 
752
 
753
 
753
        dec     esi
754
        dec     esi
754
        jnz     .new_y
755
        jnz     .new_y
755
 
756
 
756
        add     esp, drbar.stack_data
757
        add     esp, drbar.stack_data
757
        popad
758
        popad
758
        xor     eax, eax
759
        xor     eax, eax
759
ret
760
ret
760
 
761
 
761
draw_bar_end_32:
762
draw_bar_end_32:
762
        mov     eax, [drbar.color]    ;; BBGGRR00
763
        mov     eax, [drbar.color]    ;; BBGGRR00
763
 
764
 
764
        mov     esi, [drbar.real_sy]
765
        mov     esi, [drbar.real_sy]
765
        align   4
766
        align   4
766
     .new_y:
767
     .new_y:
767
        mov     edi, [drbar.real_sx]
768
        mov     edi, [drbar.real_sx]
768
        align   4
769
        align   4
769
     .new_x:
770
     .new_x:
770
 
771
 
771
        cmp     byte [ebp], bl
772
        cmp     byte [ebp], bl
772
        jne     .skip
773
        jne     .skip
773
        mov     [edx], eax
774
        mov     [edx], eax
774
      .skip:
775
      .skip:
775
 
776
 
776
        ; add pixel
777
        ; add pixel
777
        add     edx, 4
778
        add     edx, 4
778
        inc     ebp
779
        inc     ebp
779
 
780
 
780
        dec     edi
781
        dec     edi
781
        jnz     .new_x
782
        jnz     .new_x
782
 
783
 
783
        ; add line
784
        ; add line
784
        add     edx, [drbar.line_inc_scr]
785
        add     edx, [drbar.line_inc_scr]
785
        add     ebp, [drbar.line_inc_map]
786
        add     ebp, [drbar.line_inc_map]
786
 
787
 
787
    ;  drawing gradient bars
788
    ;  drawing gradient bars
788
        test    eax, 0x80000000
789
        test    eax, 0x80000000
789
        jz      @f
790
        jz      @f
790
        test    al, al
791
        test    al, al
791
        jz      @f
792
        jz      @f
792
        dec     al
793
        dec     al
793
      @@:
794
      @@:
794
    ; 
795
    ; 
795
 
796
 
796
        dec     esi
797
        dec     esi
797
        jnz     .new_y
798
        jnz     .new_y
798
 
799
 
799
        add     esp, drbar.stack_data
800
        add     esp, drbar.stack_data
800
        popad
801
        popad
801
        call    VGA_draw_bar
802
        call    VGA_draw_bar
802
        xor     eax, eax
803
        xor     eax, eax
803
        mov     [EGA_counter],1
804
        mov     [EGA_counter],1
804
ret
805
ret
805
 
806
 
806
 
807
 
807
;voodoodbcplimit:
808
;voodoodbcplimit:
808
 
809
 
809
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
810
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
810
 
811
 
811
 
812
 
812
;     pusha
813
;     pusha
813
 
814
 
814
;     xor edx,edx
815
;     xor edx,edx
815
;     mov eax,ebp
816
;     mov eax,ebp
816
;     mov ebx,[ScreenWidth] ; Screen_X_size
817
;     mov ebx,[ScreenWidth] ; Screen_X_size
817
;     inc ebx   ; +1
818
;     inc ebx   ; +1
818
;     sub eax,WinMapAddress ; -AddrBuffer
819
;     sub eax,WinMapAddress ; -AddrBuffer
819
;     div ebx ;
820
;     div ebx ;
820
;     mov ebx,eax ; ebx:=Y
821
;     mov ebx,eax ; ebx:=Y
821
;     mov eax,edx ; eax:=X
822
;     mov eax,edx ; eax:=X
822
;     call cplimit
823
;     call cplimit
823
 
824
 
824
;     test ecx,ecx
825
;     test ecx,ecx
825
;     jne  dbcpl12
826
;     jne  dbcpl12
826
;     popa
827
;     popa
827
;     clc
828
;     clc
828
;     ret
829
;     ret
829
;   dbcpl12:
830
;   dbcpl12:
830
;     popa
831
;     popa
831
;     stc
832
;     stc
832
;     ret
833
;     ret
833
 
834
 
834
 
835
 
835
 
836
 
836
 
837
 
837
;dbcplimit:
838
;dbcplimit:
838
 
839
 
839
;        pusha
840
;        pusha
840
 
841
 
841
;        xor  edx,edx
842
;        xor  edx,edx
842
;        mov  ebx,[ScreenWidth]
843
;        mov  ebx,[ScreenWidth]
843
;        inc  ebx
844
;        inc  ebx
844
;        sub  eax,WinMapAddress
845
;        sub  eax,WinMapAddress
845
;        div  ebx
846
;        div  ebx
846
;        mov  ebx,eax
847
;        mov  ebx,eax
847
;        mov  eax,edx
848
;        mov  eax,edx
848
;        call cplimit
849
;        call cplimit
849
 
850
 
850
;        test ecx,ecx
851
;        test ecx,ecx
851
;        jne  dbcpl1
852
;        jne  dbcpl1
852
;        popa
853
;        popa
853
;        clc
854
;        clc
854
;        ret
855
;        ret
855
;     dbcpl1:
856
;     dbcpl1:
856
;        popa
857
;        popa
857
;        stc
858
;        stc
858
;        ret
859
;        ret
859
 
860
 
860
 
861
 
861
 
862
 
862
 
863
 
863
 
864
 
864
 
865
 
865
;--------------vbe voodoo ------------------------------------------------
866
;--------------vbe voodoo ------------------------------------------------
866
vesa20_drawbackground_tiled:
867
vesa20_drawbackground_tiled:
867
 
868
 
868
     call [disable_mouse]
869
     call [disable_mouse]
869
 
870
 
870
     push ebp
871
     push ebp
871
     push eax
872
     push eax
872
     push ebx
873
     push ebx
873
     push ecx
874
     push ecx
874
     push edx
875
     push edx
875
 
876
 
876
     mov edx,dword [WinMapAddress-8] ; B
877
     mov edx,dword [WinMapAddress-8] ; B
877
     add edx,dword [WinMapAddress-8] ; +B
878
     add edx,dword [WinMapAddress-8] ; +B
878
     add edx,dword [WinMapAddress-8] ; +B
879
     add edx,dword [WinMapAddress-8] ; +B
879
     push edx
880
     push edx
880
 
881
 
881
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
882
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
882
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
883
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
883
 
884
 
884
     mov eax,[BytesPerScanLine]
885
     mov eax,[BytesPerScanLine]
885
     mul ebx
886
     mul ebx
886
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
887
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
887
     add ebp, eax   ; +X
888
     add ebp, eax   ; +X
888
     add ebp, eax   ; +X
889
     add ebp, eax   ; +X
889
     add ebp, eax   ; +X
890
     add ebp, eax   ; +X
890
 
891
 
891
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
892
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
892
     jz @f
893
     jz @f
893
     add ebp,eax ; +X
894
     add ebp,eax ; +X
894
   @@:
895
   @@:
895
     add ebp,[LFBAddress]  ; +LFB
896
     add ebp,[LFBAddress]  ; +LFB
896
 
897
 
897
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
898
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
898
 
899
 
899
     call calculate_edi
900
     call calculate_edi
900
 
901
 
901
 
902
 
902
   dp3:                             ; MAIN LOOP
903
   dp3:                             ; MAIN LOOP
903
 
904
 
904
     cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
905
     cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
905
;     je  ybgp
906
;     je  ybgp
906
;
907
;
907
;     jmp nbgp
908
;     jmp nbgp
908
;
909
;
909
;   ybgp:
910
;   ybgp:
910
     jne nbgp
911
     jne nbgp
911
 
912
 
912
     push eax
913
     push eax
913
     push ebx
914
     push ebx
914
 
915
 
915
     mov ecx,dword [WinMapAddress-8]    ; B
916
     mov ecx,dword [WinMapAddress-8]    ; B
916
     xor edx,edx                   ; edx:=0
917
     xor edx,edx                   ; edx:=0
917
     div ecx                       ; Xstart/B
918
     div ecx                       ; Xstart/B
918
 
919
 
919
     ; eax=Int(qn) edx:=Rem
920
     ; eax=Int(qn) edx:=Rem
920
 
921
 
921
     lea esi,[edx+edx*2]           ; esi:=edx*3
922
     lea esi,[edx+edx*2]           ; esi:=edx*3
922
 
923
 
923
     mov ecx,dword [WinMapAddress-4]    ; ecx:=H
924
     mov ecx,dword [WinMapAddress-4]    ; ecx:=H
924
     mov eax,[esp+0]               ; eax:=Ystart
925
     mov eax,[esp+0]               ; eax:=Ystart
925
     xor edx,edx                   ;
926
     xor edx,edx                   ;
926
     div ecx                       ; Ystart/H
927
     div ecx                       ; Ystart/H
927
 
928
 
928
     mov eax,edx                   ; eax:=Rem
929
     mov eax,edx                   ; eax:=Rem
929
     xor edx,edx                   ;
930
     xor edx,edx                   ;
930
     mov ebx,[esp+8]               ; ebx:=B*3
931
     mov ebx,[esp+8]               ; ebx:=B*3
931
     mul ebx                       ;
932
     mul ebx                       ;
932
     add esi,eax                   ;
933
     add esi,eax                   ;
933
     mov eax,[esi+IMG_BACKGROUND]
934
     mov eax,[esi+IMG_BACKGROUND]
934
     and eax,0xffffff
935
     and eax,0xffffff
935
 
936
 
936
     xchg edi, ebp
937
     xchg edi, ebp
937
     stosw
938
     stosw
938
     shr eax,16
939
     shr eax,16
939
     stosb
940
     stosb
940
     xchg ebp, edi                 ; ebp+=3
941
     xchg ebp, edi                 ; ebp+=3
941
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
942
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
942
     jz @f
943
     jz @f
943
     inc ebp ; +1
944
     inc ebp ; +1
944
   @@:
945
   @@:
945
 
946
 
946
     pop ebx
947
     pop ebx
947
     pop eax
948
     pop eax
948
 
949
 
949
     jmp hook1
950
     jmp hook1
950
 
951
 
951
   nbgp:
952
   nbgp:
952
     add ebp,3                     ; +3
953
     add ebp,3                     ; +3
953
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
954
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
954
     jz  @f
955
     jz  @f
955
     inc ebp ; +1
956
     inc ebp ; +1
956
   @@:
957
   @@:
957
 
958
 
958
   hook1:
959
   hook1:
959
 
960
 
960
     inc edi                       ; ptrBuffer++
961
     inc edi                       ; ptrBuffer++
961
     add esi,3                     ; ptrImage+=3
962
     add esi,3                     ; ptrImage+=3
962
     inc eax
963
     inc eax
963
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
964
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
964
;     jg nodp3
965
;     jg nodp3
965
;     jmp dp3
966
;     jmp dp3
966
;
967
;
967
;   nodp3:
968
;   nodp3:
968
     jle dp3
969
     jle dp3
969
 
970
 
970
     mov ebp,[draw_data+32+RECT.left]
971
     mov ebp,[draw_data+32+RECT.left]
971
 
972
 
972
     inc ebx
973
     inc ebx
973
 
974
 
974
     mov  eax,[BytesPerScanLine]
975
     mov  eax,[BytesPerScanLine]
975
     mul  ebx
976
     mul  ebx
976
     xchg ebp, eax                 ; BytesPerScanLine*(Ywin+y)
977
     xchg ebp, eax                 ; BytesPerScanLine*(Ywin+y)
977
     add  ebp, eax                 ; +X
978
     add  ebp, eax                 ; +X
978
     add  ebp, eax                 ; +X=X*2
979
     add  ebp, eax                 ; +X=X*2
979
     add  ebp, eax                 ; +X=X*3
980
     add  ebp, eax                 ; +X=X*3
980
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
981
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
981
     jz   @f
982
     jz   @f
982
     add  ebp,eax                  ; +X=X*4
983
     add  ebp,eax                  ; +X=X*4
983
   @@:
984
   @@:
984
     add ebp,[LFBAddress]          ; +LFB
985
     add ebp,[LFBAddress]          ; +LFB
985
 
986
 
986
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
987
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
987
 
988
 
988
     call calculate_edi
989
     call calculate_edi
989
 
990
 
990
     cmp ebx,[draw_data+32+RECT.bottom]
991
     cmp ebx,[draw_data+32+RECT.bottom]
991
;     jg  dp4
992
;     jg  dp4
992
;
993
;
993
;     jmp dp3
994
;     jmp dp3
994
;
995
;
995
;   dp4:
996
;   dp4:
996
     jle dp3
997
     jle dp3
997
 
998
 
998
     add esp,4
999
     add esp,4
999
 
1000
 
1000
     pop edx
1001
     pop edx
1001
     pop ecx
1002
     pop ecx
1002
     pop ebx
1003
     pop ebx
1003
     pop eax
1004
     pop eax
1004
     pop ebp
1005
     pop ebp
1005
     mov     [EGA_counter],1
1006
     mov     [EGA_counter],1
1006
     call  VGA_drawbackground
1007
     call  VGA_drawbackground
1007
     ret
1008
     ret
1008
 
1009
 
1009
; ----------
1010
; ----------
1010
 
1011
 
1011
 
1012
 
1012
vesa20_drawbackground_stretch:
1013
vesa20_drawbackground_stretch:
1013
 
1014
 
1014
     call  [disable_mouse]
1015
     call  [disable_mouse]
1015
 
1016
 
1016
     push ebp
1017
     push ebp
1017
     push eax
1018
     push eax
1018
     push ebx
1019
     push ebx
1019
     push ecx
1020
     push ecx
1020
     push edx
1021
     push edx
1021
 
1022
 
1022
     mov edx,dword [WinMapAddress-8] ; B
1023
     mov edx,dword [WinMapAddress-8] ; B
1023
     add edx,dword [WinMapAddress-8] ; +B
1024
     add edx,dword [WinMapAddress-8] ; +B
1024
     add edx,dword [WinMapAddress-8] ; +B
1025
     add edx,dword [WinMapAddress-8] ; +B
1025
     push edx
1026
     push edx
1026
 
1027
 
1027
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
1028
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
1028
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
1029
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
1029
 
1030
 
1030
     mov eax,[BytesPerScanLine]
1031
     mov eax,[BytesPerScanLine]
1031
     mul ebx
1032
     mul ebx
1032
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
1033
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
1033
     add ebp, eax   ; +X
1034
     add ebp, eax   ; +X
1034
     add ebp, eax   ; +X
1035
     add ebp, eax   ; +X
1035
     add ebp, eax   ; +X
1036
     add ebp, eax   ; +X
1036
 
1037
 
1037
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
1038
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
1038
     jz  @f
1039
     jz  @f
1039
     add ebp,eax ; +X
1040
     add ebp,eax ; +X
1040
   @@:
1041
   @@:
1041
     add ebp,[LFBAddress] ; +LFB
1042
     add ebp,[LFBAddress] ; +LFB
1042
 
1043
 
1043
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1044
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1044
 
1045
 
1045
     call calculate_edi
1046
     call calculate_edi
1046
 
1047
 
1047
 
1048
 
1048
sdp3: ; MAIN LOOP
1049
sdp3: ; MAIN LOOP
1049
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
1050
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
1050
jne snbgp
1051
jne snbgp
1051
push eax
1052
push eax
1052
push ebx
1053
push ebx
1053
mov eax,dword [WinMapAddress-8]
1054
mov eax,dword [WinMapAddress-8]
1054
imul eax, [esp+4] ;4
1055
imul eax, [esp+4] ;4
1055
xor edx,edx
1056
xor edx,edx
1056
mov ebx,[ScreenWidth]
1057
mov ebx,[ScreenWidth]
1057
div ebx
1058
div ebx
1058
mov cx,dx
1059
mov cx,dx
1059
lea esi,[eax+eax*2]
1060
lea esi,[eax+eax*2]
1060
mov eax,dword [WinMapAddress-4]
1061
mov eax,dword [WinMapAddress-4]
1061
imul eax, [esp+0] ;0
1062
imul eax, [esp+0] ;0
1062
xor edx,edx
1063
xor edx,edx
1063
mov ebx,[ScreenHeight]
1064
mov ebx,[ScreenHeight]
1064
div ebx
1065
div ebx
1065
shl ecx,16
1066
shl ecx,16
1066
mov cx,dx
1067
mov cx,dx
1067
imul eax, [esp+8] ;8
1068
imul eax, [esp+8] ;8
1068
add esi,eax
1069
add esi,eax
1069
mov eax,[esi+IMG_BACKGROUND]
1070
mov eax,[esi+IMG_BACKGROUND]
1070
push eax
1071
push eax
1071
ror ecx,16
1072
ror ecx,16
1072
xor eax,eax
1073
xor eax,eax
1073
mov ax,cx
1074
mov ax,cx
1074
shl eax,1 ; óìíîæåíèå íà 2
1075
shl eax,1 ; óìíîæåíèå íà 2
1075
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
1076
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
1076
xor edx,edx
1077
xor edx,edx
1077
mov ebx,[ScreenWidth]
1078
mov ebx,[ScreenWidth]
1078
div ebx
1079
div ebx
1079
cmp eax,5
1080
cmp eax,5
1080
pop eax
1081
pop eax
1081
jb @f
1082
jb @f
1082
mov ebx,[esi+IMG_BACKGROUND+3]
1083
mov ebx,[esi+IMG_BACKGROUND+3]
1083
call overlapping_of_points
1084
call overlapping_of_points
1084
@@:
1085
@@:
1085
push eax
1086
push eax
1086
ror ecx,16
1087
ror ecx,16
1087
xor eax,eax
1088
xor eax,eax
1088
mov ax,cx
1089
mov ax,cx
1089
shl eax,1 ; óìíîæåíèå íà 2
1090
shl eax,1 ; óìíîæåíèå íà 2
1090
lea eax,[eax+eax*4] ; óìíîæåíèå íà
1091
lea eax,[eax+eax*4] ; óìíîæåíèå íà
1091
xor edx,edx
1092
xor edx,edx
1092
mov ebx,[ScreenHeight]
1093
mov ebx,[ScreenHeight]
1093
div ebx
1094
div ebx
1094
cmp eax,5
1095
cmp eax,5
1095
pop eax
1096
pop eax
1096
jb @f
1097
jb @f
1097
mov ebx,[display_data-8]
1098
mov ebx,[display_data-8]
1098
shl ebx,1
1099
shl ebx,1
1099
add ebx,[display_data-8]
1100
add ebx,[display_data-8]
1100
add ebx,IMG_BACKGROUND
1101
add ebx,IMG_BACKGROUND
1101
add ebx,esi
1102
add ebx,esi
1102
mov ebx,[ebx]
1103
mov ebx,[ebx]
1103
call overlapping_of_points
1104
call overlapping_of_points
1104
@@:
1105
@@:
1105
and eax,0xffffff
1106
and eax,0xffffff
1106
xchg edi, ebp
1107
xchg edi, ebp
1107
stosw
1108
stosw
1108
shr eax,16
1109
shr eax,16
1109
stosb
1110
stosb
1110
xchg ebp, edi ; ebp+=3
1111
xchg ebp, edi ; ebp+=3
1111
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
1112
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
1112
jz @f
1113
jz @f
1113
inc ebp ; +1
1114
inc ebp ; +1
1114
@@:
1115
@@:
1115
pop ebx
1116
pop ebx
1116
pop eax
1117
pop eax
1117
jmp shook1
1118
jmp shook1
1118
 
1119
 
1119
overlapping_of_points:
1120
overlapping_of_points:
1120
push ecx edi
1121
push ecx edi
1121
mov ecx,eax
1122
mov ecx,eax
1122
mov edx,ebx
1123
mov edx,ebx
1123
xor eax,eax
1124
xor eax,eax
1124
mov al,cl
1125
mov al,cl
1125
xor ebx,ebx
1126
xor ebx,ebx
1126
mov bl,dl
1127
mov bl,dl
1127
add eax,ebx
1128
add eax,ebx
1128
rcr eax,1
1129
rcr eax,1
1129
xor edi,edi
1130
xor edi,edi
1130
mov di,ax
1131
mov di,ax
1131
xor eax,eax
1132
xor eax,eax
1132
mov al,ch
1133
mov al,ch
1133
xor ebx,ebx
1134
xor ebx,ebx
1134
mov bl,dh
1135
mov bl,dh
1135
add eax,ebx
1136
add eax,ebx
1136
rcr eax,1
1137
rcr eax,1
1137
ror edi,8
1138
ror edi,8
1138
add edi,eax
1139
add edi,eax
1139
ror ecx,8
1140
ror ecx,8
1140
ror edx,8
1141
ror edx,8
1141
xor eax,eax
1142
xor eax,eax
1142
mov al,ch
1143
mov al,ch
1143
xor ebx,ebx
1144
xor ebx,ebx
1144
mov bl,dh
1145
mov bl,dh
1145
add eax,ebx
1146
add eax,ebx
1146
rcr eax,1
1147
rcr eax,1
1147
ror edi,8
1148
ror edi,8
1148
add eax,edi
1149
add eax,edi
1149
ror eax,16
1150
ror eax,16
1150
pop edi ecx
1151
pop edi ecx
1151
ret
1152
ret
1152
 
1153
 
1153
   snbgp:
1154
   snbgp:
1154
     add  ebp,3                     ; +3
1155
     add  ebp,3                     ; +3
1155
     cmp [ScreenBPP],byte 24        ; 24 or 32 bpp ? - x size
1156
     cmp [ScreenBPP],byte 24        ; 24 or 32 bpp ? - x size
1156
     jz  @f
1157
     jz  @f
1157
     inc ebp ; +1
1158
     inc ebp ; +1
1158
   @@:
1159
   @@:
1159
 
1160
 
1160
   shook1:
1161
   shook1:
1161
 
1162
 
1162
     inc edi                       ; ptrBuffer++
1163
     inc edi                       ; ptrBuffer++
1163
     add esi,3                     ; ptrImage+=3
1164
     add esi,3                     ; ptrImage+=3
1164
     inc eax
1165
     inc eax
1165
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
1166
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
1166
     jle sdp3
1167
     jle sdp3
1167
 
1168
 
1168
     mov ebp,[draw_data+32+RECT.left]
1169
     mov ebp,[draw_data+32+RECT.left]
1169
 
1170
 
1170
     inc ebx
1171
     inc ebx
1171
 
1172
 
1172
     mov  eax,[BytesPerScanLine]
1173
     mov  eax,[BytesPerScanLine]
1173
     mul  ebx
1174
     mul  ebx
1174
     xchg ebp, eax                 ; BytesPerScanLine*(Ywin+y)
1175
     xchg ebp, eax                 ; BytesPerScanLine*(Ywin+y)
1175
     add  ebp, eax                 ; +X
1176
     add  ebp, eax                 ; +X
1176
     add  ebp, eax                 ; +X=X*2
1177
     add  ebp, eax                 ; +X=X*2
1177
     add  ebp, eax                 ; +X=X*3
1178
     add  ebp, eax                 ; +X=X*3
1178
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
1179
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
1179
     jz   @f
1180
     jz   @f
1180
     add  ebp,eax                  ; +X=X*4
1181
     add  ebp,eax                  ; +X=X*4
1181
   @@:
1182
   @@:
1182
     add ebp,[LFBAddress]          ; +LFB
1183
     add ebp,[LFBAddress]          ; +LFB
1183
 
1184
 
1184
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1185
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1185
 
1186
 
1186
     call calculate_edi
1187
     call calculate_edi
1187
 
1188
 
1188
     cmp ebx,[draw_data+32+RECT.bottom]
1189
     cmp ebx,[draw_data+32+RECT.bottom]
1189
     jle sdp3
1190
     jle sdp3
1190
 
1191
 
1191
     add esp,4
1192
     add esp,4
1192
 
1193
 
1193
     pop edx
1194
     pop edx
1194
     pop ecx
1195
     pop ecx
1195
     pop ebx
1196
     pop ebx
1196
     pop eax
1197
     pop eax
1197
     pop ebp
1198
     pop ebp
1198
     mov     [EGA_counter],1
1199
     mov     [EGA_counter],1
1199
     call  VGA_drawbackground
1200
     call  VGA_drawbackground
1200
     ret
1201
     ret