57,7 → 57,6 |
and ecx, 0xffffff |
ret |
|
|
Vesa20_getpixel32: |
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
102,15 → 101,13 |
; ebp = pointer to 'get' function |
; esi = pointer to 'init' function |
; edi = parameter for 'get' function |
|
vesa20_putimage: |
pushad |
call [disable_mouse] |
|
sub esp, putimg.stack_data |
|
; save pointer to image |
mov [putimg.pti], ebx |
|
; unpack the size |
mov eax, ecx |
and ecx, 0xFFFF |
117,7 → 114,6 |
shr eax, 16 |
mov [putimg.image_sx], eax |
mov [putimg.image_sy], ecx |
|
; unpack the coordinates |
mov eax, edx |
and edx, 0xFFFF |
124,7 → 120,6 |
shr eax, 16 |
mov [putimg.image_cx], eax |
mov [putimg.image_cy], edx |
|
; calculate absolute (i.e. screen) coordinates |
mov eax, [TASK_BASE] |
mov ebx, [eax-twdw + WDATA.box.left] |
133,7 → 128,6 |
mov ebx, [eax-twdw + WDATA.box.top] |
add ebx, [putimg.image_cy] |
mov [putimg.abs_cy], ebx |
|
; real_sx = MIN(wnd_sx-image_cx, image_sx); |
mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
; \begin{diamond}[20.08.2006] |
151,7 → 145,6 |
mov ebx, [putimg.image_sx] |
.end_x: |
mov [putimg.real_sx], ebx |
|
; init real_sy |
mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
; \begin{diamond}[20.08.2006] |
168,7 → 161,6 |
mov ebx, [putimg.image_sy] |
.end_y: |
mov [putimg.real_sy], ebx |
|
; line increment |
mov eax, [putimg.image_sx] |
sub eax, [putimg.real_sx] |
177,13 → 169,11 |
call esi |
add eax, [putimg.arg_0] |
mov [putimg.line_increment], eax |
|
; winmap new line increment |
mov eax, [ScreenWidth] |
inc eax |
sub eax, [putimg.real_sx] |
mov [putimg.winmap_newline], eax |
|
; screen new line increment |
mov eax, [BytesPerScanLine] |
mov ecx, [putimg.real_sx] |
192,10 → 182,8 |
imul ecx, ebx |
sub eax, ecx |
mov [putimg.screen_newline], eax |
|
; pointer to image |
mov esi, [putimg.pti] |
|
; pointer to screen |
mov edx, [putimg.abs_cy] |
imul edx, [BytesPerScanLine] |
205,7 → 193,6 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
|
; pointer to pixel map |
mov eax, [putimg.abs_cy] |
imul eax, [ScreenWidth] |
213,23 → 200,18 |
add eax, [putimg.abs_cx] |
add eax, WinMapAddress |
xchg eax, ebp |
|
; get process number |
mov ebx, [CURRENT_TASK] |
|
cmp byte [ScreenBPP], 32 |
je put_image_end_32 |
|
;put_image_end_24: |
mov edi, [putimg.real_sy] |
align 4 |
.new_line: |
mov ecx, [putimg.real_sx] |
|
; push ebp edx |
align 4 |
.new_x: |
|
push [putimg.edi] |
mov eax, [putimg.ebp+4] |
call eax |
240,20 → 222,16 |
shr eax, 16 |
mov [edx+2], al |
.skip: |
|
; add esi, 3 ;[putimg.source_bpp] |
add edx, 3 |
inc ebp |
|
dec ecx |
jnz .new_x |
; pop edx ebp |
|
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
;inc ebp |
|
dec edi |
jnz .new_line |
.finish: |
266,11 → 244,9 |
align 4 |
.new_line: |
mov ecx, [putimg.real_sx] |
|
; push ebp edx |
align 4 |
.new_x: |
|
push [putimg.edi] |
mov eax, [putimg.ebp+4] |
call eax |
279,20 → 255,16 |
; mov eax, [esi] ; ecx = RRBBGGRR |
mov [edx], eax |
.skip: |
|
; add esi, [putimg.source_bpp] |
add edx, 4 |
inc ebp |
|
dec ecx |
jnz .new_x |
; pop edx ebp |
|
add esi, [putimg.line_increment] |
add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
;inc ebp |
|
dec edi |
jnz .new_line |
.finish: |
313,7 → 285,6 |
; edi = 0x00000001 force |
|
;;; mov [novesachecksum], dword 0 |
|
pushad |
test edi,1 ; force ? |
jnz .forced |
340,15 → 311,12 |
call dword [PUTPIXEL] ; call the real put_pixel function |
.exit: |
popad |
|
ret |
|
align 4 |
Vesa20_putpixel24: |
|
; eax = x |
; ebx = y |
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [eax+eax*2] ; edi = x*3 |
mov eax, [esp+32-8+4] |
357,25 → 325,20 |
mov [edi], ax |
shr eax, 16 |
mov [edi+2], al |
|
ret |
|
|
align 4 |
Vesa20_putpixel32: |
|
; eax = x |
; ebx = y |
|
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
mov eax, [esp+32-8+4] ; eax = color |
add edi, [LFBAddress] ; ebx = where to put pixel in memory |
mov [edi], eax |
|
ret |
|
|
;************************************************* |
|
;align 4 |
418,12 → 381,10 |
mov bp, bx ; ebp = y2 |
shr eax, 16 ; eax = x1 |
shr ebx, 16 ; ebx = y1 |
|
push eax ; save x1 |
push ebx ; save y1 |
push esi ; save x2 |
push ebp ; save y2 |
|
; checking x-axis... |
sub esi, eax ; esi = x2-x1 |
push esi ; save y2-y1 |
436,7 → 397,6 |
.x2lx1: |
neg esi ; get esi absolute value |
.no_vline: |
|
; checking y-axis... |
sub ebp, ebx ; ebp = y2-y1 |
push ebp ; save y2-y1 |
445,17 → 405,14 |
mov edx, [dl_x2] ; else (if y1=y2) |
call hline |
jmp .exit |
|
.y2ly1: |
neg ebp ; get ebp absolute value |
.no_hline: |
|
|
cmp ebp, esi |
jle .x_rules ; |y2-y1| < |x2-x1| ? |
|
cmp [dl_y2], ebx ; make sure y1 is at the begining |
jge .no_reverse1 |
|
neg dword [dl_dx] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
463,9 → 420,7 |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
|
.no_reverse1: |
|
mov eax, [dl_dx] |
cdq ; extend eax sing to edx |
shl eax, 16 ; using 16bit fix-point maths |
473,13 → 428,11 |
mov edx, ebp ; edx = counter (number of pixels to draw) |
mov ebp, 1 *65536 ; <<16 ; ebp = dy = 1.0 |
mov esi, eax ; esi = dx |
jmp .y_rules |
|
jmp .y_rules |
.x_rules: |
|
cmp [dl_x2], eax ; make sure x1 is at the begining |
jge .no_reverse2 |
|
neg dword [dl_dy] |
mov edx, [dl_x2] |
mov [dl_x2], eax |
487,9 → 440,7 |
mov edx, [dl_y2] |
mov [dl_y2], ebx |
mov [dl_y1], edx |
|
.no_reverse2: |
|
xor edx, edx |
mov eax, [dl_dy] |
cdq ; extend eax sing to edx |
498,16 → 449,12 |
mov edx, esi ; edx = counter (number of pixels to draw) |
mov esi, 1 *65536 ;<< 16 ; esi = dx = 1.0 |
mov ebp, eax ; ebp = dy |
|
.y_rules: |
|
mov eax, [dl_x1] |
mov ebx, [dl_y1] |
shl eax, 16 |
shl ebx, 16 |
|
align 4 |
|
.draw: |
push eax ebx |
shr eax, 16 |
514,13 → 461,10 |
shr ebx, 16 |
call [putpixel] |
pop ebx eax |
|
add ebx, ebp ; y = y+dy |
add eax, esi ; x = x+dx |
|
dec edx |
jnz .draw |
|
; force last drawn pixel to be at (x2,y2) |
mov eax, [dl_x2] |
mov ebx, [dl_y2] |
541,7 → 485,6 |
; ecx = color |
; edi = force ? |
push eax edx |
|
cmp edx, eax ; make sure x2 is above x1 |
jge @f |
xchg eax, edx |
551,7 → 494,6 |
inc eax |
cmp eax, edx |
jle @b |
|
pop edx eax |
ret |
|
564,7 → 506,6 |
; ecx = color |
; edi = force ? |
push ebx edx |
|
cmp edx, ebx ; make sure y2 is above y1 |
jge @f |
xchg ebx, edx |
574,7 → 515,6 |
inc ebx |
cmp ebx, edx |
jle @b |
|
pop edx ebx |
ret |
|
605,14 → 545,10 |
; edx ye |
; edi color |
vesa20_drawbar: |
|
pushad |
call [disable_mouse] |
|
sub esp, drbar.stack_data |
|
mov [drbar.color], edi |
|
sub edx, ebx |
jle .exit ;// mike.dld, 2005-01-29 |
sub ecx, eax |
619,16 → 555,13 |
jle .exit ;// mike.dld, 2005-01-29 |
mov [drbar.bar_sy], edx |
mov [drbar.bar_sx], ecx |
|
mov [drbar.bar_cx], eax |
mov [drbar.bar_cy], ebx |
|
mov edi, [TASK_BASE] |
add eax, [edi-twdw + WDATA.box.left] ; win_cx |
add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
mov [drbar.abs_cx], eax |
mov [drbar.abs_cy], ebx |
|
; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
; \begin{diamond}[20.08.2006] |
642,7 → 575,6 |
popad |
xor eax, eax |
inc eax |
|
ret |
@@: |
cmp ebx, [drbar.bar_sx] |
650,7 → 582,6 |
mov ebx, [drbar.bar_sx] |
.end_x: |
mov [drbar.real_sx], ebx |
|
; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
; \begin{diamond}[20.08.2006] |
662,7 → 593,6 |
popad |
xor eax, eax |
inc eax |
|
ret |
@@: |
cmp ebx, [drbar.bar_sy] |
670,13 → 600,11 |
mov ebx, [drbar.bar_sy] |
.end_y: |
mov [drbar.real_sy], ebx |
|
; line_inc_map |
mov eax, [ScreenWidth] |
sub eax, [drbar.real_sx] |
inc eax |
mov [drbar.line_inc_map], eax |
|
; line_inc_scr |
mov eax, [drbar.real_sx] |
movzx ebx, byte [ScreenBPP] |
685,7 → 613,6 |
neg eax |
add eax, [BytesPerScanLine] |
mov [drbar.line_inc_scr], eax |
|
; pointer to screen |
mov edx, [drbar.abs_cy] |
imul edx, [BytesPerScanLine] |
695,7 → 622,6 |
imul eax, ebx |
add edx, eax |
add edx, [LFBAddress] |
|
; pointer to pixel map |
mov eax, [drbar.abs_cy] |
imul eax, [ScreenWidth] |
703,10 → 629,8 |
add eax, [drbar.abs_cx] |
add eax, WinMapAddress |
xchg eax, ebp |
|
; get process number |
mov ebx, [CURRENT_TASK] |
|
cmp byte [ScreenBPP], 24 |
jne draw_bar_end_32 |
draw_bar_end_24: |
720,7 → 644,6 |
; edx - pointer to screen |
; esi - counter |
; edi - counter |
|
mov esi, [drbar.real_sy] |
align 4 |
.new_y: |
727,24 → 650,19 |
mov edi, [drbar.real_sx] |
align 4 |
.new_x: |
|
cmp byte [ebp], bl |
jne .skip |
mov [edx], bh |
mov [edx + 1], ax |
.skip: |
|
; add pixel |
add edx, 3 |
inc ebp |
|
dec edi |
jnz .new_x |
|
; add line |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
|
; <Ivan 15.10.04> drawing gradient bars |
test eax, 0x00800000 |
jz @f |
753,10 → 671,8 |
dec bh |
@@: |
; </Ivan 15.10.04> |
|
dec esi |
jnz .new_y |
|
add esp, drbar.stack_data |
popad |
xor eax, eax |
764,7 → 680,6 |
|
draw_bar_end_32: |
mov eax, [drbar.color] ;; BBGGRR00 |
|
mov esi, [drbar.real_sy] |
align 4 |
.new_y: |
771,23 → 686,18 |
mov edi, [drbar.real_sx] |
align 4 |
.new_x: |
|
cmp byte [ebp], bl |
jne .skip |
mov [edx], eax |
.skip: |
|
; add pixel |
add edx, 4 |
inc ebp |
|
dec edi |
jnz .new_x |
|
; add line |
add edx, [drbar.line_inc_scr] |
add ebp, [drbar.line_inc_map] |
|
; <Ivan 15.10.04> drawing gradient bars |
test eax, 0x80000000 |
jz @f |
796,10 → 706,8 |
dec al |
@@: |
; </Ivan 15.10.04> |
|
dec esi |
jnz .new_y |
|
add esp, drbar.stack_data |
popad |
call VGA_draw_bar |
807,7 → 715,6 |
mov [EGA_counter],1 |
ret |
|
|
;voodoodbcplimit: |
|
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer |
868,23 → 775,18 |
|
;--------------vbe voodoo ------------------------------------------------ |
vesa20_drawbackground_tiled: |
|
call [disable_mouse] |
|
push ebp |
push eax |
push ebx |
push ecx |
push edx |
|
mov edx,dword [WinMapAddress-8] ; B |
add edx,dword [WinMapAddress-8] ; +B |
add edx,dword [WinMapAddress-8] ; +B |
push edx |
|
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
|
mov eax,[BytesPerScanLine] |
mul ebx |
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
891,52 → 793,36 |
add ebp, eax ; +X |
add ebp, eax ; +X |
add ebp, eax ; +X |
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
jz @f |
add ebp,eax ; +X |
@@: |
add ebp,[LFBAddress] ; +LFB |
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
|
call calculate_edi |
|
|
dp3: ; MAIN LOOP |
|
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
; je ybgp |
; |
; jmp nbgp |
; |
; ybgp: |
jne nbgp |
|
push eax |
push ebx |
|
mov ecx,dword [WinMapAddress-8] ; B |
xor edx,edx ; edx:=0 |
div ecx ; Xstart/B |
|
; eax=Int(qn) edx:=Rem |
|
lea esi,[edx+edx*2] ; esi:=edx*3 |
|
mov ecx,dword [WinMapAddress-4] ; ecx:=H |
mov eax,[esp+0] ; eax:=Ystart |
xor edx,edx ; |
div ecx ; Ystart/H |
|
mov eax,edx ; eax:=Rem |
xor edx,edx ; |
mov ebx,[esp+8] ; ebx:=B*3 |
mul ebx ; |
add esi,eax ; |
mov eax,[esi+IMG_BACKGROUND] |
; mov eax,[esi+IMG_BACKGROUND] |
mov eax,[img_background] |
mov eax,[esi+eax] |
and eax,0xffffff |
|
xchg edi, ebp |
stosw |
shr eax,16 |
946,12 → 832,9 |
jz @f |
inc ebp ; +1 |
@@: |
|
pop ebx |
pop eax |
|
jmp hook1 |
|
nbgp: |
add ebp,3 ; +3 |
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
958,23 → 841,14 |
jz @f |
inc ebp ; +1 |
@@: |
|
hook1: |
|
inc edi ; ptrBuffer++ |
add esi,3 ; ptrImage+=3 |
inc eax |
cmp eax,[draw_data+32+RECT.right] ; X > xend? |
; jg nodp3 |
; jmp dp3 |
; |
; nodp3: |
jle dp3 |
|
mov ebp,[draw_data+32+RECT.left] |
|
inc ebx |
|
mov eax,[BytesPerScanLine] |
mul ebx |
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
986,21 → 860,11 |
add ebp,eax ; +X=X*4 |
@@: |
add ebp,[LFBAddress] ; +LFB |
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
|
call calculate_edi |
|
cmp ebx,[draw_data+32+RECT.bottom] |
; jg dp4 |
; |
; jmp dp3 |
; |
; dp4: |
jle dp3 |
|
add esp,4 |
|
pop edx |
pop ecx |
pop ebx |
1014,23 → 878,19 |
|
|
vesa20_drawbackground_stretch: |
|
call [disable_mouse] |
|
push ebp |
push eax |
push ebx |
push ecx |
push edx |
|
mov edx,dword [WinMapAddress-8] ; B |
add edx,dword [WinMapAddress-8] ; +B |
add edx,dword [WinMapAddress-8] ; +B |
push edx |
|
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
|
dec ebx |
mov eax,[BytesPerScanLine] |
mul ebx |
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
1037,18 → 897,14 |
add ebp, eax ; +X |
add ebp, eax ; +X |
add ebp, eax ; +X |
|
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
jz @f |
add ebp,eax ; +X |
@@: |
add ebp,[LFBAddress] ; +LFB |
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
|
call calculate_edi |
|
|
sdp3: ; MAIN LOOP |
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
jne snbgp |
1070,8 → 926,21 |
mov cx,dx |
imul eax, [esp+8] ;8 |
add esi,eax |
mov eax,[esi+IMG_BACKGROUND] |
; mov eax,[esi+IMG_BACKGROUND] |
mov eax,[img_background] |
|
push eax |
mov eax,[display_data-4] |
imul eax,[display_data-8] |
imul eax,3 |
sub eax,3 |
cmp eax,esi |
pop eax |
jbe @f |
|
mov eax,[esi+eax] |
@@: |
push eax |
ror ecx,16 |
xor eax,eax |
mov ax,cx |
1083,7 → 952,20 |
cmp eax,5 |
pop eax |
jb @f |
mov ebx,[esi+IMG_BACKGROUND+3] |
; mov ebx,[esi+IMG_BACKGROUND+3] |
mov ebx,[img_background] |
|
push eax |
mov eax,[display_data-4] |
imul eax,[display_data-8] |
imul eax,3 |
sub eax,3 |
cmp eax,esi |
pop eax |
jbe @f |
|
mov ebx,[esi+ebx+3] |
|
call overlapping_of_points |
@@: |
push eax |
1101,7 → 983,16 |
mov ebx,[display_data-8] |
shl ebx,1 |
add ebx,[display_data-8] |
add ebx,IMG_BACKGROUND |
add ebx,[img_background] ;IMG_BACKGROUND |
|
push eax |
mov eax,[display_data-4] |
imul eax,[display_data-8] |
imul eax,3 |
cmp eax,esi |
pop eax |
jbe @f |
|
add ebx,esi |
mov ebx,[ebx] |
call overlapping_of_points |
1162,12 → 1053,12 |
@@: |
|
shook1: |
|
inc edi ; ptrBuffer++ |
add esi,3 ; ptrImage+=3 |
inc eax |
cmp eax,[draw_data+32+RECT.right] ; X > xend? |
jle sdp3 |
; jbe sdp3 |
|
mov ebp,[draw_data+32+RECT.left] |
|
1189,9 → 1080,13 |
|
call calculate_edi |
|
; cmp ebx,[ScreenHeight] |
; ja @f |
|
cmp ebx,[draw_data+32+RECT.bottom] |
jle sdp3 |
|
; jbe sdp3 |
@@: |
add esp,4 |
|
pop edx |