You are on page 1of 3

;QUIZ I

;Name: Muhammad Aidid bin Mohd Tahir

;SID: EE098249

;Sec: 3A

;Write a one macro to load the following values into

;the respective file registers:

; [0x10]=0x11

; [0x11]=0x22

; [0x12]=33

;Write another macro to load the following values into

;the respective file registers:

; [0x20]=0x44

; [0x21]=0x55

; [0x22]=66

;Write a main program to do the following:

; [0x10]+[0x22]=[0x30]

; [0x11]+[0x21]=[0x31]

; [0x12]+[0x20]=[0x32]

;Compile and simulate.

;Show the final answer to your instructor.

;[10 marks]

;Marks breakdown:

;Load values into respective file registers using macro: 3 marks

;Add function: 4 marks

;Ability to compile, simulate and show the final answer: 3 marks

;After you have completed the quiz, please print it with asm code and

;snapshots of results. Submit to my room BN-1-063


#include<p18F458.inc>

load macro val1,val2,val3,val4,val5,val6

movlw val1

movwf val2,A

movlw val3

movwf val4,A

movlw val5

movwf val6,A

nop

endm

;program start template

org 0x00

goto start

org 0x08

retfie

org 0x18

retfie

;main program

start load 0x11,0x10,0x22,0x11,0x21,0x12

load 0x44,0x20,0x55,0x21,0x42,0x22

movf 0x10,W,A

addwf 0x22,W,A

movwf 0x30,A

movf 0x11,W,A

addwf 0x21,W,A

movwf 0x31,A

movf 0x12,W,A

addwf 0x20,W,A

movwf 0x32,A

nop

END

You might also like