#+SETUPFILE: ~/.emacs.d/org-styles/html/darksun.theme #+TITLE: BASIC applications collection #+LANGUAGE: en #+LATEX_HEADER: \usepackage[margin=1.0in]{geometry} #+LATEX_HEADER: \usepackage{parskip} #+LATEX_HEADER: \usepackage[none]{hyphenat} #+OPTIONS: H:20 num:20 #+OPTIONS: author:nil #+begin_export html #+end_export * Overview This collection contains lots of applications: - [[id:3587240c-1d50-478d-b850-04ebc8dc63c7][Miscellaneous]] - [[id:ebafd8a3-54d4-4834-a03d-a942b535a82f][2D Graphics]] - [[id:63fd5d58-9bce-4c0a-99d4-ed2d025258f0][3D Graphics]] - [[id:aa195f33-6d69-48ff-9af5-3f761a51dcb2][Games]] I wrote them at around year 2000, mostly in QBasic. * 2D GFX :PROPERTIES: :ID: ebafd8a3-54d4-4834-a03d-a942b535a82f :END: ** Fractals *Fractal of circles* #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:2D GFX/Fractals/fractal circles.bas][file:2D%20GFX/Fractals/fractal%20circles.png]] [[file:2D%20GFX/Fractals/fractal%20circles.bas][Source code]] *Fractal of squares* #+begin_export html
#+end_export [[file:2D%20GFX/Fractals/fractal%20squares.bas][Source code]] *Fractal of trees* #+begin_export html
#+end_export [[file:2D%20GFX/Fractals/fractal%20trees.bas][Source code]] ** 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. #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:2D%20GFX/Spirals/index.html][file:2D%20GFX/Spirals/logo.png]] [[file:2D%20GFX/Spirals/index.html][Read more]] ** Animations Collection of various 2D animations. Good for demonstrating various algorithms and getting fun looking results quite easily. #+begin_export html #+end_export [[file:2D%20GFX/Animations/index.html][Read more]] * 3D GFX :PROPERTIES: :ID: 63fd5d58-9bce-4c0a-99d4-ed2d025258f0 :END: ** 3D Synthezier Parses scene definition language and creates 3D world based on it. Result will be in a [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj file]], witch can be then visualized using external renderer. See directory: : 3D GFX/3D Synthetizer/ #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:3D%20GFX/3D%20Synthezier/doc/index.html][file:3D%20GFX/3D%20Synthezier/doc/hexagonal%20city,%202.jpeg]] [[file:3D%20GFX/3D%20Synthezier/doc/index.html][Read more]] ** Miscellaneous *Rotating exclamation mark* Wireframe 3D model of a rotating exclamation mark. #+begin_export html
#+end_export [[file:3D%20GFX/!.bas][Source code]] *Pointcloud 3D bouncing ball* Calculates the pointcloud sphere and bounces it on screen. #+begin_export html
#+end_export [[file:3D%20GFX/3D%20ball.bas][Source code]] *3D curved surface* 3D model of a curved and shaded surface. #+begin_export html
#+end_export [[file:3D%20GFX/3D%20land.bas][Source code]] *3D game of life animation* Animation that displays game of life on dynamically deformed 2D surface placed in 3D world. #+begin_export html
#+end_export [[file:3D%20GFX/3D%20life.bas][Source code]] *3D text in a room* Wireframe 3D text hanging in a wireframe 3D room. User can look and fly around in all directions. #+begin_export html
#+end_export [[file:3D%20GFX/3D%20text.bas][Source code]] *3D bouncing cubes on grid floor* 3D wireframe cubes bouncing on a grid floor, creating an immersive and dynamic visual effect. #+begin_export html
#+end_export [[file:3D%20GFX/bouncing%20cubes.bas][Source code]] *Attracted particles* 3D simulation of particles attracted to each other. When particles get too close, stronger repulsive force takes over. There is also friction. Eventually after some bouncing, particles settle in equilibrium state. #+begin_export html
#+end_export [[file:3D%20GFX/gravity%20particles.bas][Source code]] *Matrix math for rotation in 3D space* Instead of combining simple 2D rotors, pixels in this 3D space are rotated by using matrix multiplications. #+begin_export html
#+end_export [[file:3D%20GFX/matrix%20math.bas][Source code]] *Rocket simulator* Attempt to simulate rocket taking off from the surface of the earth and flying into space. #+begin_export html
#+end_export [[file:3D%20GFX/rocket%20simulator.bas][Source code]] *Screensaver to display animation of flying through the star field* #+begin_export html
#+end_export [[file:3D%20GFX/stars.bas][Source code]] *Tank animation* Animated tank driving through the bridge back and forward. User can look and fly around in all directions. #+begin_export html
#+end_export [[file:3D%20GFX/tank.bas][Source code]] *tiled room* Room with some tiles on the wall and on the floor. User can freely fly around. #+begin_export html
#+end_export [[file:3D%20GFX/tiled%20room.bas][Source code]] * Misc :PROPERTIES: :ID: 3587240c-1d50-478d-b850-04ebc8dc63c7 :END: * Games :PROPERTIES: :ID: aa195f33-6d69-48ff-9af5-3f761a51dcb2 :END: ** 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. #+begin_export html
#+end_export [[file:Games/Worm/worm.bas][Source code]] Levels are stored in [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=tree;f=Games/Worm;h=644d30adafb2621f34f6d2f3e43e026084092f60;hb=HEAD]['lvl' files]] that are directly editable using text editor. ** 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. [[file:Games/Checkers 2/checkers2.bas][Source code]] #+attr_html: :class responsive-img #+attr_latex: :width 1000px [[file:Games/Checkers 2/checkers2.bas][file:Games/Checkers%202/screenshot.png]] * Download ** Getting the source code Programs author is Svjatoslav Agejenko - Homepage: https://svjatoslav.eu (See also [[https://www.svjatoslav.eu/projects/][other software projects]].) - Email: mailto://svjatoslav@svjatoslav.eu *These programs are free software: released under Creative Commons Zero (CC0) license.* - [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=summary][Browse Git repository online]]. - [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]. - You can clone Git repository using git: : git clone https://www3.svjatoslav.eu/git/qbasicapps.git ** 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 [[https://www.qemu.org/][QEMU]], [[https://www.virtualbox.org/][VirtualBox]] or [[https://www.vmware.com/products/desktop-hypervisor.html][VMware Workstation or Player]]. After creating virtual machine, you need to obtain and install some distribution of DOS like [[https://en.wikipedia.org/wiki/MS-DOS][MS-DOS]] or [[https://www.freedos.org/][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 :: [[https://qb64.com][QB64]] is mostly compatible with Microsoft BASIC variants and can be used too. - [[id:97ea6094-ade6-4c7d-aea9-9874acf9dc86][DOSBox + MS BASIC]] :: Easy to install and good compatibility. *** DOSBox + MS BASIC :PROPERTIES: :ID: 97ea6094-ade6-4c7d-aea9-9874acf9dc86 :END: 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 [[https://en.wikipedia.org/wiki/Volkov_Commander][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 [[id:13c7d873-f1aa-4061-88ac-dc9e43c6303d][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: #+begin_example ├── COPYING ├── index.org ├── QB45 │   ├── QB.EXE │   └── QB.INI ├── run_dosbox.sh ├── (... other repository files and directories) ├── VC.COM ├── VC.EXT └── VC.INI #+end_example *** DOSBox usage tips :PROPERTIES: :ID: 13c7d873-f1aa-4061-88ac-dc9e43c6303d :END: **** 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-.conf 2. Disable scancodes usage: : usescancodes=false 3. Save the changes and restart DOSBox for the configuration to take effect. **** 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-.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. 4. If scaling did not work, set output to opengl: : output=opengl **** 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 **** 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-.conf 2. Edit [cpu] section accordingly: #+begin_src conf [cpu] core=normal cputype=auto cycles=fixed 100000 #+end_src 3. Save the changes and restart DOSBox for the configuration to take effect. ** See also - Programs found in the March 1975 3rd printing of David Ahl's 101 BASIC Computer Games, published by Digital Equipment Corp: https://github.com/maurymarkowitz/101-BASIC-Computer-Games - QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS: https://qb64.com/