中断调用取得控制权冲突,求帮助
发几个关键部位的代码,愿意帮我的看看问题在哪里,单独两个模块单独调用都没问题,但是没发共同执行,我自己写了几个调用代码,完全没作用,对于重入这个问题完全搞不明白原理,能帮我写一个么?再次谢谢了
MOV AH,7
INT 21h
CMP AL,F1 ;根据扫描码转入相应处理过程
JE Start_G
Start_G: ;游戏开始
; CALL Gametime
CALL Startgame
这个是按f1可以开始游戏和计时,显示系统时间,但是实际上只能开始游戏而无法计时,控制权完全被键盘中断夺取了,下面是计时那部分的模块,帮我看看,我会给你分的
Gametime PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
PUSH ES
MOV AX,SEG Tdata_seg
MOV DS,AX
MOV AL,1ch
MOV AH,35h
INT 21h
PUSH DS
PUSH DX
PUSH DS
MOV DX,OFFSET CLInt
MOV AX,SEG CLInt
MOV DS,AX
MOV AL,1ch
MOV AH,25h
INT 21h
POP DS
; IN AL,21h
; AND AL,0feh
; OUT 21h,AL
STI
again:
CALL StartGame
POP DX
POP DS
MOV AL,1ch
MOV AH,25h
INT 21h
POP ES
POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
RET
Gametime ENDP
;---------------------------------------------------------------------
CLInt PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
MOV BX,SEG count
MOV DS,BX
LEA BX,count
INC WORD PTR[BX]
CMP WORD PTR[BX],18
JNE exit5
CALL INCtest
exit5: MOV AL,20h
OUT 20h,AL
POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
IRET
CLInt ENDP
;---------------------------------------------------------
INCtest PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
MOV WORD PTR[BX],0
ADD BX,2
INC WORD PTR[BX]
CMP WORD PTR[BX],60
JNE RETurn
CALL INCtest
RETurn:
CALL systime
MOV AH,2
MOV DH,16
MOV DL,54
INT 10h
MOV AH,02h
MOV BX, DS:WORD PTR hours
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,DS:WORD PTR min
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,DS:WORD PTR sec
CALL convert
POP DI
POP DX
POP CX
POP BX
POP AX
RET
INCtest ENDP
convert PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV CX,10d
MOV AX,BX
MOV DX,0
DIV CX
MOV BX,DX
MOV DL,AL
ADD DL,30h
MOV AH,02h
INT 21h
MOV DL,BL
ADD DL,30h
MOV AH,02h
INT 21h
POP DX
POP CX
POP BX
POP AX
RET
convert ENDP
;------------------------------------------------------------
systime PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
en:
setpos 19,54
MOV AH,2
INT 1ah
MOV ran,CH
MOV rbn,CL
MOV rcn,DH
MOV BH,0h
MOV BL,ran
CALL binidec
MOV AH,02h
MOV DL,':'
INT 21h
MOV BH,0h
MOV BL,rbn
CALL binidec
MOV AH,02h
MOV DL,':'
INT 21h
MOV BH,0h
MOV BL,rcn
CALL binidec
MOV ren,10000
dely:
DEC ren
MOV rdn,1000
dely1:
DEC rdn
CMP rdn,0
JNE dely1
CMP ren,0
JNE dely
exit8: POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
RET
systime ENDP
binidec PROC NEAR
MOV fla,0
MOV CX,1000h
CALL dec_div
MOV CX,100h
CALL dec_div
MOV CX,10h
CALL dec_div
MOV fla,1h
MOV CX,1h
CALL dec_div
MOV DL,20h
MOV AH,02h ;输出空格
INT 21h
RET
binidec ENDP
dec_div PROC NEAR
MOV AX,BX
MOV DX,0
DIV CX
MOV BX,DX
CMP AL,0
JE cmpflag
JNE setflag
setflag:
MOV fla,1
cmpflag:
CMP fla,0
JNE printal
JE notprintal
printal:
MOV DL,AL
ADD DL,30h
MOV AH,02h
INT 21h
notprintal:
RET ;跳出
dec_div ENDP
编程中遇到一个问题,一个是键盘中断模块,一个是计时中断模块,都能得到程序的控制权,怎么写调用代码才能让它既在键盘输入东西又能显示时间,现在的问题是中断用有冲突,能操作就不能显示时间,能显示时间就不能操作,拜托各位大神了,帮下小弟
MOV AH,7
INT 21h
CMP AL,F1 ;根据扫描码转入相应处理过程
JE Start_G
Start_G: ;游戏开始
; CALL Gametime
CALL Startgame
这个是按f1可以开始游戏和计时,显示系统时间,但是实际上只能开始游戏而无法计时,控制权完全被键盘中断夺取了,下面是计时那部分的模块,帮我看看,我会给你分的
Gametime PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
PUSH ES
MOV AX,SEG Tdata_seg
MOV DS,AX
MOV AL,1ch
MOV AH,35h
INT 21h
PUSH DS
PUSH DX
PUSH DS
MOV DX,OFFSET CLInt
MOV AX,SEG CLInt
MOV DS,AX
MOV AL,1ch
MOV AH,25h
INT 21h
POP DS
; IN AL,21h
; AND AL,0feh
; OUT 21h,AL
STI
again:
CALL StartGame
POP DX
POP DS
MOV AL,1ch
MOV AH,25h
INT 21h
POP ES
POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
RET
Gametime ENDP
;---------------------------------------------------------------------
CLInt PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
MOV BX,SEG count
MOV DS,BX
LEA BX,count
INC WORD PTR[BX]
CMP WORD PTR[BX],18
JNE exit5
CALL INCtest
exit5: MOV AL,20h
OUT 20h,AL
POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
IRET
CLInt ENDP
;---------------------------------------------------------
INCtest PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
MOV WORD PTR[BX],0
ADD BX,2
INC WORD PTR[BX]
CMP WORD PTR[BX],60
JNE RETurn
CALL INCtest
RETurn:
CALL systime
MOV AH,2
MOV DH,16
MOV DL,54
INT 10h
MOV AH,02h
MOV BX, DS:WORD PTR hours
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,DS:WORD PTR min
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,DS:WORD PTR sec
CALL convert
POP DI
POP DX
POP CX
POP BX
POP AX
RET
INCtest ENDP
convert PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV CX,10d
MOV AX,BX
MOV DX,0
DIV CX
MOV BX,DX
MOV DL,AL
ADD DL,30h
MOV AH,02h
INT 21h
MOV DL,BL
ADD DL,30h
MOV AH,02h
INT 21h
POP DX
POP CX
POP BX
POP AX
RET
convert ENDP
;------------------------------------------------------------
systime PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH DS
en:
setpos 19,54
MOV AH,2
INT 1ah
MOV ran,CH
MOV rbn,CL
MOV rcn,DH
MOV BH,0h
MOV BL,ran
CALL binidec
MOV AH,02h
MOV DL,':'
INT 21h
MOV BH,0h
MOV BL,rbn
CALL binidec
MOV AH,02h
MOV DL,':'
INT 21h
MOV BH,0h
MOV BL,rcn
CALL binidec
MOV ren,10000
dely:
DEC ren
MOV rdn,1000
dely1:
DEC rdn
CMP rdn,0
JNE dely1
CMP ren,0
JNE dely
exit8: POP DS
POP DI
POP DX
POP CX
POP BX
POP AX
RET
systime ENDP
binidec PROC NEAR
MOV fla,0
MOV CX,1000h
CALL dec_div
MOV CX,100h
CALL dec_div
MOV CX,10h
CALL dec_div
MOV fla,1h
MOV CX,1h
CALL dec_div
MOV DL,20h
MOV AH,02h ;输出空格
INT 21h
RET
binidec ENDP
dec_div PROC NEAR
MOV AX,BX
MOV DX,0
DIV CX
MOV BX,DX
CMP AL,0
JE cmpflag
JNE setflag
setflag:
MOV fla,1
cmpflag:
CMP fla,0
JNE printal
JE notprintal
printal:
MOV DL,AL
ADD DL,30h
MOV AH,02h
INT 21h
notprintal:
RET ;跳出
dec_div ENDP