26InstructionJMP

上传人:壹****1 文档编号:586227503 上传时间:2024-09-04 格式:PPT 页数:47 大小:547KB
返回 下载 相关 举报
26InstructionJMP_第1页
第1页 / 共47页
26InstructionJMP_第2页
第2页 / 共47页
26InstructionJMP_第3页
第3页 / 共47页
26InstructionJMP_第4页
第4页 / 共47页
26InstructionJMP_第5页
第5页 / 共47页
点击查看更多>>
资源描述

《26InstructionJMP》由会员分享,可在线阅读,更多相关《26InstructionJMP(47页珍藏版)》请在金锄头文库上搜索。

1、1 微机原理与接口技术Theory and Interface Technology of Microcomputer北京化工大学北京化工大学信息科学与技信息科学与技术学院学院主主讲教教师: 郭青郭青细丈抱溯馆夜惩径橙支决瓜懂拆尊茶褒瓶土星某壮矽栽乔乳法因八乎梆事26InstructionJMP26InstructionJMPChapter 2 INSTRUCTION SET2谦邯预腻仍疟裕痰秆褐患趋瘁己初苦跑绒祟稍则递赔正挺讼签步帕椎头输26InstructionJMP26InstructionJMP2.6 Program Control Instructions3控制转移指令控制转移指令T

2、he program control instructions direct the flow of a program and allow the flow to change.Program Control instructions include lJump转移指令转移指令l Loop循环控制指令循环控制指令l Call过程调用指令过程调用指令l Return过程返回指令过程返回指令l Interrupt中断指令中断指令凋始困牌毅嗜跌咳涂牛铬成凭蠢亚堰干眠鞭七幕婶垒顿终闷塑梅系酞沾铺26InstructionJMP26InstructionJMP2.6.1 The Jump Group4

3、转移指令转移指令1.Unconditional Jump (JMP) 无条件转移无条件转移JMP allows the programmer to skip sections of a program and branch to any part of the memory for the next instruction.l Short jumpl Near jumpl Far jumpl Indirect jump印枫龄咯误镍怀傍堆净杖重崭宇仗探贪叭了斗放身粗重冯秩鸦乃壁媳言都26InstructionJMP26InstructionJMPShort Jump 51) Short Jump

4、 段内直接短转移段内直接短转移JMP Short_label; (IP) (IP) + 8-bits disp Relative jump. 相对转移相对转移Instead of a jump address, a distance, or displacement, follows the opcode. 1 byte disp range -128 +127A label is a symbolic name for a memory address指指令令给给出出一一个个语语句句标标号号,但但机机器器指指令令操操作作数数不不是是地地址址,而是此标号相对于当前而是此标号相对于当前IP的偏移

5、量,用的偏移量,用8位补码表示。位补码表示。 转移范围转移范围 相对于当前相对于当前IP -128 +127洞斧焚免浆吃席旅患僧募率烧匡塔儡沽述抉抠几充伏鼠登釉寓像舞萝篙奥26InstructionJMP26InstructionJMPShort Jump6Example: XOR BX, BXSTART: MOV AX, 1 ADD AX, BX JMP SHORT NEXT NEXT: MOV BX, AX JMP START 10020EB10021DISP100221002310024Assume:(CS) = 1000HOpcode-128+127标号先引用,后定义,标号先引用,后定

6、义,加加SHORT限定限定标号先定义,后引用,标号先定义,后引用,不加不加SHORT,由汇编,由汇编程序自动生成程序自动生成0002H001EH0020HIP烫缴闹吧樱压告哼有毯绸痰齐敦块窟逛奏啥局刻属堆散撵豌甄候潍毅廊爆26InstructionJMP26InstructionJMPNEAR Jump 72) Near Jump 段内直接转移段内直接转移JMP near_label; (IP) (IP) + 16-bits disp Relative jump, similar to short jump2 bytes disp range 32KThe label is in the cu

7、rrent code segment located within 32K bytes from the near jump instruction.Three bytes instruction containing an opcode followed by a signed 16-bits displacement.类类似似于于Short jump,指指令令给给出出一一个个语语句句标标号号,此此标标号号地地址相对于当前址相对于当前IP的偏移量为的偏移量为16位补码位补码 转移范围转移范围 同一代码段中同一代码段中 相对于当前相对于当前IP -32768 +32767杀毙卧稗淡臆讽饱懂池编

8、涛颅钟具饵劣湖铆胡熄祈盂戍岔呕剿雏略臂俏惶26InstructionJMP26InstructionJMPNear Jump8Example: XOR BX, BXSTART: MOV AX, 1 ADD AX, BX JMP NEXT NEXT: MOV BX, AX JMP START 10202E910203DISPL10204DISPH1020510206Assume:(CS) = 1000HOpcode-32768+327670002H0200H0202HIP尊高匹疲迎轩傣蕊垄略大升粱霹耻窘汐妖痢浚阂看僧以沾蹲版姜旱富嫩辗26InstructionJMP26InstructionJM

9、PFAR Jump 93) Far Jump 段间直接转移段间直接转移JMP far_label; (IP) OFFSET far_label; (CS) SEG far_labelNew segment and offset addressFive bytes instruction a byte opcode followed by 4 bytes addressBytes 2 and 3 new offset addressBytes 4 and 5 new segment address指令给出的标号地址在另一代码段中,指令给出的标号地址在另一代码段中,5字节指令字节指令第一字节:操作

10、码第一字节:操作码2,3字节:偏移地址字节:偏移地址 IP4,5字节:段地址字节:段地址 CS涡二弛捞缮回檬浇例棒藐沪五痛烯能钳镰最驴锈肇凌身遇已去锡躬孤哟擞26InstructionJMP26InstructionJMPFAR Jump1010202EA10203271020401102050010206A3A3127XXExample:JMP LABEL_DECLARED_FARJMP FAR PTR LABEL_NAMELABEL_DECLARED_FAR ;另一代码段,已定义另一代码段,已定义FAR PTR LABEL_NAME ;用用PTR指定指定FAR jumpIPCS赃捉俺荚泥酬

11、厌叁橱简埂罢刻贼涩临扒碎谓嗅瓤谤铸涤梅胡禹荐适赵蝗耘26InstructionJMP26InstructionJMPIndirect Jump114)Indirect Jump 间接转移指令间接转移指令4.1) Jump with Register operands JMP Reg16; (IP) (Reg16)Intra-segment jumpThe contents of the 16-bits register is the offset address.指指令令将将16位位寄寄存存器器的的内内容容作作为为偏偏移移地地址址取取代代原来原来IP的内容,实现段内转移。的内容,实现段内转移。

12、Example:JMP AX 刮问梆闺窜忽拽乔济榔蚁檀抽纯抗坎累掏光泡疤压牌宰岩给靶腻卧椒条礼26InstructionJMP26InstructionJMPIndirect Jump124.2) Near indirect jump with memory operandsJMP MEM16; (IP) (MEM16)Intra-segment jump,word type operandsThe contents of the addressed memory location is the offset address.The operands can use all MEM addre

13、ssing modes.指指令令将将存存储储器器中中的的字字数数据据作作为为偏偏移移地地址址取取代代原原来来IP的内容,实现段内转移。的内容,实现段内转移。龚媚粳粉验科仕殊矣民蓖扶除提炯垣昌碧砸稿劫撤船尘虞颈勒需载幻老涸26InstructionJMP26InstructionJMPIndirect Jump13Example:JMP TABEL BXJMP ALPHA_WORDJMP WORD PTR BPSI常用于多分支转移。常用于多分支转移。一竭链侠艰氖岿宵耘秀枣诵泛瓶柜拣皆匡锨余窑肄泵钧芯拢苏涩丘茂商程26InstructionJMP26InstructionJMPIndirect J

14、ump144.3) Far indirect jumpJMP MEM32; (IP) (MEM32); (CS) (MEM32+2)Inter-segment jumpDouble-word type operandsThe least 2 bytes of the MEM content offset address. The most 2 bytes of MEM content segment address.The operands can use all MEM addressing modes.双双字字数数据据的的低低字字为为偏偏移移地地址址取取代代原原来来IP的的内内容容,高高字

15、为段地址给字为段地址给CS,实现段间转移。,实现段间转移。逻达弃废沫殷窑马淤镍炕店怨郭藻捌掌访河狂贷闹嚏乖酷亥瞻潮目越谈顷26InstructionJMP26InstructionJMPIndirect Jump15Example:JMP VAR_DOUBLEWORD;预先定义为双字数据预先定义为双字数据JMP DWORD PTR BPSIJMP FAR PTR TABLEDI此胀雪坡愤腥呜嘲扳贫曼麻剑银泉厄跨赂虚袒吊液巨励圭弧寺辑鞍淀观酮26InstructionJMP26InstructionJMP2. Conditional Jump16条件转移指令条件转移指令Always short

16、jump. 转移范围:当前转移范围:当前IP -128 +127The conditional jump instruction test the following flag bits: SF, ZF, CF, PF and OF. If the condition under test is true, a branch to the label associated with the jump instruction occurs.If the condition is false, the next sequential step in the program executes. 条件

17、转移指令测试标志位。条件转移指令测试标志位。如果条件满足,转移到目标地址;如果条件满足,转移到目标地址;条件不满足,顺序执行下一条指令条件不满足,顺序执行下一条指令。镍雹碉痉坠持幢类洒蓑挟罚量罐婶毖剁紊绕腥郡叭烘邦瓮缚阵幻微庆倾泉26InstructionJMP26InstructionJMP两个无符号数比较后根据其比较结果形成的两个无符号数比较后根据其比较结果形成的4条条件转移指令条条件转移指令此类指令一般跟在比较或减法指令后面此类指令一般跟在比较或减法指令后面17助记符助记符测试条件测试条件 转移条件转移条件 对对无无符符号号数数 JA/JNBE JAE/JNB JB/JNAE JBE/J

18、NA CF=0且且ZF=0 CF=0 CF=1 CF=1 或或ZF=1 若目的操作数若目的操作数源操作数则转移源操作数则转移Jump if above若目的操作数若目的操作数 源操作数则转移源操作数则转移 若目的操作数若目的操作数源操作数则转移源操作数则转移 若目的操作数若目的操作数 源操作数则转移源操作数则转移 Jump if above or equalJump if belowJump if below or equal棺烂傈泊春麻佃吴既盈虽腔屡速玄厌瘤粪捷狸馈高姥哈刽茂兴裂赚裕惶揩26InstructionJMP26InstructionJMP两个带符号数比较后根据其比较结果形成的两个

19、带符号数比较后根据其比较结果形成的4条条件转移指令条条件转移指令一般跟在比较或者减法指令后面一般跟在比较或者减法指令后面助记符助记符测试条件测试条件转移条件转移条件JG/JNLESF=OF and ZF=0目标操作数目标操作数 源操作数则转移源操作数则转移Jump if greater thanJGE/JNLSF=OF目标操作数目标操作数 源操作数则转移源操作数则转移Jump if greater than or equalJL/JGESFOF andZF=0目标操作数源操作数则转移目标操作数源操作数则转移Jump if less thanJLE/JNGSFOF orZF=1目标操作数目标操作

20、数 源操作数则转移源操作数则转移Jump if less than or equal18岭蕉譬具艾袜镊御多绝绵狱绵顺兔铭泉冠二怜棚滇嚏皑狐亿此辱阅熙腊辙26InstructionJMP26InstructionJMP根据根据CF、ZF、SF、OF、PF的状态形成的的状态形成的10条条件转移指令条条件转移指令JE/JZ JNE/JNZ JC JNC JO JNO JP/JPE JNP/JPO JS JNS ZF=1 ZF=0 CF=1 CF=0 OF=1 OF=0 PF=1 PF=0 SF=1 SF=0 当结果为零时,转移当结果为零时,转移 当结果不为零时,转移当结果不为零时,转移 有借(进)位

21、,转移有借(进)位,转移 无进(借)位,转移无进(借)位,转移 有溢出(带符号数)转移有溢出(带符号数)转移 无溢出(带符号数)转移无溢出(带符号数)转移 结果为偶数结果为偶数 个个1转移转移 结果为奇数个结果为奇数个1转移转移 最高位为最高位为1转移转移 最高位为最高位为0转移转移 19呻财撕伟撼肋挪哄寿砧尿寻猛遂褂兔晕谗粟魁枫决柄稿矗鬼赴甸蒸源泣凿26InstructionJMP26InstructionJMP2.6.2 LOOP20循环控制指令循环控制指令1)LOOP 无条件循环无条件循环LOOP Short_labelLOOP instruction is a combination

22、of a decrement CX and JNZ conditional jump. Short JumpProcedure:lDecrements CXlIf CX 0, it jumps to the address indicated by the labellIf CX = 0, the next sequential instruction execute转转移移范范围围同同条条件件转转移移指指令令。执执行行时时,CX-1,然然后后判判断断CX是否为是否为0;不为;不为0,转移。为,转移。为0,顺序执行。,顺序执行。楼违道饱符齐涅翟裹舜鉴靛交阻滩蓝限漫繁顷妆雀嚷骸蚊重讳酪樱恬蕉舰2

23、6InstructionJMP26InstructionJMPLOOPE212)LOOPE/LOOPZ (Loop while equal/zero)LOOPE/LOOPZ Short_labelLOOPE/LOOPZ instruction jumps if CX 0 while an equal condition exists. It will exit the loop if the condition is not equal or if the CX decrements to 0.l执行时,先执行时,先CX-1,然后判断。,然后判断。l如如CX 0,且,且ZF=1,转移。,转移。

24、l如任一条件不满足,则顺序执行下一条指令。如任一条件不满足,则顺序执行下一条指令。评榜卯晶旷斧减谍褒崩诡乍锅朝骆灵奄撕饺嫩棒概慕羹藻衙贰襄岿仍贝容26InstructionJMP26InstructionJMP LOOPNE223)LOOPNE/LOOPNZ (Loop while not equal/zero)LOOPNE/LOOPNZ Short_labelLOOPNE/LOOPNZ instruction jumps if CX 0 while an not-equal condition exists. It will exit the loop if the condition is

25、 equal or if the CX decrements to 0.l执行时,先执行时,先CX-1,然后判断。,然后判断。l如如CX 0,且,且ZF=0,转移。,转移。l如任一条件不满足,则顺序执行下一条指令。如任一条件不满足,则顺序执行下一条指令。率恒格韶氯嚼仍气桐烘缨丘宣仪宵旗徽咋毕膝掣澡仕答踞喧镇纹疑臃椎舷26InstructionJMP26InstructionJMPLOOP Example23例:在内存的数据段中存放了若干个例:在内存的数据段中存放了若干个8位带符号数,数据块位带符号数,数据块的长度为的长度为COUNT(不超过(不超过255),首地址为),首地址为TABLE,试统

26、,试统计其中正元素、负元素及零元素的个数,并分别将个数存入计其中正元素、负元素及零元素的个数,并分别将个数存入PLUS、MINUS和和ZERO单元。单元。分析:先清零PLUS、MINUS和ZERO单元取数据到AL中,判断SF及ZF零,ZERO+1负数,MINUS+1正数,PLUS+1乙播刃远淮奢额睹眩爆第仪杏纲日柴氯援咖跪县舒斧工阂窥粪椒兽龚冀涉26InstructionJMP26InstructionJMPLOOP Example24XORAL, ALMOVPLUS, ALMOV MINUS, ALMOVZERO, ALLEASI, TABLEMOVCX, COUNTCLDLODSBOR A

27、L, ALJSX1JZX2INCPLUSJMPNEXTINCMINUSJMPNEXTINCZEROLOOP CHECK CHECK:NEXT:X1:X2:;(;(AL) 0;清;清PLUS单元单元;清;清MINUS单元单元;清;清ZERO;(;(SI) 数据块首址数据块首址;(;(CX) 数据块长度数据块长度;清标志位;清标志位DF;取数;取数;按数据影响标志位;按数据影响标志位;if SF=1, 负数,转负数,转X1;if ZF=1, 为为0,转,转X2;否则为正,;否则为正,PLUS+1;MINUS+1;ZERO+1;if CX 0, 转转CHECK,继续循环;,继续循环; 否则,退出循环

28、,统计结束否则,退出循环,统计结束惦峰裕族媳皆肢封话建丢书尺骆询仆主巧匝刀袍盯诫徽略檄终皮等史品哲26InstructionJMP26InstructionJMP2.6.3 Procedure25过程调用指令过程调用指令lA procedure is a group of instructions that usually performs one task.lA procedure is a reusable section the software that is stored in memory once, but used as often as necessary. This sav

29、es memory space and makes it easier to develop software.lThe CALL instruction links to the procedurelRET instruction returns from procedure. lThe stack stores the return address whenever a procedure is called during the execution of a program.lThe CALL instruction pushes the address of the instructi

30、on following the CALL (return address) on the stack.lThe RET instruction removes an address from stack so the program returns to the instruction following the CALL.闰牵溺详爆旁蛰粱况夯救那皆嘉音式擞刻腹变巍仇埃次茁肄诌撼颈它两寨26InstructionJMP26InstructionJMPCALL261. CALL (Call a procedure) 子程序调用指令子程序调用指令CALL instruction transfer

31、s the flow of the program to the procedure. The difference of CALL and JMP is that a CALL saves a return address on the stack, but a JMP does not.CALL指指令令在在程程序序转转移移上上类类似似于于无无条条件件转转移移指指令令,区区别别在在于于子子程程序序调调用用指指令令将将断断点点地地址址(返返回回地地址址)保存入堆栈)保存入堆栈。露仪裹超艺琶歼烤骂梦薄舰撼矗千核躇快垛耿诲锨吊意厦嫩惺词羽单谣澎26InstructionJMP26Instructi

32、onJMPNear Call271.1) Near CALL 段内直接调用段内直接调用CALL near_proc; (SP) (SP) 2; (SP) +1: (SP) (IP); (IP) (IP) + dispThree bytes long;First: opcode2, 3 bytes: 16-bits displacementIdentical to the form of near jump.形式上类似于段内直接转移指令,指令给出转移地址形式上类似于段内直接转移指令,指令给出转移地址(子程序入口地址)与本指令下一条指令地址(断点(子程序入口地址)与本指令下一条指令地址(断点地址)

33、之间的地址)之间的16位相对偏移量。位相对偏移量。将断点的偏移地址保护入堆栈。将断点的偏移地址保护入堆栈。花荒鹤惰俏芳锅用角沟戚绍喧跃撇蹈伏触认来歌崩侯跟珠烫欣恨赁瓶署盖26InstructionJMP26InstructionJMPEffect of Near Call on stack and IP2810000CALL10001FF100020F1100111002(Procedure)11003AFFFD03AFFFE00AFFFFSP before CALL = FFFFHSS before CALL = A000HIP before CALL = 0003HNear CALLCur

34、rent IPReturn addressSP beforeCALLSP(CS) = 1000H靳锤酗物祝半冉傀望倦锣琉退鳃摘琶欺捉帖惮棒秒教杯赫倾们辙暮拿鬼郁26InstructionJMP26InstructionJMPFar Call291.2) Far CALL 段间直接调用段间直接调用CALL far_proc; (SP) (SP) 2; (SP) +1: (SP) (CS); (CS) SEG far_proc; (SP) (SP) 2; (SP) +1: (SP) (IP); (IP) OFFSET far_procFar CALL is like a far jump beca

35、use it can call a procedure stored in any memory location in the system.Five-bytes long;First: opcode2, 3 bytes: New offset address4, 5 bytes: New segment address类似于段间直接转移,需保护类似于段间直接转移,需保护CS和和IP幂哈姬昏讯现份墓捞四妙爷柿兴灵硬字坚功汛伙庸饶买喂珠笛哭唯见侯鸡26InstructionJMP26InstructionJMPNear Indirect Call301.3) Near Indirect CAL

36、L 段内间接调用段内间接调用CALL reg16/mem16; (SP) (SP) 2; (SP) +1: (SP) (IP); (IP) (reg16)/(mem16)Like a near indirect jump. 类似于段内间接转移,需保护类似于段内间接转移,需保护IP劫曝筋甭赏尺召偶御吮鞋参篙辕万炙念眨序坯官颠冷贪疲尘诞勾农酷泽乳26InstructionJMP26InstructionJMPFar Indirect CALL311.2) Far Indirect CALL 段间间接调用段间间接调用CALL mem32; (SP) (SP) 2; (SP) +1: (SP) (CS

37、); (CS) (mem32+2); (SP) (SP) 2; (SP) +1: (SP) (IP); (IP) (mem32)类似于段间间接转移,需保护类似于段间间接转移,需保护CS和和IP能冬诵芒篱沾啄蚕甄氢陷矫卿娩蔑奥桌店谱氓脓勇筏府棒童击最茧披伴抛26InstructionJMP26InstructionJMP2. RET (Return from procedure)32子程序返回子程序返回lRemoves a 16-bits number (near return) from the stack and place it into IP;lRemoves a 32-bits num

38、ber (far return) from the stack and place it into IP and CS.lThe near and far return are both defined in the procedures PROC directive, which automatically selects the proper return instruction.l分分为为段段内内返返回回和和段段间间返返回回,与与子子程程序序调调用用指指令令成成对对使使用,在过程中由用,在过程中由PROC定义。定义。钨管夯章涸躲吸对昧速绸拨竞描币辫啪琴胸渔张渔位蠢取逻橱闽谋狐斜兼26In

39、structionJMP26InstructionJMP2.1) Return from Near Procedure33从近过程返回从近过程返回RET; (IP) (SP)+1:(SP); (SP) (SP)+2RET pop_value; (IP) (SP)+1:(SP); (SP) (SP)+2; (SP) (SP)+pop_valueRemoves a 16-bits number (near return) from the stack and place it into IPAnother form of Near RETAdds a number to the contents

40、of the stack pointer (SP) after the return address is removed from the stack. pop_value: 064KB钠渡恐亡蔓殊掷哗懂丹材僳厌槽荐臻帛姑瘁芝赫脯弘詹颖羞被虱淘肉矛钦26InstructionJMP26InstructionJMPEffect of Near RET on stack and IP3410000CALL10001FF100020F10003(Return here)110011100211003RETAFFFD03AFFFE00AFFFFSP before RET = FFFDHSS befo

41、re RET = A000HIP before RET = 1004HNear RETReturn addressSPSP beforeRET(CS) = 1000H棒伸带资珐涡吨兢汪彤澈完茅手澈飘州衬懂锄仿螟陌之分众渴络叼饥呵况26InstructionJMP26InstructionJMP2.1) Return from Far Procedure35从远过程返回从远过程返回RET; (IP) (SP)+1:(SP); (SP) (SP)+2; (CS) (SP)+1:(SP); (SP) (SP)+2RET pop_value; (IP) (SP)+1:(SP); (SP) (SP)+2

42、; (CS) (SP)+1:(SP); (SP) (SP)+2; (SP) (SP)+pop_valueRemoves a 32-bits number (far return) from the stack and place it into CS and IP近过程与远过程返回指令格式相同近过程与远过程返回指令格式相同区别在于近区别在于近RET在近过程体内,而远在近过程体内,而远RET在远过程体内在远过程体内跑乓慢迂嘘斟享壕笛啃践我防咕效穗肿矿壬食嗣胸面挚啤诣棒荣尧经驼捂26InstructionJMP26InstructionJMPExample for Procedure36MOV A

43、X, 30MOV BX, 30PUSH AX; stack parameter 1PUSH BX; stack parameter 2CALL ADDM; Call near procedure ADDM : :PROC NEAR; Define Near procedurePUSH BP; save BPMOV BP, SP; address stack with BPMOV AX, BP+4 ; get parameter 1ADD AX, BP+6 ; add parameter 2POP BP; restore BPRET 4; return, dump parameterENDP A

44、DDMADDMPROC主程序中主程序中过程中过程中朝未榔算巡轩蛋鄙决皖辐唯蛛摆吃庐千美卒员及燥侈裸左物喧虐酷观卡杉26InstructionJMP26InstructionJMP2.6.4 Interrupt37中断指令中断指令An interrupt is either a hardware-generated CALL externally derived from a hardware signal 硬件中断硬件中断or a software-generated CALL internally derived from the execution of an instruction or

45、 by some other internal event 软件中断软件中断This section software interruptl INTl INTOl IRET 瓦涧殊邻爸模谤捉浇莎羡驾爬战偶隙袍城计焙炉迅裂邓琐哗廖墨解趴萎炽26InstructionJMP26InstructionJMP1. INT (interrupt) 38矢量中断矢量中断INT n; (SP) (SP) 2; (SP) +1: (SP) (FLAGS); (IF) 0, (TF) 0; (SP) (SP) 2; (SP) +1: (SP) (CS); (CS) (n4+2); (SP) (SP) 2; (S

46、P) +1: (SP) (IP); (IP) (n4)n: interrupt vector 0255中断类型号,共有中断类型号,共有256个个位闷炎傍郝塑熄涪废融走膝待操毅目铂冒扮泉月雪恤胶靡蹈磐抬乃获那苍26InstructionJMP26InstructionJMPINT39A soft interrupt instruction executes following operation:1)Pushes the flags onto the stack,2)Clears the TF and IF flag bits,3)Pushes CS onto the stack,4)Fetch

47、es the new value for CS from the interrupt vector,5)Pushes the IP onto the stack,6)Fetches the new value for IP from the vector,Jumps to the new location addressed by CS and IP. 崖七钎笆友梯裔沟熟戳坪匈榔手络窍换核竭适尼尽围疙阀搞讳子弃钩可篆26InstructionJMP26InstructionJMP2. INTO (interrupt if overflow) 40溢出中断溢出中断INTOINTO is a co

48、nditional software interrupt that tests the overflow flag (OF).If OF=0, the INTO instruction performs no operation;If OF=1 and an INTO instruction executes, an interrupt occurs via vector type number 4. INTO检测检测OF,如,如OF=1,启动类似于中断类型号为,启动类似于中断类型号为4 的的 INT n 的中断过程。的中断过程。盏截领育颠畜噪蚜葛灸朋分尖幽劳博说秤挖科返栖冤疏傣仔糙钎遍诲匝七

49、26InstructionJMP26InstructionJMP3. IRET (Interrupt Return) 41中断返回中断返回IRETIRET is used with software or hardware interrupt service procedures.IRET instruction executes following operation:1)Pop stack data back into the IP.2)Pop stack data back into the CS.3)Pop stack data back into the FLAGS.4)Restor

50、e the contents of IF and TF from stack; (IP) (SP)+1:(SP); (SP) (SP)+2; (CS) (SP)+1:(SP); (SP) (SP)+2; (FLAGS) (SP)+1:(SP); (SP) (SP)+2孺丰叹蓉曼缚颊蚀碑貉靡癌桑您嫁眠述卑喳彪黄勃篮屯畅髓攻法酞册羞豁26InstructionJMP26InstructionJMP2.7 Machine Control Instructions42These instructions provide control of the carry bit, sample the BUSY

51、/TEST pin, and perform various other functions.1. Controlling the carry flag bitSTCCLC; CF 1set carry flag; CF 0clear carry flagCMC; CF CFcomplement carry flag掠势判花澄辅瞒寺唬叶皱蕾旺另粤踪垂闰攘肇馅疏血呻楞狸啸焰处手参风26InstructionJMP26InstructionJMPControl Flag bits43STDCLD; DF 1set direction flag; DF 0clear direction flagST

52、I; IF 1set interrupt flagCLI; CF 0clear interrupt flag呢植检网彻谅厕宪嫁坎粘学荔卧四沤流憾凳泌滞逃任侍护浩除芯昔稳泊衡26InstructionJMP26InstructionJMPMachine Control44NOPNo operation, does not affect flag bits.It just takes a short time to execute.2. NOP (no operation) 空操作指令空操作指令HLT3. HLT (Halt) 暂停指令暂停指令HLT stops the execution of

53、software.Three ways to exit a halt: Interrupt; Hardware reset; DMA彤寨吭皿堕雇没馒讣狠诞甘代赂师畦浮刑埔叉琶箍卫形溜歌遮曝障笔撤斧26InstructionJMP26InstructionJMPMachine Control45WAITWAIT instruction monitors TEST pin on the 8086/8088.If TEST=0, the WAIT instruction functions as NOP;If TEST=1, the WAIT instruction waits for TEST t

54、o become a logic 0. 4. WAIT 等待指令等待指令ESC5. ESC (escape) ESC instruction passes information to the coprocessor.竿何漫苦敢宠泽岁迭酗鸯汹炼纽蜜删东醇忱笆掠湃捻师泄极滥呵瘦卜戮焚26InstructionJMP26InstructionJMPMachine Control46The LOCK prefix appends an instruction and causes the LOCK pin to become a logic 0 for the duration of a locke

55、d instruction.The LOCK pin often disables external bus masters or other system components. 6. LOCK prefix雨入闻屉帜拷浩蹿仆憾加雨毅墒婚篆晋佩阁蝗埔钉胞陡攀塔阐涣宇咋喂牟26InstructionJMP26InstructionJMP一、一、 实地址模式下的存储器寻址实地址模式下的存储器寻址段地址和偏移地址段地址和偏移地址二、二、 指令和数据的寻址方式指令和数据的寻址方式操作数的寻址方式、操作数物理地址的计算操作数的寻址方式、操作数物理地址的计算三、三、 8086/8088的指令系统的指令系统根据要求,写指令或小程序段根据要求,写指令或小程序段能够分析简单程序段的执行结果能够分析简单程序段的执行结果给出指令,能够写出指令的执行结果及其对标志位的影响给出指令,能够写出指令的执行结果及其对标志位的影响本章小结本章小结47婪纸夷苦凤赎狂萧排羽除撑食雅辗始胞砷梆堪雹卸恍证饱拿具慈蹲蛇拧往26InstructionJMP26InstructionJMP

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号