From the course: Learning Assembly Language

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Controlling the assembler flow

Controlling the assembler flow - Python Tutorial

From the course: Learning Assembly Language

Start my 1-month free trial

Controlling the assembler flow

- [Instructor] At some stage, we'll want to check a value and change our execution path, depending upon the result. In a high level language, we can use if statements and for and while loops. While there are some macro instructions that provide higher level constructs in Assembler, we'll take the more basic approach and use direct Assembler instructions. When we execute an instruction, the processing chip maintains a set of flags, which may or may not be set. We can check these flags and change our execution path accordingly, using a jump instruction. And we can see here a selection of jump instructions. Note that when comparing a value, if it's equal, than the zero flag is set. Hence, jump zero and jump equal are in fact the same instruction. In general, jumps must be within plus or minus 128 bytes, except for the unconditional jump, which is unrestricted. Let's see how we use conditional jumps in code. I've…

Contents