关于汇编的推箱子程游戏计时功能的实现,改了半天还是不行?什么原因?
全部代码.zip
(61.04 KB)
小弟遇到一个问题,这是网上一个汇编写成的推箱子游戏,但是里面却不能实现计时和显示时间的功能,里面有这部分代码,但是小弟水平有限,不会弄,求大神帮帮小弟;******************************************************
;时间数据段
;******************************************************
TDATA_SEG SEGMENT PARA
;=======================================================================================
count DW 0
sec DW 0
min DW 0
hours DW 0
;=======================================================================================
TDATA_SEG ENDS
;------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------
Gametime PROC NEAR ;游戏时间
MOV DX,SEG tdata_seg
MOV DS,DX
MOV AL,1ch
MOV AH,35h
INT 21h
PUSH DX
PUSH DS
MOV AX,SEG CLInt
MOV DS,AX
LEA DX,CLInt
MOV AL,1ch
MOV AH,25h
INT 21h
IN AL,21h
AND AL,0feh
OUT 21h,AL
STI
POP DS
POP DX
CALL systime
CALL StartGame
MOV AL,1ch
MOV AH,25h
INT 21h
RET
gametime ENDP
;---------------------------------------------------------------------
CLInt PROC NEAR
PUSH DS
PUSH BX
MOV BX,SEG count
MOV DS,BX
LEA BX,count
INC BX
CMP BX,18
JNE exit6
CALL INCtest
exit6: MOV AL,20h
OUT 20h,AL
POP BX
POP DS
RET
CLInt ENDP
;---------------------------------------------------------
INCtest PROC NEAR
MOV AH,2
MOV DH,20
MOV DL,25
INT 10h
MOV BX,0
ADD BX,2
INC BX
CMP BX,60
JNE RETurn
CALL INCtest
RETurn:
setpos 16,54
MOV AH,02h
MOV BX, hours
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,min
CALL convert
MOV AH,02h
MOV DL,3ah
INT 21h
MOV AH,02h
MOV BX,sec
CALL convert
RET
INCtest ENDP
;----------------------------------------------------------
convert PROC NEAR
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
RET
convert ENDP
;--------------------------------------------------------------
[ 本帖最后由 yle 于 2012-5-31 20:14 编辑 ]