﻿<?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/longaotx/category/18450.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 06 Jan 2012 06:30:22 GMT</lastBuildDate><pubDate>Fri, 06 Jan 2012 06:30:22 GMT</pubDate><ttl>60</ttl><item><title>汇编语言学习笔记——第十四章 端口</title><link>http://www.cppblog.com/longaotx/archive/2012/01/05/163653.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Thu, 05 Jan 2012 13:06:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/05/163653.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163653.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/05/163653.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163653.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163653.html</trackback:ping><description><![CDATA[<br />1.CPU可以直接读写以下3个地方的数据：<br />&nbsp; &nbsp; a.CPU内部的寄存器；<br />&nbsp; &nbsp; b.内存单元；<br />&nbsp; &nbsp; c.端口。<br /><br />2.访问端口时，CPU通过端口地址定位端口。<br /><br />3.在PC系统中，CPU最多可以定位64KB个不同的端口，则端口地址的范围是0～65535。<br /><br />4.CPU对端口只有两条读写指令：in和out。<br />&nbsp; &nbsp; 例：in al,60h &nbsp;；从60h端口读入一个字节<br /><br />5.在in和out指令中，只能使用ax和al来存放从端口中读入的数据或要发送到端口中的数据。访问8位端口时用AL，访问16位端口时用ax。<br />&nbsp; &nbsp; 对256～65535的端口进行读写时，端口号放在DX中。<br /><br />6.CPU通过地址为70h和71h的两个端口读写CMOS RAM。<br />&nbsp; &nbsp; 70h为地址端口，存放要访问的CMOS RAM单元的地址。<br />&nbsp; &nbsp; 71h为数据端口，存放从选定的CMOS RAM单元中读取的数据，或要写入到其中的数据。<br /><br />7.shl是逻辑左移指令，功能为：<br />&nbsp; &nbsp; a.将一个寄存器或内存单元中的数据向左移位；<br />&nbsp; &nbsp; b.将最后移出的一位写入CF中；<br />&nbsp; &nbsp; c.最低位用0补充。<br /><br />8.shr是逻辑右移指令，功能为：<br />&nbsp; &nbsp; a.将一个寄存器或内存单元中的数据向右移位；<br />&nbsp; &nbsp; b.将最后移出的一位写入CF中；<br />&nbsp; &nbsp; c.最高位用0补充。<br /><br />实验14 访问CMOS RAM<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月05日<img src ="http://www.cppblog.com/longaotx/aggbug/163653.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-05 21:06 <a href="http://www.cppblog.com/longaotx/archive/2012/01/05/163653.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第十三章 int指令</title><link>http://www.cppblog.com/longaotx/archive/2012/01/05/163651.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Thu, 05 Jan 2012 12:57:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/05/163651.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163651.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/05/163651.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163651.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163651.html</trackback:ping><description><![CDATA[<br /><span style="font-family: Courier; ">1.int指令的格式为：int n，n为中断类型码，它的功能是引发中断过程。<br /><br />2.CPU执行int n指令，相当于引发一个n号中断的中断过程，执行过程如下：</span>&nbsp; &nbsp;<br />&nbsp; &nbsp; （1）取中断类型码n；<br />&nbsp; &nbsp; （2）标志寄存器入栈，IF=0,TF=0;<br />&nbsp; &nbsp; （3）CS、IP入栈；<br />&nbsp; &nbsp; （4）(IP)=(n*4),(CS)=(n*4+2).<br /><br />3.int 10h中断例程是BIOS提供的中断例程，其中包含了多个和屏幕输出相关的子程序。<br /><br />4.int 21h中断例程是DOS提供的中断例程，其中包含了DOS提供给程序员在编程时调用的子程序。<br /><br />实验13 编写、应用中断例程<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月04日<img src ="http://www.cppblog.com/longaotx/aggbug/163651.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-05 20:57 <a href="http://www.cppblog.com/longaotx/archive/2012/01/05/163651.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第十二章 内中断</title><link>http://www.cppblog.com/longaotx/archive/2012/01/04/163574.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Wed, 04 Jan 2012 13:46:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/04/163574.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163574.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/04/163574.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163574.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163574.html</trackback:ping><description><![CDATA[<br />1.8086CPU中4种中断源及中断类型码：<br />&nbsp; &nbsp; （1）除法错误：0；<br />&nbsp; &nbsp; （2）单步执行：1；<br />&nbsp; &nbsp; （3）执行into指令：4；<br />&nbsp; &nbsp; （4）执行int指令。该指令的格式为 int n，指令中的n为字节型立即数，是提供给CPU的中断类型码。<br /><br />2.中断向量表，是中断处理程序入口地址的列表。<br />&nbsp; 中断向量表在内存中保存，其中存放着256个中断源所对应的中断处理程序的入口。<br />&nbsp; 对于8086PC机，中断向量表指定放在内存地址0处。<br /><br />3.中断过程：<br />&nbsp; &nbsp; （1）取得中断类型码N；<br />&nbsp; &nbsp; （2）pushf<br />&nbsp; &nbsp; （3）TF＝0，IF＝0<br />&nbsp; &nbsp; （4）push CS<br />&nbsp; &nbsp; （5）push IP<br />&nbsp; &nbsp; （6）(IP)=(N*4),(CS)=(N*4+2)<br /><br />4.单步中断的过程：<br />&nbsp; &nbsp; （1）取得中断类型码1；<br />&nbsp; &nbsp; （2）标志寄存器入栈，TF、IF设置为0；<br />&nbsp; &nbsp; （3）CS、IP入栈；<br />&nbsp; &nbsp; （4）(IP)=(1*4),(CS)=(1*4+2)<br /><br />5.一般情况下，CPU会响应中断。<br />&nbsp; 特殊情况下，CPU在执行完当前指令后，即使是发生中断，也不会响应。<br /><br />实验12 编写0号中断的处理程序<br />&nbsp; &nbsp; 略。<br /><br />今天和昨天一样，也看了四章书，不过不是很仔细地看，有些地方跳过了。继续努力！<br /><br /><br />END<br />2012年01月04日<img src ="http://www.cppblog.com/longaotx/aggbug/163574.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-04 21:46 <a href="http://www.cppblog.com/longaotx/archive/2012/01/04/163574.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第十一章 标志寄存器</title><link>http://www.cppblog.com/longaotx/archive/2012/01/04/163573.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Wed, 04 Jan 2012 13:35:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/04/163573.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163573.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/04/163573.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163573.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163573.html</trackback:ping><description><![CDATA[<br />1.在8086CPU中，标志寄存器的作用：<br />&nbsp; &nbsp; （1）用来存储相关指令的某些执行结果；<br />&nbsp; &nbsp; （2）用来为CPU执行相关指令提供行为依据；<br />&nbsp; &nbsp; （3）用来控制CPU的相关工作方式。<br /><br />2.flag寄存器按位起作用。<br /><br />3.标志寄存器的第6位是ZF，零标志位。结果为0，则ZF＝1。<br /><br />4.flag的第2位是PF，奇偶标志位。1的个数为偶数，则PF＝1.<br /><br />5.flag的第7位是SF，符号标志位。结果为负，则SF＝1.<br /><br />6.flag的第0位是CF，进位标志位。<br /><br />7.flag的第11位是OF，溢出标志位。发生溢出，则OF＝1.<br /><br />8.adc:带进位加法指令。<br />&nbsp; &nbsp; 指令格式：adc 操作对象1，操作对象2<br />&nbsp; &nbsp; 功能：操作对象1＝操作对象1＋操作对象2＋CF<br /><br />9.sbb：带借位减法指令。<br />&nbsp; &nbsp; 指令格式：sbb 对象1，对象2<br />&nbsp; &nbsp; 功能：对象1＝对象1－对象2－CF<br /><br />10：cmp:比较指令。<br />&nbsp; &nbsp; 指令格式：cmp 对象1，对象2<br />&nbsp; &nbsp; 功能：对象1－对象2，不保存结果，根据计算结果对标志寄存器进行设置。<br /><br />11.flag的第10位是DF，方向标志位。在串处理指令中，控制每次操作后si和di的增减。<br />&nbsp; &nbsp; df=0 每次操作后si和di递增；<br />&nbsp; &nbsp; df=1 每次操作后si和di递减。<br /><br />12.串传送指令<br />&nbsp; &nbsp; （1）movsb,执行movsb指令相当于下面操作：<br />&nbsp; &nbsp; &nbsp; &nbsp; a.((es)*16+(di))=((ds)*16+(si))<br />&nbsp; &nbsp; &nbsp; &nbsp; b.如果df=0则 (si)=(si)+1 (di)=(di)+1;如果df=1则(si)=(si)-1 (di)=(di)-1.<br />&nbsp; &nbsp; （2）movsw,movsw的功能是将ds:si指向的内存字单元中的字送入ds:di中，然后根据flag中df位的值，将si和di递增2或递减2.<br />&nbsp; &nbsp; （3）rep，格式： rep movsb/movsw<br />&nbsp; &nbsp; &nbsp; &nbsp; rep的作用是根据cx的值，重复执行后面的串传送指令。<br /><br />13.pushf的功能是将标志寄存器中的值压栈。<br />&nbsp; &nbsp;popf是从栈中弹出数据，送入标志寄存器中。<br />&nbsp; &nbsp;pushf和popf为直接访问标志寄存器提供了一种方法。<br /><br />实验11 编写子程序<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月04日<img src ="http://www.cppblog.com/longaotx/aggbug/163573.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-04 21:35 <a href="http://www.cppblog.com/longaotx/archive/2012/01/04/163573.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第十章 CALL和RET指令</title><link>http://www.cppblog.com/longaotx/archive/2012/01/04/163571.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Wed, 04 Jan 2012 13:18:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/04/163571.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163571.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/04/163571.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163571.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163571.html</trackback:ping><description><![CDATA[<br />1.ret指令用栈中的数据，修改IP的内容，从而实现近转移。<br />&nbsp; retf指令用栈中的数据，修改CS和IP的内容，从而实现远转移。<br /><br />2.call指令不能实现短转移。<br /><br />3.call指令：<br />&nbsp; &nbsp; （1）call 标号 （将当前的IP压栈后，转到标号处执行指令）<br />&nbsp; &nbsp; （2）call far ptr 标号 （实现段间转移）<br />&nbsp; &nbsp; （3）call 16位reg<br />&nbsp; &nbsp; （4）call word ptr 内存单元地址<br />&nbsp; &nbsp; （5）call dword ptr 内存单元地址<br /><br />4.mul指令：乘法指令<br />&nbsp; &nbsp; 格式： mul reg 或 mul 内存单元<br />&nbsp; &nbsp; （1）两个相乘的数，要求都是8位或都是16位。如果是8位，一个默认放在AL中，另一个放在8位reg或内存字节单元中；如果是16位，一个默认放在 &nbsp;AX中，另一个放在16位reg或内存字单元中。<br />&nbsp; &nbsp; （2）结果：如果是8位乘法，结果默认放在AX中，如果是16位乘法，结果高位默认在DX中存放，低位在AX中存放。<br /><br />实验10 编写子程序<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月04日<img src ="http://www.cppblog.com/longaotx/aggbug/163571.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-04 21:18 <a href="http://www.cppblog.com/longaotx/archive/2012/01/04/163571.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第九章 转移指令的原理</title><link>http://www.cppblog.com/longaotx/archive/2012/01/04/163569.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Wed, 04 Jan 2012 13:09:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/04/163569.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163569.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/04/163569.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163569.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163569.html</trackback:ping><description><![CDATA[<br />1.转移指令：可以修改IP，或同时修改CS和IP的指令的统称。<br /><br />2.8086CPU的转移行为：<br />&nbsp; &nbsp; （1）段内转移：只修改IP。如 jmp ax。<br />&nbsp; &nbsp; （2）段间转移：同时修改CS和IP。如 jmp 1000:0 。<br /><br />3.由于转移指令对IP的修改范围不同，段内转移分为短转移和近转移。<br />&nbsp; &nbsp; 短转移IP的修改范围为－128～127.<br />&nbsp; &nbsp; 近转移IP的修改范围为－32768～32767.<br /><br />4.8086CPU转移指令分类：<br />&nbsp; &nbsp; a.无条件转移指令；<br />&nbsp; &nbsp; b.条件转移指令；<br />&nbsp; &nbsp; c.循环指令；<br />&nbsp; &nbsp; d.过程；<br />&nbsp; &nbsp; e.中断。<br /><br />5.操作符offset的功能是取得标号的偏移地址。<br /><br />6.段内短转移的jmp指令：jmp short 标号<br />&nbsp; 段内近转移的jmp指令：jmp near ptr 标号<br />&nbsp; 段间转移（远转移）：jmp far ptr 标号<br />&nbsp; 转移地址在reg中的jmp指令：jmp 16位reg<br /><br />7.转移地址在内存中的jmp指令：<br />&nbsp; &nbsp; （1）jmp word ptr 内存单元地址 （段内转移）<br />&nbsp; &nbsp; （2）jmp dword ptr 内存单元地址 （段间转移）<br /><br />8.所有的有条件转移指令都是短转移，对IP的修改范围都为－128～127.<br /><br />9.jcxz指令为有条件转移指令：<br />&nbsp; &nbsp; 指令格式：jcxz 标号 （如果(cx)=0,转移到标号处执行）<br /><br />10.所有的循环指令都是短转移。如 loop 指令。<br /><br />11.loop指令格式： loop标号 （(cx)=(cx)-1,如果(cx)不为零，转移到标号处执行）<br /><br />12.根据位移进行转移的指令，它们的转移范围受到转移位移的限制。<br /><br />实验8 分析一个奇怪的程序<br />&nbsp; &nbsp; 略。<br />实验9 根据材料编程<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月04日<img src ="http://www.cppblog.com/longaotx/aggbug/163569.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-04 21:09 <a href="http://www.cppblog.com/longaotx/archive/2012/01/04/163569.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第八章 数据处理的两个基本问题</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163517.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 15:54:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163517.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163517.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163517.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163517.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163517.html</trackback:ping><description><![CDATA[<br />1.描述性符号：reg和sreg<br />&nbsp; &nbsp; reg集合：ax/bx/cx/dx/ah/al/bh/bl/ch/cl/dh/cl/sp/bp/si/di；<br />&nbsp; &nbsp; sreg集合：ds/ss/cs/es。<br /><br />2.在8086CPU中，只有bx、si、di和bp可用在&#8220;[]&#8220;中来进行内存单元的寻址。<br />&nbsp; &nbsp; 在&#8221;[]&#8220;中，这4个寄存器可以单个出现，或只能以四种组合出现：bx和si、bx和di、bp和xi、bp和di。<br />&nbsp; &nbsp; 只要在[]中使用bp，而指令没有显式给出段地址，段地址就默认在ss中。<br /><br />3.立即数（idata）：直接包含在机器指令中的数据。<br /><br />4.寻址方式总结：见教材164页表格。<br /><br />5.指令要处理的数据有多长&#8212;&#8212;<br />&nbsp; &nbsp; （1）通过寄存器名指明数据尺寸；<br />&nbsp; &nbsp; （2）在没有寄存器名存在的情况下，用操作符X ptr指明内存单元的长度，X在汇编指令中可以为word或byte；<br />&nbsp; &nbsp; （3）其他方法。<br /><br />6.div指令：除法指令<br />&nbsp; &nbsp; （1）除数：有8位和16位两种，在一个reg或内存单元中；<br />&nbsp; &nbsp; （2）被除数：默认放在AX或DX和AX中。如果除数为8位，被除数则为16位，默认放在AX中；如果除数为16位，被除数则为32位，放在DX和AX中， &nbsp; &nbsp; DX存放高16位，AX存放低16位；<br />&nbsp; &nbsp; （3）结果：如果除数为8位，则AL存储除法操作的商，AH存放除法操作的余数；如果除数为16位，则AX存放除法操作的商，DX存放除法操作的余 &nbsp; &nbsp; 数。<br /><br />7.伪指令dd：定义dword类型数据<br />&nbsp; &nbsp; 操作符dup：用来进行数据的重复。<br />&nbsp; &nbsp; &nbsp; &nbsp;例：db 3 dup (0,1,2) 相当于 db 0,1,2,0,1,2,0,1,2<br /><br />实验7 寻址方式在结构化数据访问中的应用<br />&nbsp; &nbsp; 略。<br /><br /><br />今天看了四章书，要加倍努力！<br />END<br />2012年01月03日<img src ="http://www.cppblog.com/longaotx/aggbug/163517.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 23:54 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163517.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第六章 包含多个段的程序 ＆第七章 更灵活的定位内存地址的方法</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163516.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 15:39:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163516.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163516.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163516.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163516.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163516.html</trackback:ping><description><![CDATA[<br />6－1.应该考虑用多个段来存放数据、代码和栈。<br /><br />7－1.and指令：逻辑与指令，按位进行与运算。相应位置0.<br />&nbsp; &nbsp; &nbsp;or指令：逻辑或指令，按位进行或运算。相应位置1.<br /><br />2.小写字母的ASCII码值比大写字母的ASCII码值大20H。<br /><br />3.[bx+idata]表示一个内存单元，偏移地址为(bx)+idata(即bx中的数值加上idata）。<br /><br />4.si和di不能够分成两个8位寄存器来使用。<br /><br />5.[bx+si]和[bx+di]：<br />&nbsp; &nbsp; [bx+si]表示一个内存单元，偏移地址为(bx)+(si).<br /><br />6.[bx+si+idata]和[bx+di+idata]：<br />&nbsp; &nbsp; [bx+si+idata]表示一个内存单元，偏移地址为(bx)+(si)+idata。<br /><br />7.不同寻址方式的灵活应用：<br />&nbsp; &nbsp; （1）[idata]用一个常量表示地址，可用于直接定位一个内存单元；<br />&nbsp; &nbsp; （2）[bx]用一个变量来表示内存地址，用于间接定位一个内存单元；<br />&nbsp; &nbsp; （3）[bx+idata]用一个变量和一个常量表示内存地址，可以在一个起始地址的基础上用变量间接定位一个内存单元；<br />&nbsp; &nbsp; （4）[bx+si]用两个变量表示地址；<br />&nbsp; &nbsp; （5）[bx+si+idata]用两个变量和一个常量表示地址。<br /><br />8.一般来说，在需要暂存数据的时候，我们都应该使用栈。<br /><br />实验6 实践课程中的程序<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月03日<img src ="http://www.cppblog.com/longaotx/aggbug/163516.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 23:39 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163516.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第五章 [BX]和loop指令</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163501.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 11:09:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163501.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163501.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163501.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163501.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163501.html</trackback:ping><description><![CDATA[<br />1.完整描述一个内存单元需要两种信息：<br />&nbsp; &nbsp;a.内存单元的地址；<br />&nbsp; &nbsp;b.内存单元的长度（类型）。<br />2.[bx]表示一个内存单元，它的偏移地址在bx中，段地址在ds中。<br />3.约定：<br />&nbsp; &nbsp;a.描述性符号&#8220;（）&#8221;表示一个寄存器或一个内存单元的内容；<br />&nbsp; &nbsp;b.&#8220;（）&#8221;中的元素类型：寄存器名；段寄存器名；内存单元中的物理地址（一个20位的数据）。<br />&nbsp; &nbsp;c.&#8220;（X）&#8221;表示的数据类型：字节；字。由寄存器名或具体运算决定。<br />&nbsp; &nbsp;d.符号idata表示常量。<br /><br />5.1 [BX]<br />5.2 Loop指令&#8212;&#8212;<br />&nbsp; &nbsp; loop指令格式：loop 标号<br />&nbsp; &nbsp; CPU执行loop指令时，进行两步操作：<br />&nbsp; &nbsp; &nbsp; a.(cx)=(cx)-1;<br />&nbsp; &nbsp; &nbsp; b.判断CX中的值，不为零则转至标号处执行程序，如果为零则向下执行。<br /><br />5.3 在Debug中跟踪用loop指令实现的循环程序<br />5.4 Debug和汇编编译器masm对指令的不同处理<br />5.5 loop的[bx]的联合应用<br />5.6 段前缀<br />5.7 一段安全的空间<br />5.8 段前缀的使用<br /><br />实验4 [bx]和loop的使用<br />&nbsp; &nbsp; 略。<br /><br />END<br />2012年01月03日<img src ="http://www.cppblog.com/longaotx/aggbug/163501.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 19:09 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163501.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第四章 第一个程序</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163500.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 10:57:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163500.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163500.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163500.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163500.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163500.html</trackback:ping><description><![CDATA[<br />本章是实际操作的一章，仅摘录少数要点。<br /><br />1.伪指令由编译器执行。<br />2.segment和ends成对使用，定义一个段。<br />3.一个段必须有一个名称标识，此名称为&#8220;标号&#8221;。<br />4.end标记整个程序的结束。<br />5.assume将有特定用途的段和相关的段寄存器关联起来。<br />6.程序返回指令：<br />&nbsp; &nbsp; mov ax,4c00H<br />&nbsp; &nbsp; int 21H<br /><br />END<br />2012年01月02日<img src ="http://www.cppblog.com/longaotx/aggbug/163500.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 18:57 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163500.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第三章 寄存器（内存访问）</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163498.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 10:52:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163498.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163498.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163498.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163498.html</trackback:ping><description><![CDATA[<br />3.1 内存中字的存储&#8212;&#8212;<br />&nbsp; &nbsp; 字单元：存放一个字型数据（16位）的内存单元，由两个地址连续的内存单元组成。<br /><br />3.2 DS和[address]&#8212;&#8212;<br />&nbsp; &nbsp; 8086CPU不支持将数据直接送入段寄存器的操作。<br />&nbsp;&nbsp;&nbsp;<br />3.3 字的传送<br />3.4 mov/add/sub指令&#8212;&#8212;<br />&nbsp; &nbsp; mov指令形式：<br />&nbsp; &nbsp; mov 寄存器，数据<br />&nbsp; &nbsp; mov 寄存器，寄存器<br />&nbsp; &nbsp; mov 寄存器，内存单元<br />&nbsp; &nbsp; mov 内存单元，寄存器<br />&nbsp; &nbsp; mov 段寄存器，寄存器<br />&nbsp; &nbsp; add指令形式：<br />&nbsp; &nbsp; add 寄存器，数据<br />&nbsp; &nbsp; add 寄存器，寄存器<br />&nbsp; &nbsp; add 寄存器，内存单元<br />&nbsp; &nbsp; add 内存单元，寄存器<br />&nbsp; &nbsp; sub指令形式：<br />&nbsp; &nbsp; sub 寄存器，数据<br />&nbsp; &nbsp; sub 寄存器，寄存器<br />&nbsp; &nbsp; sub 寄存器，内存单元<br />&nbsp; &nbsp; sub 内存单元，寄存器<br /><br />3.5 数据段<br />3.6 栈<br />3.7 CPU提供的栈机制&#8212;&#8212;<br />&nbsp; &nbsp; 8086CPU的入栈和出栈操作都以字为单位进行。<br />&nbsp; &nbsp; SS段寄存器：栈顶的段地址。<br />&nbsp; &nbsp; SP寄存器：偏移地址。<br />&nbsp; &nbsp; 任意时刻：SS:SP指向栈顶元素。<br /><br />3.8 栈顶超界的问题&#8212;&#8212;<br />&nbsp; &nbsp; 8086CPU不保证对栈的操作不会超界。<br /><br />3.9 push/pop指令&#8212;&#8212;<br />&nbsp; &nbsp; push/pop 寄存器/段寄存器/内存单元<br /><br />3.10栈段&#8212;&#8212;<br />&nbsp; &nbsp; 一个栈段的容量最大为64KB。<br /><br />&nbsp; &nbsp; 注：栈是一种非常重要的机制，要深入理解，灵活掌握。需要参照教材认真学习栈。<br /><br />END<br />2012年01月01日<img src ="http://www.cppblog.com/longaotx/aggbug/163498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 18:52 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第二章 寄存器</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163496.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 10:33:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163496.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163496.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163496.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163496.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163496.html</trackback:ping><description><![CDATA[<br />在CPU中：<br />   &nbsp;&nbsp;&nbsp;运算器进行信息处理；<br />   &nbsp;&nbsp;&nbsp;寄存器进行信息存储；<br />   &nbsp;&nbsp;&nbsp;控制器控制各种器件进行工作；<br />   &nbsp;&nbsp;&nbsp;内部总线连接各种器件，在它们之间进行数据传送。<br /><br />8086CPU有14个寄存器：（8086所有寄存器16位）<br />   &nbsp;&nbsp;&nbsp;AX、BX、CX、DX、SI、DI、SP、BP、IP、CS、SS、DS、ES、PSW<br /><br />2.1 通用寄存器&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;通用寄存器：AX、BX、CX、DX；<br />    &nbsp;&nbsp;&nbsp;16位可分两个独立使用的8位寄存器：<br />        &nbsp;&nbsp;&nbsp;AX＝AH＋AL；BX＝BH＋BL；CX＝CH＋CL；DX＝DH＋DL。<br />    &nbsp;&nbsp;&nbsp;AX的低8位构成AL，高8位构成AH寄存器。<br /><br />2.2 字在寄存器中的存储&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;字节：byte，8个bit；<br />    &nbsp;&nbsp;&nbsp;字：两个字节，为高位字节和低位字节。<br /><br />2.3 几个汇编指令&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;写汇编指令或寄存器名称时不分大小写。<br />    &nbsp;&nbsp;&nbsp;数据传送或运算时，指令的两个操作对象的位数应当一致。<br /><br />2.4 物理地址<br />2.5 16位结构的CPU&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;16位结构描述了一个CPU具有的结构特性：<br />        &nbsp;&nbsp;&nbsp;（1）运算器一次最多可以处理16位的数据；<br />        &nbsp;&nbsp;&nbsp;（2）寄存器的最大宽度为16位；<br />        &nbsp;&nbsp;&nbsp;（3）寄存器和运算器之间的通路为16位。<br /><br />2.6 8086CPU给出物理地址的方法&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;地址加法器：物理地址＝段地址*16＋偏移地址；<br />    &nbsp;&nbsp;&nbsp;简捷算法：段地址*16 即 左移4位。<br /><br />2.7 &#8220;段地址*16＋偏移地址＝物理地址&#8221;的本质含义&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;本质含义：CPU在访问内存时，用一个基础地址（段地址*16）和一个相对于基础地址的偏移地址相加，给出     内存单元的物理地址。<br />    &nbsp;&nbsp;&nbsp;基础地址＋偏移地址＝物理地址。<br /><br />2.8 段的概念&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;段地址*16：定位段的起始地址（基础地址）。<br />    &nbsp;&nbsp;&nbsp;偏移地址：定位段中的内存单元。<br />    &nbsp;&nbsp;&nbsp;一个段的最大长度为64KB。<br /><br />2.9 段寄存器&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;8086CPU有4个段寄存器：CS、DS、SS、ES。<br /><br />2.10CS和IP&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;CS：代码段寄存器。<br />    &nbsp;&nbsp;&nbsp;IP：指令指针寄存器。<br />    &nbsp;&nbsp;&nbsp;8086机中，任意时刻，CPU将CS：IP指向的内容当作指令执行。<br /><br />2.11修改CS、IP的指令&#8212;&#8212;<br />    &nbsp;&nbsp;&nbsp;jmp指令：jmp 段地址：偏移地址<br />    &nbsp;&nbsp;&nbsp;用指令中给出的段地址修改CS，偏移地址修改IP。<br />    &nbsp;&nbsp;&nbsp;&#8220;jmp 某一合法寄存器&#8221;：用寄存器中的值修改IP。<br /><br />2.12代码段<br /><br />实验1 查看CPU和内存，用机器指令和汇编指令编程<br />&nbsp;&nbsp;&nbsp;略。<br /><br />END<br />2012年01月01日<img src ="http://www.cppblog.com/longaotx/aggbug/163496.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 18:33 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163496.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汇编语言学习笔记——第一章 基础知识</title><link>http://www.cppblog.com/longaotx/archive/2012/01/03/163495.html</link><dc:creator>龙傲天下</dc:creator><author>龙傲天下</author><pubDate>Tue, 03 Jan 2012 10:30:00 GMT</pubDate><guid>http://www.cppblog.com/longaotx/archive/2012/01/03/163495.html</guid><wfw:comment>http://www.cppblog.com/longaotx/comments/163495.html</wfw:comment><comments>http://www.cppblog.com/longaotx/archive/2012/01/03/163495.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/longaotx/comments/commentRss/163495.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/longaotx/services/trackbacks/163495.html</trackback:ping><description><![CDATA[学习教材：《汇编语言（第2版）》，王爽，清华大学出版社<br /><br />第一章 基础知识<br /><br />1.1机器语言<br />1.2汇编语言的产生<br />1.3汇编语言的组成&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;（1）汇编指令：机器码的助记符，有对应的机器码；<br />   &nbsp;&nbsp;&nbsp;（2）伪指令：无对应的机器码，由编译器执行；<br />   &nbsp;&nbsp;&nbsp;（3）其他符号：如＋、－、*、/等，由编译器识别，无对应的机器码。<br />   &nbsp;&nbsp;&nbsp;汇编语言的核心：汇编指令。它决定了汇编语言的特性。<br /><br />1.4存储器<br />1.5指令和数据&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;指令和数据是应用上的概念。存储时无区别，二进制。<br /><br />1.6存储单元&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;1Byte=8bit;<br />   &nbsp;&nbsp;&nbsp;微机存储器：1存储单元＝1Byte=8bit;1存储器＝128存储单元＝128Byte<br />   &nbsp;&nbsp;&nbsp;微机存储器的容量以字节为最小单位计算。<br /><br />1.7CPU对存储器的读写&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;CPU进行数据读写的3类信息交换：<br />      &nbsp;&nbsp;&nbsp;（1）存储单元的地址（地址信息）；<br />      &nbsp;&nbsp;&nbsp;（2）器件的选择，读或写的命令（控制信息）；<br />      &nbsp;&nbsp;&nbsp;（3）读或写的数据（数据信息）；<br />   &nbsp;&nbsp;&nbsp;总线的逻辑分类：地址总线、控制总线、数据总线。<br /><br />1.8地址总线&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;CPU地址总线宽度＝地址线根数N。这样的CPU最多可以寻找2的N次方个内存单元。<br /><br />1.9数据总线&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;数据总线的宽度决定了CPU的外界的数据传送速度。<br />   &nbsp;&nbsp;&nbsp;8088CPU的数据总线宽度为8，8086的数据总线宽度为16。<br />      &nbsp;&nbsp;&nbsp;例：传送数据89D8H：8088两次传送，8086一次传送。<br /><br />1.10控制总线&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;控制总线是不同控制线的集合。<br />   &nbsp;&nbsp;&nbsp;控制总线宽度决定了CPU对外部器件的控制能力。<br /><br />1.11内存地址空间（概述）<br />1.12主板<br />1.13接口卡<br />1.14各类存储器芯片<br />1.15内存地址空间&#8212;&#8212;<br />   &nbsp;&nbsp;&nbsp;内存地址空间的大小受CPU地址总线宽度的限制。<br />   &nbsp;&nbsp;&nbsp;8086CPU的地址总线宽度为20，内存地址空间大小为1MB；80386CPU地址总线宽度为32，内存地址空间最大为4GB。<br /><br />END<br />2012年01月01日<img src ="http://www.cppblog.com/longaotx/aggbug/163495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/longaotx/" target="_blank">龙傲天下</a> 2012-01-03 18:30 <a href="http://www.cppblog.com/longaotx/archive/2012/01/03/163495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>