Subversion Repositories Kolibri OS

Rev

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

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