Subversion Repositories Kolibri OS

Rev

Rev 115 | Rev 119 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 115 Rev 117
Line 50... Line 50...
50
       add al,32
50
       add al,32
51
     palvgalbl3:
51
     palvgalbl3:
52
       out dx,al  ; green 0,31 or 63
52
       out dx,al  ; green 0,31 or 63
53
       add ah,1
53
       add ah,1
54
       loop palvganew
54
       loop palvganew
55
 
-
 
-
 
55
;       mov    dx, 3ceh
-
 
56
;       mov    ax, 0005h 
-
 
57
;       out    dx, ax        
56
       ret
58
       ret
Line -... Line 59...
-
 
59
 
Line 57... Line 60...
57
 
60
palette320x200:
58
 
61
 
59
vga_putimage:
62
       mov   edx,0x3c8
60
; pushad
63
       xor   eax, eax
61
 call    [disable_mouse]
64
       out   dx,al
62
 push ebp ;
65
       mov   ecx,256
63
 push esi ;
66
       mov   edx,0x3c9
64
 push edi ;
67
       xor   eax,eax
65
 
68
 
66
 push eax ;
69
     palnew:
67
 push ebx ; +8 [ptrImage]
70
       mov   al,0
68
 push ecx ; +4 [BH]
-
 
69
 push edx ; +0 [xy]
71
       test  ah,64
70
 
72
       jz    pallbl1
71
 movzx eax,word [esp+2]   ; eax:=x
73
       add   al,21
72
 movzx ebx,word [esp+0]   ; ebx:=y
-
 
73
 mov ecx,[0x3010]         ;
-
 
74
 add eax,[ecx-twdw+WDATA.box.left]     ; eax+=Xwin
74
     pallbl1:
75
 add ebx,[ecx-twdw+WDATA.box.top]   ; ebx+=Ywin
75
       test  ah,128
76
 mov ecx,ebx              ; ecx = y+Ywin
-
 
77
 mov edx,eax              ; edx = x+Xwin
-
 
78
 
76
       jz    pallbl2
79
 imul ebx, 640*4          ; (y+Ywin)*BytesPerScanLine
77
       add   al,42
80
 shl eax,2                ; (x+Xwin)*BytesPerPixel
78
     pallbl2:
81
 add eax,ebx              ;
79
       out   dx,al
82
 mov edi,eax              ; store copy
-
 
83
        add eax,[0xfe80]         ; +AddrLFB
-
 
84
 ;entry point in LFB >> EAX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrLFB
-
 
85
 
80
       mov   al,0
86
 shr edi,5                ; change from 4 to 1/8 BytesPerPixel
-
 
87
 add edi,0xa0000          ; + VGABasePtr
-
 
88
 ;VGA start address >> EDI:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrVGA
81
       test  ah,8
89
 
82
       jz    pallbl3
90
 mov ebx, [0xfe00]        ; ScreenXSize
83
       add   al,8
91
 inc ebx                  ; +1
84
     pallbl3:
92
 imul ebx,ecx             ; *(y+Ywin)
85
       test  ah,16
93
 mov ebp, ebx             ;
-
 
94
 add ebp, edx             ; +(x+Xwin)
-
 
95
 add ebp, WinMapAddress   ; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
86
       jz    pallbl4
96
 
87
       add   al,15
97
 mov esi,[esp+8] ; esi:=AddrImg
88
     pallbl4:
98
 movzx ecx,word [esp+6] ; ecx:=B
-
 
99
 movzx ebx,word [esp+4] ; ebx:=H
89
       test  ah,32
100
 
-
 
101
 ; check limits while draw ?
90
       jz    pallbl5
102
 
91
       add   al,40
103
 push ecx ; B
-
 
104
 push eax ; LFB address
92
     pallbl5:
105
 
-
 
106
 mov eax,[0x3010]
93
       out   dx,al
107
 mov ecx,[eax+draw_data-0x3000+RECT.left]
94
       mov   al,0
108
 cmp ecx,0
-
 
109
 jnz dbcblimitlset_vga
-
 
110
 
95
       test  ah,1
111
 mov ecx,[eax+draw_data-0x3000+RECT.top]
96
       jz    pallbl6
112
 cmp ecx,0
-
 
113
 jnz dbcblimitlset_vga
-
 
114
 
97
       add   al,8
115
 mov ecx,[eax+draw_data-0x3000+RECT.right]
98
     pallbl6:
116
 cmp ecx,[0xfe00] ; ecx <> Screen X size
-
 
117
 jnz dbcblimitlset_vga
-
 
118
 
-
 
119
 mov ecx,[eax+draw_data-0x3000+RECT.bottom]
99
       test  ah,2
120
 cmp ecx,[0xfe04] ; ecx <> Screen Y size
-
 
121
 jnz dbcblimitlset_vga
100
       jz    pallbl7
122
 
101
       add   al,15
123
 pop eax ; LFB address
-
 
124
 pop ecx ; B
102
     pallbl7:
125
 
-
 
126
 push dword 0
103
       test  ah,4
127
 
-
 
128
 jmp pimvga
104
       jz    pallbl8
129
 
-
 
130
      dbcblimitlset_vga:
105
       add   al,40
131
 
106
     pallbl8:
132
 pop eax ; LFB address
-
 
133
 pop ecx ; B
107
       out   dx,al
Line 134... Line -...
134
 
-
 
135
 push dword 1
-
 
136
 
108
       add   ah,1
137
pimvga:
-
 
138
 push edi
-
 
139
 push esi
-
 
140
 push eax  ; LFB address
-
 
Line -... Line 109...
-
 
109
       loop  palnew
-
 
110
 
-
 
111
       ret
-
 
112
 
-
 
113
uglobal
-
 
114
  novesachecksum dd 0x0
-
 
115
  EGA_counter    db  0
-
 
116
  VGA_drawing_screen db 0
-
 
117
  VGA_8_pixels: 
-
 
118
     rb 16
-
 
119
  temp:
-
 
120
     .cx dd 0
-
 
121
endg
-
 
122
 
-
 
123
checkVga_N13:
-
 
124
 
-
 
125
        cmp    [0xfe0c],dword 0x13
-
 
126
        jne   @f
-
 
127
 
141
 push ecx  ; B
128
;      cnvl:
-
 
129
        pushad
-
 
130
        cmp   [EGA_counter],1
142
 push ebx  ; H
131
        je   novesal
-
 
132
        mov    ecx,[0xfb0a]
-
 
133
        cmp    ecx,[novesachecksum]
Line -... Line 134...
-
 
134
        jne    novesal
-
 
135
        popad
-
 
136
      @@:
-
 
137
        ret
-
 
138
 
-
 
139
      novesal:
-
 
140
        mov    [novesachecksum],ecx
-
 
141
        mov    ecx,0
-
 
142
        movzx  eax,word [0xfb0c]
-
 
143
        cmp    eax,100
-
 
144
        jge    m13l3
-
 
145
        mov    eax,100
-
 
146
      m13l3:
-
 
147
        cmp    eax,480-100
-
 
148
        jbe    m13l4
-
 
149
        mov    eax,480-100
-
 
150
      m13l4:
-
 
151
        sub    eax,100
-
 
152
        imul   eax,640*4
-
 
153
        add    ecx,eax
-
 
154
        movzx  eax,word [0xfb0a]
-
 
155
        cmp    eax,160
-
 
156
        jge    m13l1
-
 
157
        mov    eax,160
-
 
158
      m13l1:
-
 
159
        cmp    eax,640-160
-
 
160
        jbe    m13l2
-
 
161
        mov    eax,640-160
-
 
162
      m13l2:
-
 
163
        sub    eax,160
-
 
164
        shl    eax,2
-
 
165
        add    ecx,eax
143
 push edx  ; x+Xwin
166
        mov    esi,[0xfe80]
144
 
-
 
145
 mov ebx,[0x3000]
-
 
146
 mov bh,[esp+6*4]
-
 
147
 
-
 
148
 cld
167
        add    esi,ecx
149
 
-
 
150
 npvga:
168
        mov    edi,0xa0000
151
 
169
        mov    edx,200
152
   cmp bl,[ds:ebp]
-
 
153
   jnz impvgano
-
 
154
 
170
        mov    ecx,320
155
;   cmp bh,0
-
 
156
;   jz impvgayes
-
 
157
 
-
 
158
;   call voodoodbcplimit
171
        cld
159
;   jnz impvgano
172
     m13pix:
160
 
173
        lodsd
161
; impvgayes:
174
        cmp    eax,0
162
 
-
 
163
   push eax  ; LFB address
-
 
164
   push ebx  ; app no.
175
        jne    @f
165
   push ecx  ; B
-
 
166
   push edx  ; x+Xwin
-
 
167
 
-
 
168
   mov edx,[esi] ; color
176
        xor    eax,eax
169
   mov [eax],dx
177
        jmp    .save_pixel
170
   shr edx,16
-
 
171
   mov [eax+2],dl
178
    @@:
172
 
-
 
173
   mov eax,[esi] ; color
179
        push   eax
174
   mov ecx,[esp] ; x+Xwin
180
        mov    ebx,eax
175
   and ecx,0x07  ; modulo 8
181
        and    eax,(128+64+32)      ; blue
-
 
182
        shr    eax,5
176
   call setvgapixel ; eax=color, ecx=x%8, edi=VGA address
183
        and    ebx,(128+64+32)*256  ; green
177
 
-
 
178
   pop edx
184
        shr    ebx,8+2
179
   pop ecx
-
 
180
   pop ebx
185
        add    eax,ebx
181
   pop eax
186
        pop    ebx
182
 
187
        and    ebx,(128+64)*256*256 ; red
183
 impvgano:
188
        shr    ebx,8+8
184
 
-
 
185
   add esi,3 ; esi+=3 ptrImage+=3
189
        add    eax,ebx
186
   add eax,4 ; eax+=4 LFBaddr +=4
190
     .save_pixel:
187
   inc ebp
191
        stosb
188
   inc edx ; x+Xwin+n
-
 
189
 
192
        loop   m13pix
190
   test edx,0x07  ; test modulo 8
193
        mov    ecx,320
191
   jnz impvgacont
194
        add    esi,4*(640-320)
Line -... Line 195...
-
 
195
        dec    edx
192
   inc edi
196
        jnz    m13pix
-
 
197
        mov    [EGA_counter],0
-
 
198
        popad
-
 
199
        ret
-
 
200
 
-
 
201
    novesal_1:
-
 
202
        pushad
-
 
203
        mov    esi,[0xfe80]
-
 
204
        mov    edi,0xa0000
-
 
205
        mov    ebx,640/32  ; 640*480/(8*4)
193
 
206
        mov    edx,480
-
 
207
     @@:
-
 
208
        push   ebx edx esi edi
-
 
209
        shl    edx,9           
194
        impvgacont:
210
        lea    edx,[edx+edx*4]
195
   dec ecx ; B--
211
        add    esi,edx
-
 
212
        shr    edx,5
196
   jnz npvga
213
        add    edi,edx
197
 
214
        call   VGA_draw_long_line
Line -... Line 215...
-
 
215
        pop    edi esi edx ebx
198
      pop edx
216
        dec    edx
-
 
217
        jnz    @r
-
 
218
        call   VGA_draw_long_line_1
-
 
219
        popad
-
 
220
        ret
-
 
221
 
-
 
222
VGA_draw_long_line:
199
      pop ebx
223
        mov    dx,3ceh
-
 
224
        mov    ax,0ff08h
-
 
225
        cli
-
 
226
        out    dx, ax 
-
 
227
        mov    ax,0005h
-
 
228
        out    dx, ax
-
 
229
    m12pix:
-
 
230
        call   VGA_draw_32_pixels
-
 
231
        dec    ebx
-
 
232
        jnz    m12pix
-
 
233
        mov    dx,3c4h
-
 
234
        mov    ax,0ff02h
-
 
235
        out    dx,ax
-
 
236
        mov    dx,3ceh
Line -... Line 237...
-
 
237
        mov    ax,0205h
-
 
238
        out    dx,ax
-
 
239
        mov    dx,3ceh
-
 
240
        mov    al,08h
-
 
241
        out    dx,al
-
 
242
        sti
-
 
243
        ret
-
 
244
 
-
 
245
VGA_draw_32_pixels:
-
 
246
        xor    eax,eax
-
 
247
        mov    ebp,VGA_8_pixels
-
 
248
        mov    [ebp],eax
-
 
249
        mov    [ebp+4],eax
-
 
250
        mov    [ebp+8],eax
-
 
251
        mov    [ebp+12],eax
-
 
252
        mov    ch,4
-
 
253
    .main_loop:
-
 
254
        mov    cl,8
200
      pop ecx
255
    .convert_pixels_to_VGA:
-
 
256
        lodsd   ; eax = 24bit colour
-
 
257
        cmp    eax,0
-
 
258
        je     .end
201
      pop eax
259
        rol    eax,8
-
 
260
        mov    al,ch
202
      pop esi
261
        ror    eax,8
-
 
262
        mov    ch,1
-
 
263
        dec    cl
-
 
264
        shl    ch,cl
-
 
265
        cmp    al,85
-
 
266
        jb     .p13green
-
 
267
        or     [ebp],ch
-
 
268
        cmp    al,170
-
 
269
        jb     .p13green
203
      pop edi
270
        or     [ebp+12],ch
204
 
271
    .p13green:
-
 
272
        cmp    ah,85
-
 
273
        jb     .p13red
205
      add edi,640/8  ; add one VGA line
274
        or     [ebp+4],ch
-
 
275
        cmp    ah,170
-
 
276
        jb     .p13red
206
      add eax,640*4  ; add one LFB line
277
        or     [ebp+12],ch
-
 
278
    .p13red:
-
 
279
        shr    eax,8
-
 
280
        cmp    ah,85
207
 
281
        jb     .p13cont
208
      sub ebp, ecx ;  -B
282
        or     [ebp+8],ch
209
      add ebp, [0xfe00] ;
283
        cmp    ah,170
-
 
284
        jb     .p13cont
210
      inc ebp ; ptrBuffer:=ptrBuffer-B+Screen_Xsize+1
285
        or     [ebp+12],ch
-
 
286
    .p13cont:
-
 
287
        ror    eax,8
-
 
288
        mov    ch,ah
-
 
289
        inc    cl
-
 
290
    .end:
-
 
291
        dec    cl
-
 
292
        jnz    .convert_pixels_to_VGA
211
 
293
        inc    ebp
212
      push ecx
294
        dec    ch
213
      lea ecx,[ecx+ecx*2] ;
295
        jnz    .main_loop
-
 
296
        push   esi
214
      add esi,ecx ; ptrImage:=ptrImage+B*3
297
        sub    ebp,4
-
 
298
        mov    esi,ebp
215
      pop ecx
299
        mov    dx, 3c4h
-
 
300
        mov    ah, 1h
-
 
301
    @@:
216
 
302
        mov    al, 02h
217
      dec ebx ; H--
303
        out    dx,ax
218
      jnz pimvga
304
        xchg   ax,bp
219
 
-
 
220
      add esp,4  ; jump saved limit byte
-
 
221
      pop edx
-
 
222
      pop ecx
-
 
223
      pop ebx
-
 
224
      pop eax
305
        lodsd
Line 225... Line -...
225
      pop edi
-
 
226
      pop esi
306
        mov    [edi],eax
227
      pop ebp
-
 
228
      
307
        xchg   ax,bp
229
;      call  [draw_pointer]
308
        shl    ah, 1
230
;      call    [disable_mouse]
-
 
231
;      popad
309
        cmp    ah, 10h
232
      ret
310
        jnz    @r
233
 
-
 
-
 
311
        add    edi,4
234
 
312
        pop    esi
235
VGA_putpixel:
313
        ret
236
 
-
 
237
 ; eax = x
314
 
238
 ; ebx = y
315
VGA_putpixel:
239
 
316
 ; eax = x
240
 mov     ecx,eax
-
 
241
 mov     eax, [esp+32-8+4] ; color
317
 ; ebx = y
242
 
318
        mov     ecx,eax
243
 imul    ebx, 640*4        ; y*BytesPerLine (Vesa2.0 32)
319
        mov     eax, [esp+32-8+4] ; color
244
 lea     edx, [ebx+ecx*4]  ; + x*BytesPerPixel (Vesa2.0 32)
-
 
245
 
320
        shl        ebx,9           
246
 mov     edi,edx
-
 
247
 add     edi, [0xfe80]     ; + LFB address
-
 
248
 mov     [edi], eax        ; write to LFB for Vesa2.0
321
        lea        ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
249
 
-
 
250
 shr     edx,5             ; change BytesPerPixel to 1/8
322
        lea     edx, [ebx+ecx*4]  ; + x*BytesPerPixel (Vesa2.0 32)
251
 mov     edi,edx
-
 
252
 add     edi, 0x0a0000     ; address of pixel in VGA area
-
 
253
 
-
 
254
 and     ecx,0x07          ; bit no. (modulo 8)
-
 
255
 
-
 
256
setvgapixel:
323
        mov     edi,edx
257
 pushfd
-
 
258
 cli
-
 
259
 ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
-
 
260
 
324
        add     edi, [0xfe80]     ; + LFB address
261
 push   eax
-
 
262
 mov    ebx,eax            ; color
325
        mov     [edi], eax        ; write to LFB for Vesa2.0
263
 
-
 
264
 ;mov    al,0x08
-
 
265
 ;mov    dx,0x03ce
-
 
266
 ;out    dx,al             ; select GDC bit mask register
-
 
267
 
-
 
268
 inc    cl
326
        shr     edx,5             ; change BytesPerPixel to 1/8
269
 mov    ax, 0x100
327
        mov     edi,edx
270
 shr    ax,cl
328
        add     edi, 0x0a0000     ; address of pixel in VGA area
271
 mov    dx,0x03cf
329
        and     ecx,0x07          ; bit no. (modulo 8)
272
 out    dx,al              ; set bit mask for pixel
330
        pushfd
273
 
331
        ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8)
274
 mov    dl,0
-
 
275
 mov    eax,ebx
332
        xor    edx,edx
276
 and    eax,0x000000ff     ; blue
-
 
277
 cmp    eax,85
333
        cmp    eax,0
278
 jle    p13green
334
        je     .p13cont
279
 or     dl,0x01
335
        cmp    al,85
280
 cmp    eax,170
336
        jb    .p13green
281
 jle    p13green
337
        or     dl,0x01
282
 or     dl,0x08
338
        cmp    al,170
283
 
-
 
284
p13green:
339
        jb    .p13green
285
 and    ebx,0x0000ff00     ; green
340
        or     dl,0x08
286
 cmp    ebx,85*256
-
 
287
 jle    p13red
341
.p13green:
288
 or     dl,0x02
342
        cmp    ah,85
289
 cmp    ebx,170*256
343
        jb    .p13red
290
 jle    p13red
344
        or     dl,0x02
291
 or     dl,0x08
345
        cmp    ah,170
292
 
346
        jb    .p13red
293
p13red:
-
 
294
 pop    ebx
347
        or     dl,0x08
-
 
348
.p13red: 
-
 
349
        shr    eax,8
-
 
350
        cmp    ah,85
-
 
351
        jb    .p13cont
-
 
352
        or     dl,0x04
-
 
353
        cmp    ah,170
-
 
354
        jb    .p13cont
-
 
355
        or     dl,0x08
295
 and    ebx,0x00ff0000     ; red
356
.p13cont:
-
 
357
        ror    edx,8
296
 cmp    ebx,85*256*256
358
        inc    cl
297
 jle    p13cont
-
 
298
 or     dl,0x04
359
        xor    eax,eax
-
 
360
        inc    ah
299
 cmp    ebx,170*256*256
361
        shr    ax,cl
Line -... Line 362...
-
 
362
        mov    dx,3cfh
-
 
363
        cli
-
 
364
        out    dx,al
-
 
365
        mov    al,[edi]           ; dummy read
-
 
366
        rol    edx,8
-
 
367
        mov    [edi],dl
-
 
368
        popfd
-
 
369
;.end:
-
 
370
        ret
-
 
371
        
-
 
372
VGA__putimage:
-
 
373
; ecx = size [x|y]
-
 
374
; edx = coordinates [x|y]
-
 
375
        cmp    [0xfe0c],dword 0x12
-
 
376
        jne     @f
-
 
377
         pushad
-
 
378
        ; calculate absolute (i.e. screen) coordinates
-
 
379
         rol  edx,16
Line 300... Line 380...
300
 jle    p13cont
380
         movzx eax,dx
301
 or     dl,0x08
381
         rol  edx,16
302
 
-
 
303
p13cont:
-
 
304
 mov    al,[edi]           ; dummy read
-
 
305
 mov    [edi],dl
-
 
306
 
-
 
307
 popfd
-
 
308
 ret
-
 
309
 
-
 
310
 
382
         movzx ebx,dx
311
vga_drawbar:
383
         movzx edx,cx
312
;     pushad
384
         rol   ecx,16
313
 call    [disable_mouse]
-
 
314
     sub edx,ebx ; edx:=Yend-Ystart=H
-
 
315
     sub ecx,eax ; ecx:=Xend-Xstat=B
-
 
316
 
-
 
317
     push ebp ; +24
-
 
318
     push esi ; +20
-
 
319
     push edi ; +16
-
 
320
     push eax ; +12
-
 
321
     push ebx ; +8
-
 
322
     push ecx ; +4
-
 
323
     push edx ; +0
-
 
324
 
-
 
325
     mov ecx,[0x3010] ;
-
 
326
     add eax,[ecx-twdw+WDATA.box.left] ; eax:=Xwin+x
385
         movzx ecx,cx
327
     add ebx,[ecx-twdw+WDATA.box.top] ; ebx:=Ywin+y
386
         call  VGA_draw_bar_1
328
     mov ecx, eax ; ecx:=(x+Xwin)
-
 
329
     mov edx, ebx ; edx:=(y+Ywin)
-
 
330
 
-
 
331
     imul ebx, 640/8  ;
-
 
332
     mov edi, ebx ; edi:=BytesPerScanLine*(y+Ywin)
-
 
333
     shr eax, 3 ;
-
 
334
     add edi, eax ;  + (x+Xwin)*BytesPerPixel
-
 
335
     add edi,0xa0000  ; + VGAbaseaddress
387
         popad
336
 
-
 
337
     mov eax, [0xfe00] ; ScreenXSize
-
 
338
     inc eax ; +1
388
@@:
339
     imul eax,edx ; *(y+Ywin)
-
 
340
     mov ebp, eax ;
-
 
341
     add ebp, ecx ; +(x+Win)
-
 
342
     add ebp, WinMapAddress ; +AddrBuffer
-
 
343
 
-
 
344
     mov eax, [0xfe08]  ; BytesPerScanLine - LFB
-
 
345
     mul edx            ; *(y+Ywin)
-
 
346
     mov esi,eax
-
 
347
     add esi,ecx
-
 
348
     add esi,ecx
-
 
349
     add esi,ecx
-
 
350
     add esi,ecx        ; + 4*(x+Xwin)
-
 
351
     add esi,[0xfe80]   ; +AddrLFB
-
 
352
 
-
 
353
; edi:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel + AddrVGA
-
 
354
; esi:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel + AddrLFB
-
 
355
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
-
 
356
 
-
 
357
; x size
389
         ret
358
 
390
 
359
     mov eax,[esp+4] ; B [esp+4]
391
VGA_draw_bar:
360
     mov ebx,[esp+0] ; H
-
 
361
 
392
; eax   cx
362
     mov edx,[esp+16] ; color
393
; ebx   cy
363
     test edx,0x80000000
-
 
-
 
394
; ecx   xe
364
     jz nodbglvga
395
; edx   ye
-
 
396
        cmp    [0xfe0c],dword 0x12
365
 
397
        jne     @f
Line -... Line 398...
-
 
398
         pushad
-
 
399
         sub   ecx,eax
366
     ; no color glide for VGA - set to half glide
400
         sub   edx,ebx
367
     shr ebx,1  ; H/2
-
 
368
     sub edx,ebx
-
 
369
     mov [esp+16],edx
-
 
370
     mov ebx,[esp+0] ; reset to H
-
 
371
 
-
 
372
   nodbglvga:
-
 
373
     ; check limits ?
-
 
374
 
-
 
375
     push eax
-
 
376
     push ecx
-
 
377
 
-
 
378
     mov eax,[0x3010]
-
 
379
 
-
 
380
     mov ecx,[eax+draw_data-0x3000+RECT.left]
-
 
381
     cmp ecx,0
401
         and   eax,0xffff
382
     jnz dbcblimitlset_vga2
-
 
383
 
-
 
384
     mov ecx,[eax+draw_data-0x3000+RECT.top]
-
 
385
     cmp ecx,0
-
 
386
     jnz dbcblimitlset_vga2
-
 
387
 
-
 
388
     mov ecx,[eax+draw_data-0x3000+RECT.right]
-
 
389
     cmp ecx,[0xfe00]
-
 
390
     jnz dbcblimitlset_vga2
-
 
391
 
-
 
392
     mov ecx,[eax+draw_data-0x3000+RECT.bottom]
-
 
393
     cmp ecx,[0xfe04]
-
 
394
     jnz dbcblimitlset_vga2
-
 
395
 
-
 
396
     pop ecx
-
 
397
     pop eax
-
 
398
 
-
 
399
     push dword 0
-
 
400
 
-
 
401
     jmp dbnewpivga
-
 
402
 
-
 
403
   dbcblimitlset_vga2:
-
 
404
 
-
 
405
     pop ecx ; x+Xwin
-
 
406
     pop eax ; B
402
         and   ebx,0xffff
407
 
-
 
408
     push dword 1
-
 
409
 
-
 
410
   dbnewpivga:
-
 
411
 
-
 
412
     push eax; B
403
         and   ecx,0xffff
413
     push ebx ; H
-
 
414
     push edi
404
         and   edx,0xffff
415
     push esi
405
         call  VGA_draw_bar_1
416
     push ecx ; x+Xwin
-
 
417
 
406
         popad
418
     mov   ebx,[0x3000]
-
 
419
 
-
 
420
     cld
-
 
421
 
-
 
422
     dbnpvga:
-
 
423
 
-
 
424
       mov dl,[ds:ebp]
-
 
425
 
-
 
426
       cmp dl,bl
-
 
427
       jnz dbimpvgano
-
 
428
 
-
 
429
;       mov edx,[esp+5*4] ; check limit?
-
 
430
;       cmp edx,0
407
@@:
431
;       jz dbimpvgayes
408
         ret
432
 
-
 
433
;       call voodoodbcplimit
409
 
434
;       jnz  dbimpvgano
410
VGA_draw_bar_1:
435
 
411
        mov     [temp.cx],eax
436
;     dbimpvgayes:
-
 
437
 
-
 
438
       push eax ; B
412
        mov     eax, [0x3010]
439
       push ebx
-
 
440
       push ecx ; x+Xwin
413
        add     ebx, [eax-twdw + 4]
441
 
414
        mov     eax, [eax-twdw + 0]
442
       mov eax,[esp+12+20+16+4] ; color
415
        add     eax, [temp.cx]
443
       mov ebx,eax
-
 
444
 
416
        and     eax,0xfff8
445
       mov [esi],bx    ; write LFB pixel
-
 
446
       shr  ebx,16
-
 
447
       mov  [esi+2],bl
417
        shl     ebx,9           
448
 
418
        lea     ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5
449
       and ecx,0x07 ; modulo 8
-
 
450
       call setvgapixel ; eax=color, ecx=x%8, edi=VGA address
419
        lea     ebx, [ebx+eax*4]  ; + x*BytesPerPixel (Vesa2.0 32)
451
 
420
        mov     esi,ebx
452
       pop ecx
-
 
453
       pop ebx
-
 
454
       pop eax
-
 
455
 
-
 
456
     dbimpvgano:
-
 
457
 
-
 
458
       add esi,4    ; ptrLFB+=4
-
 
459
       inc ebp  ; address buffer
-
 
460
       inc ecx  ; x posn++
-
 
461
       test ecx,0x07  ; test modulo 8
-
 
462
       jnz dbvgacont
-
 
463
       inc edi  ; VGA screen ptr++
-
 
464
 
-
 
465
     dbvgacont:
-
 
466
       dec eax  ; B--  NB ecx in Vesa20 fn?
-
 
467
       jnz dbnpvga
-
 
468
 
-
 
469
   dbnpvgad:
-
 
470
 
-
 
471
     pop ecx
-
 
472
     pop esi
-
 
473
     pop edi
-
 
474
     pop ebx
-
 
475
     pop eax
-
 
476
 
-
 
477
     add esi,[0xfe08]            ; ptrLFB+=BytesPerScanLine
-
 
478
     add edi,640/8               ; ptrScreen+=BytesPerScanLine
-
 
479
 
-
 
480
     add ebp,[0xfe00]            ;
-
 
481
     sub ebp, eax                ; was ecx in vesa20 fn?
-
 
482
     inc ebp                     ; ptrBuffer:=ptrBuffer-B+BytesPerLine+1
-
 
483
 
-
 
484
     dec ebx                     ; H--
-
 
485
     jz nodbnewpivga             ; H<>0
-
 
486
 
-
 
487
     jmp dbnewpivga
-
 
488
 
-
 
489
   nodbnewpivga:
421
        add     esi, [0xfe80]     ; + LFB address
Line 490... Line -...
490
 
-
 
491
     add esp,7*4   ; NB includes limit check flag
422
        shr     ebx,5             ; change BytesPerPixel to 1/8
492
     ;pop ebx
-
 
493
     ;pop eax
-
 
494
     ;pop edi
-
 
495
     ;pop esi
-
 
496
     pop ebp
-
 
497
 
-
 
498
     ;pop edx
-
 
499
     ;pop ecx
-
 
500
;     popad
-
 
501
     ret
-
 
502
 
-
 
503
 
-
 
504
vga_drawbackground_tiled:
-
 
505
 call    [disable_mouse]
-
 
506
     push ebp
-
 
507
     push eax
-
 
508
     push ebx
-
 
509
     push ecx
-
 
510
     push edx
-
 
511
 
-
 
512
     mov edx,dword [0x400000-8] ; B
-
 
513
     add edx,dword [WinMapAddress-8] ; +B
-
 
514
     add edx,dword [WinMapAddress-8] ; +B
-
 
515
     push edx
-
 
516
 
-
 
517
     mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
-
 
518
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
-
 
519
     mov ecx,eax
-
 
520
     mov edx,ebx
-
 
521
 
-
 
522
     imul edx, 640*4          ; (y+Ywin)*BytesPerScanLine
-
 
523
     shl ecx,2                ; (x+Xwin)*BytesPerPixel
-
 
524
     add ecx,edx              ;
-
 
525
     mov ebp,ecx              ; store copy
-
 
526
     add ecx,[0xfe80]         ; +AddrLFB
-
 
527
  ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr
-
 
528
 
-
 
529
     shr ebp,5                ; change from 4 to 1/8 BytesPerPixel
-
 
530
     add ebp,0xa0000          ; + VGABasePtr
-
 
531
  ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV
-
 
532
 
423
        mov     edi,ebx
533
 
424
        add     edi, 0x0a0000     ; address of pixel in VGA area
534
     call calculate_edi
-
 
535
 
-
 
536
   dp3vga:                            ; MAIN LOOP
-
 
537
 
-
 
538
     cmp [edi+WinMapAddress],byte 1     ; ptrBuffer^<>byte(1)
-
 
539
     je  ybgpvga
-
 
540
 
425
        mov     ebx,ecx
541
     jmp nbgpvga
-
 
542
 
-
 
543
   ybgpvga:
-
 
544
 
-
 
545
     push eax  ; x
-
 
546
     push ebx  ; y
-
 
547
     push ecx  ; LFB address
-
 
548
 
-
 
549
     mov ecx,dword [WinMapAddress-8]    ; B
-
 
550
     xor edx,edx                   ; edx:=0
-
 
551
     div ecx                       ; Xstart/B
-
 
552
 
-
 
553
     ; eax=Int(qn) edx:=Rem
-
 
554
 
-
 
555
     lea esi,[edx+edx*2]           ; esi:=edx*3
-
 
556
 
-
 
557
     mov ecx,dword [WinMapAddress-4]    ; ecx:=H
-
 
558
     mov eax,[esp+4]               ; eax:=Ystart
-
 
559
     xor edx,edx                   ;
-
 
560
     div ecx                       ; Ystart/H
426
        shr     ebx,5
561
 
427
        inc     ebx
562
     mov eax,edx                   ; eax:=Rem
-
 
563
     xor edx,edx                   ;
-
 
564
     mov ebx,[esp+12]              ; ebx:=B*3
428
.main_loop:
565
     mul ebx                       ;
-
 
566
     add esi,eax                   ;
429
        call   VGA_draw_long_line_1
567
 
-
 
568
     mov eax,[esi+0x300000]        ; color
-
 
569
     and eax,0xffffff
-
 
570
 
-
 
571
     mov ecx, [esp]   ; LFB address
-
 
572
     mov ebx,eax      ; copy color
-
 
573
     mov [ecx],bx
-
 
574
     shr ebx,16
-
 
575
     mov [ecx+2],bl
-
 
576
 
430
        dec    edx
577
     xchg edi, ebp
-
 
578
     mov  ecx,[esp+8]     ; x position
-
 
579
     and  ecx,0x07        ; x modulo 8
-
 
580
     call setvgapixel     ; eax=color, ecx=x%8, edi=VGA address
-
 
581
     xchg ebp, edi
-
 
582
 
-
 
583
     pop ecx
-
 
584
     pop ebx
-
 
585
     pop eax
-
 
586
 
-
 
587
   nbgpvga:
-
 
588
 
-
 
589
     inc eax                       ; x++
-
 
590
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
-
 
591
     jg  nodp3vga
-
 
592
 
-
 
593
     test eax,0x07                 ; x test modulo 8
-
 
594
     jnz hook1vga
-
 
595
     inc ebp                       ; VGA address++
-
 
596
 
-
 
597
   hook1vga:
-
 
598
     add ecx,4                     ; LFB address += 4
-
 
599
     inc edi                       ; ptrBuffer++
-
 
600
     add esi,3                     ; ptrImage+=3
-
 
601
     jmp dp3vga
-
 
602
 
-
 
603
   nodp3vga:
-
 
604
 
-
 
605
     mov eax,[draw_data+32+RECT.left]         ; x+Xwin
-
 
606
     inc ebx                       ; y position
-
 
607
     mov ecx,eax
-
 
608
     mov edx,ebx
-
 
609
 
-
 
610
     imul edx, 640*4          ; (y+Ywin)*BytesPerScanLine
-
 
611
     shl ecx,2                ; (x+Xwin)*BytesPerPixel
-
 
612
     add ecx,edx              ;
-
 
613
     mov ebp,ecx              ; store copy
-
 
614
     add ecx,[0xfe80]         ; +AddrLFB
-
 
615
    ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr
-
 
616
 
-
 
617
 
-
 
618
     shr ebp,5                ; change from 4 to 1/8 BytesPerPixel
-
 
619
     add ebp,0xa0000          ; + VGABasePtr
-
 
620
   ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV
-
 
621
 
-
 
622
 
-
 
623
     call calculate_edi
-
 
624
 
-
 
625
     cmp ebx,[draw_data+32+RECT.bottom]         ; Y > yend
-
 
626
     jg  dp4vga
-
 
627
 
431
        jnz    .main_loop
Line 628... Line -...
628
     jmp dp3vga
-
 
629
 
-
 
630
   dp4vga:
-
 
631
 
-
 
632
     add esp,4
432
        call   VGA_draw_long_line_1
633
 
-
 
634
     pop edx
-
 
635
     pop ecx
-
 
636
     pop ebx
-
 
637
     pop eax
-
 
638
     pop ebp
-
 
639
 
-
 
640
     ret
-
 
641
 
-
 
642
; ----------
-
 
643
 
-
 
644
 
433
        ret
645
 
-
 
646
vga_drawbackground_stretch:
-
 
647
 call    [disable_mouse]
-
 
648
 
-
 
649
     push ebp
-
 
650
     push eax
-
 
651
     push ebx
-
 
652
     push ecx
-
 
653
     push edx
-
 
654
 
434
 
655
     mov edx,dword [WinMapAddress-8] ; B
-
 
656
     add edx,dword [WinMapAddress-8] ; +B
-
 
657
     add edx,dword [WinMapAddress-8] ; +B
-
 
658
     push edx
-
 
659
 
-
 
660
     mov eax,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
-
 
661
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
-
 
662
     mov ecx,eax
-
 
663
     mov edx,ebx
-
 
664
 
-
 
665
     imul edx, 640*4          ; (y+Ywin)*BytesPerScanLine
-
 
666
     shl ecx,2                ; (x+Xwin)*BytesPerPixel
-
 
667
     add ecx,edx              ;
-
 
668
     mov ebp,ecx              ; store copy
-
 
669
     add ecx,[0xfe80]         ; +AddrLFB
-
 
670
   ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr
-
 
671
 
-
 
672
     shr ebp,5                ; change from 4 to 1/8 BytesPerPixel
-
 
673
     add ebp,0xa0000          ; + VGABasePtr
-
 
674
   ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+AddrV
-
 
675
 
435
VGA_draw_long_line_1:
676
 
-
 
677
     call calculate_edi
-
 
678
 
-
 
679
   sdp3vga:                            ; MAIN LOOP
-
 
680
 
-
 
681
     cmp [edi+WinMapAddress],byte 1     ; ptrBuffer^<>byte(1)
-
 
682
     je  sybgpvga
-
 
683
 
-
 
684
     jmp snbgpvga
-
 
685
 
-
 
686
   sybgpvga:
-
 
687
 
-
 
688
     push eax   ; x
-
 
689
     push ebx   ; y
-
 
690
     push ecx   ; LFB address
-
 
691
 
-
 
692
     mov   eax,dword [WinMapAddress-8]  ; B
-
 
693
     xor   edx,edx
-
 
694
     mov   ebx,[esp+8]             ; Xstart
-
 
695
     mul   ebx                     ; B*Xstart
-
 
696
     xor   edx,edx
-
 
697
     mov   ebx,[0xfe00]            ; x screen width
-
 
698
     div   ebx                     ; B*Xstart/xwidth
-
 
699
     lea   esi,[eax+eax*2]         ; *3
-
 
700
     mov   eax,dword [WinMapAddress-4]  ; H
-
 
701
     xor   edx,edx
-
 
702
     mov   ebx,[esp+4]             ; Ystart
-
 
703
     mul   ebx                     ; H*Ystart
-
 
704
     xor   edx,edx
-
 
705
     mov   ebx,[0xfe04]            ; y screen height
-
 
706
     div   ebx                     ; H*Ystart/yheight
-
 
707
 
-
 
708
     xor   edx,edx
-
 
709
     mov   ebx,[esp+12]             ; B*3
-
 
710
     mul   ebx                     ;
-
 
711
     add   esi,eax
-
 
712
     mov   eax,[esi+0x300000]      ; color
-
 
713
     and   eax,0xffffff
-
 
714
 
-
 
715
     mov   ecx, [esp]   ; LFB address
-
 
716
     mov   ebx,eax      ; copy color
-
 
717
     mov   [ecx],bx
-
 
718
     shr   ebx,16
-
 
719
     mov   [ecx+2],bl
-
 
720
 
-
 
721
     xchg  edi, ebp
-
 
722
     mov   ecx,[esp+8]     ; x position
-
 
723
     and   ecx,0x07        ; x modulo 8
-
 
724
     call  setvgapixel     ; eax=color, ecx=x%8, edi=VGA address
-
 
725
     xchg  ebp, edi        ; ebp+=3
-
 
726
 
-
 
727
     pop ecx
-
 
728
     pop ebx
-
 
729
     pop eax
-
 
730
 
-
 
731
   snbgpvga:
-
 
732
 
-
 
733
     inc eax                       ; x++
-
 
734
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
-
 
735
     jg  snodp3vga
-
 
736
 
-
 
737
     test eax,0x07                 ; x test modulo 8
-
 
738
     jnz shook1vga
-
 
739
     inc ebp                       ; VGA address++
-
 
740
 
-
 
741
   shook1vga:
-
 
742
     add ecx,4                     ; LFB address += 4
-
 
743
     inc edi                       ; ptrBuffer++
-
 
744
     add esi,3                     ; ptrImage+=3
-
 
745
     jmp sdp3vga
-
 
746
 
-
 
747
   snodp3vga:
-
 
748
 
-
 
749
     mov eax,[draw_data+32+RECT.left]         ; x+Xwin
-
 
750
     inc ebx                       ; y position
-
 
751
     mov ecx,eax
-
 
752
     mov edx,ebx
-
 
753
 
436
        push   ebx edx esi edi
754
     imul edx, 640*4          ; (y+Ywin)*BytesPerScanLine
437
        shl    edx,9           
755
     shl ecx,2                ; (x+Xwin)*BytesPerPixel
-
 
756
     add ecx,edx              ;
-
 
757
     mov ebp,ecx              ; store copy
-
 
758
     add ecx,[0xfe80]         ; +AddrLFB
-
 
759
  ;entry point in LFB >> ECX:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+Addr
-
 
760
 
-
 
761
 
-
 
762
     shr ebp,5                ; change from 4 to 1/8 BytesPerPixel
-
 
763
     add ebp,0xa0000          ; + VGABasePtr
-
 
764
          ;VGA start address >> EBP:=(y+Ywin)*BytesPerScanLine+X*BytesPerPixel+A
-
 
765
 
-
 
766
 
-
 
767
     call calculate_edi
-
 
768
 
-
 
769
     cmp ebx,[draw_data+32+RECT.bottom]        ; Y > yend
-
 
770
     jg  sdp4vga
438
        lea    edx,[edx+edx*4]
771
 
-
 
772
     jmp sdp3vga
-