pantalla equ 0b800h
.model tiny
.code
include bdos.mac
org 100h
inicio:
jmp instalar
se_g dw 0
des dw 0
hora db 8 dup('?')
reloj proc
cli
push ax
push bx
push cx
push dx
push si
push di
push ds
push es
;;*****************
mov ax,40h
mov es,ax
mov si,6ch
mov ax,es:[si]
mov dx,es:[si+2]
mov bx,32761
div bx
shr ax,1
;;*******
jnc p0
add dx,bx
p0: mov ch,al
mov ax,dx
mov dx,0
mov bx,1092
div bx
mov cl,al
mov ax,dx
mov dx,0
mov bx,18
div bx
mov dh,al
;;******
mov bh,10
mov ah,0
mov al,ch
div bh
add ax,3030h
mov word ptr hora,ax
mov hora+2,':'
mov ah,0
mov al,cl
div bh
add ax,3030h
mov word ptr hora+3,ax
mov hora+5,':'
mov ah,0
mov al,dh
div bh
add ax,3030h
mov word ptr hora+6,ax
mov hora+8,':'
mov ah,0
mov al,dl
div bh
add ax,3030h
mov word ptr hora+9,ax
;;*********************************
mov ax,pantalla
mov es,ax
mov di,2*(80-length hora)
mov cx,length hora
mov si,0
mover:
mov al,hora[si]
mov es:[di],al
inc di
mov byte ptr es:[di],07h
inc si
inc di
loop mover
fin:
pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
pop ax
sti
iret
reloj endp
instalar:
GET_INT 1ch,se_g,des
SET_INT 1ch,,reloj
TSR_COM<offset instalar-offset inicio+100h>
;;fin: int 20h
end inicio
GET_INT macro n,s,o
ifnb <n>
mov al,n
endif
mov ah,35h
int 21h
ifnb <s>
mov s,ES
endif
ifnb <o>
mov o,BX
endif
endm
SET_INT macro n,s,o
ifnb <n>
mov al,n
endif
ifnb <s>
mov DS,s
endif
ifnb <o>
mov DX,offset o
endif
mov ah,25h
int 21h
endm
TSR_COM macro etq,c
mov dx,( etq-1)/16+1
ifnb <c>
mov al,c
endif
mov ah,31h
int 21h
endm