.model tiny
.code
.startup
mov ah,9h
mov dx,offset mesaa
int 21h
start1:
mov ah,01h
int 21h
cmp al,'1'
jb start1
cmp al,'8'
ja start1
and ax,000fh
dec ax
shl ax,1
mov bx,ax
jmp table[bx]
start2:
mov ah,9
int 21h
.exit 0
mes db 'Input a number (1~8) ',0dh,0ah,'$'
disp1:
mov dx,offset mes1
jmp start2
disp2:
mov dx,offset mes2
jmp start2
disp3 :
mov dx,offset mes3
jmp start2
disp4:
mov dx,offset mes4
jmp start2
disp5:
mov dx,offset mes5
jmp start2
disp6:
mov dx,offset mes6
jmp start2
disp7:
mov dx,offset mes7
jmp start2
disp8:
mov dx,offset mes8
jmp start2
mes1 db 0dh,0ah, 'chapter 1!',0dh,0ah,'$'
mes2 db 'chapter 2!',0dh,0ah,'$'
mes3 db 'chapter 3!',0dh,0ah,'$'
mes4 db 'chapter 4!',0dh,0ah,'$'
mes5 db 'chapter 5!',0dh,0ah,'$'
mes6 db 'chapter 6!',0dh,0ah,'$'
mes7 db 'chapter 7!',0dh,0ah,'$'
mes8 db 'chapter 8!',0dh,0ah,'$'
table dw disp1,disp2,disp3,disp4
dw disp5,disp6,disp7,disp8
end
关键是table的定义:disp1等在内存的状态是什么样的,怎么存储的,能这么用吗??一般都是dw后跟数据的啊……