Swordfish uses two files when compiling. An asm *.inc file (for example, P18F4520.INC) and a *.bas file (for example, an 18F4520.bas). These files need to be located in the Swordfish 'includes' folder.

To add new devices, you can download and use the following software:

You must have the latest version of MPLAB or MPLABX installed. The software uses various files supplied by the Microchip assembler to try and construct the files required by the compiler. Just unzip the software and place in a folder that can be written to. The software will create two new folders called 'NewInclude' and 'NewIncludeBASIC', so it is essential you have write permissions!

Device Creation Software

Make sure the software is pointing to the MPASM or MPASMX installation folder. If it is not, use the 'Change Folder' button to point to the location of the assembler. For MPLAB this is typically "C:\Program Files\Microchip\MPASM Suite" and for MPLABX it's "C:\Program Files\Microchip\MPLABX\mpasmx". Next, press the 'Get Candidates' button. This will build a list of all files that the software thinks it can generate Swordfish device files for. Finally, press the 'Convert Files' button to start the build process.

V1.44 Options:

  • Include 18LF
Selecting this option will create device files for both the 18F and 18LF families.
  • Create Reg Bit File
Selecting this will generate additional 'P18Fxxxx.bas' files that contain register bit definitions
in the form of 'public const bitname = bitno'. These files will be located in the NewIncludeBASIC folder.
  • Include 18xv
Selecting this option will create device files for the 18xv core devices (Currently unsupported).
  • XML List
By default the program generates a log file in the NewIncludeBASIC folder that contains a listing of all the supported devices and other info. The default log file format ('_devices.txt') is a plain text file. Selecting this option will generate an additional XML formatted file ('_devices.xml') that is in a form compatible with MPLABX plugins.

The 'Copy Device List' button will take the contents of the device list window and copy it to the Windows clipboard in the form of 'device = xxxx' statements.

If all goes well, after pressing 'Convert Files' will see the two 'NewInclude' folders containing *.bas files and *.inc files. These folders will be created in the same path the program was run from. The contents of both these folders must be copied into the Swordfish 'includes' folder. For example,

  c:\program files\mecanique\swordfish\includes\18F4520.bas
  c:\program files\mecanique\swordfish\includes\

Please note that for Vista and Windows 7 users, the paths to the include files will be a little different. For example,

  c:\users\all users\mecanique\swordfish\includes\18F4520.bas
  c:\users\all users\mecanique\swordfish\includes\

You will probably also need to copy the latest version of MPASM into the Swordfish 'bin' folder, in order to assemble the new parts you have created files for. To do this, navigate to the Microchip folder specified above and:

For MPASM users, copy the three files


from the 'MPASM Suite' directory to your Swordfish\Bin directory.

For MPASMX users, the steps are a little different depending on the version of MPLABX. In some versions there is only a single executable named 'mpasmx.exe', while for others there is an identical file named 'MPASMWIN.exe'. If your version contains MPASMWIN.exe, you can use that file instead of copying and renaming mpasmx.exe. Otherwise copy the files


from the 'MPLABX/mpasmx' directory to your Swordfish\Bin directory, and rename the file mpasmx.exe to MPASMwin.exe

Note: The last version of MPLAB released was v8.92 (which includes MPASM v5.49) and is available from the Microchip development tools archive page at The download above contains files already converted for this version.

Support for the 18FxxK40 family requires the device files from MPASMX v5.68 (MPLABX 3.35) or later. The zip file below contains the core 18F device files already converted from mpasmx 5.77 (MPLABX 4.20) It does not include the LF devices or the register bit files.


  • Don't just copy all of the files to the include folder. Some of the files supplied by Swordfish have been hand edited. You don't want to break these.
  • Take a look at the files generated. Remember, they may need tweaking - refer to the datasheet. Also note that Microchip, on occasions, have the wrong information supplied in their own files!

SystemConvert program Delphi source files: SystemConvert V1.44 source