B0
Copyright © 2000-2007, Darran Kartaschew
Version History
- 05 May 2005 - v0.0.1
- First alpha - code generation nearly complete. Currently only
generates temp files containing code, (eg doesn't produce code that
can be passed through FASM just yet).
- 07 May 2005 - v0.0.2
- Alpha release - Massive Code cleanup (over 200 lines removed).
No functionality changes.
- 08 May 2005 - v0.0.3
- Alpha release - Now allow for registers/strings to be passed as
parameters for function calls.
Code refactoring removed another 100 lines of code. (current line
count = 1922 lines)
- 08 May 2005 - v0.0.4
- Alpha release - Activated most command line parameters. Only
-i<include> doesn't work.
DEBUG info is now a command line switch, and not automatic. (That
is info to help debug the compiler, and NOT the application)
Increased hash table size to 250,007 hashes. This does mean that
the hash table takes upto 64MB by itself!
Improved Error reporting.
Fixed bug in library nesting.
- 10 May 2005 - v0.0.5
- Alpha release - minor bugfixes
User Source code finalised to be UTF-8 due to limitations with the
current available toolsets. (I've taken the lowest demoninator for
current support, which is UTF-8).
Strings within your applications are now properly UTF-16
encoded.
Immediates can be hexadecimal notation, in addition to decimal
notation.
Global variables now accept multiple values, when
preinitialised.
Procedures now accept immediate values as parameters.
Output options: elf, 0f and flat are now functional.
Include paths now work. Can include up to 255 paths. (from either
the environment variable or the -i command line
operator).
- 16 May 2005 - v0.0.6
- Alpha release - Added rotate operators. (<<< and
>>>)
Added signed MUL, DIV, and MOD operators.
Added signed comparisons, and comparison operators: >=
<=.
Added non-64bit pointer operations.
Added FPU Regsiters (no operators as this stage), and FPU Memory
sizes (m80).
Added workaround for text editors that insert a BOM into the start
of UTF8 encoded text files. (eg Microsoft Notepad). Note: "Use
of a BOM is neither required nor recommended for UTF-8, ..." -
Unicode 4.1 Chap 2.6
Added IF-THEN-ELSE construct!
- 28 May 2005 - v0.0.7
- A bit of a code restructure and refactorisation. (reduced line
count to ~2690 lines before adding FPU handler code). Mainly in
hash_table setup and refactoring to move similar code into separate
functions.
Modified how FP variables will be declared. (Allows for unambigous
fp->int conversions).
Fixed bug in handling IF-THEN-ELSE and WHILE-DO code. (more
correctly, the way blocks are handled).
Added floating point declarations. (Integer declarations only
accept integer or hexadecimal preinitialisation, and FPU
declarations only accept float numbers).
Added floating point comparisons.
Added floating point loads/stores and math operations.
Added floating point stack dec/inc operators.
Fixed register load of pointer into array addressed by register. eg
r1 = &my_array[r2]; now compiles correctly.
Added -! command line option.
- 30 May 2005 - v0.0.8
- Added prefix "_B0_" to all variables and procedures names to
ensure that assembler opcodes can be used in code without
conflicting with the predefined opcodes.
Fixed ELF64 ouput to now be linkable, rather than a plain static
linked executable. (Add extern keyword).
Add new output format elfo to output a linkable file
in ELF format (WARNING: See the manual regarding object file
creation and what type of code is required).
- 08 June 2005 - v0.0.9
- Added basic preparser for allow for basic definitions and
conditional compilation.
Added ability to nest #ifdef and #ifndef
blocks.
Fixed bug, which allowed sourcecode to be processed when not part
of a function, under some circumstances.
- 10 June 2005 - v0.0.10
- Added #undefine keyword.
Started standard library.
Added allowance to use multiple regs, separated by commas for
push and pop keywords.
Fixed bug in proc definitions (regarding destroying the previous
local label definitions).
- 25 June 2005 - v0.0.11
- Source code reorganisation
Clean up code to gain better ANSI C99 compliance
Added checks for VC++ 2005 (stops emitting warnings on what M$
consider are deprecated calls).
Compiles under gcc 3.3 correctly (tested within INTERIX
environment).
- 20 July 2005 - v0.0.12
- Added initial support structures, however still lots to do.
Fixed bug when producing elf object files (exporting local
variables now fixed).
Fixed bug in stack allocation for called procedures/functions.
Fixed bug in string length calculations.
Fixed bugs in unicode conversion and linux stdlibs. (Both should be
considered incomplete at this stage).
Added 2 linux examples. le.b0 and
le2.b0.
Development environment moved to CRUX v2.1 - (AMD64).
Source code compiles cleanly on:
- Windows using VC++2003 and VC++2005.
- Interix (Microsoft Services for Unix) using gcc 3.3.
- (Linux) CRUX v2.1 (AMD64) using gcc 3.4.3. (Examples tested
within this environment).
Man page added to distro for *nix based systems.
- 15 August 2005 - v0.0.13
- Structures have been added. (Generated code is somewhat sloppy
but works correctly, I plan to improve the code over the next few
releases).
Fixed bug in ELF64 object file creation. (Fix export of main()
correctly and adjust section flags for data section).
Fixed improper generation of "mov mem64, imm64" which
doesn't exist. Fasm will change it to "mov mem64,
imm32" if the immediate is smaller than 32bits, else
generate error if immediate is larger.
Added jmp, call, and ret
keywords.
Tested with fasm v1.64!
Modified way that variables are handled within the compiler,
resulting in slight speed up.
- 15 October 2005 - v0.0.14
- Improved address generation code for variables.
Fixed bug in structure declarations, (relates to the way the close
block token was handled).
Updated and corrected User Manual.
Added section in Makefile to generate PDF manual from HTML source,
(requires html2ps and ghostscript).
Improved handled of uninitialised data and generation of bss.
Added in and out keywords.
Corrected bug, when handling included files. (now saves and
restores current char in file before loading new file).
Fixed up source line calculations when aborting on error. (should
now be accurate, unless you use CR (U+000dh) as the line break, in which case
line count won't mean squat - Damn Mac's. Well at least it works on
Windows and *nix).
This release took a little longer, due to having a personal
life.
Corrected bug when using multiply libraries embedded in each other.
(classic off-by-one error).
Reorganised source tree and Makefile (*nix systems).
Added ability to use zero-offset structures. (similar to the
virtual keyword in fasm).
- 25 October 2005 - v0.0.15
- The Windows x64 release! (PE64 is now available as an output
format).
Extended 'extern' keyword for PE64 support.
- 09 January 2006 - v0.0.16
- GTK v1.2 and GTK v2.0 examples provided for Linux (same app,
just using different GTK versions).
Partial Linux Syscall wrapper library. (Linux only).
Added ability to encode strings as m8. These are
encoded as UTF-8 in the asm output file.
Added a CGI example. (Yes, a CGI for web applications! see
/examples/cgi1.b0)
Fixed bug where on a comment on the last line would cause the
compiler into an endless loop.
Couple of other bugfixes, regarding end-of-line and end-of-file
markers.
Fixed bug when generating UTF8 strings.
Added ability to jump based on the following CPU Flags: Parity,
Carry, Overflow, Sign and Zero flags.
Included b0.xml style sheet for jEdit users.
(Copy into the modes directory and add the item to the catalogue
file).
And Merry Christmas and a Happy New Year to all!
- 09 January 2006 - v0.0.16 - IA32
- A one time only port of b0 to produce IA-32 (aka i386)
applications for Linux and Windows. Extract the main distribution,
and goto ./src/ia32/. See the README file inclosed.
- 16 January 2006 - v0.0.17
- Merged IA32 and AMD64 builds into single source file. Only
requires a define to be added to build the IA32 version, eg -Di386
at the CLI.
Modified the while to produce slightly better
code.
Modified output in regards to error strings.
Modified demo le5.b0 to also output argc
and argv variables.
Added COMPILER_OPTION keyword to let the user set the
output format and string type from within the source file.
Updated *nix man file.
Added ability to change the string format (UTF8/UTF16) on the fly
within the source code file, by using the
COMPILER_OPTION keyword.
Added additional buffer overflow checks on all structures and
arrays...
- 14 February 2006 - v0.0.18
- Added check for main(); when producing ELF executables.
Started rewriting the b0 compiler in b0.
Fixed bug in preprocessor, which was turning '-' characters within
the string to a subtract token.
Fixed bug in preprocessor, which will skip #endif if directly
proceeded by a } and set to not generate code (as part of a
#ifdef/#ifndef condition).
Removed 0F and Flat output formats.
Fixed bug in call procedure routine when dealing with PE
executables.
Fixed bug on performing signed compliment on floating point
registers.
Fixed bug in preprocesser when dealing with 0 offset
structures.
Fixed bug in call procedure when processing arguments. (It was
possible to run off the token stack).
- 20 April 2006 - v0.0.19
- Modified ELF output for updates in fasm 1.65.13. If using
v0.0.19, I HIGHLY recommend that you upgrade to fasm to at least
v1.65.13.
Added DISABLESTACKFRAME and
ENABLESTACKFRAME compiler option directives.
(Enables/Disables the creation of stack frames on function
calls).
b0 compiler written in b0 is now available as an ELFO object
file to be linked with libc**. (Win64 and Linux native versions
still be tested). ** There are still a few bugs in the
preprocessor, in relation to floating point definitions. If you
avoid floating point definitions, you should be okay. Problems
are in atof(); and ftoa();
Added ability to have multiple -i command line
arguments.
Added ability to load immediate (dword integer only) when using
global pointers. eg [r15+r14*8] = -1;
When compiling with MSVC++ path separator is ";" else
it's ":" (for *nix systems).
Added ability to load a register with the calculation of a
complex pointer. (eg r0 = &[r0+r0*4]; maps to
the lea assembler mnemonic or lea r0,
[r0+r0*4]).
Fixed bug in NOT and NEG operations.
Fixed bug when using global pointers. ({reg} =
[{reg}-{immediate}] no longer generates an error).
Fixed bug IN/OUT instructions.
Fixed bug in while({FPU_REG}){ }; code sequence.
Included ability to handle 1.0e10 formatted floating point
numbers, (previously restricted to straight 1.0 format, that
is no exponent could previously be defined).
Included ability to use the shift operator with the preprocessor
only when dealing with integer values.
Note: This will be the final C version. All code maintenance will
be performed on the b0 version of the compiler.
- 30 July 07 - v0.0.20
- Yep, that's right over a year of development, I guess Real Life™
got in the way.
Linux (18-Jun-06), Windows (17-May-07) and FreeBSD (26-Apr-07)
native versions of the b0 compiler.
Fixed ftoa(); and atof(); functions.
Fixed deeply nested #ifdef/#else/#endif structures. (Under some
circumstances, the #else would reactive code generation when it
shouldn't.
Fixed floating point definitions storage.
Added switch to create Window DLL Files. (-fdll or #COMPILER_OPTION
DLL 'mydll.dll').
Added compiler option to include pre-compiled resource files.
(#COMPILER_OPTION RSRC 'myres.res')
Start optimising compiler for performance (The b0 source version is
roughly 50% larger than the C source version, and processes roughly
65K lines per second (b0 ver) vs. 143K lines per second (C ver) on
my 1.6GHz Opteron 242).
Integer/Float bounds checking added for immediate operations.
Restructed how immediates are handled internally, improving
processing throughput.
- Due to certain factors, the standard library will no longer
be actively developed. If others wish to continue to develop
the standard library, they are more than welcome to do so.
Included b0.lang style sheet for gEdit users
(aka GNOME users).
(Copy into the /usr/X11R6/share/gnome/gtksourceview-1.0/language-specs
directory and add the following x-b0.xml and
b0.xml to the GNOME mime database).
GTK Examples cleaned up (removed all linux dependencies, now build
correctly on FreeBSD as well as Linux).
Added a resource section into the Windows binary, including icons
for the application and *.b0 source files. Registry file in src\rsrc
will add the icon and file associations (done automatically if
you run build install if installing from source, or if
you use the *.msi installation file. (You still need to define
which application to open the file).