问题1。2个直接定址表的区别是什么,什么时候该加0?
menu_tab dw offset b_menu1-offset boot+7c00h
fun_table dw offset reset_pc-offset boot+7c00h,0
上面的2个直接定址表的区别是一个后面要加个0,一个不加0,什么时候该加0,什么时候不用加0?
问题2。;Get the user input
choice: mov ah,0
---->下面开始读取键盘输入,判断调用哪个子程序。
int 16h
cmp al,'1'
----->这里是判断什么?然后转到choice.
jb choice
cmp al,'4'
----->这里是判断什么?然后转到choice.
ja choice
;Clear Screen first
call clear
;Call the sub function
sub al,'1'
----->这里为什么要al减一呢?
mov bl,4
mul bl
mov si,ax
mov bx,offset fun_table-offset boot+7c00h
call dword ptr es:[bx][si]
boot_ok:mov ax,4c00h
int 21h
------------------------------------------------------------------------------------
补上显示菜单的代码,以及子程序的直接定址表。
;Define the boot menu
b_menu1:db "1) Reset PC",0
b_menu2:db "2) Start system",0
b_menu3:db "3) Clock",0
b_menu4:db "4) Set clock",0
b_menu5:db "Please enter your choice:[1-4]",0
time_str:db "yy/mm/dd hh:mm:ss",0
set_clock_p:db "Please enter the new time(yy/mm/dd hh:mm:ss):",0
set_clock_s:db "__/__/__ __:__:__",0
set_clock_top dw 0
menu_tab dw offset b_menu1-offset boot+7c00h,offset b_menu2-offset boot+7c00h,offset b_menu3-offset boot+7c00h,offset b_menu4-offset boot+7c00h,offset b_menu5-offset boot+7c00h
fun_table dw offset reset_pc-offset boot+7c00h,0,200h,0,offset clock-offset boot+7c00h,0,offset set_clock-offset boot+7c00h,0
org_int9_addr dw 0,0
|