EXTRN InitKeyDisplay:NEAR, Display8:NEAR, GetKeyB:NEAR
_STACK SEGMENT STACK
DW 100 DUP(?)
_STACK ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
BUFFER DB 8 DUP(?)
DATA ENDS
CODE SEGMENT
START PROC NEAR
ASSUME CS:CODE, DS:_DATA, SS:_STACK
MOV AX,_DATA
MOV DS,AX
MOV ES,AX
NOP
CALL InitKeyDisplay ;对键盘、 数码管扫描控制器8255初始化
START1: CALL GetKeyB ;键值存放在AL中
CMP AL,8
JB START2
XOR AL,AL ;大于7, 作0处理
START2: XOR AH,AH
MOV BX,AX
SHL BX,1
LEA DI,Table_1
JMP CS:[DI][BX]
Table_1: DW Key0, Key1, Key2, Key3, Key4, Key5, Key6, Key7
Key0: MOV AL,1
JMP Key
Key1: MOV AL,2
JMP Key
Key2: MOV AL,3
JMP Key
Key3: MOV AL,4
JMP Key
Key4: MOV AL,5
JMP Key
Key5: MOV AL,6
JMP Key
Key6: MOV AL,7
JMP Key
Key7: MOV AL,8
JMP Key
Key: MOV CX,8
LEA DI,BUFFER
REP STOSB
LEA SI,BUFFER
CALL Display8
;MOV CX,60000
;LOOP $ ;延时
JMP START1
START ENDP
CODE ENDS
END START
程序流程图