From a2109c90b2304f022d8db74210f1400512e9d4f9 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Sat, 18 Feb 2012 17:56:20 +0000 Subject: [PATCH] Fix for f38 - correction for the remainder of the division git-svn-id: svn://kolibrios.org@2353 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/video/vesa20.inc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 368ce3fbd6..019f3345c0 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -445,6 +445,14 @@ dl_dy equ esp+0 cdq ; extend eax sing to edx shl eax, 16 ; using 16bit fix-point maths idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) +;-------------------------------------- +; correction for the remainder of the division + shl edx, 1 + cmp ebp, edx + jb @f + inc eax +@@: +;-------------------------------------- mov edx, ebp ; edx = counter (number of pixels to draw) mov ebp, 1 *65536; <<16 ; ebp = dy = 1.0 mov esi, eax ; esi = dx @@ -466,6 +474,14 @@ dl_dy equ esp+0 cdq ; extend eax sing to edx shl eax, 16 ; using 16bit fix-point maths idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) +;-------------------------------------- +; correction for the remainder of the division + shl edx, 1 + cmp esi, edx + jb @f + inc eax +@@: +;-------------------------------------- mov edx, esi ; edx = counter (number of pixels to draw) mov esi, 1 *65536;<< 16 ; esi = dx = 1.0 mov ebp, eax ; ebp = dy @@ -474,10 +490,25 @@ dl_dy equ esp+0 mov ebx, [dl_y1] shl eax, 16 shl ebx, 16 +;----------------------------------------------------------------------------- align 4 .draw: push eax ebx +;-------------------------------------- +; correction for the remainder of the division + test ah, 0x80 + jz @f + add eax, 1 shl 16 +@@: +;-------------------------------------- shr eax, 16 +;-------------------------------------- +; correction for the remainder of the division + test bh, 0x80 + jz @f + add ebx, 1 shl 16 +@@: +;-------------------------------------- shr ebx, 16 call [putpixel] pop ebx eax