Fix libimg to execute emms after mmx code

Also, remove an emms hack from Dino game.
Fix #98.
This commit is contained in:
2025-02-24 01:40:31 +00:00
parent 54669d62b4
commit a11466d56b
6 changed files with 175 additions and 128 deletions

View File

@@ -17,6 +17,55 @@
;; ;;
;;================================================================================================;;
;;============================================================================;;
proc img.blend uses ebx esi edi, _bottom, _top, _xbottom, _ybottom, \ ;///////;;
_xtop, _ytop, _width, _height ;//////////////;;
;;----------------------------------------------------------------------------;;
;? Alpha blend _top image to _bottom one (both must be of type Image.bpp32) ;;
;;----------------------------------------------------------------------------;;
;> _bottom = pointer to bottom image (will be changed) ;;
;> _top = pointer to top image (unchanged) ;;
;> _xbottom = x coord inside _bottom image where to put _top image ;;
;> _ybottom = y coord inside _bottom image where to put _top image ;;
;> _xtop = x coord inside _top image to start from ;;
;> _ytop = y coord inside _top image to start from ;;
;> _width = width of _top image area to put to _bottom image ;;
;> _height = height of _top image area to put to _bottom image ;;
;;----------------------------------------------------------------------------;;
;< eax = 0 (fail) / _bottom (ok) ;;
;;============================================================================;;
mov esi, [_top]
mov edi, [_bottom]
mov eax, [esi+Image.Width]
sub eax, [_width]
shl eax, 2
push eax
mov eax, [edi+Image.Width]
sub eax, [_width]
shl eax, 2
push eax
mov eax, [_ytop]
imul eax, [esi+Image.Width]
add eax, [_xtop]
shl eax, 2
mov esi, [esi+Image.Data]
add esi, eax
mov eax, [_ybottom]
imul eax, [edi+Image.Width]
add eax, [_xbottom]
shl eax, 2
mov edi, [edi+Image.Data]
add edi, eax
stdcall img._.composite_rgb_00, [_width], [_height]
mov eax, [_bottom]
ret
endp
proc xcf._.blend_rgb
push eax ebx
@@ -248,7 +297,7 @@ proc xcf._.merge_8a _copy_width, _copy_height, _img_total_bpl, _bottom_total_bpl
endp
proc xcf._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
proc img._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pxor xmm0, xmm0
@@ -412,7 +461,7 @@ proc xcf._.composite_rgb_00 _copy_width, _copy_height, _bottom_total_bpl, _img_t
endp
proc xcf._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
proc img._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
.line:
mov ecx, [_copy_width]
@@ -470,7 +519,7 @@ proc xcf._.composite_gray_00 _copy_width, _copy_height, _bottom_total_bpl, _img_
endp
proc xcf._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
proc img._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
.line:
mov ecx, [_copy_width]
@@ -495,7 +544,7 @@ proc xcf._.composite_indexed_00 _copy_width, _copy_height, _bottom_total_bpl, _i
endp
proc xcf._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
proc img._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
pxor xmm4, xmm4
@@ -542,7 +591,7 @@ proc xcf._.composite_rgb_01 _copy_width, _copy_height, _bottom_total_bpl, _img_t
endp
proc xcf._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
proc img._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_total_bpl
pushad
pxor xmm4, xmm4
@@ -587,7 +636,7 @@ proc xcf._.composite_gray_01 _copy_width, _copy_height, _bottom_total_bpl, _img_
endp
proc xcf._.composite_rgb_03 ; Multiply
proc img._.composite_rgb_03 ; Multiply
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
@@ -598,7 +647,7 @@ proc xcf._.composite_rgb_03 ; Multiply
endp
proc xcf._.composite_rgb_04 ; Screen
proc img._.composite_rgb_04 ; Screen
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
@@ -614,7 +663,7 @@ proc xcf._.composite_rgb_04 ; Screen
endp
proc xcf._.composite_rgb_05 ; Overlay
proc img._.composite_rgb_05 ; Overlay
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
@@ -630,7 +679,7 @@ proc xcf._.composite_rgb_05 ; Overlay
endp
proc xcf._.composite_rgb_06 ; Difference
proc img._.composite_rgb_06 ; Difference
movdqa xmm4, xmm3
pminub xmm4, xmm2
@@ -643,7 +692,7 @@ proc xcf._.composite_rgb_06 ; Difference
endp
proc xcf._.composite_rgb_07 ; Addition
proc img._.composite_rgb_07 ; Addition
paddusb xmm3, xmm2
punpcklbw xmm2, xmm0
@@ -653,7 +702,7 @@ proc xcf._.composite_rgb_07 ; Addition
endp
proc xcf._.composite_rgb_08 ; Subtract
proc img._.composite_rgb_08 ; Subtract
movdqa xmm4, xmm2
psubusb xmm4, xmm3
@@ -665,7 +714,7 @@ proc xcf._.composite_rgb_08 ; Subtract
endp
proc xcf._.composite_rgb_09 ; Darken Only
proc img._.composite_rgb_09 ; Darken Only
pminub xmm3, xmm2
punpcklbw xmm2, xmm0
@@ -675,7 +724,7 @@ proc xcf._.composite_rgb_09 ; Darken Only
endp
proc xcf._.composite_rgb_10 ; Lighten Only
proc img._.composite_rgb_10 ; Lighten Only
pmaxub xmm3, xmm2
punpcklbw xmm2, xmm0
@@ -685,7 +734,7 @@ proc xcf._.composite_rgb_10 ; Lighten Only
endp
proc xcf._.composite_rgb_11 ; Hue (H of HSV)
proc img._.composite_rgb_11 ; Hue (H of HSV)
push eax ebx ecx edx
movd eax, xmm3
@@ -749,7 +798,7 @@ proc xcf._.composite_rgb_11 ; Hue (H of HSV)
endp
proc xcf._.composite_rgb_12 ; Saturation (S of HSV)
proc img._.composite_rgb_12 ; Saturation (S of HSV)
push eax ebx ecx edx
movd eax, xmm3
@@ -807,7 +856,7 @@ proc xcf._.composite_rgb_12 ; Saturation (S of HSV)
endp
proc xcf._.composite_rgb_13 ; Color (H and S of HSL)
proc img._.composite_rgb_13 ; Color (H and S of HSL)
push eax ebx ecx edx
movd eax, xmm3
@@ -854,7 +903,7 @@ proc xcf._.composite_rgb_13 ; Color (H and S of HSL)
endp
proc xcf._.composite_rgb_14 ; Value (V of HSV)
proc img._.composite_rgb_14 ; Value (V of HSV)
push eax ebx ecx edx
movd eax, xmm3
@@ -909,7 +958,7 @@ proc xcf._.composite_rgb_14 ; Value (V of HSV)
endp
proc xcf._.composite_rgb_15 ; Divide
proc img._.composite_rgb_15 ; Divide
push eax ebx ecx
movd eax, xmm3
@@ -1006,7 +1055,7 @@ proc xcf._.composite_rgb_15 ; Divide
endp
proc xcf._.composite_rgb_16 ; Dodge
proc img._.composite_rgb_16 ; Dodge
push eax ebx ecx
movd eax, xmm3
@@ -1107,7 +1156,7 @@ proc xcf._.composite_rgb_16 ; Dodge
endp
proc xcf._.composite_rgb_17 ; Burn
proc img._.composite_rgb_17 ; Burn
push eax ebx ecx
movd eax, xmm3
@@ -1212,7 +1261,7 @@ proc xcf._.composite_rgb_17 ; Burn
endp
proc xcf._.composite_rgb_18 ; Hard Light
proc img._.composite_rgb_18 ; Hard Light
push eax ebx ecx
movd eax, xmm3
@@ -1297,7 +1346,7 @@ proc xcf._.composite_rgb_18 ; Hard Light
endp
proc xcf._.composite_rgb_20 ; Grain Extract
proc img._.composite_rgb_20 ; Grain Extract
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0
@@ -1311,7 +1360,7 @@ proc xcf._.composite_rgb_20 ; Grain Extract
endp
proc xcf._.composite_rgb_21 ; Grain Merge
proc img._.composite_rgb_21 ; Grain Merge
punpcklbw xmm2, xmm0
punpcklbw xmm3, xmm0