Anda di halaman 1dari 1

Convert the instructions to the machine code and fill in the content of WREG, File registers and

Status register. [16 marks]

Note: All the four (4) instructions are independent of each other but based on the same initial condition.

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
0x100 10 78 4A 91 FF D6 E2 C9 78 44 1B A7 C0 22 00 00
0x200 3C EF 1F 6E 00 00 00 00 00 00 00 00 00 00 00 0F

Coding Machine [WREG] File Register Status


Code (FR) Register

N OV Z DC C

Initial Condition 0x05 All [FR]=0 0 0 0 0 1


MOVLB 0x1
MOVFF 0x202,0x104 C202 F104 0x05 [0x104]= 0x1F 0 0 0 0 1
2 marks 1 mark 0.5 mark
1 mark
MOVWF 0x10,A 6E10 1 mark 0x05 [0x10]= 0x05 0 0 0 0 1 0.5 mark
1 mark 1 mark
ADDWF 0x0B,F,BANKED 270B 1 mark 0x05 [0x10B]= 0xAC 1 0 0 0 0 0.5 mark
1 mark 1.5 marks
SUBWF 0x07,W,BANKED 5D07 1 mark 0xC4 [0x107]= 0xC9 1 0 0 1 1 0.5 mark
1 mark 1.5 marks

Question for my section

Assign the addressing modes for the following instructions. [5 marks]

Addressing Mode
MOVLW 0x23 Immediate, Inherent 2 marks

LFSR FSR2, 0x123 Indirect, Inherent 2 marks

BTFSS 0x80, 5, BANKED Bit-Direct 1 mark

Expand the full term of GPR and SFR. What are the purposes of these TWO registers? [4 marks]

GPR-General Purpose Register used to hold dynamic data when CPU is executing program [2m]

SFR-Special Function Register used by the CPU and peripheral modules for controlling the
desired operation of the MCU [2m]

Anda mungkin juga menyukai