Top Banner
Lecture 5 and Lecture 6 Chapter 7 –Program Logic and Control
26

Assembly Lecture5

Aug 18, 2015

Download

Documents

Computer is an interesting language
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Lecture 5 and Lecture 6Chapter 7 Program Logic and ControlChapter OutlineShort, near and far addressJMP Instructionhe CMP InstructionConditional Jump instructionhe Loop instruction!hile Loop"#P#$ LoopShort,near,and far addresses1- A short address, limited to a distance of -128 to 127 bytes2- A near address, limited to a distance of -32,768 to 32,767 bytes3- A far address, which may be within the same segment at a distance over 32K or in other segmentSHORT NEAR FARJMP YES YES YESJXXX(conditional jump) YES YES NOLOOP YES NO NOCALL NlA YES YES%nconditional Jumps & he JMP Instruction he JMP !"#m$% instr#ction ca#ses an #nconditional transfer of control !#nconditional "#m$%& 'ynta() *+, destination-(am$le *+,.1/00&&.1/)12334JMP SHORT/NEAR/FAR address%nconditional Jumps & he JMP Instruction'ac()ard and *or)ard +umps5ac6ward)

.1/) 00&*+, .1/7orward) *+, .1/00&.1/)

he CMP Instruction he "#m$ condition is often $rovided by the CMP !com$are% instr#ction 'ynta() 3+, destination, so#rce 3om$ares by com$#ting destination contents min#s so#rce contents& he res#lt is not stored, b#t the flags are affected& 8estination may not be a constant& 3+, is "#st li6e '95, e(ce$t that destination is not changed&Conditional Jumps'ynta( *((( destination:label -(am$le *2;,