Assembly Primer For Hackers (Part 9) Conditional Branching
|
|
|
||||||||||||
Description: This is Part 9 of the "Assembly Language Primer for Hackers" video series. Please start here by watching Part 1 of this series, if you have not already done so. In this video we will look at Conditional Branching in Assembly Language using the JXX family of instructions and the LOOP instruction.
The conditional jump instructions such as JA, JAE, JZ, JNZ etc. use various flags in the EFLAGS register such as the Zero Flag (ZF), the Parity Flag (PF), Overflow Flag (OF), Sign Flag (SF) etc. to determine which instruction path to take next. In this video we will look at the JZ condition jump instruction in great detail. JZ using the Zero Flag (ZF) to determine if the last instruction resulted in the Zero operation or not and then chooses to jump to a specified location if it was set. We will also look at the LOOP instruction which used the ECX register to loop over a set of instructions over and over again.
Please download the ConditionalBranching.s sample code file to try the example shown in this video.
This video is part of the following groups:
1. Assembly Language Megaprimer for Linux ( 11 videos)
Comments (19)
|
slingshot on Sat 26 Mar 2011 Great video series, I have going thru these and doing some extra exercises. |
|
|
Col_Loki on Sat 30 Apr 2011 Top notch thanks. This series has been a major help to me. Looking forward to doing more. |
|
|
sekstiseks on Sat 30 Apr 2011 Thanks again man! Well explained. =) |
|
|
balder on Wed 18 May 2011 again thanks, one thing which would be nice would be a further reading or .. home work section :). i find my self having to go back through the video at the end so i can note down all the things to try out. however it would be good to have a pointer to a good source for further reading. i found this http://bit.ly/lncuoy however it uses intel syntax |
|
|
balder on Wed 18 May 2011 " however it would be good to have a pointer" |
|
|
rails345 on Tue 31 May 2011 I appreciate the skill and effort you've put into this series. My read of the Intel x86 instruction set suggests that the Conditional Loop slide at 15:30 is in error for LOOPZ and LOOPNZ. Shouldn't this read ...ECX is not zero AND the zero flag (ZF) is set (for LOOPZ) and (ZF) is not set (for LOOPNZ). This would be the 1st error in this series and speaks of a lot of attention to detail. Thanks! |
|
|
nkb on Fri 24 Jun 2011 Awesome again !! |
|
|
xplt on Fri 08 Jul 2011 As always! Another great movie! Thank you Vivek! |
|
|
punkt2 on Tue 12 Jul 2011 it says "video not found" :( |
|
|
neo on Fri 15 Jul 2011 Bravo Vivek. |
|
|
mac on Mon 01 Aug 2011 yooyoyoyooy going great sir, But i have the problems i can't write the code from my own. |
|
|
voidexp on Fri 12 Aug 2011 I have an Intel Core 2 Duo, so, a 64-bit processor. The example code |
|
|
gutterchurl on Wed 31 Aug 2011 voidexp: that should be %ecx, not %eax. pushq/popq %rcx works for me on linux x64 |
|
|
orrala on Mon 03 Oct 2011 thanks, bro :) next one! |
|
|
Thilee on Thu 01 Dec 2011 Thank you very much. Please keep uploading the video tutorials. |
|
|
RobinB on Fri 09 Dec 2011 Vivek thank you for your effort in creating these videos. I think it would be great if you could give us homework, in that you tell us to make a program or something like that. Also when you start out there are a lot of things to remember and maybe you could make cheat sheets for stuff like registers, flags, some syntax for both the assembly language but also gdb and compiling. Just some thoughts, love your work, keep up the good work! |
|
|
RobinB on Fri 09 Dec 2011 As Balder said pretty much :) |
|
|
Patcher on Sun 18 Dec 2011 gr8 job..!!! |
|
|
bala150985 on Wed 01 Feb 2012 Thanks Vivek & Thanks gutterchurl |







