由於某些原因,當我切換到鼠標輸入切換回鍵盤輸入時,我的程序增加和減少計數器沒有效果。它在我們輸入字符的第一個循環中完美運行。 這是程序,有什麼建議嗎? 看鼠標時間跳轉後什麼速度跳轉以供參考。 CX計數器沒有更新或沿着這些線路。 (我不知道,如果計數器沒有更新或天氣存在比較CX存在的經過我從mousetime切換到keytime一個問題。)跳轉後計數器不工作 - 彙編語言
CLEAR MACRO
MOV AX,0600H
MOV BH,07
MOV CX,0000
MOV DX,184FH
INT 10H
ENDM
CURSOR MACRO Col, Row
MOV AH,02
MOV BH,00
MOV DL,Col
MOV DH,Row
INT 10H
ENDM
DISP MACRO MES
MOV AH,09
MOV DX,OFFSET MES
INT 21H
ENDM
CLEARLINE MACRO ROW
CURSOR 00,ROW
DISP SPACES
ENDM
ALWAYSONSCREENINFO MACRO
CURSOR 16,00
DISP TITLE1
CURSOR 50,00
DISP NAMES1
CURSOR 54,01
DISP NAMES2
CURSOR 33,7
DISP MENU
CURSOR 24,9
DISP OPTION1
CURSOR 24,10
DISP OPTION2
CURSOR 22,11
DISP DASHES
CURSOR 18,12
DISP MOUSEMENU
CURSOR 14,13
DISP OPTION3
CURSOR 8,14
DISP OPTION4
CURSOR 13,15
DISP CHARMENU
CURSOR 21,16
DISP KILL
ENDM
.MODEL SMALL ; RUN THE PROGRAM IN DIMENSIONS 79x24
.STACK 64H
.DATA
TITLE1 DB 'MICROPROCESSOR - EENG410','$'
NAMES1 DB 'name1 & name2','$'
NAMES2 DB 'std1 std2','$'
MENU DB 'MENU','$'
OPTION1 DB '1. Press "U" to Speed up the motor','$'
OPTION2 DB '2. Press "D" to Slow Down the motor','$'
OPTION3 DB '1. Right click the mouse to turn motor direction to clockwise','$'
OPTION4 DB '2. Left click the mouse to turn the motor direction to anti-clockwise','$'
DASHES DB '----------------------------------------','$'
MOUSEMENU DB '(Press M to switch to the mouse options)','$'
CHARMENU DB '(Press the scroll button to switch back to fist 2 options)','$'
SPEEDUP DB 'DC motor is speeding up ','$'
SLOWDOWN DB 'DC motor is slowing down','$'
RIGHT DB 'DC motor will now rotate clockwise','$'
LEFT DB 'DC motor will now rotate anti-clockwise','$'
KILL DB '-----To exit the program, press "E"-----','$'
PROGRAMEND1 DB 'Thank you for using our program','$'
PROGRAMEND2 DB 'The program has been terminated','$'
SPACES DB ' ','$'
TRY DB 'Please try again','$'
SPEEDNOW DB 'Speed:','$'
DIRECTION DB 'Motor Direction:','$'
CLOCK DB 'Right','$'
COUNTER DB 'Left ','$'
N1 DB '1','$'
N2 DB '2','$'
N3 DB '3','$'
N4 DB '4','$'
N5 DB '5','$'
N6 DB '6','$'
N7 DB '7','$'
MAXSPEED DB 'Max speed is 7','$'
MINSPEED DB 'Min speed is 1','$'
.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
CLEAR
ALWAYSONSCREENINFO
MOV CX,1
CURSOR 28,21
DISP SPEEDNOW
CURSOR 35,21
DISP N1
CURSOR 22,22
DISP DIRECTION
CURSOR 39,22
DISP CLOCK
MOV CX,1
L0: MOV AH,00 ;LOOP START
INT 16H
CMP AL,' '
JE SPACED
CMP AL,'U'
JE FASTER
CMP AL,'u'
JE FASTER
CMP AL,'D'
JE SLOWER
CMP AL,'d'
JE SLOWER
CMP AL,'M'
JE MOUSETIME
CMP AL,'m'
JE MOUSETIME
CMP AL,'E'
JE EXIT
CMP AL,'e'
JE EXIT
JNE TRYAGAINKEY
A1: MOV AX,03
INT 33H
CMP BX,0
JE A1
CMP BX,1 ;MOUSE LEFT
JE MRIGHT
CMP BX,2 ;MOUSE RIGHT
JE MLEFT
CMP BX,3
JE KEYTIME
SPACED: CLEARLINE 19
JMP L0
FASTER: CLEARLINE 19
CURSOR 27,19
DISP SPEEDUP
JMP INCREASE
SLOWER: CLEARLINE 19
CURSOR 27,19
DISP SLOWDOWN
JMP DECREASE
MOUSETIME: JMP A1
KEYTIME: JMP L0
MRIGHT: CLEARLINE 19
CURSOR 18,19
DISP RIGHT
JMP TRIGHT
MLEFT: CLEARLINE 19
CURSOR 18,19
DISP LEFT
JMP TLEFT
TRYAGAINKEY: CLEARLINE 19
CURSOR 28,19
DISP TRY
JMP L0
INCREASE: CMP CX,7
JE CANNOTINCREASESPEED
INC CX
JMP WHATSPEED
DECREASE: CMP CX,1
JE CANNOTDECREASESPEED
DEC CX
JMP WHATSPEED
TRIGHT: CURSOR 39,22
DISP CLOCK
JMP A1
TLEFT: CURSOR 39,22
DISP COUNTER
JMP A1
CANNOTINCREASESPEED: CLEARLINE 19
CURSOR 27,19
DISP MAXSPEED
JMP L0
CANNOTDECREASESPEED: CLEARLINE 19
CURSOR 27,19
DISP MINSPEED
JMP L0
WHATSPEED: CMP CX,1
JE N11
CMP CX,2
JE N22
CMP CX,3
JE N33
CMP CX,4
JE N44
CMP CX,5
JE N55
CMP CX,6
JE N66
CMP CX,7
JE N77
N11: CURSOR 35,21
DISP N1
JMP L0
N22: CURSOR 35,21
DISP N2
JMP L0
N33: CURSOR 35,21
DISP N3
JMP L0
N44: CURSOR 35,21
DISP N4
JMP L0
N55: CURSOR 35,21
DISP N5
JMP L0
N66: CURSOR 35,21
DISP N6
JMP L0
N77: CURSOR 35,21
DISP N7
JMP L0
EXIT: CLEAR
CURSOR 21,12
DISP PROGRAMEND1
CURSOR 21,13
DISP PROGRAMEND2
MOV AH, 4CH
INT 21H
END MAIN
櫃檯?請具體說明,*什麼*計數器? –
對不起,計數器CX未更新並相應顯示(比較cx,然後顯示n0 - n7) – corruptdna
單個地方的代碼太多。曾聽說過調試? – user35443