﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-业精于勤</title><link>http://www.cppblog.com/wlwcode/</link><description>灬活死人墓、</description><language>zh-cn</language><lastBuildDate>Tue, 09 Jun 2026 17:48:08 GMT</lastBuildDate><pubDate>Tue, 09 Jun 2026 17:48:08 GMT</pubDate><ttl>60</ttl><item><title>汇编--INT 10H功能</title><link>http://www.cppblog.com/wlwcode/archive/2017/06/06/214978.html</link><dc:creator>thvoifar、</dc:creator><author>thvoifar、</author><pubDate>Tue, 06 Jun 2017 04:19:00 GMT</pubDate><guid>http://www.cppblog.com/wlwcode/archive/2017/06/06/214978.html</guid><wfw:comment>http://www.cppblog.com/wlwcode/comments/214978.html</wfw:comment><comments>http://www.cppblog.com/wlwcode/archive/2017/06/06/214978.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wlwcode/comments/commentRss/214978.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wlwcode/services/trackbacks/214978.html</trackback:ping><description><![CDATA[<div>转自：<div>http://www.cnblogs.com/magic-cube/archive/2011/10/19/2217676.html</div><br />INT 10H 是由 BIOS 对屏幕及显示器所提供的服务程序，而后倚天公司针对倚天中文提供了许多服务程序，这些服务程序也加挂在 INT 10H 内。使用 INT 10H 中断服务程序时，先指定 AH 寄存器为下表编号其中之一，该编号表示欲调用的功用，而其他寄存器的详细说明，参考表后文字，当一切设定好之后再调用 INT 10H。底下是它们的说明：<br />AH<br />&nbsp;&nbsp; &nbsp;<br />功 能<br />&nbsp;&nbsp; &nbsp;<br />调用参数<br />&nbsp;&nbsp; &nbsp;<br />返回参数 / 注释<br />1<br />&nbsp;&nbsp; &nbsp;<br />　置光标类型<br />&nbsp;&nbsp; &nbsp;<br />　　（CH）0&#8213;3 = 光标开始行<br />　　（CL）0&#8213;3 = 光标结束行<br />&nbsp;&nbsp; &nbsp;<br />2<br />&nbsp;&nbsp; &nbsp;<br />　置光标位置<br />&nbsp;&nbsp; &nbsp;<br />　　BH = 页号<br />　　DH = 行<br />　　DL = 列 　<br />&nbsp;&nbsp; &nbsp;<br />3<br />&nbsp;&nbsp; &nbsp;<br />　读光标位置<br />&nbsp;&nbsp; &nbsp;<br />　　BH = 页号<br />&nbsp;&nbsp; &nbsp;<br />　CH = 光标开始行<br />　CL = 光标结束行<br />　DH = 行<br />　DL = 列<br />4<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp; 读光笔位置<br />&nbsp;&nbsp; &nbsp;<br />　　<br />&nbsp;&nbsp; &nbsp;<br />AH=0 光笔未触发<br />=1 光笔触发<br />CH=象素行<br />BX=象素列<br />DH=字符行<br />DL=字符列<br />5<br />&nbsp;&nbsp; &nbsp;<br />　显示页<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AL = 显示页号<br />&nbsp;&nbsp; &nbsp;<br />6<br />&nbsp;&nbsp; &nbsp;<br />　屏幕初始化或上卷<br />&nbsp;&nbsp; &nbsp;<br />　　AL = 上卷行数<br />　　AL =0全屏幕为空白<br />　　BH = 卷入行属性<br />　　CH = 左上角行号<br />　　CL = 左上角列号<br />　　DH = 右下角行号<br />　　DL = 右下角列号<br />&nbsp;&nbsp; &nbsp;<br />7<br />&nbsp;&nbsp; &nbsp;<br />　屏幕初始化或下卷<br />&nbsp;&nbsp; &nbsp;<br />　　AL = 下卷行数<br />　　AL = 0全屏幕为空白<br />　　BH = 卷入行属性<br />　　CH = 左上角行号<br />　　CL = 左上角列号<br />　　DH = 右下角行号<br />　　DL = 右下角列号<br />&nbsp;&nbsp; &nbsp;<br />8<br />&nbsp;&nbsp; &nbsp;<br />　读光标位置的属性和字符<br />&nbsp;&nbsp; &nbsp;<br />　　BH = 显示页<br />&nbsp;&nbsp; &nbsp;<br />　AH = 属性<br />　AL = 字符<br />9<br />&nbsp;&nbsp; &nbsp;<br />　在光标位置显示字符及其属性<br />&nbsp;&nbsp; &nbsp;<br />　　BH = 显示页<br />　　AL = 字符<br />　　BL = 属性<br />　　CX = 字符重复次数<br />&nbsp;&nbsp; &nbsp;<br />A<br />&nbsp;&nbsp; &nbsp;<br />　在光标位置只显示字符<br />&nbsp;&nbsp; &nbsp;<br />　　BH = 显示页<br />　　AL = 字符<br />　　CX = 字符重复次数<br />&nbsp;&nbsp; &nbsp;<br />E<br />&nbsp;&nbsp; &nbsp;<br />　显示字符(光标前移)<br />&nbsp;&nbsp; &nbsp;<br />　　AL = 字符<br />　　BL = 前景色<br />&nbsp;&nbsp; &nbsp;<br />　光标跟随字符移动<br />13<br />&nbsp;&nbsp; &nbsp;<br />　显示字符串<br />&nbsp;&nbsp; &nbsp;<br />　　ES:BP = 串地址<br />　　CX = 串长度<br />　　DH， DL = 起始行列<br />　　BH = 页号<br />　　AL = 0，BL = 属性<br />　　串：Char，char，&#8230;&#8230;，char<br />　　AL = 1，BL = 属性<br />　　串：Char，char，&#8230;&#8230;，char<br />　　AL = 2<br />　　串：Char，attr，&#8230;&#8230;，char，attr<br />　　AL = 3<br />　　串：Char，attr，&#8230;&#8230;，char，attr<br />&nbsp;&nbsp; &nbsp;<br /><br /><br /><br /><br /><br />　光标返回起始位置<br /><br />　光标跟随移动<br /><br /><br />　光标返回起始位置<br /><br /><br />　光标跟随串移动<br />AH=00H<br /><br />AH=00/INT 10H 是用来设定显示模式的服务程序，AL 寄存器表示欲设定的模式：<br /><br />AL &nbsp;&nbsp; &nbsp;文字/图形 &nbsp;&nbsp; &nbsp;分辨率 &nbsp;&nbsp; &nbsp;颜色<br />00 &nbsp;&nbsp; &nbsp;文字 &nbsp;&nbsp; &nbsp;40*25 &nbsp;&nbsp; &nbsp;2<br />01 &nbsp;&nbsp; &nbsp;文字 &nbsp;&nbsp; &nbsp;40*25 &nbsp;&nbsp; &nbsp;16<br />02 &nbsp;&nbsp; &nbsp;文字 &nbsp;&nbsp; &nbsp;80*25 &nbsp;&nbsp; &nbsp;2<br />03 &nbsp;&nbsp; &nbsp;文字 &nbsp;&nbsp; &nbsp;80*25 &nbsp;&nbsp; &nbsp;16<br />04 &nbsp;&nbsp; &nbsp;图形 &nbsp;&nbsp; &nbsp;320*200 &nbsp;&nbsp; &nbsp;2<br />05 &nbsp;&nbsp; &nbsp;图形 &nbsp;&nbsp; &nbsp;320*200 &nbsp;&nbsp; &nbsp;4<br />06 &nbsp;&nbsp; &nbsp;图形 &nbsp;&nbsp; &nbsp;640*200 &nbsp;&nbsp; &nbsp;2<br />AH=01H<br /><br />您可以把光标想成一个小的矩形，平时这个矩形扁平位于某字底部，但藉由此功能可以改变其大小与位置。光标起始处与终止处分别由 CL 与 CH 的 0 到 4 位表示，参考下图：<br /><br />而 CH 的第 7 位必须是 0，第 5、6 位表示光标属性：<br /><br />位 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 位 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 属性<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 正常<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 隐形<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 闪烁缓慢<br /><br />AH=02H<br /><br />此功能是设定光标位置，位置用 DH、DL 表示，DH 表示列号，DL 表示行号。由左至右称之为『列』，屏幕最上面一列为第零列，紧靠第零列的下一列称为第一列&#8230;&#8230;；由上而下称之为『行』，屏幕最左边一行称之为第零行，紧靠 第零行右边的一行为第一行。故最左边，最上面的位置为 DH=0 且 DL=0；最左边第二列，DH=1，DL=0。如果是文字模式时，BH 为欲改变光标位置的显示页，如果是图形模式，BH 要设为 0。<br /><br />以行列来说明 DH、DL 之意义，小木偶常常搞混，底下以座标方式解释。在文字模式下，字符的位置类似数学直角座标系的座标，但是 Y 轴方向相反，Y 轴是以屏幕最上面为零，越下面越大，直到 24 为止，存于 DH 内。X 轴和直角座标系相同，越右边越大，存于 DL 内，其最大值视显示模式而变。<br />AH=03H<br /><br />AH=03H/INT 10H 这个中断服务程序返回时，会在 DX 里面有光标的行列位置，CX 内有光标的大小，DX、CX 之数值所代表的意义和 AH=02H/INT 10H、AH=01H/INT 10H 相同。<br />AH=04H<br /><br />此功能是探测光笔之位置，似乎只有 CGA 卡有接上光笔？？<br />AH=05H<br /><br />这个功能是把指定的显示页显示于屏幕上，欲显示的显示页于 AL 寄存器中指定。此功能只能在文字模式下才能发生作用。<br />AH=06H/07H<br /><br />这个服务程序的功用是把某一个设定好的矩形区域内的文字向上或向下移动。先说明向上移动，即调用 AH=06H/INT 10H。当此服务程序工作时，会使矩形区域的文字向上移动，而矩形区域底端移进空格列。向上移动的列数存入 AL 中 ( 如果 AL 为零，表示使矩形区域的所有列均向上移 )，底端移入空格列的属性存于 BH，矩形区域是藉由 CX、DX 来设定左上角与右上角的座标，左上角的行与列分别由 CL、CH 设定，右下角的行与列由 DL、DH 设定。<br /><br />AH=07H/INT 10H 和 AH=06H/INT 10H 相似，只是卷动方像不同而已。<br />AH=08H<br /><br />这个服务程序是用来取得光标所在位置的字符及属性，调用前，BH 表示欲读取之显示页，返回时，AL 为该位置之 ASCII 字符，AH 为其属性。有关属性的说明，请参考注一。<br />AH=09H<br /><br />这个功能是在光标位置显示字符，所要显示字符的 ASCII 码存于 AL 寄存器，字符重复次数存于 CX 寄存器，显示页存于 BH 寄存器，属性存于 BL 寄存器，其属性使用与 AH=08/INT 10H 一样。<br />AH=0AH<br /><br />这个功能和 AH=09H/INT 10H 一样，差别在 AH=0AH 只能写入一个字符，而且不能改变字符属性。<br />AH=0BH<br /><br />这个服务程序是选择调色盘。显示模式 5 是 320*200 的图形模式，最多可以显示 4 种颜色，这四种颜色的意思是最多可以『同时』显示一种背景色及三种前景色，而这三种前景色有两种方式可供选择，因此事实上，在显示模式 5 有两种调色盘可供选择。就好像您去买 12 种颜色的水彩，但可在调色盘上以任意比例搭配出许多种颜色。<br /><br />调色盘 0 的三色是绿、红、黄；调色盘 1 的三色是青、紫红、白。背景色有 16 六种可供选择，这 16 种就是注一的 16 色。调用此中断时，先决定要设定背景色抑或调色盘，<br /><br />&nbsp;&nbsp;&nbsp; 要设定背景色时，则使 BH 为 0，再使 BL 之数值为 0 到 0fh 之间表示注一的 16 色之一。<br />&nbsp;&nbsp;&nbsp; 要设定调色盘时，则使 BH 为 1。再设定 BL 为零或一表示选择那一种调色盘。<br /><br />背景色只有在前景色为 0 时才会显现出来。<br />AH=0CH<br /><br />AH=0Ch/INT 10H 是在绘图模式中显示一点 ( 也就是写入点像，write graphics pixel )，而 AH=0DH/INT 10H 则是读取点像 ( read graphics pixel )。<br /><br />写入时，要写入位置 X 座标存于 CX 寄存器，Y 座标存于 DX 寄存器，颜色存于 AL 寄存器。和文字模式相同，萤光幕上的 Y 座标是最上面一列为零，越下面越大，X 座标则和数学的定义相同。CX、DX、AL 值之范围与显示模式有关：<br /><br />显示模式 &nbsp;&nbsp; &nbsp;X 座标 &nbsp;&nbsp; &nbsp;Y 座标 &nbsp;&nbsp; &nbsp;颜色<br />4 &nbsp;&nbsp; &nbsp;0～319 &nbsp;&nbsp; &nbsp;0～199 &nbsp;&nbsp; &nbsp;0、1<br />5 &nbsp;&nbsp; &nbsp;0～319 &nbsp;&nbsp; &nbsp;0～199 &nbsp;&nbsp; &nbsp;0～3<br />6 &nbsp;&nbsp; &nbsp;0～639 &nbsp;&nbsp; &nbsp;0～199 &nbsp;&nbsp; &nbsp;0、1<br /><br />AH=0DH/INT 10H 则是读取某一位置之点像，您必须指定 CX、DX，而 INT 10H 会传回该位置点像之颜色。<br />AH=0EH<br /><br />这个子程序是使显示器像打字机一样的显示字符来，在前面用 AH=09H/INT 10H 和 AH=0AH/INT 10H 都可以在萤光幕上显示字符，但是这两奘方式显示字符之后，光标位置并不移动，而 AH=0EH/INT 10H 则会使光标位置移动，每显示一个字符，光标会往右移一格，假如已经到最右边了，则光标会移到最左边并移到下一列，假如已经移到最下面一列的最右边，则屏幕 会向上卷动。<br /><br />AL 寄存器存要显示的字符，BH 为目前的显示页，如果是在图形模式，则 BH 须设为 0，假如是在图形模式下，也可以设定 BL 来表示文字的颜色，文字模式下的 BL 则无功能。<br />AH=0FH<br /><br />这个服务程序是得到目前的显示模式，调用前只需使 AH 设为 0fh，当由 INT 10H 返回时，显示模式存于 AL 寄存器 ( 参考 AH=00H/INT 10H 的显示模式表 )，目前的显示页存于 BH 寄存器，总字符行数存于 AH 寄存器。<br /><br />注一： 所谓属性是指字符的颜色、背景颜色、是否闪烁、有没有底线等性质。在彩色显示卡 ( CGA/EGA/VGA 等 ) 的文字模式中，颜色是用 4 个位表示，故可以表现出 16 种颜色，如下表：<br /><br />二进制数 &nbsp;&nbsp; &nbsp;颜色 &nbsp;&nbsp; &nbsp;例子 &nbsp;&nbsp; &nbsp;二进制数 &nbsp;&nbsp; &nbsp;颜色 &nbsp;&nbsp; &nbsp;例子<br />0000 &nbsp;&nbsp; &nbsp;黑色 &nbsp;&nbsp; &nbsp;black &nbsp;&nbsp; &nbsp;1000 &nbsp;&nbsp; &nbsp;灰色 &nbsp;&nbsp; &nbsp;gray<br />0001 &nbsp;&nbsp; &nbsp;蓝色 &nbsp;&nbsp; &nbsp;blue &nbsp;&nbsp; &nbsp;1001 &nbsp;&nbsp; &nbsp;淡蓝色 &nbsp;&nbsp; &nbsp;light blue<br />0010 &nbsp;&nbsp; &nbsp;绿色 &nbsp;&nbsp; &nbsp;green &nbsp;&nbsp; &nbsp;1010 &nbsp;&nbsp; &nbsp;淡绿色 &nbsp;&nbsp; &nbsp;light green<br />0011 &nbsp;&nbsp; &nbsp;青色 &nbsp;&nbsp; &nbsp;cyan &nbsp;&nbsp; &nbsp;1000 &nbsp;&nbsp; &nbsp;淡青色 &nbsp;&nbsp; &nbsp;light cyan<br />0100 &nbsp;&nbsp; &nbsp;红色 &nbsp;&nbsp; &nbsp;red &nbsp;&nbsp; &nbsp;1100 &nbsp;&nbsp; &nbsp;淡红色 &nbsp;&nbsp; &nbsp;light red<br />0101 &nbsp;&nbsp; &nbsp;紫红色 &nbsp;&nbsp; &nbsp;magenta &nbsp;&nbsp; &nbsp;1101 &nbsp;&nbsp; &nbsp;淡紫红色 &nbsp;&nbsp; &nbsp;light magenta<br />0110 &nbsp;&nbsp; &nbsp;棕色 &nbsp;&nbsp; &nbsp;brown &nbsp;&nbsp; &nbsp;1110 &nbsp;&nbsp; &nbsp;黄色 &nbsp;&nbsp; &nbsp;yellow<br />0111 &nbsp;&nbsp; &nbsp;银色 &nbsp;&nbsp; &nbsp;light gray &nbsp;&nbsp; &nbsp;1111 &nbsp;&nbsp; &nbsp;白色 &nbsp;&nbsp; &nbsp;white<br /><br />在彩色显示器里，如 CGA、EGA、VGA 等，常用一个字节 ( 8 个位 ) 来表示文字颜色和背景颜色，通常以第 0～3 位表示文字本身颜色；第 4～6 位表示背景颜色，背景颜色只有上表左栏的 8 种而已；第 7 个位，表示是否闪烁，0 表示不闪烁，1 表示闪烁。<br /><br />但是在单色显示器里，如 MDA 和 Hercules 卡中，这些颜色表并无意义，所以属性解释方式不同，请看下表：<br /><br />数值 &nbsp;&nbsp; &nbsp;属性<br />00H &nbsp;&nbsp; &nbsp;空格，不显示任何数据<br />77H &nbsp;&nbsp; &nbsp;显示白色方块<br />07H &nbsp;&nbsp; &nbsp;正常的黑底白字<br />70H &nbsp;&nbsp; &nbsp;反白的白底黑字<br />01H &nbsp;&nbsp; &nbsp;加底线</div><img src ="http://www.cppblog.com/wlwcode/aggbug/214978.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wlwcode/" target="_blank">thvoifar、</a> 2017-06-06 12:19 <a href="http://www.cppblog.com/wlwcode/archive/2017/06/06/214978.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>