Total members 11894 |It is currently Sat Nov 23, 2024 9:26 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





1. Conditional Branching:

Code:
  DECFSZ      fileReg, d

Decrements file register and skip next instruction if value in file registers reaches 0.
Attachment:
Untitled3.png
Untitled3.png [ 53.42 KiB | Viewed 3822 times ]

Code:
BNZ      Label

Branch if the value in file register is not zero, it works on zero flag in status register.
Attachment:
Untitled4.png
Untitled4.png [ 51.72 KiB | Viewed 3822 times ]

Code:
BZ      Label

Branch if the value in file register is zero.
Code:
BNC      Label

Branch if no carry, if C flag in status register is zero.
Attachment:
Untitled.png
Untitled.png [ 11.43 KiB | Viewed 3823 times ]


2. Unconditional Branching:
Code:
GOTO      Label


Nested Loops:
Due to the fact that registers in PIC can carry only 8 bits which means it can have numbers only from 0 to 255, and then if we have for loop greater than 255 what should we do? This is the nested loop:
Attachment:
Untitled2.png
Untitled2.png [ 76.47 KiB | Viewed 3822 times ]


Comparing Instructions:

Code:
cpfseq f,a ; compare register f with WREG, skip if equal
cpfsgt f,a ; compare register f with WREG, skip if greater than
cpfslt f,a ; compare register f withWREG, skip if less than
decfsz f,d,a ; decrement f, skip if 0
dcfsnz f,d,a ; decrement f, skip if not 0
incfsz f,d,a ; increment f, skip if 0
infsnz f,d,a ; increment f, skip if not 0




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Loops and Branching
 C++ For Loops     -  
 C++ for loops     -  
 Nesting Two for Loops     -  
 Break in Nested Loops     -  
 Re: Lets Learn C++----->(Lesson 4) Loops     -  
 Using Program Loops to Create Time Delays     -  
 write a while loops performing operations on number     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com