regconfi

导航

汇编语言 实验14

 1 assume cs:code
 2 
 3 data segment
 4         db 9,8,7,4,2,0
 5         db 0,3,6,9,12,15
 6 data ends
 7 
 8 stack segment
 9         dw 16 dup (0)
10 stack ends
11 
12 code segment
13 begin:
14         mov ax,stack
15         mov ss,ax
16         mov sp,20h
17 
18         mov ax,0b800h
19         mov es,ax
20         mov di,0
21 
22         mov ax,data
23         mov ds,ax
24    again:
25         mov si,0
26         mov di,160*10+60
27         call clear_screen
28         mov byte ptr es:[di+4],'/'
29         mov byte ptr es:[di+5],2
30         mov byte ptr es:[di+10],'/'
31         mov byte ptr es:[di+11],2
32         mov byte ptr es:[di+22],':'
33         mov byte ptr es:[di+23],2
34         mov byte ptr es:[di+28],':'
35         mov byte ptr es:[di+29],2
36 
37         mov cx,6
38    s0:
39         call shuchu
40         inc si
41         loop s0
42         jmp again
43 
44         mov ax,4c00h
45         int 21h
46 
47 shuchu:
48         push ax
49         push cx
50         push di
51 
52         mov al,ds:[si+6]
53         mov ah,0
54         add di,ax
55         add di,ax
56 
57         mov al,ds:[si]
58         out 70h,al
59         in al,71h
60 
61         mov ah,al
62         mov cl,4
63         shr ah,cl
64         and al,00001111b
65         add ah,30h
66         add al,30h
67         mov byte ptr es:[di],ah
68         mov byte ptr es:[di+1],2
69         mov byte ptr es:[di+2],al
70         mov byte ptr es:[di+3],2
71 
72         pop di
73         pop cx
74         pop ax
75         ret
76 
77 clear_screen:
78         push cx
79         push di
80         mov di,160*10
81         mov cx,80
82    scs0:
83         push cx
84         mov cx,1
85    scs1:
86         mov word ptr es:[di],0
87         add di,2
88         loop scs1
89         pop cx
90         loop scs0
91         pop di
92         pop cx
93         ret
94 
95 code ends
96 end begin

 

posted on 2014-12-28 22:04  regconfi  阅读(327)  评论(0编辑  收藏  举报