程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> 匯編語言-請大神們幫我看一下這個程序哪出錯了,萬分感謝!!

匯編語言-請大神們幫我看一下這個程序哪出錯了,萬分感謝!!

編輯:編程綜合問答
請大神們幫我看一下這個程序哪出錯了,萬分感謝!!

STACK1 SEGMENT STACK
DW 200 DUP (?)
STACK1 ENDS
DATA SEGMENT
SPACE DB 1000 DUP (' ')
PATTERN DB 6 DUP (' '),0C9H,26 DUP (0CDH),0BBH,6 DUP (' ')
DB 6 DUP (' '),0BAH,26 DUP (20H),0BAH,6 DUP (' ')
DB 6 DUP (' '),0C8H,26 DUP (0CDH),0BCH,6 DUP (' ')
DBUFFER DB 8 DUP (':'),12 DUP (' ')
DBUFFER1 DB 20 DUP (' ')
STR1 DB 0DH,0AH, 'PLEASE INPUT DATE(D) OR TIME(T) OR QUIT(Q): $'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA,SS:STACK1
START: MOV AX,0001H ;設置顯示方式為40*25彩色文本方式
INT 10H
MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV BP,OFFSET SPACE
MOV DX,0B00H
MOV CX,1000
MOV BX,0040H
MOV AX,1300H
INT 10H
MOV BP,OFFSET PATTERN ;顯示矩形條
MOV DX,0B00H
MOV CX,120
MOV BX,004EH
MOV AX,1301H
INT 10H
LEA DX,STR1 ;顯示提示信息
MOV AH,9
INT 21H
MOV AH,1 ;從鍵盤輸入單個字符
INT 21H
CMP AL,44H ;AL='D'?
JNE A
CALL DATE ;顯示系統日期
A: CMP AL,54H ;AL='T'?
JNE B
CALL TIME ;顯示系統時間
B: CMP AL,51H ;AL='Q'?
JNE START
MOV AH,4CH ;返回dos狀態
INT 21H

DATE PROC NEAR ;顯示日期子程序
dis:MOV AH,2AH ;取日期
INT 21H
MOV SI,0
MOV AX,CX
MOV BX,100
DIV BL
MOV BL,AH
CALL BCDASC1 ;日期數值轉換成相應的ASCII碼字符
MOV AL,BL
CALL BCDASC1
INC SI
MOV AL,DH
CALL BCDASC1
INC SI
MOV AL,DL
CALL BCDASC1
MOV BP,OFFSET DBUFFER1
MOV DX,0C0DH
MOV CX,20
MOV BX,004EH
MOV AX,1301H
INT 10H
MOV AH,02H ;設置光標位置
MOV DX,0300H
MOV BH,0
INT 10H
MOV BX,0018H
REPEA: MOV CX,0FFFFH ;延時
REPEAT:LOOP REPEAT
DEC BX
JNZ REPEA
MOV AH,01H ;讀鍵盤緩沖區字符到AL寄存器
INT 16H
JE dis
JMP START
MOV AX,4C00H
INT 21H
RET
DATE ENDP

TIME PROC NEAR ;顯示時間子程序
DISPLAY1:MOV SI,0
MOV BX,100
DIV BL
MOV AH,2CH ;取時間
INT 21H
MOV AL,CH
CALL BCDASC ;將時間數值轉換成ASCII碼字符
INC SI
MOV AL,CL
CALL BCDASC
INC SI
MOV AL,DH
CALL BCDASC
MOV BP,OFFSET DBUFFER
MOV DX,0C0DH
MOV CX,20
MOV BX,004EH
MOV AX,1301H
INT 10H
MOV AH,02H
MOV DX,0300H
MOV BH,0
INT 10H
MOV BX,0018H
RE: MOV CX,0FFFFH
REA: LOOP REA
DEC BX
JNZ RE
MOV AH,01H
INT 16H
JE DISPLAY1
JMP START
MOV AX,4C00H
INT 21H
RET
TIME ENDP

BCDASC PROC NEAR ;時間數值轉換成ASCII碼字符子程序
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,'0'
MOV DBUFFER[SI],AL
INC SI
ADD AH,'0'
MOV DBUFFER[SI],AH
INC SI
POP BX
RET
BCDASC ENDP

BCDASC1 PROC NEAR ;日期數值轉換成ASCII碼字符子程序
PUSH BX
CBW
MOV BL,10
DIV BL
ADD AL,'0'
MOV DBUFFER1[SI],AL
INC SI
ADD AH,'0'
MOV DBUFFER1[SI],AH
INC SI
POP BX
RET
BCDASC1 ENDP
CODE ENDS
END START

cursor equ 45H
attrib equ 2fh
code segment
assume cs:code,ds:code
start:
jmp go
oldcur dw ?
OLD1C DW 2 DUP(?)
NEWINT1C:
PUSHF
CALL DWORD PTR CS:OLD1C
push ax
PUSH BX
PUSH CX
PUSH DX
XOR BH,BH
MOV AH,3
INT 10H
MOV CS:OLDCUR,DX
MOV AH,2
xor bh,bh
MOV DX,CURSOR
INT 10H
MOV AH,2     ;讀取系統時鐘
INT 1AH
PUSH DX
PUSH CX
POP BX
PUSH BX
CALL SHOWBYTE
CALL SHOWCOLON
POP BX
XCHG BH,BL
CALL SHOWBYTE
CALL SHOWCOLON
POP BX
CALL SHOWBYTE
MOV DX,CS:OLDCUR
MOV AH,2
XOR BH,BH
INT 10H
POP DX
POP CX
POP BX
POP AX
IRET
SHOWBYTE PROC NEAR
PUSH BX
MOV CL,4
MOV AL,BH
SHR AL,CL
ADD AL,30H
CALL SHOW
CALL CURMOVE
POP BX
MOV AL,BH
AND AL,0FH
ADD AL,30H
CALL SHOW
CALL CURMOVE
RET
SHOWBYTE ENDP

SHOWCOLON PROC NEAR
MOV AL,':'
CALL SHOW
CALL CURMOVE
RET
SHOWCOLON ENDP

CURMOVE PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV AH,3
MOV BH,0
INT 10H
INC DL
MOV AH,2
INT 10H
POP DX
POP CX
POP BX
POP AX
RET
CURMOVE ENDP

SHOW PROC NEAR
PUSH AX
PUSH BX
PUSH CX
MOV AH,09H
MOV BX,attrib
MOV CX,1
INT 10H
POP CX
POP BX
POP AX
RET
SHOW ENDP

GO:
PUSH CS
POP DS
MOV AX,351CH ;取中斷向量
INT 21H
MOV OLD1C,BX      ;保存原中斷向量
MOV BX,ES
MOV OLD1C+2,BX
MOV DX,OFFSET NEWINT1C ;置新的中斷向量
MOV AX,251CH
INT 21H
MOV DX,OFFSET GO
SUB DX,OFFSET START
MOV CL,4
SHR DX,CL
ADD DX,11H
MOV AX,3100H       ;結束並駐留
INT 21H
CODE ENDS
END START

最佳回答:


這種匯編程序,最好用turbo debugger等工具單步調試下。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved