Microprocessors: From Assembly Language to C Using thePIC18Fxx2

I.5: CHAPTER 5

I.5 CHAPTER 5

1.

Code fragment:

  do {   i = i - k;  }  while (i < (j + k));

2.

Code fragment:

  if (i && j) {    k = k & 0xFF00;  }

3.

Code fragment:

  k = i  i;

4.

Code fragment:

  while (i != j) {    k = k  1;    j--; }

Answers

1.

top  movf    k,w  subwf   i,f         ; i LSB = i LSB - k LSB  movf    k+1,w  subwfb  i+1,f       ; i MSB = i MSB - k MSB  ; need to do [ i - (j+k)] for comparison, use  ; temporary location, do j+k first  movf    j,w  addwf   k,w         ; w = i LSB + k LSB  movwf   tmp         ;save LSB to tmp LSB, a temporary                       location  movf    j+1,w  addwfc  k+1,w       ;w = i LSB + k LSB  movwf  ...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: ISO Containers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.