Vistas de página en total

89906

miércoles, 26 de junio de 2013

SCREEN


   En este caso en este fichero ASM incluimos las rutinas de borrado y posicionado en pantalla getxy, gotoxy, cls, y cls_window.
   Como vemos solo utilizo rutina (ver main) en las dos últimas funciones, ya que las primeras no necesitan parámetros y por lo tanto es más compacto no usar rutina. Al no llevar parámetros a través de  pila, no es necesaria la salvaguarda de puntero de pila y la posterior recuperación de esta.



SCREEN.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/>.

include main.mac
_modelo exe
_code
      public _getxy   ; necesario publicar al no haber sido definidas con "rutina"
      public _cls
      public _gotoxy

;devuelve la posicion del cursor
;devuelve x en al y en ah
_getxy proc near
        push bx
        push cx
        push dx
        mov ah,3
        mov bh,0
        int 10h
        mov ax,dx
        pop dx
        pop cx
        pop bx
        ret                           ; necesario por no ser definido con "rutina"
_getxy endp

;borra la pantalla con un color
;toma el color en Al
_cls proc near
        push bx
        push cx
        push dx
        mov bh,al
        mov ax,600h
        mov cx,0
        mov dx,194fh
        int 10h
        mov bx,0
        mov ah,2
        mov dx,0
        int 10h
        pop dx
        pop cx
        pop bx
        ret                                  ; necesario por no ser definido con "rutina"
_cls endp


; posicionael cursor
; la posición se pasa a través de pila
 _gotoxy proc near
        push dx
        push bx
        mov dx,ax
        mov bx,0
        mov ah,2
        int 10h
        pop bx
        pop dx
       ret
_gotoxy endp
_data
_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.