.386
.model small
.data

.code
start:
MOV AX,DATA 
       MOV DS,AX 
       MOV AH,0 
       MOV AL,03H 
       INT 10H 
       MOV BH,0 
       MOV DH,10 
       MOV DL,10 
       MOV AH,2 
       INT 10H   ;把光标设置在中央,可以不要这几句,主要是让你看得方便 
TOP:   MOV AH,0 
       INT 16H 
DOWN :CMP AH,50H ;下 
       JNZ RIGHT 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       INC DH 
       MOV AH,2 
       INT 10H 
       JMP NEXT 
RIGHT: CMP AH,4DH ;右 
       JNZ UP 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       CMP DL,79     ;判断是不是到了最后一列 
       JZ  NEXT1      
       INC DL        
  DONE:MOV AH,2 
       INT 10H 
       JMP NEXT 
 NEXT1:INC DH       
        MOV DL,0 
        JMP DONE 
   UP: CMP AH,48H  ;上 
       JNZ LEFT 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       CMP DH,1 
       JZ  NEXT 
       DEC DH 
       MOV AH,2 
       INT 10H 
       JMP NEXT 
LEFT: CMP AH,4BH ;左 
       JNZ ESC1 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       CMP DL,1  
       JZ  NEXT2 
       DEC DL   
       INT 10H 
       JMP NEXT 
NEXT2: CMP DH,1   
       JNZ DDD   
       JMP NEXT   
DDD:    DEC DH 
       MOV DL,79 
       JMP D 
ESC1:   CMP AL,1BH  ;退出 
       JNZ BACK 
       JMP EXIT 
BACK:  CMP AL,08H   
       JNZ ENTER 
       MOV DL,AL 
       MOV AH,2 
       INT 21H 
       MOV DL,20H 
       MOV AH,2 
       INT 21H 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       DEC DL 
       MOV AH,2 
       INT 10H 
       JMP NEXT 
 ENTER:CMP AL,0DH  
       JNZ DEFAULT 
       MOV AH,3 
       MOV BH,0 
       INT 10H 
       INC DH       
       MOV DL,0 
       MOV AH,2 
       INT 10H 
       JMP NEXT 
DEFAULT: MOV DL,AL ;其它键 
        MOV AH,2 
        INT 21H 
NEXT:  JMP TOP 
EXIT:  MOV AH,4CH 
       INT 21H 


 END  START 
  
  
　　 