| CARVIEW |
LWTOOLS
About LWTOOLS
LWTOOLS is a set of cross-development tools for the Motorola 6809 and Hitachi 6309 microprocessors. It supports assembling to raw binaries, CoCo LOADM binaries, and a proprietary object file format for later linking. It also supports macros and file inclusion among other things.
LWTOOLS was born in 2006 when William Astle decided that none of the crossassemblers available at the time supported all the features he wanted to use. After over two years of intermittent development, and three separate releases of LWASM and one separate release of LWLINK, LWTOOLS had it's initial release on January 29, 2009.
You can read the current version of the manual for LWTOOLS online as a single HTML page, multiple HTML pages, or as a PDF.
Support Development/Donate to the Cause
If anyone wishes to support further development of LWTOOLS, I accept PayPal donations to lost@l-w.ca. I also accept bitcoin donations at the following address: 1EcdzmbwuqY4ydBtmyzP58wJywvLUqkGzE. If desired, I can accept USD and CAD by post. Contact me for details. If you have a pet feature you want added to the tools, you might be able to motivate me to implement it for a sufficient bribe.
Building from Source
On a reasonable system, lwtools should build from the source by simply running "make" at the top level of the source directory. The various binaries will be in the lwasm, lwlink, and lwar directories when done. "make install" will install the binaries to /usr/local/bin/.
It is possible to build Windows binaries using mingw or Cygwin (www.cygwin.com).
For Cygwin install GCC or Clang and make, then follow the instructions above.
For mingw, install the complete development system in addition to the C compiler and the basic MSYS system. Then, running under the mingw shell, the same procedure as for reasonable systems above will work. The exe files will be in the directories mentioned above. Note that you can access your "C" drive at /c in mingw which should allow you to find your downloaded lwtools tar archive.
As of LWTOOLS 4.12, projects for building in Visual Studio 2013 or later are provided as a courtesy. Reasonable efforts are made to keep them up to date, however this is not an officially supported configuration.
Third Party Contributions
Various third party contributions are presented here. Third party contributions are provided as is. Any problems with any third party contribution should be directed to the originator of the contributions. For obvious reasons, I cannot provide any support for anything provided by third parties.
Of particular interest to those of you running on Windows are Tormod's windows binaries in contrib/tormod. There are also other contributed Windows binaries in contrib/lw which may be more current. Again, these are provided for your convenience but are not officially supported.
Downloads
The following released versions are available. Please do not report bugs in older releases unless they are present in the latest release. Old releases are provided for archaeological purposes only.
- 2025-04-18: LWTOOLS 4.24. This version is a roll-up release containing a number of source cleanups and bug fixes including some memory leaks and other fixes.
- 2024-08-03: LWTOOLS 4.23. This version fixes a stack corruption bug related to the object file output format. If you have been having random unexplained crashes from lwasm, you definitely want this update. Also comes with the shiny new ability to use a 0b or 0B prefix for binary constants.
- 2023-12-22: LWTOOLS 4.22. This version comes with a couple of useful additions including being able to specify STDIN as the source file using - and the ability to specify an offset and length for includebin. Of some use might be the --no-warn=ifp1 flag to suppress warnings about the use of ifp1. Finally, the default compile optimization flag is reduced to -O2. It seems there are still compilers that actually generate incorrect code under -O3.
- 2023-04-23: LWTOOLS 4.21. This version comes with a couple of bugfixes related to building with certain Windows tools as well as an undefined memory access problem. Updating is recommended.
- 2022-08-17: LWTOOLS 4.20. It is highly recommended that everyone using an older version upgrade to this release. The big change is a fix to avoid relying on undefined memory when deciding whether to register a symbol using the data or code address. Also fix the basic output target to keep linesbelow 249 characters, a fix for numeric entry points in lwlink, and a couple other miscelaneous fixes.
- 2022-01-25: LWTOOLS 4.19. The marquee change this time is fixing a macro expansion bug related to positional parameters specified as {num}. Additionally, lwlink will now not include any bytes for BSS sections when using the raw target. If you were counting on the old behaviour, use the raw2 target. Finally, this release includes a fix for the TFM compatibility instruction sizes being accounted incorrectly.
- 2021-01-19: LWTOOLS 4.18. The usual small collection of bugfixes. In particular, there is a critical fix to cycle count listings for modern systems (bad use of sprintf()) and a fix for building on more modern systems (missing extern).
- 2019-05-05: LWTOOLS 4.17. This release comes with several bug fixes and a new option to output the global symbol table in assembly source format.
- 2018-12-12: LWTOOLS 4.16. The most significant update to this version is the operandsizewarning pragma which will cause warnings to be generated for lines where a smaller addressing mode could be used. Also of use is the new << prefix for index offsets to force 5 bit offset mode.
- 2018-01-07: LWTOOLS 4.15. The most notable updates this time is the ability to provide full filenames to the -l option to lwlink. Also, lwlink, lwasm, and lwar will all behave more sensibily in the face of invalid command line arguments. There are also a few other miscelaneous updates and fixes.
- 2017-04-09: LWTOOLS 4.14.The most important change is that the forwardrefmax pragma is now engaged by default. This will greatly improve assembly times but it does mean that forward references will always use the maximum addressing mode (16 bits) even if a smaller addressing mode will work. Use --pragma=noforwardrefmax to return to the original behaviour. An error related to like term collection in the expression simplifier has also been fixed. If you've had trouble with non-trivial expressions evaluating to the wrong result, this might fix it. It is also now possible to define macros conditionally without getting a parse error on the line with the MACRO directive. This release also has a number of updates to the binutils wrapper scripts for gcc6809 as well as miscelaneous updates to the lwtools binaries themselves.
- 2016-04-17: LWTOOLS 4.13. This release has a number of fixes that will be of interest to people using cycle counting among other things. There are also some fixes to the gcc6809 patch in the extras/ folder which fix a code generation error. The biggest news for this release is "pragma newsource" which allows spaces in operands but as a result requires a ";" to introduce line terminating comments.
- 2015-10-11: LWTOOLS 4.12. This release has a number of improvements overall, including better detection of error situations like byte overflows, bad register lists for psh/pul, cycle count reports, and some Macro-80C compatibility. Some of the fixups for error detection will break code that seemed to be working fine before. That it was working is purely accidental.
- 2015-04-14: LWTOOLS 4.11. This release has a couple of important fixes for code generation. If you were having trouble with INCLUDEBIN or "d,s" addressing, you'll want this release. It also includes SREC output support for lwlink. There is also a new pragma to disable forward reference optimization (forwardrefmax) which may speed up assembly dramatically for large source files where there is little or no benefit to attempting such optimization (where all the direct page references are defined before the code, for instance).
- 2014-04-11: LWTOOLS 4.10. This version has some minor updates for source code compatibility. It also has an important bug fix for the downward growing section support added to lwlink in the previous release. The most notable addition to this release is support for Motorola SREC and Intel Hex output formats.
- 2014-01-10: LWTOOLS 4.9. This version has various bug fixes that may affect code that seemed to be correct before. It now checks for byte overflows for forced 8 bit offset modes relative to index registers or PC. It also has some added linker functionality (notably placing sections from high memory downward).
- 2013-06-13: LWTOOLS 4.8. This version contains various improvements to the build system and some various corrections to some source file formatting and other errors which were causing problems or warnings on some platforms. It also fixes a crash related to noexpand macros. It also forces binary mode when opening files to avoid issues on certain platforms with non-transparent ascii file handling. Also, notably prevents crashing on division by zero in source code. Various other fixes for crash bugs and other fairly specialized problems are also included, including several specific to the os9 target.
- 2013-01-23: LWTOOLS 4.7. This version comes with the usual collection of minor fixes including fixing a problem with [,u] in 6809 only mode. It also has several new features which may be of interest to some.
- 2012-06-10: LWTOOLS 4.6. This version comes with the usual collection of minor fixes. It also fixes an inversion that swapped the meanings of the --6809 and --6309 switches to lwasm. Also of note is that the autobranchlength pragma in lwasm now works much more usefully on forward references.
- LWTOOLS 4.5. This version comes with a raft of minor fixes including a major speedup in resolving forward references which will be most noticeable on large source files. Download the source code.
- LWTOOLS 4.4. This version fixes a critical code generation bug with 16 bit relative branch instructions which was introduced in version 4.3. Download the source code.
- LWTOOLS 4.3. *** Don't use this release--See 4.4 above*** This release fixes several bugs, notably related to building OS9 modules. It also contains a new pragma, autobranchlength, which allows the assembler to decide whether to use a long or short branch as needed for any branch instruction. It also comes with a --define command line switch to allow specifying symbol values on the command line. I do not have a properly functional build environment for Windows so no binaries at this time. If anyone is willing to contribute such, let me know. Download the source code.
- LWTOOLS 4.2. This version fixes a number of memory leaks, an incorrect malloc() size, problems with *pragma and ifdef, and adds a "nolist" pramga to suppress portions of the listing when using --list. It also corrects errors handling &-prefixed decimal constants and %-prefixed binary constants. This version may or may not compile and work properly under Windows. I am informed that some of the fixes have helped. I do not have a properly functional build environment for Windows so no binaries at this time. If anyone is willing to contribute such, let me know. Download the source code.
- LWTOOLS 4.1. This version fixes a couple of code generation errors, one of which affects a relatively uncommon indexed mode. It also has a few functional regressions against the 3.x versions fixed so it should now work as a backend for gcc6809. See the extras/ folder for more information. Download the source code. Sorry, no Windows binaries at this time. I don't have Windows so I can't test Windows builds and given the problems that have occurred with them in the past, I feel it would be a disservice to provide binaries that may or may not work. If anyone with a function Windows build environment (32 or 64 bit) is willing to compile, I'll post the resulting binaries here.
- LWTOOLS 4.0.
A new version of lwtools is out, now freshly freed from autotools hell. This
is the first release after a major reorganization and retooling of the code
to remove dependence on autotools for portability. As such, there may be
bugs. It is, however, capable of assembling Color Basic and Extended Color
Basic correctly. Download the source
code or the win32/win64
binaries. Note that there have been reports of problems with the windows
builds on some systems, notably Windows 7. If someone is willing to take on
the task of maintaining a Windows port of lwtools, please contact me.
Aaron Wolfe has kindly provided these win64 binaries which may work better than the ones in the windows binaries package above. - Older release notices are archived here.
The source code is also available from the project's mercurial repository which can be found at https://lwtools.projects.l-w.ca/hg/.
Note that the project originally used subversion. However, on March 18, 2010, it was switched over to mercurial.
Note also that as of January 19, 2011, the old repository was decommissioned in favour of a new, clean repository. The old repository is available at https://lwtools.projects.l-w.ca/hg-old/ in case anyone wishes to inspect it.
Back to CoCo 3 Stuff.
Last modified Friday, April 18, 2025. I can be contacted at lost@l-w.ca.