BASIC applications collection

Table of Contents

1. Applications

This collection contains lots of toy applications:

  • Games.
  • Graphics tests (2D/3D/4D).
  • Algorithms tests.
  • Utilities.

I wrote those applications mostly more than 20 years ago, mostly in QBasic. Because programs are old, coding style and commenting was often times bad. I'm now using artificial intelligence to revive and modernize them one by one.

Few examples:

1.1. Checkers

Play checkers against the computer with any board size and any amount of caps. Does thinking by recursively testing many possible scenarios with any depth.

Since it is slow QBasic implementation, it isn't practical to play with many caps or big thinking depth, for reasonable responce time.

Source code

screenshot.png

1.2. 2D graphics demos and animations

Collection of various 2D animations. Good for demonstrating various algorithms and getting fun looking results quite easily.

Read more

1.3. Multiplayer game of worms

Game supports up to 5 players. Any amount of those players can be AI controlled. Game has multiple levels. After worms have eaten certain amount of fruits, game advances to the next level. Each worm has limited amount of lives. When worm runs into the wall or another worm, it loses one life.

Source code

Levels are stored in 'lvl' files that are directly editable using text editor.

1.4. Fractals

Fractal of circles

fractal%20circles.png

Source code

Fractal of squares

Source code

Fractal of trees

Source code

1.5. 3D Synthezier

Parses scene definition language and creates 3D world based on it. Result will be in a wavefront obj file, witch can be then visualized using external renderer.

See directory:

graphics/3D/3D Synthezier

hexagonal%20city,%202.jpeg

rectangular%20city,%203.jpeg

Read more

1.6. Spiral series

Small collection of programs that are result of exploratory programming, for fun. It started out from drawing spiral on the screen. Every iteration built upon previous result.

logo.png

Read more

2. Getting the source code

Programs author is Svjatoslav Agejenko

These programs are free software: released under Creative Commons Zero (CC0) license.

3. Installation and Usage

There are various ways to run legacy QBasic applications under Debian GNU/Linux:

Full system virtualization
One way would be to use full system virtualization with QEMU, VirtualBox or VMware Workstation or Player. After creating virtual machine, you need to obtain and install some distribution of DOS like MS-DOS or FreeDOS. Within DOS you can then use either Microsoft QBasic or Microsoft QuickBasic. QBasic is already included in Microsoft DOS by default. QuickBasic is more capable but must be obtained separately.
QB64
QB64 is mostly compatible with Microsoft BASIC variants and can be used too.
DOSBox + MS BASIC
Easy to install and good compatibility.

3.1. DOSBox + MS BASIC

Following tutorial focuses on using DOSBox with original Microsoft QBasic or QuickBasic.

DOSBox is trivial to install and BASIC programs do not need to be copied to virtual drive or operating system to run them. Using original BASIC binaries ensures good compatibility.

Here is suggested installation and usage procedure:

  1. Install DOSBox by running the following command in your terminal:

    sudo apt-get install dosbox
    
  2. Obtain and place a copy of QuickBasic QB.EXE executable binary into directory QB45 within project root directory.

    Optionally obtain Volkov Commander executable VC.COM and place it under project root directory. Volkov Commander simplifies filesystem navigation and running arbitrary BASIC program by selecting it and pressing ENTER key. For this to work, BAS file extension is mapped to BASIC executable within VC.EXT file (already available in the project root directory). In case you are using QBasic instead, feel free to fix VC.EXT to point to appropriate BASIC executable.

  3. Optionally check and apply DOSBox usage tips.
  4. Execute script that is located in the root directory of the repository:

    ./run_dosbox.sh
    
  5. Now project root directory appears as root directory of virtual C: drive. You can navigate around and start programs.

Here is suggested project directory layout with QuickBasic and Volkov Commander installed:

├── COPYING
├── index.org
├── QB45
│   ├── QB.EXE
│   └── QB.INI
├── run_dosbox.sh
├── (... other repository files and directories)
├── VC.COM
├── VC.EXT
└── VC.INI

3.2. DOSBox usage tips

3.2.1. How to change keyboard layout to Dvorak

In case you want to use Dvorak keyboard layout and DOSBox fails to auto-apply it, here is how you can set it manually:

  1. Edit file:

    ~/.dosbox/dosbox-<version>.conf
    
  2. Modify keyboardlayout field as follows

    keyboardlayout=dv103
    
  3. Save the changes and restart DOSBox for the configuration to take effect.

3.2.2. Increase window size

If you have big high-resolution screen, by default DOSBox window could appear small. To make it bigger:

  1. Edit file:

    ~/.dosbox/dosbox-<version>.conf
    
  2. Set windowresolution to either of those values:

    windowresolution=1366x768
    windowresolution=1600x900
    
  3. Save the changes and restart DOSBox for the configuration to take effect.

3.2.3. Exit mouse capture

DOSBox detects when a game uses mouse control. When you click on the screen, it should get locked (confined to the DOSBox window) and work.

To release mouse lock, press:

CTRL-F10

3.2.4. Increase CPU speed for better animation smoothness

Many applications benefit from as fast CPU as possible. Games and animations that require limited frames per second always have their own CPU independent mechanisms for limiting animation speed. So setting CPU as fast as possible within emulator is beneficial.

This is how I accomplished it in DOSBox:

  1. Edit file:

    ~/.dosbox/dosbox-<version>.conf
    
  2. Edit [cpu] section accordingly:

    [cpu]
    core=normal
    cputype=auto
    cycles=fixed 100000
    
  3. Save the changes and restart DOSBox for the configuration to take effect.

Created: 2024-11-26 ti 01:14

Validate