在实模式,装配中使用Bresenham的线算法

SeB*_*Bee 0 c floating-point x86 assembly types

嘿!
我想在装配中画线.我用C编写了算法,现在我需要把它放到汇编中.
我是16位实模式; 图形模式:12h(640*480 16色)
C源:

//x1/y1/x2/y2 = start x, start y, end x, end y
void draw_line(int x1, int y1, int x2, int y2)
{
    double delta_l = (x2-x1)/(y2-y1);
         //delta_l = like graph slope; maybe it's negative and/or not integer
         // it can be also type 'float'
    double y;

    for(int x = x1; x <= x2; x++)
    {
        y = y1 + ( x * delta_l );
        Round_To_Integer(y);
        Put_Pixel(x, y, color);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我无法计算汇编中的浮点数(或双精度数).
请帮我把这个C代码"翻译"成ASM.
谢谢.

Cod*_*odo 5

我对Bresenham算法的理解是,它的核心思想是通过使用一个变量来避免浮点运算,其中误差在整数变量中求和,并且只要误差超过某个值就进行校正.

页面有一步一步的解释.