在DOS下输入
clock 回车 在屏幕右上角显示时间和作者名,同时颜色变化
clock uninstall 回车 卸载时钟
1 ;98 z.bin
2
3 code segment
4 assume cs:code,ds:code
5 org 100h
6
7 begin:
8 jmp install
9 d1 db 'z'
10 old dd ?
11 c db 0
12 color db 0
13 pag db ?
14 line_23 db 10 dup(20h,0)
15 line db 'Z',0eh,'B',0eh,'.',0eh,20h,0
16 line_24 db 2 dup(20h,0ah,20h,0ah,':',8eh),20h,0ah,20h,0ah
17 start:
18 inc cs:[c]
19 cmp byte ptr cs:[c],8
20 je n1
21 jmp dword ptr cs:[old]
22 n1:
23 mov byte ptr cs:[c],0
24 push ax
25 push bx
26 push cx
27 push dx
28 push ds
29 push es
30 push di
31 push si
32
33 cmp byte ptr cs:[color],15
34 jae n3
35 inc cs:[color]
36 mov bh,cs:[color]
37 mov byte ptr cs:[line+1],bh
38 mov byte ptr cs:[line+3],bh
39 jmp n4
40 n3:
41 mov byte ptr cs:[color],0
42 n4:
43 mov ah,0fh
44 int 10h
45 ; mov ah,3
46 ; int 10h
47 ; push dx
48 mov cs:[pag],bh
49 mov ax,0b800h
50 mov es,ax
51 ; mov ax,4096
52 ; mov bh,pag
53 ; mul bh
54
55 ; mov di,ax
56 ; add di,140
57 mov ax,cs
58 mov ds,ax
59 ; lea si,line_23
60 cld
61 ; mov cx,20
62 ; rep movsb
63 mov ah,2
64 int 1ah
65 push cx
66 mov ah,ch
67 mov cl,4
68 shr ch,cl
69 add ch,30h
70 mov byte ptr cs:[line_24],ch
71 mov ch,ah
72 and ch,0fh
73 add ch,30h
74 mov byte ptr cs:[line_24+2],ch
75 pop bx
76 mov ah,bl
77 shr bl,cl
78 add bl,30h
79 mov byte ptr cs:[line_24+6],bl
80 and ah,0fh
81 add ah,30h
82 mov byte ptr cs:[line_24+8],ah
83 mov ah,dh
84 shr dh,cl
85 add dh,30h
86 mov byte ptr cs:[line_24+12],dh
87 and ah,0fh
88 add ah,30h
89 mov byte ptr cs:[line_24+14],ah
90 mov ax,4096
91 mov bh,pag
92 mul bh
93 mov di,ax
94 add di,134
95 lea si,line
96 mov cx,24
97 rep movsb
98
99 ; pop dx
100 ; mov bh,pag
101 ; mov ah,2
102 ; int 10h
103 pop si
104 pop di
105 pop es
106 pop ds
107 pop dx
108 pop cx
109 pop bx
110 pop ax
111 iret
112 install:
113 mov ax,351ch
114 int 21h
115 mov word ptr old,bx
116 mov word ptr old+2,es
117 mov si,80h
118 cmp byte ptr cs:[si],0
119 je next
120 cmp byte ptr es:[103h],'z'
121 jne error
122 push ds
123 push dx
124 push di
125 cli
126 lea di,old
127 mov ds,word ptr es:[di+2]
128 mov dx,word ptr es:[di]
129 mov ax,251ch
130 int 21h
131 sti
132 pop di
133 pop dx
134 pop ds
135 mov ah,49h
136 int 21h
137 jmp eexit
138 error:
139 lea dx, mess
140 mov ah,9
141 int 21h
142 eexit:
143 mov ah,4ch
144 int 21h
145 next:
146 mov ax,251ch
147 lea dx,start
148 int 21h
149 lea dx,install
150 int 27h
151 mess db ' the TSR program no find!$'
152
153 code ends
154 end begin
155