王爽《汇编语言》(第三版)实验14解析

代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 cs:code
data segment
db '00/00/00 00:00:00','$'
db 9,8,7,4,2,0
data ends

code segment
start: mov ax,data
mov ds,ax
mov di,0
mov si,18

mov cx,6
s:
mov al,[si]
out 70h,al
in al,71h

mov ah,al
mov cl,4
shr ah,cl
and al,00001111b

add ah,30h
add al,30h

mov byte ptr [di],ah
mov byte ptr [di+1],al ;个位数码
inc si
add di,3
loop s

mov ah,2
mov bh,0
mov dh,12
mov dl,15
int 10h

mov ax,data
mov ds,ax
mov dx,0
mov ah,9
int 21h

mov ax,4c00h
int 21h

code ends
end start