Skip to content

Instantly share code, notes, and snippets.

@nvgrw
Last active August 29, 2015 14:06
Show Gist options
  • Save nvgrw/dad2ccd72e2ce02840ea to your computer and use it in GitHub Desktop.
Save nvgrw/dad2ccd72e2ce02840ea to your computer and use it in GitHub Desktop.
Quarkbox Tutorial (for Windows & Mac)

Quarkbox (for Windows & Mac)

I made a thing. It's called Quarkbox and it allows you to compile and run your TurboPascal programs from the Atom text editor.

It comes bundled with the TurboPascal compiler from borlandc.org, so that's one thing less to worry about.

Benefits over the Blue Window of Death Editor (BWODE)

  • It doesn't suck.
  • It can be extended, infinitely.
  • Open source.
  • You can use your favourite keyboard shortcuts, like ctrl+s and ctrl+v.
  • You can indent text easily.
  • You can have multiple cursors.
  • Spell checking ermahgerd.
  • More here.

In other words: Atom + Quarkbox are infinitely better!

1. Download & Install DOSBox

Windows

Go to the official DOSBox download page and download the Windows version of DOSBox 0.74. The link will be close to the top. Run the installer, making sure that you install DOSBox to the default directory. If you don't, then you will need to tell Quarkbox where DOSBox is located later on.

Mac OS X

Go to the official DOSBox download page and download the Mac OS X version of DOSBox 0.74. Just like the Windows version, the link will be close to the top. Mount the downloaded disk image and drag the DOSBox.app into your /Applications directory. If you can't find this, just click the Finder icon in your Dock, press ⌘⇧G, enter /Applications in the modal that appears and then press ⏎ (Return).

2. Download & Install Atom

Unless you have it installed already.

Windows

On Windows, the process is a little more involved than on Mac.

First, install Chocolatey NuGet. It's a package manager for Windows and is where one can get pre-built versions of Atom. The instructions for downloading and installing are detailed here.

Now you can install Atom. Open the command prompt by pressing Win+R and type choco install Atom. After that, press enter and once Chocolatey has fetched and installed Atom you can close the command prompt.

Mac OS X

On Mac, go to the Atom front page and click the "Downlod For Mac" link. Extract the Atom .zip archive once the download has completed and copy the Atom.app into your /Applications directory.

3. Download and Install Quarkbox

Start Atom and then open the Settings. Click on the "Packages" item in the sidebar. Search for Quarkbox, and install the first package that appears (for reference, the description is "Build and run TurboPascal applications within Atom").

When I update Quarkbox, Atom will notify you and let you download the update. It's quite neat actually.

4. Configuring Quarkbox

Assuming you have restarted Atom, you will now need to configure Quarkbox in order for everything to work. Open the Settings, find Quarkbox in the sidebar and click on it. Alternatively you can also use the search bar.

Image depicting Quarkbox's Settings

In Quarkbox's settings you'll find the "Dos Box Executable" field. Here you specify exactly that. If you are on OS X and your DOSBox.app resides under /Applications, the default value should suffice. There is a default value for Windows, but you need to be running 64-bit Windows and have DOSBox installed to the default directory or you'll have to change this as well.

When entering a path, make sure that it is the full path from the root of the filesystem. On OS X, you will need to link not to the DOSBox.app but to the DOSBox executable inside (usually found in Contents/MacOS/). On Windows you have to link to the DOSBox.exe file.

You can also set whether you want PAUSE to be run after your program finishes execution (so you can debug runtime errors) and enable auto-saving before your program is built.

5. Using Quarkbox

Assuming that you have followed the steps above, Quarkbox should now work.

Open a TurboPascal .PAS file. If the filename contains spaces, these will be replaced by underscores once you build (and the original file will be deleted). DOS has an 8.3 file name restriction, but Quarkbox can largely account for this. If you have two or more files of the same filetype with the identical first 8 characters you might run into problems.

Use these shortcuts to use Quarkbox

  • Build and then run your program: ctrl+alt+o
  • Build your program: ctrl+alt+shift+o
  • Run your program: cmd+ctrl+alt+o

Alternatively you can also access these options under the Packages > Quarkbox menu.

If everything works, DOSBox will launch to compile your program. Should a compilation error occur, Quarkbox will parse the output from TurboPascal and highlight the affected area of your code after alerting the error. Quarkbox may then launch your program if you have chosen the build then run menu option.

6. Pascal and Atom

Atom doesn't support Pascal out of the box so you will probably want to install a Package that adds support for the proper syntax highlighting. To install this package, follow the same sort of process that you did to install Quarkbox, but instead of searching for "Quarkbox", search for "language pascal". The first package is probably what you want, and once installed it will highlight all .PAS files for you.

Inside Quarkbox

Quarkbox is open source! If you can think of any improvements, do open an issue or send a pull request with your changes.

The name "Quarkbox" is a portmanteau between the words "Quark" and "DOSBox". Who would've guessed. Why Quark you ask? Wikipedia states this:

A quark is an elementary particle and a fundamental constituent of matter. Quarks combine to form composite particles called hadrons, the most stable of which are protons and neutrons, the components of atomic nuclei.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment