2010-10-01 11:21:55 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2015-06-01 21:18:07 +02:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
2010-10-01 11:21:55 +02:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; VESA20.INC ;;
|
|
|
|
;; ;;
|
|
|
|
;; Vesa 2.0 functions for MenuetOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright 2002 Ville Turjanmaa ;;
|
|
|
|
;; Alexey, kgaz@crosswindws.net ;;
|
|
|
|
;; - Voodoo compatible graphics ;;
|
|
|
|
;; Juan M. Caravaca ;;
|
|
|
|
;; - Graphics optimimizations eg. drawline ;;
|
|
|
|
;; ;;
|
|
|
|
;; See file COPYING for details ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
uglobal
|
|
|
|
align 4
|
|
|
|
bgr_cur_line rd 1920 ; maximum width of screen
|
|
|
|
bgr_next_line rd 1920
|
|
|
|
endg
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
iglobal
|
|
|
|
align 4
|
|
|
|
overlapping_of_points_ptr dd overlapping_of_points
|
|
|
|
endg
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
Vesa20_getpixel16:
|
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
|
|
|
@@:
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
test ecx, 0x04000000 ; don't load to mouseunder area
|
|
|
|
jnz .no_mouseunder
|
|
|
|
call [_display.check_m_pixel]
|
|
|
|
test ecx, ecx ; 0xff000000
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
.no_mouseunder:
|
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
|
|
|
lea edi, [eax*2] ; edi = x*2
|
|
|
|
add edi, ebx ; edi = x*2+(y*y multiplier)
|
|
|
|
|
|
|
|
movzx ecx, word[LFB_BASE+edi]
|
|
|
|
shl ecx, 3
|
|
|
|
ror ecx, 8
|
|
|
|
shl cx, 2
|
|
|
|
ror ecx, 8
|
|
|
|
shl cl, 3
|
|
|
|
rol ecx, 16
|
|
|
|
@@:
|
|
|
|
and ecx, 0x00ffffff
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_getpixel24:
|
|
|
|
|
|
|
|
; check for hardware cursor
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
2015-07-22 14:08:35 +02:00
|
|
|
test ecx, 0x04000000 ; don't load to mouseunder area
|
2012-03-08 09:33:38 +01:00
|
|
|
jnz .no_mouseunder
|
|
|
|
call [_display.check_m_pixel]
|
2014-12-01 04:51:07 +01:00
|
|
|
test ecx, ecx ; 0xff000000
|
2012-03-08 09:33:38 +01:00
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_mouseunder:
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2014-12-01 04:51:07 +01:00
|
|
|
lea edi, [eax+eax*2] ; edi = x*3
|
2015-07-22 14:08:35 +02:00
|
|
|
add edi, ebx ; edi = x*3+(y*y multiplier)
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [LFB_BASE+edi]
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
and ecx, 0x00ffffff
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
Vesa20_getpixel32:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; check for hardware cursor
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
2015-07-22 14:08:35 +02:00
|
|
|
test ecx, 0x04000000 ; don't load to mouseunder area
|
2012-03-08 09:33:38 +01:00
|
|
|
jnz .no_mouseunder
|
|
|
|
call [_display.check_m_pixel]
|
2014-12-01 04:51:07 +01:00
|
|
|
test ecx, ecx ; 0xff000000
|
2012-03-08 09:33:38 +01:00
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_mouseunder:
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2014-12-01 04:51:07 +01:00
|
|
|
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [LFB_BASE+edi]
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
and ecx, 0x00ffffff
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; ebx = pointer
|
|
|
|
; ecx = size [x|y]
|
|
|
|
; edx = coordinates [x|y]
|
|
|
|
; ebp = pointer to 'get' function
|
|
|
|
; esi = pointer to 'init' function
|
|
|
|
; edi = parameter for 'get' function
|
|
|
|
|
|
|
|
align 16
|
|
|
|
vesa20_putimage:
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
virtual at esp
|
|
|
|
putimg:
|
|
|
|
.real_sx dd ?
|
|
|
|
.real_sy dd ?
|
|
|
|
.image_sx dd ?
|
|
|
|
.image_sy dd ?
|
|
|
|
.image_cx dd ?
|
|
|
|
.image_cy dd ?
|
|
|
|
.pti dd ?
|
|
|
|
.abs_cx dd ?
|
|
|
|
.abs_cy dd ?
|
|
|
|
.line_increment dd ?
|
|
|
|
.winmap_newline dd ?
|
|
|
|
.screen_newline dd ?
|
2012-03-08 09:33:38 +01:00
|
|
|
.real_sx_and_abs_cx dd ?
|
|
|
|
.real_sy_and_abs_cy dd ?
|
|
|
|
.stack_data = 4*14
|
2010-10-01 11:21:55 +02:00
|
|
|
.edi dd ?
|
|
|
|
.esi dd ?
|
|
|
|
.ebp dd ?
|
|
|
|
.esp dd ?
|
|
|
|
.ebx dd ?
|
|
|
|
.edx dd ?
|
|
|
|
.ecx dd ?
|
|
|
|
.eax dd ?
|
|
|
|
.ret_addr dd ?
|
|
|
|
.arg_0 dd ?
|
|
|
|
end virtual
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pushad
|
|
|
|
sub esp, putimg.stack_data
|
2010-10-01 11:21:55 +02:00
|
|
|
; save pointer to image
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [putimg.pti], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; unpack the size
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, ecx
|
|
|
|
and ecx, 0xFFFF
|
|
|
|
shr eax, 16
|
|
|
|
mov [putimg.image_sx], eax
|
|
|
|
mov [putimg.image_sy], ecx
|
2010-10-01 11:21:55 +02:00
|
|
|
; unpack the coordinates
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, edx
|
|
|
|
and edx, 0xFFFF
|
|
|
|
shr eax, 16
|
|
|
|
mov [putimg.image_cx], eax
|
|
|
|
mov [putimg.image_cy], edx
|
2010-10-01 11:21:55 +02:00
|
|
|
; calculate absolute (i.e. screen) coordinates
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [TASK_BASE]
|
|
|
|
mov ebx, [eax-twdw + WDATA.box.left]
|
|
|
|
add ebx, [putimg.image_cx]
|
|
|
|
mov [putimg.abs_cx], ebx
|
|
|
|
mov ebx, [eax-twdw + WDATA.box.top]
|
|
|
|
add ebx, [putimg.image_cy]
|
|
|
|
mov [putimg.abs_cy], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; real_sx = MIN(wnd_sx-image_cx, image_sx);
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
|
|
|
|
inc ebx ; WDATA.box.width is one pixel less than real window x-size
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ebx, [putimg.image_cx]
|
|
|
|
ja @f
|
|
|
|
add esp, putimg.stack_data
|
|
|
|
popad
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp ebx, [putimg.image_sx]
|
|
|
|
jbe .end_x
|
|
|
|
mov ebx, [putimg.image_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.end_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [putimg.real_sx], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; init real_sy
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebx
|
|
|
|
sub ebx, [putimg.image_cy]
|
|
|
|
ja @f
|
|
|
|
add esp, putimg.stack_data
|
|
|
|
popad
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp ebx, [putimg.image_sy]
|
|
|
|
jbe .end_y
|
|
|
|
mov ebx, [putimg.image_sy]
|
2014-12-01 04:51:07 +01:00
|
|
|
.end_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [putimg.real_sy], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; line increment
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [putimg.image_sx]
|
|
|
|
mov ecx, [putimg.real_sx]
|
|
|
|
sub eax, ecx
|
2010-10-01 11:21:55 +02:00
|
|
|
;; imul eax, [putimg.source_bpp]
|
|
|
|
; lea eax, [eax + eax * 2]
|
2012-03-08 09:33:38 +01:00
|
|
|
call esi
|
|
|
|
add eax, [putimg.arg_0]
|
|
|
|
mov [putimg.line_increment], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; winmap new line increment
|
2015-06-01 21:18:07 +02:00
|
|
|
mov eax, [_display.width]
|
2012-03-08 09:33:38 +01:00
|
|
|
sub eax, [putimg.real_sx]
|
|
|
|
mov [putimg.winmap_newline], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; screen new line increment
|
2015-06-01 21:18:07 +02:00
|
|
|
mov eax, [_display.lfb_pitch]
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [_display.bytes_per_pixel]
|
2012-03-08 09:33:38 +01:00
|
|
|
imul ecx, ebx
|
|
|
|
sub eax, ecx
|
|
|
|
mov [putimg.screen_newline], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; pointer to image
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, [putimg.pti]
|
2010-10-01 11:21:55 +02:00
|
|
|
; pointer to screen
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edx, [putimg.abs_cy]
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul edx, [BytesPerScanLine]
|
2012-10-12 20:24:48 +02:00
|
|
|
mov edx, [BPSLine_calc_area+edx*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [putimg.abs_cx]
|
|
|
|
imul eax, ebx
|
|
|
|
add edx, eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; pointer to pixel map
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [putimg.abs_cy]
|
2014-12-01 04:51:07 +01:00
|
|
|
; imul eax, [Screen_Max_X]
|
|
|
|
; add eax, [putimg.abs_cy]
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [d_width_calc_area + eax*4]
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [putimg.abs_cx]
|
2015-06-01 21:18:07 +02:00
|
|
|
add eax, [_display.win_map]
|
2012-03-08 09:33:38 +01:00
|
|
|
xchg eax, ebp
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
|
|
|
add ecx, [putimg.abs_cx]
|
|
|
|
mov [putimg.real_sx_and_abs_cx], ecx
|
|
|
|
mov ecx, [putimg.real_sy]
|
|
|
|
add ecx, [putimg.abs_cy]
|
|
|
|
mov [putimg.real_sy_and_abs_cy], ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; get process number
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [CURRENT_TASK]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
cmp byte [_display.bits_per_pixel], 16
|
|
|
|
je put_image_end_16
|
|
|
|
cmp byte [_display.bits_per_pixel], 24
|
|
|
|
je put_image_end_24
|
|
|
|
cmp byte [_display.bits_per_pixel], 32
|
2012-03-08 09:33:38 +01:00
|
|
|
je put_image_end_32
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
put_image_end_16:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [putimg.real_sy]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
2014-12-01 04:51:07 +01:00
|
|
|
je put_image_end_16_new
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp ecx, 0
|
2014-12-01 04:51:07 +01:00
|
|
|
je put_image_end_16_old
|
|
|
|
.new_line:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-15 13:41:29 +01:00
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
2012-03-15 13:41:29 +01:00
|
|
|
mov [LFB_BASE+edx], ax
|
2014-12-01 04:51:07 +01:00
|
|
|
.skip:
|
|
|
|
add edx, 2
|
2012-03-15 13:41:29 +01:00
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-15 13:41:29 +01:00
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
.correct:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
2014-12-01 04:51:07 +01:00
|
|
|
.finish:
|
2012-03-15 13:41:29 +01:00
|
|
|
add esp, putimg.stack_data
|
|
|
|
popad
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_16_old:
|
|
|
|
|
|
|
|
.new_line:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
push ecx
|
2012-03-08 09:33:38 +01:00
|
|
|
neg ecx
|
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
2012-03-09 09:20:02 +01:00
|
|
|
call check_mouse_area_for_putpixel
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
;; and eax, 00000000111110001111110011111000b
|
|
|
|
;; shr ah, 2
|
|
|
|
;; shr ax, 3
|
|
|
|
;; ror eax, 8
|
|
|
|
;; add al, ah
|
|
|
|
;; rol eax, 8
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [LFB_BASE+edx], ax
|
2014-12-01 04:51:07 +01:00
|
|
|
.skip:
|
|
|
|
inc edx
|
|
|
|
inc edx
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
2012-03-09 09:20:02 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-09 09:20:02 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
.correct:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp put_image_end_16.finish
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_16_new:
|
|
|
|
|
|
|
|
.new_line:
|
2012-03-09 09:20:02 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.new_x:
|
2012-03-09 09:20:02 +01:00
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
push ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
.sh:
|
2012-10-12 20:24:48 +02:00
|
|
|
neg ecx
|
2012-03-09 09:20:02 +01:00
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for X
|
2012-10-12 20:24:48 +02:00
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
2012-03-09 09:20:02 +01:00
|
|
|
jb .no_mouse_area
|
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
2012-03-09 09:20:02 +01:00
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
|
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp ecx, -1 ; SHIT HAPPENS?
|
2012-10-12 20:24:48 +02:00
|
|
|
jne .no_mouse_area
|
|
|
|
|
|
|
|
mov ecx, [esp]
|
|
|
|
jmp .sh
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_mouse_area:
|
2012-03-09 09:20:02 +01:00
|
|
|
pop ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
2012-03-09 09:20:02 +01:00
|
|
|
mov [LFB_BASE+edx], ax
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 2
|
2012-03-09 09:20:02 +01:00
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-09 09:20:02 +01:00
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.correct:
|
2012-03-09 09:20:02 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2012-03-09 09:20:02 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp put_image_end_16.finish
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_24:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [putimg.real_sy]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
2014-12-01 04:51:07 +01:00
|
|
|
je put_image_end_24_new
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp ecx, 0
|
2014-12-01 04:51:07 +01:00
|
|
|
je put_image_end_24_old
|
|
|
|
.new_line:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+edx+2], al
|
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 3
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
2012-03-09 09:20:02 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-09 09:20:02 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
.correct:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
2014-12-01 04:51:07 +01:00
|
|
|
.finish:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, putimg.stack_data
|
|
|
|
popad
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_24_old:
|
|
|
|
|
|
|
|
.new_line:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.new_x:
|
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
push ecx
|
2012-03-15 13:41:29 +01:00
|
|
|
neg ecx
|
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel
|
|
|
|
pop ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+edx+2], al
|
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 3
|
2012-03-15 13:41:29 +01:00
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-15 13:41:29 +01:00
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.correct:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp put_image_end_24.finish
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_24_new:
|
|
|
|
|
|
|
|
.new_line:
|
2012-03-09 09:20:02 +01:00
|
|
|
mov ecx, [putimg.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.new_x:
|
2012-03-09 09:20:02 +01:00
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
push ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
.sh:
|
2012-10-12 20:24:48 +02:00
|
|
|
neg ecx
|
2012-03-09 09:20:02 +01:00
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for X
|
2012-10-12 20:24:48 +02:00
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
2012-03-09 09:20:02 +01:00
|
|
|
jb .no_mouse_area
|
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
shl ecx, 16
|
|
|
|
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-10-12 20:24:48 +02:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
2012-03-09 09:20:02 +01:00
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
|
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp ecx, -1 ; SHIT HAPPENS?
|
2012-10-12 20:24:48 +02:00
|
|
|
jne .no_mouse_area
|
|
|
|
|
|
|
|
mov ecx, [esp]
|
|
|
|
jmp .sh
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_mouse_area:
|
2012-03-09 09:20:02 +01:00
|
|
|
pop ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+edx+2], al
|
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 3
|
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
.correct:
|
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
|
|
|
|
|
|
|
@@:
|
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
|
|
|
jmp put_image_end_24.finish
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_32:
|
|
|
|
|
|
|
|
mov edi, [putimg.real_sy]
|
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
|
|
|
je put_image_end_32_new
|
|
|
|
cmp ecx, 0
|
|
|
|
je put_image_end_32_old
|
|
|
|
|
|
|
|
.new_line:
|
|
|
|
mov ecx, [putimg.real_sx]
|
|
|
|
|
|
|
|
.new_x:
|
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], eax
|
|
|
|
|
|
|
|
.skip:
|
2012-03-09 09:20:02 +01:00
|
|
|
add edx, 4
|
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
2012-03-09 09:20:02 +01:00
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.correct:
|
2012-03-09 09:20:02 +01:00
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
|
|
|
|
|
|
|
.finish:
|
|
|
|
add esp, putimg.stack_data
|
|
|
|
popad
|
|
|
|
cmp [SCR_MODE], 0x12
|
|
|
|
jne @f
|
|
|
|
call VGA__putimage
|
|
|
|
@@:
|
|
|
|
mov [EGA_counter], 1
|
|
|
|
ret
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_32_old:
|
|
|
|
|
|
|
|
.new_line:
|
|
|
|
mov ecx, [putimg.real_sx]
|
|
|
|
.new_x:
|
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
push ecx
|
|
|
|
neg ecx
|
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel
|
|
|
|
pop ecx
|
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], eax
|
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 4
|
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
.correct:
|
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
|
|
|
|
|
|
|
@@:
|
2012-03-09 09:20:02 +01:00
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
|
|
|
jmp put_image_end_32.finish
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
put_image_end_32_new:
|
|
|
|
|
|
|
|
.new_line:
|
|
|
|
mov ecx, [putimg.real_sx]
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
|
|
|
push [putimg.edi]
|
|
|
|
mov eax, [putimg.ebp+4]
|
|
|
|
call eax
|
|
|
|
cmp [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
push ecx
|
|
|
|
|
|
|
|
.sh:
|
|
|
|
neg ecx
|
|
|
|
add ecx, [putimg.real_sx_and_abs_cx + 4]
|
|
|
|
|
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb .no_mouse_area
|
|
|
|
shl ecx, 16
|
|
|
|
|
|
|
|
add ecx, [putimg.real_sy_and_abs_cy + 4]
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel_new.1
|
|
|
|
cmp ecx, -1 ; SHIT HAPPENS?
|
|
|
|
jne .no_mouse_area
|
|
|
|
|
|
|
|
mov ecx, [esp]
|
|
|
|
jmp .sh
|
|
|
|
|
|
|
|
.no_mouse_area:
|
|
|
|
pop ecx
|
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [LFB_BASE+edx], eax
|
|
|
|
|
|
|
|
.skip:
|
|
|
|
add edx, 4
|
|
|
|
inc ebp
|
|
|
|
dec ecx
|
|
|
|
jnz .new_x
|
|
|
|
|
|
|
|
add esi, [putimg.line_increment]
|
|
|
|
add edx, [putimg.screen_newline]
|
|
|
|
add ebp, [putimg.winmap_newline]
|
|
|
|
|
|
|
|
cmp [putimg.ebp], putimage_get1bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get2bpp
|
|
|
|
jz .correct
|
|
|
|
cmp [putimg.ebp], putimage_get4bpp
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
.correct:
|
|
|
|
mov eax, [putimg.edi]
|
|
|
|
mov byte [eax], 80h
|
|
|
|
|
|
|
|
@@:
|
|
|
|
dec edi
|
|
|
|
jnz .new_line
|
|
|
|
jmp put_image_end_32.finish
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; eax = x coordinate
|
|
|
|
; ebx = y coordinate
|
2014-12-01 04:51:07 +01:00
|
|
|
; ecx = xx RR GG BB
|
|
|
|
; xx flags:
|
|
|
|
; 0x01000000 color inversion
|
|
|
|
; 0x02000000 used for draw_rectangle without top line (for drawwindow_III and drawwindow_IV)
|
2010-10-01 11:21:55 +02:00
|
|
|
; edi = 0x00000001 force
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
align 4
|
|
|
|
__sys_putpixel:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pushad
|
2015-06-01 21:18:07 +02:00
|
|
|
cmp eax, [_display.width]
|
|
|
|
jge .exit
|
|
|
|
cmp ebx, [_display.height]
|
|
|
|
jge .exit
|
2015-07-22 14:08:35 +02:00
|
|
|
test edi, 1 ; force ?
|
2012-03-08 09:33:38 +01:00
|
|
|
jnz .forced
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
; not forced
|
2012-03-09 09:20:02 +01:00
|
|
|
mov edx, [d_width_calc_area + ebx*4]
|
2015-06-01 21:18:07 +02:00
|
|
|
add edx, [_display.win_map]
|
2012-03-08 09:33:38 +01:00
|
|
|
movzx edx, byte [eax+edx]
|
|
|
|
cmp edx, [CURRENT_TASK]
|
|
|
|
jne .exit
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.forced:
|
|
|
|
; check for color inversion
|
2012-03-08 09:33:38 +01:00
|
|
|
test ecx, 0x01000000
|
2014-12-01 04:51:07 +01:00
|
|
|
jz .no_inv
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
push eax ebx edx edi
|
|
|
|
call [GETPIXEL]
|
|
|
|
pop edi edx ebx eax
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
not ecx
|
2012-03-08 09:33:38 +01:00
|
|
|
rol ecx, 8
|
|
|
|
mov cl, [esp+32-8+3]
|
|
|
|
ror ecx, 8
|
|
|
|
mov [esp+32-8], ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
.no_inv:
|
|
|
|
call [PUTPIXEL] ; call the real put_pixel function
|
|
|
|
.exit:
|
2012-03-08 09:33:38 +01:00
|
|
|
popad
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
Vesa20_putpixel16:
|
|
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
|
|
|
|
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
|
|
|
lea edi, [eax*2]; edi = x*2
|
|
|
|
mov eax, [esp+32-8+4]
|
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne @f
|
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
|
|
|
call check_mouse_area_for_putpixel
|
|
|
|
@@:
|
|
|
|
; store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
|
|
|
|
mov [LFB_BASE+ebx+edi], ax
|
|
|
|
ret
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_putpixel16_new:
|
|
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
|
|
|
|
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
|
|
|
lea edi, [eax*2]; edi = x*2
|
|
|
|
mov eax, [esp+32-8+4]
|
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
jne @f
|
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae @f
|
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb @f
|
|
|
|
rol ecx, 16
|
|
|
|
|
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae @f
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb @f
|
|
|
|
ror ecx, 16
|
|
|
|
|
|
|
|
call check_mouse_area_for_putpixel_new.1
|
|
|
|
@@:
|
|
|
|
; store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
|
|
|
|
mov [LFB_BASE+ebx+edi], ax
|
|
|
|
ret
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_putpixel24:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
lea edi, [eax+eax*2]; edi = x*3
|
|
|
|
mov eax, [esp+32-8+4]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne @f
|
2012-03-08 09:33:38 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
2012-03-09 09:20:02 +01:00
|
|
|
call check_mouse_area_for_putpixel
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
; store to LFB
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [LFB_BASE+ebx+edi], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+ebx+edi+2], al
|
2012-03-09 09:20:02 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_putpixel24_new:
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2012-03-09 09:20:02 +01:00
|
|
|
lea edi, [eax+eax*2]; edi = x*3
|
|
|
|
mov eax, [esp+32-8+4]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
jne @f
|
2012-03-09 09:20:02 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae @f
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb @f
|
2012-03-09 09:20:02 +01:00
|
|
|
rol ecx, 16
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae @f
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb @f
|
|
|
|
ror ecx, 16
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
; store to LFB
|
2012-03-09 09:20:02 +01:00
|
|
|
mov [LFB_BASE+ebx+edi], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+ebx+edi+2], al
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_putpixel32:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2014-12-01 04:51:07 +01:00
|
|
|
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
|
|
|
mov eax, [esp+32-8+4] ; eax = color
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne @f
|
2012-03-08 09:33:38 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
2012-03-09 09:20:02 +01:00
|
|
|
call check_mouse_area_for_putpixel
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
and eax, 0xffffff
|
2014-12-01 04:51:07 +01:00
|
|
|
; store to LFB
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [LFB_BASE+edi], eax
|
2012-03-09 09:20:02 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; eax = x
|
|
|
|
; ebx = y
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
Vesa20_putpixel32_new:
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bx
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
2012-10-12 20:24:48 +02:00
|
|
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
2014-12-01 04:51:07 +01:00
|
|
|
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
|
|
|
mov eax, [esp+32-8+4] ; eax = color
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
jne @f
|
2012-03-09 09:20:02 +01:00
|
|
|
; check mouse area for putpixel
|
|
|
|
test eax, 0x04000000
|
|
|
|
jnz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae @f
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb @f
|
2012-03-09 09:20:02 +01:00
|
|
|
rol ecx, 16
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae @f
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb @f
|
|
|
|
ror ecx, 16
|
|
|
|
|
2012-03-09 09:20:02 +01:00
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
and eax, 0x00ffffff
|
|
|
|
; store to LFB
|
2012-03-09 09:20:02 +01:00
|
|
|
mov [LFB_BASE+edi], eax
|
2012-03-08 09:33:38 +01:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
calculate_edi:
|
2014-12-01 04:51:07 +01:00
|
|
|
; mov edi, ebx
|
|
|
|
; imul edi, [Screen_Max_X]
|
|
|
|
; add edi, ebx
|
2012-03-15 13:41:29 +01:00
|
|
|
mov edi, [d_width_calc_area + ebx*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
add edi, eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; DRAWLINE
|
2012-03-08 09:33:38 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; eax = x1 shl 16 + x2
|
|
|
|
; ebx = y1 shl 16 + y2
|
2010-10-01 11:21:55 +02:00
|
|
|
; ecx = color
|
|
|
|
; edi = force ?
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
__sys_draw_line:
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
dl_x1 equ esp+20
|
|
|
|
dl_y1 equ esp+16
|
|
|
|
dl_x2 equ esp+12
|
|
|
|
dl_y2 equ esp+8
|
|
|
|
dl_dx equ esp+4
|
|
|
|
dl_dy equ esp+0
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
pusha
|
|
|
|
|
2015-07-22 14:08:35 +02:00
|
|
|
xor edx, edx ; clear edx
|
|
|
|
xor esi, esi ; unpack arguments
|
2012-03-08 09:33:38 +01:00
|
|
|
xor ebp, ebp
|
2015-07-22 14:08:35 +02:00
|
|
|
mov si, ax ; esi = x2
|
|
|
|
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
|
2010-10-01 11:21:55 +02:00
|
|
|
; checking x-axis...
|
2015-07-22 14:08:35 +02:00
|
|
|
sub esi, eax ; esi = x2-x1
|
|
|
|
push esi ; save y2-y1
|
|
|
|
jl .x2lx1 ; is x2 less than x1 ?
|
|
|
|
jg .no_vline ; x1 > x2 ?
|
|
|
|
mov edx, ebp ; else (if x1=x2)
|
2012-03-08 09:33:38 +01:00
|
|
|
call vline
|
2015-07-22 14:08:35 +02:00
|
|
|
push edx ; necessary to rightly restore stack frame at .exit
|
2012-03-08 09:33:38 +01:00
|
|
|
jmp .exit
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.x2lx1:
|
2015-07-22 14:08:35 +02:00
|
|
|
neg esi ; get esi absolute value
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_vline:
|
2010-10-01 11:21:55 +02:00
|
|
|
; checking y-axis...
|
2015-07-22 14:08:35 +02:00
|
|
|
sub ebp, ebx ; ebp = y2-y1
|
|
|
|
push ebp ; save y2-y1
|
|
|
|
jl .y2ly1 ; is y2 less than y1 ?
|
|
|
|
jg .no_hline ; y1 > y2 ?
|
2014-12-01 04:51:07 +01:00
|
|
|
mov edx, [dl_x2] ; else (if y1=y2)
|
2012-03-08 09:33:38 +01:00
|
|
|
call hline
|
|
|
|
jmp .exit
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.y2ly1:
|
2015-07-22 14:08:35 +02:00
|
|
|
neg ebp ; get ebp absolute value
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_hline:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp ebp, esi
|
2015-07-22 14:08:35 +02:00
|
|
|
jle .x_rules ; |y2-y1| < |x2-x1| ?
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp [dl_y2], ebx ; make sure y1 is at the begining
|
2012-03-08 09:33:38 +01:00
|
|
|
jge .no_reverse1
|
|
|
|
neg dword [dl_dx]
|
|
|
|
mov edx, [dl_x2]
|
|
|
|
mov [dl_x2], eax
|
|
|
|
mov [dl_x1], edx
|
|
|
|
mov edx, [dl_y2]
|
|
|
|
mov [dl_y2], ebx
|
|
|
|
mov [dl_y1], edx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_reverse1:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [dl_dx]
|
2015-07-22 14:08:35 +02:00
|
|
|
cdq ; extend eax sing to edx
|
|
|
|
shl eax, 16 ; using 16bit fix-point maths
|
|
|
|
idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1)
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; correction for the remainder of the division
|
|
|
|
shl edx, 1
|
|
|
|
cmp ebp, edx
|
|
|
|
jb @f
|
|
|
|
inc eax
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2015-07-22 14:08:35 +02:00
|
|
|
mov edx, ebp ; edx = counter (number of pixels to draw)
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebp, 1 shl 16 ; ebp = dy = 1.0
|
2015-07-22 14:08:35 +02:00
|
|
|
mov esi, eax ; esi = dx
|
2012-03-08 09:33:38 +01:00
|
|
|
jmp .y_rules
|
2014-12-01 04:51:07 +01:00
|
|
|
.x_rules:
|
2015-07-22 14:08:35 +02:00
|
|
|
cmp [dl_x2], eax ; make sure x1 is at the begining
|
2012-03-08 09:33:38 +01:00
|
|
|
jge .no_reverse2
|
|
|
|
neg dword [dl_dy]
|
|
|
|
mov edx, [dl_x2]
|
|
|
|
mov [dl_x2], eax
|
|
|
|
mov [dl_x1], edx
|
|
|
|
mov edx, [dl_y2]
|
|
|
|
mov [dl_y2], ebx
|
|
|
|
mov [dl_y1], edx
|
2014-12-01 04:51:07 +01:00
|
|
|
.no_reverse2:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor edx, edx
|
|
|
|
mov eax, [dl_dy]
|
2015-07-22 14:08:35 +02:00
|
|
|
cdq ; extend eax sing to edx
|
|
|
|
shl eax, 16 ; using 16bit fix-point maths
|
|
|
|
idiv esi ; eax = ((y2-y1)*65536)/(x2-x1)
|
2012-03-08 09:33:38 +01:00
|
|
|
; correction for the remainder of the division
|
|
|
|
shl edx, 1
|
|
|
|
cmp esi, edx
|
|
|
|
jb @f
|
|
|
|
inc eax
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2015-07-22 14:08:35 +02:00
|
|
|
mov edx, esi ; edx = counter (number of pixels to draw)
|
2014-12-01 04:51:07 +01:00
|
|
|
mov esi, 1 shl 16 ; esi = dx = 1.0
|
2015-07-22 14:08:35 +02:00
|
|
|
mov ebp, eax ; ebp = dy
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.y_rules:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [dl_x1]
|
|
|
|
mov ebx, [dl_y1]
|
|
|
|
shl eax, 16
|
|
|
|
shl ebx, 16
|
2012-03-15 13:41:29 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area
|
|
|
|
.draw:
|
2012-03-08 09:33:38 +01:00
|
|
|
push eax ebx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; correction for the remainder of the division
|
|
|
|
test ah, 0x80
|
|
|
|
jz @f
|
|
|
|
add eax, 1 shl 16
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
shr eax, 16
|
|
|
|
; correction for the remainder of the division
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
2014-12-01 04:51:07 +01:00
|
|
|
add ebx, 1 shl 16
|
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
shr ebx, 16
|
2014-12-01 04:51:07 +01:00
|
|
|
; and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area
|
2012-03-15 13:41:29 +01:00
|
|
|
; call [putpixel]
|
|
|
|
call __sys_putpixel
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ebx eax
|
|
|
|
add ebx, ebp ; y = y+dy
|
|
|
|
add eax, esi ; x = x+dx
|
|
|
|
dec edx
|
|
|
|
jnz .draw
|
2010-10-01 11:21:55 +02:00
|
|
|
; force last drawn pixel to be at (x2,y2)
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [dl_x2]
|
|
|
|
mov ebx, [dl_y2]
|
2014-12-01 04:51:07 +01:00
|
|
|
; and ecx, 0xFBFFFFFF ;n egate 0x04000000 save to mouseunder area
|
2012-03-15 13:41:29 +01:00
|
|
|
; call [putpixel]
|
|
|
|
call __sys_putpixel
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.exit:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, 6*4
|
|
|
|
popa
|
|
|
|
; call [draw_pointer]
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; draw an horizontal line
|
|
|
|
; eax = x1
|
|
|
|
; edx = x2
|
|
|
|
; ebx = y
|
|
|
|
; ecx = color
|
|
|
|
; edi = force ?
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
hline:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push eax edx
|
|
|
|
cmp edx, eax ; make sure x2 is above x1
|
|
|
|
jge @f
|
|
|
|
xchg eax, edx
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
; call [putpixel]
|
|
|
|
call __sys_putpixel
|
2012-03-08 09:33:38 +01:00
|
|
|
inc eax
|
|
|
|
cmp eax, edx
|
|
|
|
jle @b
|
|
|
|
pop edx eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2010-10-01 11:21:55 +02:00
|
|
|
; draw a vertical line
|
|
|
|
; eax = x
|
|
|
|
; ebx = y1
|
|
|
|
; edx = y2
|
|
|
|
; ecx = color
|
|
|
|
; edi = force ?
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
vline:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
push ebx edx
|
|
|
|
cmp edx, ebx ; make sure y2 is above y1
|
|
|
|
jge @f
|
|
|
|
xchg ebx, edx
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
; call [putpixel]
|
|
|
|
call __sys_putpixel
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebx
|
|
|
|
cmp ebx, edx
|
|
|
|
jle @b
|
|
|
|
pop edx ebx
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
; eax cx
|
|
|
|
; ebx cy
|
|
|
|
; ecx xe
|
|
|
|
; edx ye
|
|
|
|
; edi color
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
vesa20_drawbar:
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
virtual at esp
|
|
|
|
drbar:
|
|
|
|
.bar_sx dd ?
|
|
|
|
.bar_sy dd ?
|
|
|
|
.bar_cx dd ?
|
|
|
|
.bar_cy dd ?
|
|
|
|
.abs_cx dd ?
|
|
|
|
.abs_cy dd ?
|
|
|
|
.real_sx dd ?
|
|
|
|
.real_sy dd ?
|
|
|
|
.color dd ?
|
|
|
|
.line_inc_scr dd ?
|
|
|
|
.line_inc_map dd ?
|
2012-03-08 09:33:38 +01:00
|
|
|
.real_sx_and_abs_cx dd ?
|
|
|
|
.real_sy_and_abs_cy dd ?
|
|
|
|
.stack_data = 4*13
|
2010-10-01 11:21:55 +02:00
|
|
|
end virtual
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
pushad
|
|
|
|
sub esp, drbar.stack_data
|
|
|
|
mov [drbar.color], edi
|
|
|
|
sub edx, ebx
|
2014-12-01 04:51:07 +01:00
|
|
|
jle .exit
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ecx, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
jle .exit
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [drbar.bar_sy], edx
|
|
|
|
mov [drbar.bar_sx], ecx
|
|
|
|
mov [drbar.bar_cx], eax
|
|
|
|
mov [drbar.bar_cy], ebx
|
|
|
|
mov edi, [TASK_BASE]
|
2014-12-01 04:51:07 +01:00
|
|
|
add eax, [edi-twdw + WDATA.box.left] ; win_cx
|
|
|
|
add ebx, [edi-twdw + WDATA.box.top] ; win_cy
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [drbar.abs_cx], eax
|
|
|
|
mov [drbar.abs_cy], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
|
|
|
|
inc ebx ; WDATA.box.width is one pixel less than real window x-size
|
2012-03-08 09:33:38 +01:00
|
|
|
sub ebx, [drbar.bar_cx]
|
|
|
|
ja @f
|
2014-12-01 04:51:07 +01:00
|
|
|
.exit:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, drbar.stack_data
|
|
|
|
popad
|
|
|
|
xor eax, eax
|
|
|
|
inc eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp ebx, [drbar.bar_sx]
|
|
|
|
jbe .end_x
|
|
|
|
mov ebx, [drbar.bar_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.end_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [drbar.real_sx], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebx
|
|
|
|
sub ebx, [drbar.bar_cy]
|
|
|
|
ja @f
|
|
|
|
add esp, drbar.stack_data
|
|
|
|
popad
|
|
|
|
xor eax, eax
|
|
|
|
inc eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp ebx, [drbar.bar_sy]
|
|
|
|
jbe .end_y
|
|
|
|
mov ebx, [drbar.bar_sy]
|
2014-12-01 04:51:07 +01:00
|
|
|
.end_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [drbar.real_sy], ebx
|
2010-10-01 11:21:55 +02:00
|
|
|
; line_inc_map
|
2015-06-01 21:18:07 +02:00
|
|
|
mov eax, [_display.width]
|
2012-03-08 09:33:38 +01:00
|
|
|
sub eax, [drbar.real_sx]
|
|
|
|
mov [drbar.line_inc_map], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; line_inc_scr
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
mov ebx, [_display.bytes_per_pixel]
|
2012-03-08 09:33:38 +01:00
|
|
|
imul eax, ebx
|
|
|
|
neg eax
|
2015-06-01 21:18:07 +02:00
|
|
|
add eax, [_display.lfb_pitch]
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [drbar.line_inc_scr], eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; pointer to screen
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edx, [drbar.abs_cy]
|
2012-03-15 13:41:29 +01:00
|
|
|
; imul edx, [BytesPerScanLine]
|
2012-10-12 20:24:48 +02:00
|
|
|
mov edx, [BPSLine_calc_area+edx*4]
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [drbar.abs_cx]
|
|
|
|
imul eax, ebx
|
|
|
|
add edx, eax
|
2010-10-01 11:21:55 +02:00
|
|
|
; pointer to pixel map
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, [drbar.abs_cy]
|
2014-12-01 04:51:07 +01:00
|
|
|
; imul eax, [Screen_Max_X]
|
|
|
|
; add eax, [drbar.abs_cy]
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [d_width_calc_area + eax*4]
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
add eax, [drbar.abs_cx]
|
2015-06-01 21:18:07 +02:00
|
|
|
add eax, [_display.win_map]
|
2012-03-08 09:33:38 +01:00
|
|
|
xchg eax, ebp
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ebx, [drbar.real_sx]
|
|
|
|
add ebx, [drbar.abs_cx]
|
|
|
|
mov [drbar.real_sx_and_abs_cx], ebx
|
|
|
|
mov ebx, [drbar.real_sy]
|
|
|
|
add ebx, [drbar.abs_cy]
|
|
|
|
mov [drbar.real_sy_and_abs_cy], ebx
|
|
|
|
|
|
|
|
add edx, LFB_BASE
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; get process number
|
2012-03-15 13:41:29 +01:00
|
|
|
mov ebx, [CURRENT_TASK] ; bl - process num
|
|
|
|
mov esi, [drbar.real_sy]
|
|
|
|
mov eax, [drbar.color] ; BBGGRR00
|
|
|
|
rol eax, 8
|
|
|
|
mov bh, al ; 0x80 drawing gradient bars
|
|
|
|
ror eax, 8
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
cmp byte [_display.bits_per_pixel], 16
|
|
|
|
je draw_bar_end_16
|
|
|
|
cmp byte [_display.bits_per_pixel], 24
|
|
|
|
je draw_bar_end_24
|
|
|
|
cmp byte [_display.bits_per_pixel], 32
|
|
|
|
je draw_bar_end_32
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
2012-03-15 13:41:29 +01:00
|
|
|
; eax - color high RRGGBB
|
2010-10-01 11:21:55 +02:00
|
|
|
; bl - process num
|
|
|
|
; ecx - temp
|
|
|
|
; edx - pointer to screen
|
|
|
|
; esi - counter
|
|
|
|
; edi - counter
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
draw_bar_end_24:
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
|
|
|
je draw_bar_end_24_new
|
|
|
|
cmp ecx, 0
|
|
|
|
je draw_bar_end_24_old
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; store to LFB
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [edx + 2], al
|
2014-12-01 04:51:07 +01:00
|
|
|
.skip:
|
2010-10-01 11:21:55 +02:00
|
|
|
; add pixel
|
2012-03-08 09:33:38 +01:00
|
|
|
add edx, 3
|
|
|
|
inc ebp
|
|
|
|
dec edi
|
|
|
|
jnz .new_x
|
2010-10-01 11:21:55 +02:00
|
|
|
; add line
|
2012-03-08 09:33:38 +01:00
|
|
|
add edx, [drbar.line_inc_scr]
|
|
|
|
add ebp, [drbar.line_inc_map]
|
2012-03-15 13:41:29 +01:00
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
2012-03-15 13:41:29 +01:00
|
|
|
test al, al
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
2012-03-15 13:41:29 +01:00
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
2014-12-01 04:51:07 +01:00
|
|
|
.end:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, drbar.stack_data
|
|
|
|
popad
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
|
|
|
draw_bar_end_24_old:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.new_y:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
mov ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel
|
2014-12-01 04:51:07 +01:00
|
|
|
; store to LFB
|
2012-03-15 13:41:29 +01:00
|
|
|
mov [edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [edx + 2], al
|
|
|
|
mov eax, [drbar.color]
|
2014-12-01 04:51:07 +01:00
|
|
|
.skip:
|
2012-03-15 13:41:29 +01:00
|
|
|
; 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]
|
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
|
|
|
jmp draw_bar_end_24.end
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2012-03-08 09:33:38 +01:00
|
|
|
draw_bar_end_24_new:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.new_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae .no_mouse_area
|
2014-12-01 04:51:07 +01:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
|
|
|
rol ecx, 16
|
|
|
|
add ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb .no_mouse_area
|
|
|
|
ror ecx, 16
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
push eax
|
|
|
|
call check_mouse_area_for_putpixel_new.1
|
|
|
|
mov [edx], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [edx + 2], al
|
|
|
|
pop eax
|
|
|
|
jmp .skip
|
|
|
|
|
|
|
|
.no_mouse_area:
|
|
|
|
; store to LFB
|
|
|
|
mov [edx], ax
|
|
|
|
ror eax, 16
|
|
|
|
mov [edx + 2], al
|
|
|
|
rol eax, 16
|
|
|
|
.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]
|
|
|
|
|
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
|
|
|
@@:
|
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
|
|
|
jmp draw_bar_end_24.end
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; eax - color high RRGGBB
|
|
|
|
; bl - process num
|
|
|
|
; ecx - temp
|
|
|
|
; edx - pointer to screen
|
|
|
|
; esi - counter
|
|
|
|
; edi - counter
|
|
|
|
|
|
|
|
draw_bar_end_32:
|
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
|
|
|
je draw_bar_end_32_new
|
|
|
|
cmp ecx, 0
|
|
|
|
je draw_bar_end_32_old
|
|
|
|
|
|
|
|
.new_y:
|
|
|
|
mov edi, [drbar.real_sx]
|
|
|
|
.new_x:
|
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [edx], eax
|
|
|
|
mov eax, [drbar.color]
|
|
|
|
.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]
|
|
|
|
|
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
|
|
|
@@:
|
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
|
|
|
.end:
|
|
|
|
add esp, drbar.stack_data
|
|
|
|
popad
|
|
|
|
cmp [SCR_MODE], 0x12
|
|
|
|
jne @f
|
|
|
|
call VGA_draw_bar
|
|
|
|
@@:
|
|
|
|
xor eax, eax
|
|
|
|
mov [EGA_counter], 1
|
|
|
|
ret
|
|
|
|
|
|
|
|
draw_bar_end_32_old:
|
|
|
|
|
|
|
|
.new_y:
|
|
|
|
mov edi, [drbar.real_sx]
|
|
|
|
.new_x:
|
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
mov ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel
|
|
|
|
; store to LFB
|
|
|
|
mov [edx], eax
|
|
|
|
mov eax, [drbar.color]
|
|
|
|
.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]
|
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
|
|
|
@@:
|
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
|
|
|
jmp draw_bar_end_32.end
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
align 4
|
|
|
|
draw_bar_end_32_new:
|
|
|
|
|
|
|
|
.new_y:
|
|
|
|
mov edi, [drbar.real_sx]
|
|
|
|
.new_x:
|
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
|
|
|
|
|
|
|
mov ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
2012-03-08 09:33:38 +01:00
|
|
|
rol ecx, 16
|
|
|
|
add ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb .no_mouse_area
|
|
|
|
ror ecx, 16
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check mouse area for putpixel
|
2012-10-12 20:24:48 +02:00
|
|
|
push eax
|
2012-03-08 09:33:38 +01:00
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
mov [edx], eax
|
2012-10-12 20:24:48 +02:00
|
|
|
pop eax
|
2012-03-08 09:33:38 +01:00
|
|
|
jmp .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
.no_mouse_area:
|
|
|
|
|
|
|
|
; store to LFB
|
|
|
|
mov [edx], eax
|
|
|
|
.skip:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; add pixel
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, 4
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebp
|
|
|
|
dec edi
|
|
|
|
jnz .new_x
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; add line
|
|
|
|
add edx, [drbar.line_inc_scr]
|
|
|
|
add ebp, [drbar.line_inc_map]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
2012-03-15 13:41:29 +01:00
|
|
|
test al, al
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
2012-03-15 13:41:29 +01:00
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp draw_bar_end_32.end
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; eax - color high RRGGBB
|
|
|
|
; bl - process num
|
|
|
|
; ecx - temp
|
|
|
|
; edx - pointer to screen
|
|
|
|
; esi - counter
|
|
|
|
; edi - counter
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
draw_bar_end_16:
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
mov ecx, [_display.select_cursor]
|
|
|
|
cmp ecx, select_cursor
|
2014-12-01 04:51:07 +01:00
|
|
|
je draw_bar_end_16_new
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp ecx, 0
|
2014-12-01 04:51:07 +01:00
|
|
|
je draw_bar_end_16_old
|
|
|
|
.new_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edx], ax
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [drbar.color]
|
2014-12-01 04:51:07 +01:00
|
|
|
.skip:
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; add pixel
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, 2
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebp
|
|
|
|
dec edi
|
|
|
|
jnz .new_x
|
2010-10-01 11:21:55 +02:00
|
|
|
; add line
|
2012-03-08 09:33:38 +01:00
|
|
|
add edx, [drbar.line_inc_scr]
|
|
|
|
add ebp, [drbar.line_inc_map]
|
2012-03-15 13:41:29 +01:00
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
2014-12-01 04:51:07 +01:00
|
|
|
.end:
|
2012-03-08 09:33:38 +01:00
|
|
|
add esp, drbar.stack_data
|
|
|
|
popad
|
2013-05-28 21:09:31 +02:00
|
|
|
cmp [SCR_MODE], 0x12
|
2012-03-09 09:20:02 +01:00
|
|
|
jne @f
|
2012-03-08 09:33:38 +01:00
|
|
|
call VGA_draw_bar
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
xor eax, eax
|
|
|
|
mov [EGA_counter], 1
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
draw_bar_end_16_old:
|
|
|
|
|
|
|
|
.new_y:
|
2012-03-15 13:41:29 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-15 13:41:29 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
mov ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call check_mouse_area_for_putpixel
|
2014-12-01 04:51:07 +01:00
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edx], ax
|
2012-03-15 13:41:29 +01:00
|
|
|
mov eax, [drbar.color]
|
|
|
|
.skip:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; add pixel
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, 2
|
2012-03-15 13:41:29 +01:00
|
|
|
inc ebp
|
|
|
|
dec edi
|
|
|
|
jnz .new_x
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; add line
|
|
|
|
add edx, [drbar.line_inc_scr]
|
|
|
|
add ebp, [drbar.line_inc_map]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-15 13:41:29 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp draw_bar_end_16.end
|
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
align 4
|
2014-12-01 04:51:07 +01:00
|
|
|
draw_bar_end_16_new:
|
|
|
|
|
|
|
|
.new_y:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [drbar.real_sx]
|
2014-12-01 04:51:07 +01:00
|
|
|
.new_x:
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp byte [ebp], bl
|
|
|
|
jne .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [drbar.real_sy_and_abs_cy]
|
|
|
|
sub ecx, esi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check for Y
|
|
|
|
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
|
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [Y_UNDER_subtraction_CUR_hot_y]
|
|
|
|
jb .no_mouse_area
|
2012-03-08 09:33:38 +01:00
|
|
|
rol ecx, 16
|
|
|
|
add ecx, [drbar.real_sx_and_abs_cx]
|
|
|
|
sub ecx, edi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check for X
|
|
|
|
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
|
|
|
|
jae .no_mouse_area
|
2012-10-12 20:24:48 +02:00
|
|
|
sub cx, [X_UNDER_subtraction_CUR_hot_x]
|
|
|
|
jb .no_mouse_area
|
|
|
|
ror ecx, 16
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; check mouse area for putpixel
|
2012-10-12 20:24:48 +02:00
|
|
|
push eax
|
2012-03-08 09:33:38 +01:00
|
|
|
call check_mouse_area_for_putpixel_new.1
|
2014-12-01 04:51:07 +01:00
|
|
|
push eax
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edx], ax
|
|
|
|
pop eax
|
2012-10-12 20:24:48 +02:00
|
|
|
pop eax
|
2012-03-08 09:33:38 +01:00
|
|
|
jmp .skip
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.no_mouse_area:
|
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
push eax
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edx], ax
|
|
|
|
pop eax
|
|
|
|
.skip:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; add pixel
|
2014-12-01 04:51:07 +01:00
|
|
|
add edx, 2
|
2012-03-08 09:33:38 +01:00
|
|
|
inc ebp
|
|
|
|
dec edi
|
|
|
|
jnz .new_x
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
; add line
|
|
|
|
add edx, [drbar.line_inc_scr]
|
|
|
|
add ebp, [drbar.line_inc_map]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-15 13:41:29 +01:00
|
|
|
; drawing gradient bars
|
|
|
|
test bh, 0x80
|
2012-03-08 09:33:38 +01:00
|
|
|
jz @f
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
dec al
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
dec esi
|
|
|
|
jnz .new_y
|
2014-12-01 04:51:07 +01:00
|
|
|
jmp draw_bar_end_16.end
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
align 4
|
|
|
|
vesa20_drawbackground_tiled:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
pushad
|
|
|
|
; External loop for all y from start to end
|
|
|
|
mov ebx, [draw_data+32+RECT.top] ; y start
|
2014-12-01 04:51:07 +01:00
|
|
|
dp2:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov ebp, [draw_data+32+RECT.left] ; x start
|
|
|
|
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
2015-07-22 14:08:35 +02:00
|
|
|
; and LFB data (output for our function) [edi]
|
2012-03-15 13:41:29 +01:00
|
|
|
; mov eax, [BytesPerScanLine]
|
|
|
|
; mul ebx
|
2012-10-12 20:24:48 +02:00
|
|
|
mov eax, [BPSLine_calc_area+ebx*4]
|
2010-10-01 11:21:55 +02:00
|
|
|
xchg ebp, eax
|
|
|
|
add ebp, eax
|
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 2
|
|
|
|
je @f
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 3
|
|
|
|
je @f
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, LFB_BASE
|
|
|
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
|
|
|
call calculate_edi
|
|
|
|
xchg edi, ebp
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebp, [_display.win_map]
|
2010-10-01 11:21:55 +02:00
|
|
|
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
|
|
|
; 2) Calculate offset in background memory block
|
|
|
|
push eax
|
|
|
|
xor edx, edx
|
|
|
|
mov eax, ebx
|
|
|
|
div dword [BgrDataHeight] ; edx := y mod BgrDataHeight
|
|
|
|
pop eax
|
|
|
|
push eax
|
|
|
|
mov ecx, [BgrDataWidth]
|
|
|
|
mov esi, edx
|
|
|
|
imul esi, ecx ; esi := (y mod BgrDataHeight) * BgrDataWidth
|
|
|
|
xor edx, edx
|
|
|
|
div ecx ; edx := x mod BgrDataWidth
|
|
|
|
sub ecx, edx
|
|
|
|
add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth)
|
|
|
|
pop eax
|
|
|
|
lea esi, [esi*3]
|
|
|
|
add esi, [img_background]
|
|
|
|
xor edx, edx
|
|
|
|
inc edx
|
|
|
|
; 3) Loop through redraw rectangle and copy background data
|
|
|
|
; Registers meaning:
|
|
|
|
; eax = x, ebx = y (screen coordinates)
|
|
|
|
; ecx = deltax - number of pixels left in current tile block
|
|
|
|
; edx = 1
|
|
|
|
; esi -> bgr memory, edi -> output
|
|
|
|
; ebp = offset in WinMapAddress
|
2014-12-01 04:51:07 +01:00
|
|
|
dp3:
|
2010-10-01 11:21:55 +02:00
|
|
|
cmp [ebp], dl
|
2014-12-01 04:51:07 +01:00
|
|
|
jnz .next_pix
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
push eax ecx
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, eax
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, ebx
|
|
|
|
|
|
|
|
mov eax, [esi]
|
2012-03-15 13:41:29 +01:00
|
|
|
|
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
and eax, 0xffffff
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call [_display.check_mouse]
|
2014-12-01 04:51:07 +01:00
|
|
|
.no_mouseunder:
|
|
|
|
|
|
|
|
cmp byte [_display.bits_per_pixel], 16
|
|
|
|
je .16bpp
|
|
|
|
; store to LFB
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [edi], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [edi+2], al
|
2014-12-01 04:51:07 +01:00
|
|
|
pop ecx eax
|
|
|
|
jmp .next_pix
|
2012-03-08 09:33:38 +01:00
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
.16bpp:
|
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [edi], ax
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ecx eax
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
; Advance to next pixel
|
|
|
|
.next_pix:
|
2010-10-01 11:21:55 +02:00
|
|
|
add esi, 3
|
2014-12-01 04:51:07 +01:00
|
|
|
add edi, [_display.bytes_per_pixel]
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, edx
|
|
|
|
add eax, edx
|
|
|
|
cmp eax, [draw_data+32+RECT.right]
|
|
|
|
ja dp4
|
|
|
|
sub ecx, edx
|
|
|
|
jnz dp3
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; next tile block on x-axis
|
|
|
|
mov ecx, [BgrDataWidth]
|
|
|
|
sub esi, ecx
|
|
|
|
sub esi, ecx
|
|
|
|
sub esi, ecx
|
|
|
|
jmp dp3
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
dp4:
|
2010-10-01 11:21:55 +02:00
|
|
|
; next scan line
|
|
|
|
inc ebx
|
|
|
|
cmp ebx, [draw_data+32+RECT.bottom]
|
|
|
|
jbe dp2
|
|
|
|
popad
|
|
|
|
mov [EGA_counter], 1
|
2013-05-28 21:09:31 +02:00
|
|
|
cmp [SCR_MODE], 0x12
|
2012-03-09 09:20:02 +01:00
|
|
|
jne @f
|
2010-10-01 11:21:55 +02:00
|
|
|
call VGA_drawbackground
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
vesa20_drawbackground_stretch:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
pushad
|
|
|
|
; Helper variables
|
2014-12-01 04:51:07 +01:00
|
|
|
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
|
2010-10-01 11:21:55 +02:00
|
|
|
mov eax, [BgrDataWidth]
|
2014-12-01 04:51:07 +01:00
|
|
|
dec eax
|
2010-10-01 11:21:55 +02:00
|
|
|
xor edx, edx
|
2015-06-01 21:18:07 +02:00
|
|
|
div dword [screen_workarea.right]
|
2010-10-01 11:21:55 +02:00
|
|
|
push eax ; high
|
|
|
|
xor eax, eax
|
2015-06-01 21:18:07 +02:00
|
|
|
div dword [screen_workarea.right]
|
2010-10-01 11:21:55 +02:00
|
|
|
push eax ; low
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; the same for height
|
|
|
|
mov eax, [BgrDataHeight]
|
2014-12-01 04:51:07 +01:00
|
|
|
dec eax
|
2010-10-01 11:21:55 +02:00
|
|
|
xor edx, edx
|
2015-06-01 21:18:07 +02:00
|
|
|
div dword [screen_workarea.bottom]
|
2010-10-01 11:21:55 +02:00
|
|
|
push eax ; high
|
|
|
|
xor eax, eax
|
2015-06-01 21:18:07 +02:00
|
|
|
div dword [screen_workarea.bottom]
|
2010-10-01 11:21:55 +02:00
|
|
|
push eax ; low
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; External loop for all y from start to end
|
|
|
|
mov ebx, [draw_data+32+RECT.top] ; y start
|
|
|
|
mov ebp, [draw_data+32+RECT.left] ; x start
|
|
|
|
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
|
|
|
; and LFB data (output for our function) [edi]
|
2012-03-15 13:41:29 +01:00
|
|
|
; mov eax, [BytesPerScanLine]
|
|
|
|
; mul ebx
|
2012-10-12 20:24:48 +02:00
|
|
|
mov eax, [BPSLine_calc_area+ebx*4]
|
2010-10-01 11:21:55 +02:00
|
|
|
xchg ebp, eax
|
|
|
|
add ebp, eax
|
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 2
|
|
|
|
jz @f
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 3
|
2010-10-01 11:21:55 +02:00
|
|
|
jz @f
|
|
|
|
add ebp, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
|
|
|
call calculate_edi
|
|
|
|
xchg edi, ebp
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
|
|
|
push ebx
|
|
|
|
push eax
|
|
|
|
; 2) Calculate offset in background memory block
|
|
|
|
mov eax, ebx
|
|
|
|
imul ebx, dword [esp+12]
|
|
|
|
mul dword [esp+8]
|
|
|
|
add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
|
|
|
|
mov esi, edx
|
|
|
|
imul esi, [BgrDataWidth]
|
|
|
|
push edx
|
|
|
|
push eax
|
|
|
|
mov eax, [esp+8]
|
|
|
|
mul dword [esp+28]
|
|
|
|
push eax
|
|
|
|
mov eax, [esp+12]
|
|
|
|
mul dword [esp+28]
|
|
|
|
add [esp], edx
|
|
|
|
pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
|
|
|
|
add esi, edx
|
|
|
|
lea esi, [esi*3]
|
|
|
|
add esi, [img_background]
|
|
|
|
push eax
|
|
|
|
push edx
|
|
|
|
push esi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; 3) Smooth horizontal
|
2014-12-01 04:51:07 +01:00
|
|
|
bgr_resmooth0:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov ecx, [esp+8]
|
|
|
|
mov edx, [esp+4]
|
|
|
|
mov esi, [esp]
|
|
|
|
push edi
|
|
|
|
mov edi, bgr_cur_line
|
|
|
|
call smooth_line
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
bgr_resmooth1:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov eax, [esp+16+4]
|
|
|
|
inc eax
|
|
|
|
cmp eax, [BgrDataHeight]
|
|
|
|
jae bgr.no2nd
|
|
|
|
mov ecx, [esp+8+4]
|
|
|
|
mov edx, [esp+4+4]
|
|
|
|
mov esi, [esp+4]
|
|
|
|
add esi, [BgrDataWidth]
|
|
|
|
add esi, [BgrDataWidth]
|
|
|
|
add esi, [BgrDataWidth]
|
|
|
|
mov edi, bgr_next_line
|
|
|
|
call smooth_line
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
bgr.no2nd:
|
2010-10-01 11:21:55 +02:00
|
|
|
pop edi
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
sdp3:
|
2010-10-01 11:21:55 +02:00
|
|
|
xor esi, esi
|
|
|
|
mov ecx, [esp+12]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; 4) Loop through redraw rectangle and copy background data
|
|
|
|
; Registers meaning:
|
|
|
|
; esi = offset in current line, edi -> output
|
|
|
|
; ebp = offset in WinMapAddress
|
|
|
|
; dword [esp] = offset in bgr data
|
|
|
|
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
|
|
|
|
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
|
|
|
|
; dword [esp+20] = x
|
|
|
|
; dword [esp+24] = y
|
|
|
|
; precalculated constants:
|
|
|
|
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
|
|
|
|
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
sdp3a:
|
2015-06-01 21:18:07 +02:00
|
|
|
mov eax, [_display.win_map]
|
2010-10-01 11:21:55 +02:00
|
|
|
cmp [ebp+eax], byte 1
|
|
|
|
jnz snbgp
|
|
|
|
mov eax, [bgr_cur_line+esi]
|
|
|
|
test ecx, ecx
|
|
|
|
jz .novert
|
|
|
|
mov ebx, [bgr_next_line+esi]
|
|
|
|
call [overlapping_of_points_ptr]
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.novert:
|
2012-03-08 09:33:38 +01:00
|
|
|
push ecx
|
2012-03-15 13:41:29 +01:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [esp+20+4] ;x
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, [esp+24+4] ;y
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call [_display.check_mouse]
|
2014-12-01 04:51:07 +01:00
|
|
|
.no_mouseunder:
|
|
|
|
|
|
|
|
cmp [_display.bits_per_pixel], 16
|
|
|
|
jne .not_16bpp
|
|
|
|
; convert to 16 bpp and store to LFB
|
|
|
|
and eax, 00000000111110001111110011111000b
|
|
|
|
shr ah, 2
|
|
|
|
shr ax, 3
|
|
|
|
ror eax, 8
|
|
|
|
add al, ah
|
|
|
|
rol eax, 8
|
|
|
|
mov [LFB_BASE+edi], ax
|
|
|
|
pop ecx
|
|
|
|
jmp snbgp
|
|
|
|
.not_16bpp:
|
|
|
|
|
|
|
|
; store to LFB
|
2010-10-01 11:21:55 +02:00
|
|
|
mov [LFB_BASE+edi], ax
|
|
|
|
shr eax, 16
|
|
|
|
mov [LFB_BASE+edi+2], al
|
2012-03-08 09:33:38 +01:00
|
|
|
pop ecx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
snbgp:
|
|
|
|
add edi, [_display.bytes_per_pixel]
|
2010-10-01 11:21:55 +02:00
|
|
|
add ebp, 1
|
|
|
|
mov eax, [esp+20]
|
|
|
|
add eax, 1
|
|
|
|
mov [esp+20], eax
|
|
|
|
add esi, 4
|
|
|
|
cmp eax, [draw_data+32+RECT.right]
|
|
|
|
jbe sdp3a
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
sdp4:
|
2010-10-01 11:21:55 +02:00
|
|
|
; next y
|
|
|
|
mov ebx, [esp+24]
|
|
|
|
add ebx, 1
|
|
|
|
mov [esp+24], ebx
|
|
|
|
cmp ebx, [draw_data+32+RECT.bottom]
|
|
|
|
ja sdpdone
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
; advance edi, ebp to next scan line
|
|
|
|
sub eax, [draw_data+32+RECT.left]
|
|
|
|
sub ebp, eax
|
2015-06-01 21:18:07 +02:00
|
|
|
add ebp, [_display.width]
|
2010-10-01 11:21:55 +02:00
|
|
|
sub edi, eax
|
|
|
|
sub edi, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 2
|
|
|
|
jz @f
|
2010-10-01 11:21:55 +02:00
|
|
|
sub edi, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
cmp byte [_display.bytes_per_pixel], 3
|
2010-10-01 11:21:55 +02:00
|
|
|
jz @f
|
|
|
|
sub edi, eax
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
@@:
|
2015-06-01 21:18:07 +02:00
|
|
|
add edi, [_display.lfb_pitch]
|
2010-10-01 11:21:55 +02:00
|
|
|
; restore ecx,edx; advance esi to next background line
|
|
|
|
mov eax, [esp+28]
|
|
|
|
mov ebx, [esp+32]
|
|
|
|
add [esp+12], eax
|
|
|
|
mov eax, [esp+16]
|
|
|
|
adc [esp+16], ebx
|
|
|
|
sub eax, [esp+16]
|
|
|
|
mov ebx, eax
|
|
|
|
lea eax, [eax*3]
|
|
|
|
imul eax, [BgrDataWidth]
|
|
|
|
sub [esp], eax
|
|
|
|
mov eax, [draw_data+32+RECT.left]
|
|
|
|
mov [esp+20], eax
|
|
|
|
test ebx, ebx
|
|
|
|
jz sdp3
|
|
|
|
cmp ebx, -1
|
|
|
|
jnz bgr_resmooth0
|
|
|
|
push edi
|
|
|
|
mov esi, bgr_next_line
|
|
|
|
mov edi, bgr_cur_line
|
2015-06-01 21:18:07 +02:00
|
|
|
mov ecx, [_display.width]
|
2012-03-08 09:33:38 +01:00
|
|
|
rep movsd
|
2010-10-01 11:21:55 +02:00
|
|
|
jmp bgr_resmooth1
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
sdpdone:
|
2010-10-01 11:21:55 +02:00
|
|
|
add esp, 44
|
|
|
|
popad
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [EGA_counter], 1
|
2013-05-28 21:09:31 +02:00
|
|
|
cmp [SCR_MODE], 0x12
|
2012-03-09 09:20:02 +01:00
|
|
|
jne @f
|
2010-10-01 11:21:55 +02:00
|
|
|
call VGA_drawbackground
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;--------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
smooth_line:
|
|
|
|
mov al, [esi+2]
|
|
|
|
shl eax, 16
|
|
|
|
mov ax, [esi]
|
|
|
|
test ecx, ecx
|
|
|
|
jz @f
|
|
|
|
mov ebx, [esi+2]
|
|
|
|
shr ebx, 8
|
|
|
|
call [overlapping_of_points_ptr]
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
stosd
|
|
|
|
mov eax, [esp+20+8]
|
|
|
|
add eax, 1
|
|
|
|
mov [esp+20+8], eax
|
|
|
|
cmp eax, [draw_data+32+RECT.right]
|
|
|
|
ja @f
|
|
|
|
add ecx, [esp+36+8]
|
|
|
|
mov eax, edx
|
|
|
|
adc edx, [esp+40+8]
|
|
|
|
sub eax, edx
|
|
|
|
lea eax, [eax*3]
|
|
|
|
sub esi, eax
|
|
|
|
jmp smooth_line
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov eax, [draw_data+32+RECT.left]
|
|
|
|
mov [esp+20+8], eax
|
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
align 16
|
|
|
|
overlapping_of_points:
|
|
|
|
if 0
|
|
|
|
; this version of procedure works, but is slower than next version
|
|
|
|
push ecx edx
|
|
|
|
mov edx, eax
|
|
|
|
push esi
|
|
|
|
shr ecx, 24
|
|
|
|
mov esi, ecx
|
|
|
|
mov ecx, ebx
|
|
|
|
movzx ebx, dl
|
|
|
|
movzx eax, cl
|
|
|
|
sub eax, ebx
|
|
|
|
movzx ebx, dh
|
|
|
|
imul eax, esi
|
|
|
|
add dl, ah
|
|
|
|
movzx eax, ch
|
|
|
|
sub eax, ebx
|
|
|
|
imul eax, esi
|
|
|
|
add dh, ah
|
|
|
|
ror ecx, 16
|
|
|
|
ror edx, 16
|
|
|
|
movzx eax, cl
|
|
|
|
movzx ebx, dl
|
|
|
|
sub eax, ebx
|
|
|
|
imul eax, esi
|
|
|
|
pop esi
|
|
|
|
add dl, ah
|
|
|
|
mov eax, edx
|
|
|
|
pop edx
|
|
|
|
ror eax, 16
|
|
|
|
pop ecx
|
|
|
|
ret
|
|
|
|
else
|
|
|
|
push ecx edx
|
|
|
|
mov edx, eax
|
|
|
|
push esi
|
|
|
|
shr ecx, 26
|
|
|
|
mov esi, ecx
|
|
|
|
mov ecx, ebx
|
|
|
|
shl esi, 9
|
|
|
|
movzx ebx, dl
|
|
|
|
movzx eax, cl
|
|
|
|
sub eax, ebx
|
|
|
|
movzx ebx, dh
|
|
|
|
add dl, [BgrAuxTable+(eax+0x100)+esi]
|
|
|
|
movzx eax, ch
|
|
|
|
sub eax, ebx
|
|
|
|
add dh, [BgrAuxTable+(eax+0x100)+esi]
|
|
|
|
ror ecx, 16
|
|
|
|
ror edx, 16
|
|
|
|
movzx eax, cl
|
|
|
|
movzx ebx, dl
|
|
|
|
sub eax, ebx
|
|
|
|
add dl, [BgrAuxTable+(eax+0x100)+esi]
|
|
|
|
pop esi
|
|
|
|
mov eax, edx
|
|
|
|
pop edx
|
|
|
|
ror eax, 16
|
|
|
|
pop ecx
|
|
|
|
ret
|
|
|
|
end if
|
|
|
|
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
align 4
|
2010-10-01 11:21:55 +02:00
|
|
|
init_background:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
mov edi, BgrAuxTable
|
|
|
|
xor edx, edx
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.loop2:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov eax, edx
|
|
|
|
shl eax, 8
|
|
|
|
neg eax
|
|
|
|
mov ecx, 0x200
|
2014-12-01 04:51:07 +01:00
|
|
|
|
|
|
|
.loop1:
|
2010-10-01 11:21:55 +02:00
|
|
|
mov byte [edi], ah
|
|
|
|
inc edi
|
|
|
|
add eax, edx
|
|
|
|
loop .loop1
|
|
|
|
add dl, 4
|
|
|
|
jnz .loop2
|
|
|
|
test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
|
|
|
|
jz @f
|
|
|
|
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
|
2014-12-01 04:51:07 +01:00
|
|
|
@@:
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
align 16
|
|
|
|
overlapping_of_points_mmx:
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
movd mm0, eax
|
|
|
|
movd mm4, eax
|
|
|
|
movd mm1, ebx
|
|
|
|
pxor mm2, mm2
|
|
|
|
punpcklbw mm0, mm2
|
|
|
|
punpcklbw mm1, mm2
|
|
|
|
psubw mm1, mm0
|
|
|
|
movd mm3, ecx
|
|
|
|
psrld mm3, 24
|
|
|
|
packuswb mm3, mm3
|
|
|
|
packuswb mm3, mm3
|
|
|
|
pmullw mm1, mm3
|
|
|
|
psrlw mm1, 8
|
|
|
|
packuswb mm1, mm2
|
|
|
|
paddb mm4, mm1
|
|
|
|
movd eax, mm4
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
2014-12-01 04:51:07 +01:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
;------------------------------------------------------------------------------
|