汇编语言—定时器

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

DATAS SEGMENT

COUNT DB 0

HH DW 3 DUP(0)

DST DW 3 DUP(0),'$'

YY DW 0,':',0,':',0,'$'

INT_SEG DW ?

INT_OFF DW ?

GG DB '00:00:00$'

TISH1 DB 'Press not space to stack!$'

TISH2 DB 'If you want to exit,press space!$'

TISH3 DB 'Please set time:$'

TISH4 DB '| Function table $'

TISH5 DB '| Function 1 : Pause(P)$'

TISH6 DB '| Function 2 : Continue(C)$'

TISH7 DB '| Function 3 : Zero(Z)$'

TISH9 DB '+-----------------------------------------------------------------------------+$' DATAS ENDS

STACKS SEGMENT

FD DB 50 DUP(0)

STACKS ENDS

CODES SEGMENT

ASSUME CS:CODES,SS:STACKS,DS:DATAS

START:

MOV AX,DATAS

MOV DS,AX

CALL CLEAR

MOV DX,0100H

CALL SET_POINT

CALL MENU

MOV DX,0903H

CALL SET_POINT;移动光标到指定位置

MOV DX,OFFSET TISH3

CALL SHOW

CALL SET_TIME

WA:

MOV DX,0A18H

CALL SET_POINT;移动光标到指定位置

MOV DX,OFFSET TISH1

CALL SHOW

MOV DX,0C20H

CALL SET_POINT

MOV DX,OFFSET GG

CALL SHOW;显示开始计时提示语

MOV AH,01H

INT 21H

CMP AL,20H

JZ TT

CALL SET_INT

CALL MAIN ;进入主程序

MOV AH,4CH

INT 21H

TT: LOOP WA

;---------------------------------------------------------------------- MAIN PROC

PUSH AX

PUSH SI

PUSH DX

PUSH BX

PUSH DS

FF:

MOV AX,DATAS

MOV DS,AX

MOV DX,0A18H

CALL SET_POINT

MOV DX,OFFSET TISH2

CALL SHOW;显示退出提示语

MOV DX,0C20H

CALL SET_POINT;移动光标到屏幕中间

CALL SET_SZSZ; 根据小端法则将数据交叉放在指定空间CALL PDDS ;判断是否到定时时间

MOV DX,OFFSET YY

CALL SHOW

MOV AH,01H

INT 16H

JZ FF

MOV AH,00H

INT 16H

CMP AL,20H

JZ QUIT

CMP AL,70H ;P

JZ PAUSE

CMP AL,63H ;C

JZ FF

CMP AL,7AH ;Z

JZ ZERO

LOOP FF

PAUSE:

CLI

MOV AH,01H

INT 21H

CMP AL,63H

JNZ PAUSE

STI

LOOP FF

ZERO:

MOV AX,0

MOV SI,OFFSET HH

MOV [SI],AX

MOV [SI+2],AX

MOV [SI+4],AX

LOOP FF

QUIT:

CLI

MOV AX,251CH ;回复原中断向量

MOV DX,INT_SEG

MOV DS,DX

MOV DX,INT_OFF

INT 21H

STI

POP DS

POP BX

POP DX

POP SI

POP AX

RET

MAIN ENDP

;----------------------------------------------------------------------- CLEAR PROC ;刷新屏幕

PUSH AX

PUSH BX

PUSH CX

PUSH DX

MOV AX,0600H

MOV BH,01010001B

MOV CX,0000H

MOV DX,084FFH

相关文档
最新文档