1 / 18

Assembler Exercises

Assembler Exercises. Chapters 4-6. Exercise 1. z = x + y;. Exercise 1. movf x, 0 addwf y, 0 movwf z. Exercise 2. z = x + y; //16-bit numbers. Exercise 2. movf x_lo, 0 addwf y_lo, 0 movwf z_lo btfsc status, C incf x_hi, 1 movf x_hi, 0

gus
Download Presentation

Assembler Exercises

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembler Exercises Chapters 4-6 Dr. Gheith Abandah

  2. Exercise 1 z = x + y; Dr. Gheith Abandah

  3. Exercise 1 movf x, 0 addwf y, 0 movwf z Dr. Gheith Abandah

  4. Exercise 2 z = x + y; //16-bit numbers Dr. Gheith Abandah

  5. Exercise 2 movf x_lo, 0 addwf y_lo, 0 movwf z_lo btfsc status, C incf x_hi, 1 movf x_hi, 0 addwf y_hi, 0 movwf z_hi Dr. Gheith Abandah

  6. Exercise 3 sum = 0; for (i=0; i<10; i++) sum += A[i]; Dr. Gheith Abandah

  7. Exercise 3 A equ 20 movlw 0a movwf counter movlw A movwf fsr clrw Loop addwf indf,0 incf fsr decfsz counter goto Loop movwf sum Dr. Gheith Abandah

  8. Assignment • Study Section 5.9: The ping-pong program Dr. Gheith Abandah

  9. Exercise 4 z = (x + y) - q; Dr. Gheith Abandah

  10. Exercise 4 movf x, 0 addwf y, 0 movwf z movf q, 0 subwf z, 1 Dr. Gheith Abandah

  11. Exercise 5 z = x-3; Dr. Gheith Abandah

  12. Exercise 5 movlw 3 subwf x, 0 movwf z Dr. Gheith Abandah

  13. Exercise 6 z = x<<3; Dr. Gheith Abandah

  14. Exercise 6 bcf status, C rlf x, 1 bcf status, C rlf x, 1 bcf status, C rlf x, 0 movwf z Dr. Gheith Abandah

  15. Exercise 7 z = x && 0x0f; Dr. Gheith Abandah

  16. Exercise 7 movlw 0f andwf x, 0 movwf z Dr. Gheith Abandah

  17. Exercise 8 z = x * 4; Dr. Gheith Abandah

  18. Exercise 8 bcf status, C rlf x, 1 bcf status, C rlf x, 0 movwf z Dr. Gheith Abandah

More Related