The reference
This description is based on tables from the 16-bit MCU and DSC Programmer’s Reference Manual. It differs a little from the tables in the textbook. The textbook authors make an attempt to put a bit more structure in the instruction set.
All following page reference are from the Programmer’s Reference Manual.
Some instructions
Here are all the instuctions for moving and adding. Similar instructions exist for other operations. We will have to cover flow control instructions a bit later.
MOV f | 282 |
MOV f, WREG | |
MOV.B f | |
MOV.B f, WREG | |
MOV WREG, f | 283 |
MOV.B WREG, f | |
MOV f, Wnd | 284 |
MOV Wns, f | 285 |
MOV.B #lit8, Wnd | 286 |
MOV #lit16, Wnd | 287 |
MOV [Ws+Slit10], Wnd | 288 |
MOV Wns, [Wd+Slit10] | 289 |
MOV Ws, Wd | 290 |
MOV.D Wns, Wd | 292 |
ADD f | 100 |
ADD f, WREG | |
ADD.B f | |
ADD.B f, WREG | |
ADD #lit10, Wn | 101 |
ADD.B #lit8, Wn | |
ADD Wb, #lit5, Wd | 102 |
ADD Wb, Ws, Wd | 104 |
INC f | 258 |
INC f, WREG | |
INC.B f | |
INC.B f, WREG | |
INC Ws, Wd | 259 |
INC.B Ws, Wd |
PIC addressing modes
Let’s take a look at page 95 of the Programmer’s Reference Manual to see how address modes are encoded.
Some lines of C to consider
x = y + 15 ; x = dept.chair ; x = dept->chair ; x = y + z ; x = y + V[5] ; x = y + V[i] ; V[i] = V[i+1] ; V[0] = 15 ; x = u + v + w + y + z ;