Created
December 9, 2023 03:43
-
-
Save caitlynrw/b58dfbdcd1d0c894ed20c7f9c3a045ab to your computer and use it in GitHub Desktop.
MPASM PIC18F Assembly language definition for the LaTeX listings package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% PIC18F assembly using MPASM language highlighting for LaTeX 'listings' package | |
\ProvidesPackage{pic18fmpasm} | |
\RequirePackage{listings} | |
\lstdefinelanguage[pic18f]{Assembler}{% | |
% so listings can detect directives and register names | |
alsoletter={.,\#}, | |
% strings, characters, and comments | |
morestring=[b]", | |
morestring=[b]', | |
morecomment=[l];, | |
% instructions | |
morekeywords={[1]% byte oriented file register operations | |
addwf, addwfc, andwf, clrf, comf, cpfseq, cpfsgt, cpfslt, decf, decfsz, dcfsnz,% | |
incf, incfsz, infsnz, iorwf, movf, movff, movwf, mulwf, negf, rlcf, rlncf, rrcf,% | |
rrncf, setf, subfwb, subwf, subwfb, swapf, tstfsz, xorwf,% | |
bcf, bsf, btfsc, btfss, btg,% | |
bc, bn, bnc, bnn, bnov, bnz, bov, bra, bz, call, clrwdt, daw, goto, nop,% | |
pop, push, rcall, reset, retfie, retlw, return, sleep,% | |
addlw, andlw, iorlw, lfsr, movlb, movlw, mullw, retlw, sublw, xorlw,% | |
tblrd*, tblrd*+, tblrd*-, tblrd+*, tblwt*, tblwt*+, tblwt*-, tblwt+*}, | |
% assembler directives | |
morekeywords={[2]\#define, \#include, \#undefine, bankisel, banksel, constant, end, equ, org, pagesel, pageselw, processor, radix, set, variable,% | |
__badram, __badrom, __config, config, __idlocs, __maxram, __maxrom, cblock, da, data, db, de, dt, dtm, dw, endc, fill, res,% | |
error, errorlevel, list, messg, nolist, page, space, sibtitle, title,% | |
endm, exitm, local, macro, noexpand,% | |
access_ovr, code, code_pack, extern, global, idata, idata_acs, udata_ovr, udata_shr}, | |
% register names | |
morekeywords={[3]tosu, tosh, tosl, stkptr, pclatu, pclath, pcl, tblptru, tblptrh, tblptrl, tablet, prodh, prodl, intcon, intcon2, intcon3, indf0, postinc0, postdec0, preinc0, plusw0,fsr0h, fsr0l, wreg, indf1, postinc1, postdoc1, preinc1, plusw1, fsr1h, fsr1l,bsr,% | |
indf2, postinc2, postdec2, preinc2, plusw2, fsr2h, fsr2l, status, tmr0h, tmr0l, t0con, oscon, lvdcon, wdtcon, rcon, tmr1h, tmr1l, t1con, tmr2, pr2, t2con, sspbuf, sspstat, sspcon1, sspcon2, adresh, adresl, adcon0, adcon1% | |
ccpr1h, ccpr1l, ccp1con, ccpr2h, ccpr2l, tmr3h, tmr3l, t3con, spbrg, rcreg, txreg, txsta, rcsta, eeadr, eedata, eecon2, eecon1, ipr2, pir2, pie2,% | |
ipr1, pir1, pie1, trise, trisd, trisc, trisb, trisa, late, latd, latc, latb, lata, porte, portd, portc, portb, porta}, | |
sensitive=false | |
}[strings,comments,keywords] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment