1 fn draw-line screen: (addr screen), x0: int, y0: int, x1: int, y1: int, color: int {
8 var tmp2/ecx: int <- copy x1
10 var tmp/eax: int <- abs tmp2
29 var x/ecx: int <- copy x0
30 var y/edx: int <- copy y0
32 pixel screen, x, y, color
33 # if (x == x1 && y == y1) break
42 var e2/ebx: int <- copy err
44 # if (e2 >= dy) { err += dy; x += sx; }
52 # if (e2 <= dx) { err += dx; y += sy; }
64 fn draw-horizontal-line screen: (addr screen), y: int, x0: int, x1: int, color: int {
65 var x/eax: int <- copy x0
69 pixel screen, x, y, color
75 fn draw-vertical-line screen: (addr screen), x: int, y0: int, y1: int, color: int {
76 var y/eax: int <- copy y0
80 pixel screen, x, y, color
86 fn draw-rect screen: (addr screen), xmin: int, ymin: int, xmax: int, ymax: int, color: int {
87 var y/eax: int <- copy ymin
91 draw-horizontal-line screen, y, xmin, xmax, color
97 fn draw-rect2 screen: (addr screen), xmin: int, ymin: int, w: int, h: int, color: int {
98 var xmax/eax: int <- copy xmin
100 var ymax/ecx: int <- copy ymin
102 draw-rect screen, xmin ymin, xmax ymax, color
106 fn line-point u: float, x0: int, x1: int -> _/eax: int {
107 var one/eax: int <- copy 1
108 var u-prime/xmm0: float <- convert one
109 u-prime <- subtract u
110 var result/xmm1: float <- convert x0
111 result <- multiply u-prime
112 var term2/xmm2: float <- convert x1
115 var result/eax: int <- convert result