Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembler Exercises Chapters 4-6 Dr. Gheith Abandah1.

Similar presentations


Presentation on theme: "Assembler Exercises Chapters 4-6 Dr. Gheith Abandah1."— Presentation transcript:

1 Assembler Exercises Chapters 4-6 Dr. Gheith Abandah1

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

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

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

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 Abandah5

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

7 Exercise 3 A equ20 movlw 0a movwf counter movlw A movwf fsr clrw Loopaddwf indf,0 incf fsr decfsz counter goto Loop movwf sum Dr. Gheith Abandah7

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

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

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

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

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

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

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 Abandah14

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

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

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

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


Download ppt "Assembler Exercises Chapters 4-6 Dr. Gheith Abandah1."

Similar presentations


Ads by Google