版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Chapter 6 Program control instructions,6-1 the JUMP group 6-2 Controlling the Flow of an assembly language program 6-3 procedures 6-4 introduction to interrupts 6-5 machine control and miscellaneous instructions,6-1The JUMP group,Unconditional jump (JMP) Short jump 1000:0100 JMP 0105 8-bit displacem
2、ent Distance for jump : -128127 Near jump 1000:0100 JMP NEAR 0105 jump within current segment 16-bit /32-bit displacement for 8086/80386 Distance for jump:32K/2G Far jump 1000:0100 JMP FAR 2000:0000 Jump to any location segment : offset address contained in the instructions,6-1The JUMP group,Uncondi
3、tional jump Jump with register operands JMP AX Indirect jump JMP SI JMP BX+100H,6-1The JUMP group,Conditional jumps and conditional sets Above or below For comparing unsigned numbers Carry is tested Greater or less For comparing signed numbers Sign flags is tested,Conditional jump,Example for condit
4、ional jump,MOV AX,1234H MOV BX,1000H CMP AX,BX JG IF_GREATER MOV CX,1 JMP NEXT_1 IF_GREATER:MOV CX,0 NEXT_1: RET,AX=1234H BX=1000H If AXBX CX=0 Else CX=1,6-1The JUMP group,Loop CX is decremented Jumps to the address indicated if CX0 Example: for (CX=10;CX=0;CX-) MOV CX,10; Label1: NOP LOOP Label1 NO
5、P is executed by 10 times.,Loop Loop Loopw Loopd Conditional loop LOOPE loop while equal LOOPNE loop while not equal,6-3 Procedures,Example 6-16 SUMS PROC NEAR ADD AX,BX ADD AX,CX ADD AX,DX RET SUMS ENDP SUMS1 PROC FAR ADD AX,BX ADD AX,CX ADD AX,DX RET SUMS1ENDP,6-3 Procedures,Call instruction Near
6、call Operation Push the offset for next instruction into the stack Add the displacement to IP Call procedures within the segment (32K) Far call Operation Push the segment & offset address for next instruction into the stack Replace CS & IP with segment & offset following the CALL opcode. Call proced
7、ures within the memory space,Call a procedure,Main program,procedure,Stack,CALL 2000H,RET,CS:1003H,CS:2000H,CS:1000H,10H 03H,2000H,IP,Calling,Main program,procedure,Stack,CALL 2000H,RET,CS:1003H,CS:2000H,CS:1000H,10H 03H,1003H,IP,CS:2100H,Returning,Figure 6-6 the effect of the near call on the stack
8、 and the instruction pointer,SP before CALL =FFFF SS before CALL =A000 IP before CALL =0003 CS=1000,Figure 6-7 the effect of a far CALL instruction,SP before CALL =FFFF SS before CALL =A000 IP before CALL =0005 CS=1000,CALL with register operand CALL BX CALL with indirect Memory Address CALL BX,RET
9、instruction,RET (near return ) Return from procedure called by near call 16-bit number is removed from the stack to replace IP RETF (far return) Return from procedure called by far call 32-bit number is removed from the stack to replace CS & IP RET n Remove offset address from the stack and extra by
10、tes from the stack,6-4 introduction to interrupts,Interrupt Interrupt service routine is called when interrupt event occurs Interrupt event Hardware interrupt Internal interrupt (exception) Software interrupt,Interrupt,Main program,# 10 interrupt service procedure,Stack,mov ax,3,IRET,CS:1003H,1000H:
11、2000H,CS:1000H,FLAG 0100H 1003H,1000H,IP,interrupt,add ax,bx,1000H 2000H,#10 interrupt vector,0100H,CS,#10 interrupt request,Main program,# 10 interrupt service procedure,Stack,mov ax,3,IRET,CS:1003H,1000H:2000H,CS:1000H,FLAG 0100H 1003H,1000H,IP,returning,add ax,bx,1000H 2000H,#10 interrupt vector,
12、0100H,CS,6-4 introduction to interrupts,Interrupt vectors A table starts from 00000H with 1024 bytes,20H,00H,23H,ABH,10H,00H,12H,34H,00000H,00001H,00002H,00003H,00004H,00005H,00006H,00007H,00008H,00009H,0000AH,0000BH,#0 1000H:1234H,#1 2000H:23ABH,003FFH,003FEH,003FDH,003FCH,#0FFH (255),#2,INT s IRET/IRETD INT 3 INTO,Interrupt service
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年酒店健身房改造升级投资预算方案
- 机械工程教案
- 皮肤科疱疹病毒感染防治方案
- 淋巴瘤免疫治疗指南
- 企业创新与创业精神培养指南
- 弘扬雷锋精神 绽放青春风采
- 胫骨骨折术后康复训练方案
- 2025年公务员(环境保护实务)试题及答案
- 神经内科中风患者康复训练计划
- 水自然知识科普
- 歌词:半生雪(学生版)
- 2025高考数学一轮复习-7.6-利用空间向量求空间角、距离-专项训练【含解析】
- 《 大学生军事理论教程》全套教学课件
- 反推装置 (1)课件讲解
- 英文科技论文写作
- XX县群文阅读课题中期成果报告:县域性推进小学群文阅读教学实践研究中期研究成果报告课件
- LY/T 2271-2014造林树种与造林模式数据库结构规范
- GB/T 38658-20203.6 kV~40.5 kV交流金属封闭开关设备和控制设备型式试验有效性的延伸导则
- GB/T 19409-2013水(地)源热泵机组
- GB/T 15856.4-2002六角法兰面自钻自攻螺钉
- GA/T 1047-2013道路交通信息监测记录设备设置规范
评论
0/150
提交评论