前言
- 完成时间:11.24
- 内容:汇编语言课程设计任务二
- 备注:
- 汇编比c难好多。。。(链表:你当我不存在?)都难都难!!
- 这个任务参考来源有记录,别的找不到出处的请不要打我。。
- 小白参考来源https://wenku.baidu.com/view/d5cd6ba96f1aff00bfd51e54.html
题目
1.在屏幕特定位置显示当前系统日期和时间;
2.显示的日期和时间要求即时更新,即设计为跳动的时钟;
3.可自定义电子钟的显示区域、显示位置、背景和前景色或以图形化方式显示。
4.当按下某个键,如“Q”时,程序返回DOS,数字钟消失。
流程图
初始代码
data segment
count dw 1
info db 'Current time is:',0dh,0ah,'$'
datestr db '00-00-0000',0dh,0ah,'$'
timestr db '00:00:00',0dh,0ah,'$'
data ends
code segment
assume cs:code,ds:data
main proc far
start:
mov ax,data
mov ds,ax
mov al,1ch
mov ah,35h
int 21h
push es
push bx
push ds
mov dx,offset intpro
mov ax,seg intpro
mov ds,ax
mov al,1ch
mov ah,25h
int 21h
pop ds
in al,21h
and al,11111110b
out 21h,al
sti
s:
mov di,0ffffh
delay:
mov si,0ffffh
delay1:
dec si
jnz delay1
dec di
jnz delay
loop s
pop dx
pop ds
mov al,1ch
mov ah,25h
int 21h
mov ax,4c00h
int 21h
main endp
;----------------------
;中断处理intpro
;----------------------
intpro proc near
push ds
push ax
push cx
push dx
mov ax,data
mov ds,ax
sti
dec count
jnz exit
mov dx,offset info
mov ah,09h
int 21h
call dispdate
call disptime
mov count,18
exit:
cli
pop dx
pop cx
pop ax
pop ds
iret
intpro endp
;------------------
;显示日期子程序dispdate
;-----------------
dispdate proc near
push ax
push cx
push dx
push si
mov ah