Download presentation
Presentation is loading. Please wait.
Published byAinsley Beasley Modified over 9 years ago
1
Assembly Programming Notes for Practical 3 Munaf Sheikh http://www.cs.uwc.ac.za/~msheikh/COS365Assembler
2
Jump statements Simplest form of Jump statement Simplest form of Jump statement –“jmp Lable” Equivalent to GOTO Equivalent to GOTO Simply says: Jump to Label Simply says: Jump to Label
3
Equality Comparison CMP leftOp, rightOP CMP leftOp, rightOP Compares the leftOperand to the rightOperand Compares the leftOperand to the rightOperand Jumps based on Equality: Jumps based on Equality: –JE (jump if equal) –JNE (jump if not equal) –JCXZ (jump if CX = 0) –JECXZ (jump if ECX = 0)
4
More Equality jumps JG (jump if greater) JG (jump if greater) JNLE (jump if not less than or equal to) JNLE (jump if not less than or equal to) JGE (jump if greater or equal) JGE (jump if greater or equal) JNL (jump if not le) JNL (jump if not le) JL (jump if less) JL (jump if less) Etc..: JNGE, JLE, JNG Etc..: JNGE, JLE, JNG
5
IF ELSE’s If (Expression) Statement List 1 Else Statement List 2 start expression Statement List 1 Statement list 2 end FALSETRUE
6
IF ELSE’s If (OP1 == OP2){ X = 1; Y = 2; } Else { Z = 1; } Initial code here Cmp op1 op2 L3: Je L1 L1: Mov X,1 Mov Y,2 Jmp L3 L2: Mov Z, 1 Jmp L3
7
While Loops While (Expression) Statement List TRUE start Expression Statement List End FALSE
8
Prac 3 Write an Assembly Program that: Write an Assembly Program that: –prompts the user for a System Administrator pin (PIN). –prompts the user for an Iteration Limit (LIMIT). –prints "---THE SYSTEM IS NOW RUNNING---" –Loop until counter = LIMIT prompt user for pin prompt user for pin if pin == PIN, jump to CORRECTPIN handling code if pin == PIN, jump to CORRECTPIN handling code else print error message and increment counter else print error message and increment counter jump back to beginning of loop. jump back to beginning of loop. Save as access.asm
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.