[2013-08-27 20:21] 实验14
assume cs:code
code segment
start:mov dl,7
frv:call ShowTime
jmp frv
mov ax,4c00h
int 21h
;功能:显示当前时间
;输入:(dl)表示颜色
ShowTime:push ax
push cx
push bx
push ds
push es
push si
push di
jmp ShowTime_start
ShowTime_loc:db 9,8,7,4,2,0
ShowTime_buf:db "??/??/?? ??:??:??"
ShowTime_src:db "??/??/?? ??:??:??"
ShowTime_start:mov ax,cs
mov ds,ax
mov es,ax
mov si,offset ShowTime_buf
mov di,offset ShowTime_loc
mov cx,6
ShowTime_next:push cx
mov al,es:[di]
out 70h,al
in al,71h
mov ah,al
mov cl,4
shr ah,cl
and al,15
add al,30h
add ah,30h
mov bl,[si]
cmp bl,'?'
je ShowTime_tobuf
inc si
ShowTime_tobuf:mov [si],ah
inc si
mov [si],al
inc si
inc di
pop cx
loop ShowTime_next
mov ax,0b800h
mov es,ax
mov di,160*12+31*2
mov si,offset ShowTime_buf
mov cx,17
ShowTime_show:mov al,[si]
mov es:[di],al
inc si
inc di
mov es:[di],dl
inc di
loop ShowTime_show
mov cx,17
mov ax,cs
mov es,ax
mov di,offset ShowTime_buf
mov ds,ax
mov si,offset ShowTime_src
rep movsb
pop di
pop si
pop es
pop ds
pop bx
pop cx
pop ax
ret
code ends
end start
code segment
start:mov dl,7
frv:call ShowTime
jmp frv
mov ax,4c00h
int 21h
;功能:显示当前时间
;输入:(dl)表示颜色
ShowTime:push ax
push cx
push bx
push ds
push es
push si
push di
jmp ShowTime_start
ShowTime_loc:db 9,8,7,4,2,0
ShowTime_buf:db "??/??/?? ??:??:??"
ShowTime_src:db "??/??/?? ??:??:??"
ShowTime_start:mov ax,cs
mov ds,ax
mov es,ax
mov si,offset ShowTime_buf
mov di,offset ShowTime_loc
mov cx,6
ShowTime_next:push cx
mov al,es:[di]
out 70h,al
in al,71h
mov ah,al
mov cl,4
shr ah,cl
and al,15
add al,30h
add ah,30h
mov bl,[si]
cmp bl,'?'
je ShowTime_tobuf
inc si
ShowTime_tobuf:mov [si],ah
inc si
mov [si],al
inc si
inc di
pop cx
loop ShowTime_next
mov ax,0b800h
mov es,ax
mov di,160*12+31*2
mov si,offset ShowTime_buf
mov cx,17
ShowTime_show:mov al,[si]
mov es:[di],al
inc si
inc di
mov es:[di],dl
inc di
loop ShowTime_show
mov cx,17
mov ax,cs
mov es,ax
mov di,offset ShowTime_buf
mov ds,ax
mov si,offset ShowTime_src
rep movsb
pop di
pop si
pop es
pop ds
pop bx
pop cx
pop ax
ret
code ends
end start
评论次数(0) |
浏览次数(423) |
类型(汇编作业) |
收藏此文 |