Vistas de página en total

sábado, 10 de agosto de 2013

DELAY

  Esta función se me ha pasado incluirla en su momento, para completar la macro TIME. Por ello la añado ahora.


   Esta función completa la librería Time, añadiendo la función DELAY. Con esta función podremos realizar retardos de tiempo en segundos. Utiliza el reloj del sistema para realizar la espera.



DELAY.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
.data
ti_min db 0
ti_seg db 0
pausa dw 0
.code
       public _delay

_delay proc near  bx cx, tiempo
     mov ah,2ch
     int 21h
     mov ti_min,cl
     mov ti_seg,dh

        mov al,ti_min
        mov dl,60
        mul dl
        mov dx,ax
        xor ax,ax
        mov al,ti_seg
        add dx,ax
        mov pausa,dx

 espera:
       mov ah,2ch
       int 21h
       mov ti_min,cl
       mov ti_seg,dh
        mov al,ti_min
        mov dl,60
        mul dl
        mov dx,ax
        xor ax,ax
        mov al,ti_seg
        add dx,ax
        mov ax,dx
        sub dx,pausa
        cmp dx,tiempo
        jb espera
        ret
_delay endp

end   _delay

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.