MPLAB XC8 PIC Assembler Instruction Set - Page 1
Forum section: electronics / general

author: PerranOak
author_rank: Frequent Contributor
timestamp: August 30, 2025, 05:20:20 pm
content: Am I going mad?Try as I might (and this time I really have tried) I cannot find a simple list of the instruction set for the PIC-AS assembler. I have one for MPASM but can't find the "new" one.In fact, they were in the datasheets for some uCs.Any help gratefully received.

author: Ian.M
author_rank: Super Contributor
timestamp: August 30, 2025, 08:12:57 pm
content: What makes you think the instruction sets for the various 8 bit cores have changed at all due to the MPASM to XC8 PIC-AS migration?There have been some minor changes in permitted parameters, and assembler directives are of course vastly different, but that's all documented in the macro Assembler section of the XC8 PIC User Guide.There's also MPLAB XC8 PIC Assembler User's Guide for Embedded Engineers,or, which covers the basics of the new assembler and together with the relevant device datasheet should be enough to get started.

author: westfw
author_rank: Super Contributor
timestamp: August 30, 2025, 08:19:52 pm
content: Why would it be in the assembler manual?The instruction set is different depending on the chip, encompassing at least"Baseline","Midrange","extended midrange", and "advanced (PIC18)" (and now perhaps AVR as well?)AFAIK, each PIC16 datasheet contains a section describing the instructions on that particular processor. Often with significantly detailed explanations. (At least, that's true of some really old and really recent chips...) (oh! The newish PIC16F13145 even has internal hyperlinks from the "instruction set summary" to the individual instruction descriptions.)(Alas, the new AVR datasheets just point you to one of those combined "instructions set reference manuals", leaving you to figure out which "family" your chip belongs to, and which instructions it therefore doesn't have...)

author: PerranOak
author_rank: Frequent Contributor
timestamp: August 31, 2025, 08:49:21 am
content: Good point, I guess I just assumed there would be changes. I did spot the directives changes, thanks.Initially, I looked for the instruction set in the datasheet of the chip I want to use but it wasn't there; I had expected it to be there for that very reason that different chips may use a different sub-set.In my simple way it seems that the set of all instructions that can be assembled by the assembler is an attribute of the assembler. Therefore, that is where a comprehensive and summarised list would be useful. If a particular chip uses a sub-set of this then the chip's datasheet could provide (as some do) a summary of these. Maybe it's just the one I'm using that's not got it.Maybe I'll compile (no pun intended) a summary for my my own reference.Anyway, cheers both.

author: westfw
author_rank: Super Contributor
timestamp: August 31, 2025, 09:33:50 am
content: Which chip are you using?

author: PerranOak
author_rank: Frequent Contributor
timestamp: August 31, 2025, 02:03:20 pm
content: It's a PIC24FV16KM202.I "found" it in my chips box and it seems to do all I need for now.

author: Ian.M
author_rank: Super Contributor
timestamp: August 31, 2025, 02:33:19 pm
content: Quote from: PerranOak on August 31, 2025, 02:03:20 pmWell in that case, throw out all the XC8 PIC-AS info above, as all PIC24 use XC16 which is GCC based, and I believe the XC16-AS assembler is derived from GNU GAS rather than being an independent Microchip development or acquisition.

author: PerranOak
author_rank: Frequent Contributor
timestamp: August 31, 2025, 03:09:35 pm
content: So ... will the basic instruction set (apart from assembler directives, etc.) still be the same though?

author: Ian.M
author_rank: Super Contributor
timestamp: August 31, 2025, 03:48:56 pm
content: Microchip used a GCC based 16 bit PIC toolchain even back in the days of the old MPLAB 7 and 8 before MPLAB X, so no, the instruction set documented in"16-Bit MCU and DSC Programmer’s Reference Manual"wont have changed, though the precise syntax of each instruction may have changed slightly as GNU GAS and thus Microchip XC16-AS has evolved. Note that not all PIC24 and dSPIC families implement the complete instruction set. Also note the assembler directives are significantly different from those used by by the 8 bit toolchains so referring to an XC8 or MPASM manual will just confuse you.

author: PerranOak
author_rank: Frequent Contributor
timestamp: August 31, 2025, 04:00:19 pm
content: Brilliant, cheers Ian!