📄 asm_tutorial_04.html
字号:
<!doctype HTML public "-//W3O//DTD W3 HTML 3.0//EN"><HTML><HEAD><TITLE>8086 Assembler Tutorial for Beginners (Part 4)</TITLE><META name="description" content="Interrupts - 8086 Assembler"><META name="keywords" content="interrupts, 8086, tutorial, programming, assembler tutorial, tutorial for begginers"><META name="robots" content="nofollow"></HEAD><BODY bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#007099" alink="#FF0000"><TABLE WIDTH=80%><TR><TD><FONT FACE="Verdana" SIZE=3><FONT SIZE=+1><B>8086 Assembler Tutorial for Beginners (Part 4)</B></FONT><BR><BR><FONT SIZE=+2><B>Interrupts</B></FONT><BR><BR>Interrupts can be seen as a number of functions. These functions makethe programming much easier, instead of writing a code to printa character you can simply call the interrupt and it will do everythingfor you. There are also interrupt functions that work with disk driveand other hardware. We call such functions <B>software interrupts</B>.<BR><BR>Interrupts are also triggered by different hardware,these are called <B>hardware interrupts</B>. Currently we are interestedin <B>software interrupts</B> only.<BR><BR><BR>To make a <B>software interrupt</B> there is an <B>INT</B> instruction,it has very simple syntax:<BLOCKQUOTE><B>INT value</B></BLOCKQUOTE>Where <B>value</B> can be a number between 0 to 255 (or 0 to 0FFh),<BR>generally we will use hexadecimal numbers.<BR>You may think that there are only 256 functions, but that is not correct.Each interrupt may have sub-functions.<BR>To specify a sub-function <B>AH</B> register should be set before callinginterrupt.<BR>Each interrupt may have up to 256 sub-functions(so we get <NOBR>256 * 256 = 65536</NOBR> functions).In general <B>AH</B> register is used, but sometimes other registersmaybe in use. Generally other registers are used to pass parametersand data to sub-function.<BR><BR>The following example uses <B>INT 10h</B> sub-function <B>0Eh</B> totype a "Hello!" message. This functions displays a character onthe screen, advancing the cursor and scrolling the screen as necessary.<BR><BR><TABLE BORDER=1 CELLPADDING=10 WIDTH=50%><TR><TD><PRE><FONT FACE="Fixedsys">#MAKE_COM# ; instruct compiler to make COM file.ORG 100h; The sub-function that we are using; does not modify the AH register on; return, so we may set it only once.MOV AH, 0Eh ; select sub-function.; INT 10h / 0Eh sub-function; receives an ASCII code of the; character that will be printed; in AL register.MOV AL, 'H' ; ASCII code: 72INT 10h ; print it!MOV AL, 'e' ; ASCII code: 101INT 10h ; print it!MOV AL, 'l' ; ASCII code: 108INT 10h ; print it!MOV AL, 'l' ; ASCII code: 108INT 10h ; print it!MOV AL, 'o' ; ASCII code: 111INT 10h ; print it!MOV AL, '!' ; ASCII code: 33INT 10h ; print it!RET ; returns to operating system.</FONT></PRE></TD></TR></TABLE><BR><BR>Copy & paste the above program to <I>Emu8086</I> source code editor,and press [<B>Compile and Emulate</B>] button. Run it!<BR><BR>See <A HREF="supported_interrupts.html"><B>list of supported interrupts</B></A>for more information about interrupts.<BR><BR><BR><HR><CENTER><A HREF="asm_tutorial_03.html"><B> <<< Previous Part <<< </B></A> <A HREF="asm_tutorial_05.html"><B> >>> Next Part >>> </B></A></CENTER><HR><BR></FONT></TD></TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -