The documentations Microchip has for MPLab X and XC8 are probably some of the worst I've ever read. I had to mesh what I've read from multiple sources, and with some guessing just to get the assembler working in MPLab X IDE 5.4. So here is the assembly code that gets to assemble with no error or warning messages.
Tutorials and books I've read all uses MPASM assembler instead of it's current replacement, pic-as in XC8. With MPASM and older MPLab, pure assembly code would just get built. But with current XC8 and pic-as, you have to start off with including /Applications/microchip/xc8/v2.20/pic/include/xc.inc where it has a directive pointing to /Applications/microchip/xc8/v2.20/pic/include/pic.inc which in turns has a directive pointing to /Applications/microchip/xc8/v2.20/pic/include/ic_as_chip_select.inc that eventually points to /Applications/microchip/xc8/v2.20/pic/include/proc/pic16f84a.inc that defines the PSECT:
For whatever obscure reason, there has to be
psect wrapping around the assembly code. The explanation is given as this (I've no idea what it's talking about or why I need to wrap an assembly code like I bracket-wrap a C function call):
Psects—short for program sections—are containers that group and hold
related parts of the program, even though the source code for these
parts might not be physically adjacent in the source file, or may even
be spread over several modules. They are the smallest entities
positioned by the linker into memory.
As for the listing file: instruction to read or output the listing file is somewhat mentioned in MPLAB® X IDE User’s Guide's (Section 5.16 on page 127): Window>Debugging>Output>DisassemblyListingFile. Alternatively, the listing file can be outputted to /MyProject/disassembly/listing.disasm (not in the *.lst format as Microchip forum or their guide suggests!) by inserting
-code=0h -Wa,-a in ProjectProperties/pic-asLinker/CustomLinkerOptions (there is no mention or instruction in any of their user guide and I just happen to guess right where to insert what from reading MPLAB® XC8 PIC Assembler User's Guide for Embedded Engineers) where it provides examples compiling under the XC8 command line. Neither listing files generated under the IDE provides all details - it doesn't even show the vector addresses of instructions!
Disassembly Listing for FooProject
--- /Users/*******/Desktop/Foo/FooFile.asm ------------------------------------------------------------
1: PROCESSOR 16F84A
2: #include <xc.inc>
3: PSECT code
4: ; a commend
5: org 00
01FF 0103 CLRW 6: loop: clrw
7: end loop
I won't accept my own answer. If someone can help address my finding or explain why psect is there and how to get the listing file to show vector addresses I'll accept his/her answer.
[EDIT] To output listing file on MPLabX 5.4 or with X8 (pis-as) CLI using -Wa,-a option.
// Source file must end with *.S extension for compiler to preprocess the C preprocessor
$sudo pic-as -mcpu=16F84A -Wa,-a SourceFileName.S -o OutputFolderName/OutputFileName