vbcc 6502 Release 5

This is a port of the vbcc compiler to the 6502 architecture. It
contains a compiler, assembler, linker and a port of a C Library for
the C64, C128, C16, VIC20, PET, NES, SNES, Atari 8bit, BBC Micro/Master,
MEGA65, Apple I, Apple II, Oric Atmos and Commander X16.

A few of the good things:

- compiler is under active development
- supports C99 (variable-length arrays, designated initializers etc.)
- generates optimized code (see dhrystones in sample directory)
- supports banked memory and far-pointers
- efficient floating point support based on MSBASIC code
- (limited) floating point support based on Steve Wozniaks code
- (pretty good) 32/64bit IEEE floating point support based on SANE
- support for 65C02 extensions
- support for CSG65CE02 extensions
- support for MEGA65 extensions
- support for writing interrupt handlers
- attributes for putting variables into zero page
- supports stack-frames > 256 bytes
- supports file I/O on selected targets

On the bad side, the C library is currently only partially optimized
for the 6502 and may be too big for many applications.

So far, speed of the generated code was the main concern. Code size
still needs some optimizations. An experimental code compressor is
included that can find common code sequences and outline them to
subroutines. When comparing code size it is important to leave out
the C library which can add huge overhead.

This archive contains binaries for Windows and Linux x86 (statically
linked). A sample directory with a few small test cases and some
nice NES demos is also included.

To use the compiler on Windows:

  set VBCC=<path-to-vbcc-dir>
  set PATH=%VBCC%\bin;%PATH%

On Linux, use something like:

  export VBCC=<path-to-vbcc-dir>
  export PATH=$VBCC/bin:$PATH

Compiling works pretty much like most compilers, e.g.:

  vc file.c -o binary

When using floating point, link with the math library:

  vc file.c -lm -o binary

For recommended MSBASIC floating point, link with -lms4/-lms5 and
use -msfp4/-msfp5 (see the documentation for more details and
options to use ROM routines on selected targets):

  vc file.c -msfp4 -lms4 -o binary

For IEEE floating point, link with -lmieee and use -ieee:

  vc file.c -ieee -lmieee -o binary

Choose a different target confguration with +<cfg>:

  vc +c64 file.c -o file
  vc +c128 file.c -o file
  vc +c16 file.c -o file
  vc +vic20 file.c -o file
  vc +pet file.c -o file     
  vc +nes file.c -o file.nes
  vc +atari file.c -o file.com
  vc +bbc file.c -o file
  vc +m65 file.c -o file
  vc +atmos file.c -o file.tap
  vc +x16 file.c -o file
  vc +apple1 file.c -o file.txt
  vc +apple2 file.c -o file
  vc +snes6502 file.c -o file.bin


Further information on vbcc can be found on

  http://www.compilers.de/vbcc

and in the vbcc.pdf included here. Apart from the general sections on
the compiler, be sure to have a look at the ones on the 6502 backend
and the 6502/C64, 6502/NES, 6502/Atari, 6502/BBC, 6502/MEGA65, 6502/Atmos,
6502/Apple I, 6502/Apple II, 6502/SNES, or 6502/X16 part of the C library.


LEGAL

Please consult the vbcc.pdf regarding terms of usage.


For questions, results etc., reach me at: vb@compilers.de


Volker Barthelmann

Changes since r4p2:
- much faster floating point library based on MSBASIC code
- option to use routines from Basic ROM on selected targets
  (VIC-20, C16, PET, ATMOS)
- pretty complete set of C99 math functions for wozfp, IEEE and MSBASIC
- slightly improved code generation for IEEE
- new versions of vasm and vlink
- vc frontend can pass command line options through to vlink
- some config settings like stack size can be specified on command line
- new VIC-20 config that moves the code to higher memory (for hires mode)
- a few code improvements
- a few bug fixes


Changes since r4p1:
- new target VIC20
- new target C16

Changes since r4:
- fixed sprintf

Changes since r3p3:
- several bug fixes and code improvements
- small library improvements
- updated compiler core
- updated vasm
- updated vlink
- new target Apple I
- new target Apple II (consider vbcc65816 for IIgs)
- new target SNES (better use vbcc65816 version)
- automated banking for Commander X16
- files I/O for Commander X16
- clock() support for PET

Changes since r3p2:
- add re-entrant option +atmosr for Oric/Atmos
- add raw-binary option +atmosb for Oric/Atmos
- add argc/argv support for Oric/Atmos
- updated vlink (use uppercase names for oricmc)

Changes since r3p1:
- new target Oric/Atmos
- updated vlink (needed for Oric tape files)

Changes since r3:
- added new target C128
- adapted config files to work with spaces in paths

Major Changes since r2b2:
- several bug fixes
- improved code generation
- linker mask optimizations to reduce overhead of
  some library functions (still much room for
  improvement)
- improved attribute checks for banking
- C64 new features:
  - stdio functions allow file access on
    1541 compatible drives
- MEGA65 new features:
  - free license for commercial usage
  - code generator uses 32bit extensions
  - code generator uses HW multiplier
  - full automated banking support
  - ROM-less library enabling full use of the entire RAM
  - stdio functions allow reading of files on SD card
- BBC new features:
  - stdio functions allow file access
  - full automated banking support for systems
    with sideways RAM
  - support for command line arguments
  - configuration for clean return after exit
- CBM PET new features:
  - added as new target

Changes since r2b1:
- several bug fixes
- few code generation improvements
- new command line option -nox (for debugging)

Changes since r1:
- new target: MEGA65 (native mode, some banking support)
- new target: Commander X16 (thanks András Péteri)
- new options -prefer-statics/-force-statics
  (allocate local variables in static memory rather
  than on the stack)
- new option -range-opt
  (first implementation of some range-based optimizations 
  changing induction variables to smaller types)
- added support for o65 object file format
- added support for Oric target format
- better use of x register
- improved cross-module function-inlining
- IEEE math library works with 65c02
- several code generation improvements
- fixed several bugs
- slightly reworked examples

Changes since beta patchlevel e:
- new target: bbc micro/master
- support for 65C02
- C99 mode is now the default, -c89 selects C89
- several bug fixes
- small code improvements

Changes for patchlevel e:
- fixed some register clobbering
- updated atari target files according to forum discussion
- fixed C64 reentrant startup code
- fixed NES initialization code

Changes for patchlevel d:
- fixed bugs regarding inline memcpy
- minor improvement regarding volatile
- fixed config files regarding -vv and -nostdlib

Changes for patchlevel c:
- fixed bug with const memcpy and absolute addresses
- fixed a case of incorrect cmp #0 elimination
- disabled peephole optimization on inline assembly
- adapted const memcpy parameters
- fixed volatile bug

Changes for patchlevel b:
- fixed bug with missing volatile barrier
- fixed bug with optimized memcpy with constant pointers
- improved __interrupt handling

Changes for patchlevel a:
- fixed code path with missing clc before adc

Major changes since Alpha 2:

- first version of an Atari 8bit target (Atari)
- configuration for running banked code with REU (C64)
- configuration for TxROM mapper (NES)
- some speed and size optimizations of the C library
  (thanks to Frank Wille) => up to 234 dhrystones/s on C64
- chars are unsigned by default for slightly better code
- return values of banked function calls work now
- setjmp/longjmp added
- new option -depobj to fix problems with -deps
- zpage now supports multiple arguments (vasm)
- some support for mixing source and assembly with -g
- a few bug fixes
- updated/improved documentation

Major changes since Alpha 1:

- fixed some bugs
- added NES target including lazyNES library (NES)
  (thanks to Matthias "lazycow" Bock)
- added support for banked memory and far pointers
- added 32/64bit IEEE compliant floating point based on SANE
  (thanks to Andy Werner)
- added argv handling (C64)  
  (thanks to Stefan Haubenthal)
- improved code generation for larger types
- added config for re-runnable programs (C64)
- more examples/demos
