地址法示例:我编辑的自考汇编实验题二与大家共享
;用地址表法,完成下面要求的多分支程序的设计.根据MODE单元中的模式字(0-7)分别;转向L0-L7标号处执行L0-L7处分别完成显示'0'-'7'字符.即当MODE=0时,转L0标号,
;完成显示'0'
DATA SEGMENT
MODE DW L0,L1,L2,L3,L4,L5,L6,L7
P0 DB' 0 ','$'
P1 DB' 1 ','$'
P2 DB' 2 ','$'
P3 DB' 3 ','$'
P4 DB' 4 ','$'
P5 DB' 5 ','$'
P6 DB' 6 ','$'
P7 DB' 7 ','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AH,01H
INT 21H
CMP AL,'0'
JB START
CMP AL,'7'
JA START
SUB AL,30H
MOV AH,0
ADD AX,AX
MOV SI,AX
MOV BX,MODE[SI]
JMP BX
L0: LEA DX,P0
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L1: LEA DX,P1
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L2: LEA DX,P2
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L3: LEA DX,P3
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L4: LEA DX,P4
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L5: LEA DX,P5
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L6: LEA DX,P6
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
L7: LEA DX,P7
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START