微机原理课程设计_系统时间显示_汇编课程设计|精品课程网站设计|课程设计网报告总结心得
这是一个显示系统时间的程序,运行时,在屏幕的右上角将以“时:分:秒”的形式显示本机系统的时间。该程序只能在DOS下运行。微机原理课程设计_系统时间显示_汇编课程设计代码:
cursor equ 45Hattrib equ 2fhcode segmentassume cs:code,ds:codestart:jmp gooldcur dw ?OLD1C DW 2 DUP(?)NEWINT1C:PUSHFCALL DWORD PTR CS:OLD1Cpush axPUSH BXPUSH CXPUSH DXXOR BH,BHMOV AH,3INT 10HMOV CS:OLDCUR,DXMOV AH,2xor bh,bhMOV DX,CURSORINT 10HMOV AH,2 ;读取系统时钟INT 1AHPUSH DXPUSH CXPOP BXPUSH BXCALL SHOWBYTECALL SHOWCOLONPOP BXXCHG BH,BLCALL SHOWBYTECALL SHOWCOLONPOP BXCALL SHOWBYTEMOV DX,CS:OLDCURMOV AH,2XOR BH,BHINT 10HPOP DXPOP CXPOP BXPOP AXIRETSHOWBYTE PROC NEARPUSH BXMOV CL,4MOV AL,BHSHR AL,CLADD AL,30HCALL SHOWCALL CURMOVEPOP BXMOV AL,BHAND AL,0FHADD AL,30HCALL SHOWCALL CURMOVERETSHOWBYTE ENDP
SHOWCOLON PROC NEARMOV AL,':'CALL SHOWCALL CURMOVERETSHOWCOLON ENDP
CURMOVE PROC NEARPUSH AXPUSH BXPUSH CXPUSH DXMOV AH,3MOV BH,0INT 10HINC DLMOV AH,2INT 10HPOP DXPOP CXPOP BXPOP AXRETCURMOVE ENDP
SHOW PROC NEARPUSH AXPUSH BXPUSH CXMOV AH,09HMOV BX,attribMOV CX,1INT 10HPOP CXPOP BXPOP AXRETSHOW ENDP
GO:PUSH CSPOP DSMOV AX,351CH ;取中断向量INT 21HMOV OLD1C,BX ;保存原中断向量MOV BX,ESMOV OLD1C+2,BXMOV DX,OFFSET NEWINT1C ;置新的中断向量MOV AX,251CHINT 21HMOV DX,OFFSET GOSUB DX,OFFSET STARTMOV CL,4SHR DX,CLADD DX,11HMOV AX,3100H ;结束并驻留INT 21HCODE ENDSEND START