Skip to content

Releases: tt1542/BASCOMP

BASCOMP 3.0

Choose a tag to compare

@tt1542 tt1542 released this 04 Sep 10:58
35e4648

What's new in 3.0

Welcome to BASCOMP 3.0! This major release expands the supported BASIC language while improving parser robustness, runtime safety and QBasic-style source compatibility. Much code has been rewritten and all tool chain executables are now faster and more reliable.

The BASCOMP.BAS main compiler code was transformed to be in QB mode. This should provide for much better readibility. At the same time, documentation in BASCOMP and RUNTIME was updated.

Extended control statements

DO/LOOP is now supported, including WHILE and UNTIL conditions at either end of the loop. New exit statements include EXIT DO, EXIT WHILE, EXIT FOR and EXIT SELECT. ENDIF is accepted as an alternative spelling of END IF. FOR will accept variables as input for the main running variable as well as for STEP.

More stable boolean conditions

Boolean expressions now support nested parenthesized groups, repeated NOT, and combinations of AND and OR. TRUE and FALSE are also available as numeric constants.

Extended SELECT CASE

SELECT CASE now works with both numeric and string expressions. CASE clauses may contain multiple comma-separated alternatives, and CASE ELSE and EXIT SELECT are supported.

Improved arrays and strings

Numeric and dynamic string arrays can now be released with ERASE. Array allocation and replacement are safer, including automatic cleanup of previously allocated storage. String expressions and nested string functions have also received substantial parser and context-handling improvements.

Additional conversion functions

OCT$() and BIN$() complement the existing HEX$() function. ASC() now safely returns zero for an empty string, and the three-argument form of INSTR() correctly handles the full 16-bit start value.

See the wiki page for the complete list: https://github.com/tt1542/BASCOMP/wiki/Supported-functions-and-statements.

BASCOMP 2.2

Choose a tag to compare

@tt1542 tt1542 released this 19 Jun 11:50
35e4648

What’s New in 2.2

Welcome to another release of BASCOMP! The compiler has been further optimized. Binary size stays at around 63 KB, but more functions are available and compiling/assembling speed of the toolchain has been improved.

Toolchain performance improved

BASM is now noticeably faster due to an optimization in phase 1. This improves the overall build experience, especially when repeatedly compiling larger BASCOMP-generated assembler sources.

Location/path awareness

BASCOMP now supports and uses the PROGDIR$ directive, returning the working path of the program that is currently being executed. This specifically enables BASCOMP to be called from various locations within your local file system.

Constant folding

BASCOMP will now try to fold pure numerical expressions (like 2+(3-4)*8) and output just the result. This can save several dozen to hundreds of bytes if you use mathematical formulas. Note that BASCOMP is still bound to integer numbers (no floating point processing).

Experimental support for quitting programs using Ctrl-C

Breaking routines have been added and will be involved during FOR/WHILE-Loops and INPUT$/INKEY$. This will enable you to quit running programs by using Ctrl-C under most circumstances. Mind that you can still program unquittable endless loops like: "10 GOTO 10".

Updated supported language features

See the wiki page for details: Supported functions and statements Notably, the following items have been added:

New string-producing functions

BASCOMP 2.2 adds support for additional string-producing functions:

  • HEX$(number), converting a 16-bit value to uppercase hexadecimal text without leading zeroes.
  • SPACE$(count), creating a string containing spaces.
  • STRING$(count, charCode), creating a repeated-character string.
    These extend the existing string expression support and are handled through the runtime string helper routines.

Improved CIRCLE support

CIRCLE has been extended with an optional aspect parameter. This allows drawing aspect-scaled ellipses in addition to ordinary outline circles. Internally, an aspect value of 256 represents a 1.0 scaling factor.

END now supports an optional errorlevel

END can now be used with an optional numeric expression, such as "END 1" .Without an argument, END terminates the program normally. With an argument, the value is passed as the DOS program exit code ("ERRORLEVEL").

BASCOMP 2.1

Choose a tag to compare

@tt1542 tt1542 released this 07 Jun 19:34
2666ba1

What’s New in 2.1

Toolchain and compiler strongly optimized

The whole toolchain has been reworked and optimized so that there is more space for features in the compiler. Compiler binary remains at about 64k in size. The compiler itself has grown by 468 lines or 16.641 Bytes (+17.5%).

New functions, statements etc.

See the wiki page for details: Supported functions and statements

New/improved data handling

Added support for DATAB, DATA, READ, RESTORE, and CALLDATA, including numeric/string data handling and generated data segment management.

Extended file and directory support

Added CHDIR, MKDIR, RMDIR, FILES, GET, and PUT, with improved argument parsing and runtime request handling.

Improved external string array support

XALLOC, XGET$, XSET, and XFREE handling has been expanded, including better context preservation and memory-management integration. In the future, notation for external string arrays will be more compatible towards QBasic standards.

Improved hardware and DOS integration

System-level commands and functions such as DEF SEG, PEEK, POKE, INP, OUT, and CALLINT have been extended or refined.

Improved graphics support

Graphics-related commands including SCREEN, PSET, LINE, and CIRCLE have improved parsing and option handling, including color and box/fill variants.

Improved random number initialization

RANDOMIZE now supports TIMER, TIMER(), and numeric expressions, with QuickBASIC-compatible RANDOMIZE TIMER behavior.

Improved context and stack safety

Numeric, string, source, expression, string-function, and THEN/ELSE context stacks have clearer limits and better preservation/restoration logic.

Improved error handling and diagnostics

Error categories and reporting were refined for syntax errors, FOR errors, bad line numbers, missing parentheses/quotes, type mismatches, internal errors, and IF errors.

Bug fixes, general

FOR target size now supports variables.

BASCOMP 2.0

Choose a tag to compare

@tt1542 tt1542 released this 31 May 16:45
289927f

Initial public release.

BASCOMP 2.0 is a traditional single-pass compiler, taking BASIC files in different layouts (traditional line-numbers or QB compatible mode) and creating NASM compatible assembler files.
The postprocessing ASMPACK executable optimizes the generated files, providing for a 30-percent decrease in binary size.
The resulting files can then be processed by either NASM (creating 386+ code) or using the provided BASM specialized assembler (creates 8086 compatible code).

The compiler can compile itself. All sources are included.

Usage

  • Extract all files into the same directory.
  • For compiling/building a .BAS file, use "build filename" (no extension)
  • You should end up with a .COM file of the same name.
  • For recompiling the compiler, use the "bn" batch file (no parameters)

Examples included

  • PI.BAS - calculate up to 200 digits of PI (without using floating point arithmetic!)
  • HEXDUMP.BAS - show a hexdump of a given file
  • TIMEIT.BAS - show the totel time an external program needs to run (used for the build scripts)
  • LZSENC.BAS / LZSDEC.BAS - examples of using primitive compression/decompression algorithms with BASCOMP
  • VIDDEM.BAS - demonstrating PEEK/POKE functions using video memory (color graphic adapters)
  • RENUMB.BAS - in case you run out of line numbers/need a renumbering of your BASIC code, this tool is for you
  • CONV2QB.BAS - changes traditional BASIC code with line numbers into the more readable QB format