INT 21H是DOS的中断调用,根据AH的值执行不同的功能;
在emu8086看一下;
单独输入一条指令;

进入仿真;

看一下程序代码,也就是用户程序,是存储在内存地址的01000、01001;
Run一下;运行情况如下图;
这里是内存的F4200到F4204;这里是系统内存区;前面是用户内存区;Bios DI,没有这条汇编指令;在emu8086可能指示从这里开始存放的是BIOS中断程序;就是执行int 21h会转到系统内存区;INT 21h后面是IRET指令;汇编指令中RET是返回,IRET则是中断返回;
执行IRET将从中断功能程序处,返回到用户代码;

来看一个实际的功能;01号子功能,键盘输入和回显;执行下面两条,将回显键盘输入字符,并把输入字符存入AL;

进入仿真;用户代码存到01003为止;

单步;执行到 BIOS DI 这句;再点单步执行,则出现下图;弹出仿真屏幕,并等待用户键入;

键入f,回显在仿真屏幕;f存入AL;然后进到IRET指令;

前面是在仿真内存的F4204处;执行IRET以后,返回到用户代码的下一条;也就是01004处;只输入了两条指令,01004是空的;
