VersionHistory

This page documents changes and updates to the Swordfish compiler

28 March 2023 - 2.2.4.0

  • NEW - library files ADCC.bas, I2CX.bas plus various library updates (see updated_library.txt)
  • UPDATED - 18FxxQ71.bas device files
  • UPDATED - mpasmx v5.93, 8bit_device.info v1.63
    correct 18FxxQ71 RSTOSC and BBSIZE entries
  • UPDATED - PPSTool v0.0.6.4
  • UPDATED - ConfigGenerator v1.3.7
  • IDE 2.2.4.0
  • ICC V1.2.1.0
    FIX: byte = -byte, where src == dest ignored any required banking
    add 8-bit division routines (SB_DIV_8x8)
    change floating-point rounding to better match previous versions
    various floating-point optimizations (thanks to janni)
    change int to float conversions to increase accuracy
    rollback default setting in SwordfishICC.ini for 'optimize bit test' change made in v1209
    to match v1208 setting (sb_tgoto=0)...was causing bank select issues

14 Nov 2022 - 2.2.3.8

  • NEW - SF now allows locating a const array at a specific address in program memory
example:
Const array1() As Byte @($1000) = (1,2,3,4,5)
see Samples\ConstantData\const_at.bas for examples and limitations
  • UPDATED - change floating-point handling to support the full range of the Microchip 32-bit format
    FLOAT_MAX as float = 6.80564693E+38,
    FLOAT_MIN as float = 1.17549435E-38
  • UPDATED - change various multiply routines to use hardware MUL instruction
    this can result in up to a 10x increase in speed, depending on the operation
  • UPDATED - mpasmx v5.92, 8bit_device.info v1.62
    adds 18FxxQ71 devices (preliminary)
    device list current as of mplabx 6.00
    custom version of mpasmx to add support for devices not in mpasmx 5.87
  • SF library updates (see updated_library.txt)
    includes support for Q71
    misc optimizations
  • IDE 2.2.3.8:
    improve IDE CodeExplorer handling for floating-point constants
  • ICC 1.2.0.9:
    FIX: bsr issue for multiplying 'integer = shortint * shortint' (16=8*8)
    FIX: correct word multiply when dest is the same as either of the two source variables,
    ie w1 = w1 * w
    optimize bit test code generation when reg is not in the access bank

23rd Nov 2020 - 2.2.3.6

  • UPDATED - mpasmx v5.90, 8bit_device.info v1.60
    new devices include:
    14 and 20-pin 18FxxQ40/Q41 devices
    18FxxQ83/Q84 devices
    device list current as of mplabx 5.45
    custom version of mpasmx to add support for devices not in mpasmx 5.87
  • UPDATED - new/updated device files
  • UPDATED - MPLABX plugin
    requires mplabx 5.45 to support new devices
    PICkit4/ICD4/SNAP/PKOB4 required for programming/debugging new devices
  • SF library update 11/23/2020 (see updated_library.txt)
    includes support for Q40/Q41/Q83/Q84 and other xv18 core device updates
    new modules for xv18 hardware SPI peripherals
  • IDE 2.2.3.6: remove dependancy on mpasmwin.exe
  • ICC 1.2.0.6: remove dependancy on device asm .inc files

9th Sept 2020 - 2.2.3.5

  • FIX - Corrected variable initialization using '@', 'addressof()', or 'bound()'
    dim bdata() as byte = (10,20,30)
    dim baddr as word = addressof(bdata)
  • UPDATED - SF library update 9/8/2020 (see updated_library.txt)
    includes GLCD I2C and SPI drivers for SSD1306 and ST7565R
  • MISC - add ConfigGenerator to IDE plugins
  • SwordfishICC v1.2.0.5 - updated 10th Oct 2020 to fix an issue with Q10 and Q43 devices
    see User Modules wiki page for details and download link

22nd June 2020 - 2.2.3.4

  • FIX - Corrected initialization of bit and boolean variables
  • FIX (ICC 1.2.0.4) - Corrected crash with delayms() and clock < 1MHz
    NOTE: delayus and delayms timing should not be relied upon for clock settings less than 4MHz
  • NEW - add support for '#option _inline_delayus' to set upper limit on use of inline delay code
  • UPDATED - Add parameter checks to delayus(), delayms(), and 'clock='
  • UPDATED - IDE Assembler v2.0.0.2
    fixes 8.3 filename issue (now supports long filenames)
    adds .ini file support (allows using mpasmx.exe as IDE assembler)

15th June 2020 - 2.2.3.3

  • NEW - Add support for '#option large_code_model'
This option enables support for >64K of const data, arrays, and strings
Set '#option large_code_model = true' before all other includes
example:
#option large_code_model = true
include "GLCD.bas"
include "graphics.bas"
  • NEW - Allow initialization of variables when declared
example:
Const a = 10
Const b = 20
Dim
x As Byte = 3,
value As Byte = a * b - 4
  • FIX - Corrected frame allocation issue with aliased SFRs (introduced in v2.2.3.0)
  • FIX (ICC 1.2.0.3) - Corrected issue where exceeding the max code space (_maxrom) did not generate an error
  • DEVICE FILES - remove PORTD/LATD/TRISD from 18F25/26/27Q43 device files (present in original files)
  • TOOLS -
    ConfigGen 1.3.3 - add min & max controls, autoload mpasm .info file
    PPSTool 0.0.6.1 now included
  • UPDATED - Library files
    LCD.bas now allows any pins to be used
    GLCD.bas updated for large_code_model support
    ISRTimer.bas allows selection of TMR1/3/5/7
    ISRX.bas allows selection of USART1-USART5
    other misc changes (see library\updated_library.txt)

2nd April 2020 - 2.2.3.2

  • NEW - Add support for '#option org_ram'
This option sets the start of SF system ram, allowing it to be moved for devices that have SFR's located in the bottom ram page(s)
example: #option org_ram = $0500 // start of system ram for Q43
  • NEW - Support for 18FxxQ43 family
  • NEW - Add '#option ISR_SHADOW_LOW' and '#option ISR_SHADOW_HIGH' to choose hw/software context save
Setting the option true uses hw context (shadow registers), and false uses software to save context
  • UPDATED DEVICE FILES - Add new devices
Add/change various settings to better define memory ranges, peripherals, etc.
Add '#option org_ram' setting for all devices.
  • UPDATED - Standard libraries include support for 'org_ram' and/or the Q43 (System.bas, EEPROM.bas, UARTx.bas, etc). Misc other enhancements (see 'updated_library.txt')
  • UPDATED - MPLABX plugin with new device support
  • UPDATED - A list of all the new supported devices can be found here
  • FIX - Corrected K40 device program memory access (#define _nvmcon = 1)
startup code was not setting NVMCON1 properly, causing table reads to be incorrect
(this only seems to be an issue with silicon revs containing the TBLRD errata)

30th October 2019 - 2.2.3.0

  • NEW - ICC code generator support for xv18 core device families (K42, K83), including support for 16K RAM (64 banks), new MOVFFL instruction, and multivector interrupts
  • NEW - Updated EEPROM and USART1-USART5 modules with support for K40, Q10, K42 and others.
  • UPDATED - Peripheral library modules have been updated for new devices and now have options for defining peripheral IO pins, allowing support for new devices, including PPS devices.
  • UPDATED - Standard library now includes intosc.bas, pps.bas, ivt.bas, mplabicd.bas, timer16.bas, and wdt.bas modules (previously these were user modules)
  • UPDATED - MPLABX plugin with new device support
  • UPDATED - A list of all the new supported devices can be found here
  • NEW - ConfigGenerator and SystemConvert utilities now included as standard (new Tools folder)
  • FIX - Corrected code generation error for 'longword = byte << byte' for shift 0-14.
  • FIX - Corrected code generation error for 'word = word >> byte' when dest <> src.
  • FIX - Floating-point constants were being truncated to approx E-25/E+31 range

NOTE Since the standard libraries now include many updated and previous user modules, you should check that there are no conflicts with any older version UserLibrary modules you may have installed.

23rd November 2014 - 2.2.2.5

  • FIX - Corrected code generation error in for...next loop when using signed integer.
  • FIX - Corrected debug address error when using structures in banked RAM.

17th November 2014 - 2.2.2.4

  • FIX - Corrected code generation error for inc() operator when working on signed variables.

9th November 2014 - 2.2.2.3

  • FIX - Optimised signed shortint math routine when included in subs or functions.
  • FIX - Corrected incorrect result for signed byte when one of the operands was a constant.
  • FIX - Corrected incorrect FSR1 assignment for string routines when string assignment follows a string comparison.
  • FIX - Corrected explorer division by zero.
  • FIX - Signed constant bytes were getting resized to 16 bits in when included in expressions in subroutines - this means they were being sign extended. This should now work OK.

2nd May 2014 - 2.2.2.2

  • NEW - Rather than store you modules in the UserLibrary, you can now store them within sub-folders contained in your main program area.
  • FIX - Missing check for scope when preprocessing "includes".
  • FIX - "Interrupt" not being correctly highlighted.
  • FIX - Check for online update is now optional. Default is on, to change select VIEW...EDITOR OPTIONS.
  • FIX - New ICC (1.1.6.4) which fixes a serious code generation anomaly where incorrect ASM for unsigned constants could be generated on very large programs.

22nd April 2014 - 2.2.2.1

  • FIX - Problem with RAM allocation for parameter strings and returns.

23rd January 2014 - 2.2.1.9

  • FIX - Problem with user defined RAM banking. This should now work OK.

26th August 2013 - 2.2.1.8

  • FIX - Problem when calculating string parameter size for nested sub and function calls. This should now work OK.

10th March 2013 - 2.2.1.7

  • FIX - Problem with comparing signed long integer value to constants. This should now work OK.

2nd March 2013 - 2.2.1.6

  • FIX - A problem was inadvertently introduced with alias declarations inside structures in version 2.2.1.5 of the compiler. Installing this version will fix the problem.

28th February 2013 - 2.2.1.5

  • FIX - Incorrect calculation of alias offset for multiple alias declaration. For example, Dim a,b,c As x. This should now work OK.
  • FIX - Problem when using Clear() and SizeOf() when variable is aliased to an array that is inside a structure. This should now work OK.
  • FIX - Program crashing when using AddressOf() with undeclared variable. This should now work OK.
  • FIX - Problem with inline procedures inside events causing compiler to freeze. This should now work OK.
  • FIX - Compiler was incorrectly calculating boundaries between stack and module blocks if the last item in a sub, function or module was a string, array or structure. This should now work OK.
  • FIX - Incorrect temporary storage allocation for function string return types if the same named function is used in the same expression - for example, lowercase(a) + lowercase(b). This should now work OK.
  • NEW - Added user RAM banking
  • NEW - Improved compilation speed on large projects.

1st October 2011 - 2.2.1.4

  • FIX - Return variable not being saved when result type is a structure. This should now work OK.

26th August 2011 - 2.2.1.3

  • FIX - Problem passing PORT bits by reference, where the bit value is zero. For example, PORTD.0, PORTB.0. This should now work OK.

9th August 2011 - 2.2.1.2

  • FIX - Stack error when searching macro includes. This should now work OK.
  • FIX - Problems with large constant data sets. This shoud now work OK.
  • FIX - Incorrect processing of pre-processor include file if included in pre-processor conditional statement. This should now work OK.
  • FIX - Problem with accessing array bit constants. This should now work OK.
  • FIX - Fixed error when passing string arrays through multiple sub or function calls. This should now work OK.
  • FIX - Large programs generating 'erratic' error messages. This should now work OK.
  • FIX - Memory leak in debug (*.cof) module.
  • FIX - Corrected module 'circular' referencing for macros.
  • FIX - constant data not being written correctly for *.cof file. This should now work OK.

6th July 2011 - 2.2.1.1

  • FIX - Problem with back switching for SFRs in upper RAM. This should now work OK.
  • FIX - Problem with GetTRIS() and GetLATCH() for devices with non-sequential ports. This should now work OK.
  • FIX - Limited floating point constant range. This has now been extended.
  • NEW - Added _IsCompilerSE define.

2nd June 2011 - 2.2.0.8

  • FIX - Problem with absolute address generation in COFF file. This should now work OK.
  • FIX - Problem with ASM code generator for testing. This should now work OK.
  • FIX - Added reset bank to beginning of event block.

13th February 2011 - 2.2.0.6

  • NEW - Additional support for MPASMWin.exe. If no version of MPASMWin.exe can be found in the default Swordfish BIN folder, the compiler attempts to locate the latest MPASMWin.exe version installed under MPLAB.

9th January 2011 - 2.2.0.5

  • FIX - Allowed 'sizeof()' expression to handle '.' notation when used in constant declarations
  • FIX - Interrupts not correctly context saving PCLATU. This should now work OK.
  • FIX - Interrupts and events not getting correct stack allocation if no sub or function called from main program also changed code to generate a PCLATH context save should any interrupt call an event
  • FIX - Problem with muliple include files with macros. This should now work OK.
  • FIX - Macro argument replacement now supports constructs such as x.Byte0 where x is the value to replace
  • FIX - #if defined() not checking to see if value previously defined. This should now work OK.

3rd October 2010 - 2.2.0.4

  • FIX - AddressOf() not moving the full 24 bit address into longword variable. This should now work OK.
  • FIX - Corrected comment block with quote problem, introduced in previous version
  • NEW - Added CheckParam(Value, options) to support macro construction

30th September 2010 - 2.2.0.1

  • FIX - Upper access RAM issues. This should now work OK.
  • FIX - Problem when comparing negative floats. This should now work OK.
  • FIX - Right shift longword >> longword. This should now work OK.
  • FIX - Word = Word - 2048 error. This should now work OK.
  • FIX - Word comparison error. This should now work OK.
  • FIX - Problem with for loop when INDEX is signed and STEP is constant negative. This should now work OK.
  • FIX - Problem with "M-1_U01 not found" found error for bits or boolean declarations. This should now work OK.
  • FIX - Problem with string arrays, if any string greater than 70 chars. This should now work OK.
  • FIX - 'prototype' declaration error. This should now work OK.
  • NEW - This version of the compiler introduces compiler macros. I have released it as a 'working BETA'. That is, everything works OK but I would prefer a little more using testing before it gets an official release. I will be posting some articles on using macros soon - but if you have any questions in the meantime, please feel free to post your questions on the forum.

18th May 2009 - 2.1.0.2

  • FIX - Problem with 'system file not found' error for console application in MPLAB IDE. This should now work OK.

1st October 2008 - 2.1.0.1

  • FIX - Problem with 16 bit signed multiply. This should now work OK.

18th June 2008 - 2.1.0.0

  • NEW - ICD and simulation support through COFF file generation. See here for more information on using ICD in MPLAB.
  • NEW - Optimised bit assignments when passed by reference
  • NEW - Added support for ORG_RESET and ORG_PROGRAM
  • NEW - Added VECTOR_ISR_LO and VECTOR_ISR_HI to enable remapping of interrupt vectors
  • NEW - Intermediate Debug File (IDF). Generates *.idf (intermediate debug file).
  • NEW - Changed select...case to support 'expression' rather than just 'constant expression'
  • NEW - If config wdt = off, clearWDT code for system calls (Delayms etc) is linked in if #option WDT = true
  • NEW - You can now associate a *.sfp file with the IDE, which will open the *.bas file named in the project file. Alternatively, you can drag and drop into the IDE
  • FIX - Problem assigning a constant to a float array. This should now work OK.
  • FIX - Passing structure elements that had been passed by reference not working correctly. This should now work OK.
  • FIX - Problems with constant string arrays if the length of each string, including null terminator, is an odd number AND the program accesses one of the string elements using a constant index, for example, Val = ConString(1). This should now work OK...
  • FIX - Problem with "M-1" error not found. This should now work OK.
  • FIX - Problem when passing certain types of boolean expressions by value to a sub or function. For example, Items(Index).Enabled. This should now work OK.
  • FIX - SAVE...RESTORE system allocation problem. This should now work OK.
  • FIX - Problem with bound() generating wrong code for constant arrays. This should now work OK.
  • FIX - Changes made in optimising explorer broke node sorting when expanding. This should now work OK.
  • FIX - Move#II_2424 error. This should now work OK.
  • FIX - Corrected compile exception for expression such as AddressOf(a + 1)
  • FIX - Code generation error for booleans where variable is on both left and right hand side. For example, a = a or b. This should now work OK.
  • FIX - Problem with @ when passing by reference. This should now work OK
  • FIX - Strings getting optimised away for expressions such as txt(0) = txt(1). This should now work OK.
  • FIX - Problem with expressions such as "A" = Str when used in boolean expressions such as "IF "A" = Str OR..." This should now work OK.
  • FIX - Problem with bit expressions when passed by reference. This should now work OK.

Device Support

  • FIX - Access RAM incorrectly set at $80 for 18F4450 and 18F2450. This now corrected

Modules

You should view the module source for information regarding changes and fixes.

  • Updated USBSystem.bas and USBDefs.bas to synchronise with Microchip firmware version 1.3. 18F2450 and 18F4450 USB now working correctly.
  • Updated Convert.bas to workaround ISIS bug
  • Updated USART and USART2 modules to account for Microchip silicon error
  • Updated SUART module
  • Updated Graphics.bas
  • Updated FixedFont.bas

2nd October 2007 - 2.0.2.0

Compiler and IDE

  • NEW - Optimised code for Input(), Output(), High(), Low() and Toggle() for ports passed by reference.
  • NEW - Allow register 'AsChar'.
  • NEW - Added union keyword
  • NEW - Added new pre-compiler function defined()
  • NEW - Allows '0' (nil) to be passed by reference.
  • NEW - Can now calculate constant string address, for example @"hello"
  • NEW - Can obtain address of structure variables when held in an array. For example, @Nodes(Index).Val
  • FIX - Problems with expressions such as MySub(Array(Index).Value - 10) not generating the correct code. This should now work OK.
  • FIX -Pre-processor generating error for include file when contained in a block that is disabled. This should now work OK.
  • FIX - Problem with expressions such as Value = NOT BitOf(PORT). This should now work OK
  • FIX - Problem assigning constant arrays with element 1, 2 or 4. This should now work OK.
  • FIX - Added check against errors to prevent exception being generated when trying to generate intermediate code **very rare situation** but noted on the forum
  • FIX - constant expressions such as QUOTE_CONST + "Hello" was removing the single quote - this should now work OK.
  • FIX - Problems with expression such as Val = NOT CValue where CValue declared as CValue as byte = 1. Negation was being performed on a single bit rather than 8. This should now work OK
  • FIX - Problems with expressions such as Str = CStr(Index) + " " where CSTR is a constant arrays of strings. This should now work OK.

14th August 2007 - 2.0.1.0

Compiler and IDE

  • NEW - Support for 32 bit code address (using @). Note that the compiler still uses 16 bits when passing by reference.
  • NEW - Users can now assign shortcuts to plugins. Right click on the toolbar area and select 'Customise Plugins...'
  • NEW - Support for _ProjectVersion, _ProjectVersionStr, _CompilerVersion and _CompilerVersionStr
  • NEW - Support for const dereferencing in declarations, for example, const Value = USART.br19200
  • NEW - Support for arrays of events
  • NEW - Support for array types. For example, TYPE TArray(10) = byte
  • NEW - Typed array parameters (byref pArray() as TArray) do not now use runtime passing of bounds and string bounds
  • NEW - Support for WITH statement
  • NEW - If 'an included' file is equal to the source program filename, then the compiler does not try and link it in and continues searching library folders
  • NEW - Added support for 'prototypes', allowing forward declarations.
  • NEW - Support for plugin get includes.
  • FIX - EEPROM errors not jumping to the correct module. This should now work OK.
  • FIX - Exception being generated when calculating address of sub. This should now work OK.
  • FIX - Error when passing an array element of TEvent to TEvent param. This should now work OK.
  • FIX - Duplicate 'end proc' label generation error. This should now work OK.
  • FIX - Inc and Dec not working correctly when value passed by reference. This should now work OK.
  • FIX - Problem with for loop corrupting stack. This should now work OK.
  • FIX - Array of event and word generating error for overloaded routines. This should now work OK.
  • FIX - Explorer window prevents a single prototype item being displayed as 'overloaded'. This should now work OK.
  • FIX - Problem passing event pointers to subs and functions. This should now work OK.
  • FIX - Expression such as 'const minimum = @SB_SV7' creating exception - this should now work OK.
  • FIX - Problem with expression such as Result = Str(0) + Str(1) generating an error - this should now work OK.
  • FIX - Type Value = string(n) where error was being generated for dimensioned strings. This should now work OK.
  • FIX - Calculation for bit array size was incorrect when passing byref. This should now work OK.
  • FIX - Previous for next loop was executing when 'count' was decremented elsewhere, giving a 'list out of bounds'. This should now work OK.

Additional Device Support

18F1230, 18F1330, 18F2423, 18F2458, 18F2523, 18F2553, 18F2685, 18F4423, 18F4458, 18F4523, 18F4553, 18F4682, 18F63J11, 18F63J90, 18F64J11, 18F64J90, 18F65J11, 18F65J50, 18F65J90, 18F66J11, 18F66J16, 18F66J50, 18F66J55, 18F66J60, 18F66J65, 18F67J11, 18F67J50, 18F67J60, 18F83J11, 18F83J90, 18F84J11, 18F84J90, 18F85J11, 18F85J50, 18F85J90, 18F86J11, 18F86J16, 18F86J50, 18F86J55, 18F86J60, 18F86J65, 18F87J11, 18F87J50, 18F87J60, 18F96J60, 18F96J65 and 18F97J60

Modules

You should view the module source for information regarding changes and fixes.

  • Changes to fonts and S1D15G00 driver to support new x font format.
  • Updated LCD.bas
  • Updated SPI.bas and SPI2.bas
  • Updated USART.bas and USART2.bas
  • Updated SUART.bas
  • Added Project.bas