Macro DE LLAMADA para ampliar en GRAPHICS.MAC
GRAPHICS.MAC
;Dibuja un rectangulo lleno
fillrectangle macro x0,y0,x1,y1,color
ifndef _fillrectangle
extrn _fillrectangle:near
endif
mov ax,x0
push ax
mov ax,y0
push ax
mov ax,x1
push ax
mov ax,y1
push ax
mov ax,color
push ax
call _fillrectangle
endm
FRECTAN.ASM
; Copyright (C) 2013 José Ángel Moneo Fernández ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; along with this program. If not, see <http://www.gnu.org/licenses/>..model compact,pascal
public _fillrectangle
.data
.code
;algoritmo Bresenham
_fillrectangle proc uses ax cx bx ,x0,y0,x1,y1,color
mov cx,y0
mov bx,y1
mov ax,y0 ;COMPRUEBA EL MAYOR PARA ORDENAR EL BUCLE
cmp ax,y1
jbe correcto
;invertir las y
mov cx,y1
mov bx,y0
correcto: ;BUCLE DE LÍNEAS
line x0,cx,x1,cx,color
inc cx
cmp cx,bx
jne correcto
ret
_fillrectangle endp
end
No hay comentarios:
Publicar un comentario
Si tienes algún comentario, duda o sugerencia, o si quieres aportar algún código creado a partir de las librerías expuestas aquí, por favor, indícamelo.