Turbo Pascal 2.0 course cover
← Back to Courses
module
2

Setting Up

Introduction

This is the only section with no Pascal in it. By the end of it you will have an Einstein running on your own machine, with Turbo Pascal loaded and showing its menu, and somewhere to keep the programs you write.

Set it up once and it stays out of your way.

If You Have A Real Einstein

Most of this section is about the emulator, and you can pass over it. What you need instead is the course disc on something your Einstein can read - it is a disc image, so that means whatever you already use to put images on your machine.

Use the course disc rather than an old Turbo Pascal disc of your own, even one that says Version 2.00A. Turbo Pascal has to be told what screen and keyboard it is working with, and the course disc's copy has been set up for the Einstein's 40-column screen and its DELETE key. A copy set up for something else can garble the editor, clear away everything a program prints, or make DELETE rub out a whole line. Appendix III says exactly what was changed.

Start the machine with the disc in the drive, and when you have the 0: prompt, pick this section up again at the point where it types TURBO.

Three things are different for you from here on.

  • Lines beginning "In MAME" are not for you. They say where a key is on a modern keyboard. Yours has the Einstein's names on it.
  • "Restart the Einstein" means switch it off and on again, and boot the disc.
  • BREAK may work for you. The course never relies on it, because under the emulator it does nothing.

What You Are Installing

Three pieces, all free.

PieceWhat it does
MAMEThe emulator. Given the right ROM, it behaves like an Einstein.
The Einstein ROMThe machine's own built-in software. MAME cannot be an Einstein without it.
The Turbo Pascal course discA disc image with Turbo Pascal 2.00A on it, set up for the Einstein, the finished Warehouse game, the source of MicroCalc, and room for your own work.

One disc. Turbo Pascal, the game and MicroCalc take 108K of it, and the remaining 80K is yours.

The disc matters more than it looks. Turbo keeps your programs on its disc, so it has to be able to write to it, and MAME will not write to a .dsk disc image. It will write to an .mfi. A .dsk boots perfectly well and then will not keep anything you save - which, since everything you type is going onto that disc, means losing an evening's work. The course disc is an .mfi for that reason.

Installing

These steps cover macOS and Windows. Everything in this course was written and checked on macOS; the Windows steps are written from MAME's own documentation rather than from our own machine, so if something here is wrong or missing, please tell us and we will fix it.

Linux is not written out separately - MAME is in every major distribution's package manager, and from step 2 onwards the Linux instructions are the macOS ones.

1. MAME

On macOS, the easiest way is Homebrew. If you do not already have it, follow the instructions at brew.sh, then:

brew install mame

Check it is there:

mame -version

On Windows, MAME is a download from mamedev.org/release.html. Take the 64-bit binary - mame0289b_x64.exe, or mame0289b_arm64.exe if your PC has an Arm processor. It is a self-extracting archive rather than an installer: run it, choose a folder such as C:\mame, and it unpacks a pile of files including mame.exe.

There is no installer and nothing is added to your Start menu. You work in the folder you unpacked into.

The course is written against MAME 0.289. A later version will almost certainly be fine; if something behaves differently from what a section describes, the version is the first thing to check.

2. The Einstein ROM

It is a file called einstein.zip. Download it from Einstein System ROM (MOS 1.2 & 1.21) on the Downloads page. It goes in a folder called roms.

On macOS, make one in your home folder:

~/roms/einstein.zip

On Windows, MAME already unpacked a roms folder next to mame.exe. Put it there:

C:\mame\roms\einstein.zip

Do not unzip it. MAME wants the .zip exactly as it is.

3. The Disc

Download the Turbo Pascal course disc and put it somewhere you can find again.

On macOS, a folder called einstein in your home folder will do:

~/einstein/turbopascal.mfi

On Windows, next to MAME is simplest:

C:\mame\turbopascal.mfi

Keep a spare copy of it somewhere. Your work is going onto this disc, so a mistake at the keyboard can overwrite something, and a second copy of the file you downloaded costs nothing.

Starting The Machine

One command, and it is the same one every time.

On macOS, in Terminal:

mame -rompath ~/roms einstein -flop1 ~/einstein/turbopascal.mfi -window

On Windows, open a Command Prompt in the folder you unpacked MAME into and type:

mame.exe -rompath roms einstein -flop1 turbopascal.mfi -window

The quickest way to a Command Prompt in the right place is to open the folder in File Explorer, click in the address bar, type cmd and press Enter.

Either way the parts mean the same thing: -rompath says where einstein.zip is, einstein is the machine to be, -flop1 is its first disc drive, and -window keeps it in a window rather than taking over the screen. Keep the -window - without it MAME takes the whole screen, which on a Mac means a new desktop space as well.

It is worth saving that line somewhere - a shell alias on macOS, or a .bat file on Windows - because you are going to run it a lot.

A window opens and the Einstein boots from the disc:

           ***  EINSTEIN  ***

TATUNG/XtalDOS 1.31  DRC   (C) 1985

No File
0:

Take no notice of No File; it appears every time, and nothing comes of it. That 0: is the disc operating system waiting for a command. Turbo Pascal is a program on the disc, and you ask for it by name. Type:

TURBO

and press ENTER. The screen sits still for several seconds while Turbo is read from the disc - under the emulator it is about fifteen - and then it clears and Turbo announces itself:

---------------------------------------
TURBO Pascal system       Version 2.00A
                           CP/M-80, Z80

Copyright (C) 1983,1984 by BORLAND Inc.
---------------------------------------

Terminal: EINSTEIN 40col.



Include error messages (Y/N)?

Check the version. The course disc will always say 2.00A, and EINSTEIN 40col..

The First Question

Turbo can explain its complaints in words or just give them a number, and the words take memory. Press Y - just the key, no ENTER - to have the words. This course always answers Y.

The screen clears again and you have the main menu:

Logged drive: A

Work file:
Main file:

Edit     Compile  Run   Save

eXecute  Dir      Quit  compiler Options


Text:     0 bytes (802A-802A)
Free: 26581 bytes (802B-E800)

>

Turbo Pascal's main menu, just after it has started

This is where you work from. Each word on it is a command, and the capital letter in it is the key that runs it - E to edit, R to run, D for Dir, Q to quit. S3 goes through them. Free: is how much memory is left for your program's text.

Whose Keyboard It Is Now

While the MAME window is in front, your keyboard is the Einstein's. MAME lays the Einstein's keys over yours by position, so a few characters are not where your own keys say they are. S3 deals with that; nothing in this section needs them.

MAME has control keys of its own as well - Esc to quit, F3 to reset - and it starts with them switched off, so that those keys reach the Einstein, which needs them. One key switches them on: forward delete on a Mac (Fn and Backspace on a laptop), and Scroll Lock on Windows according to MAME's documentation. Leave it alone. If Esc ever closes MAME instead of reaching the Einstein, that key has been pressed, and pressing it again puts things back.

To stop the Einstein, close the MAME window. Where the course says restart the Einstein, that means close the window and run the command again.

The Code

There is no program yet. The check that everything works is one command at the menu: D, for Dir. Turbo asks

Dir mask:

and you press ENTER, which means "everything".

Starting from

A fresh boot, TURBO, and Y to the question.

What you should see

The files on the disc, two to a line, and the room left on it:

Dir mask:
TURBO    MSG : TURBO    COM
TURBOMSG OVR : WAREHOUS PAS
TURBO    OVR : WAREHOUS COM
MC       PAS : MC-MOD01 INC
MC-MOD03 INC : MC-MOD05 INC
MC-MOD02 INC : MC-MOD04 INC
MC-MOD00 INC

Bytes Remaining On A: 80k
>

Turbo's directory of the course disc

TURBO.COM is Turbo Pascal itself, and the other three TURBO files belong to it; the WAREHOUS files are the game this course builds, finished; the MC files are MicroCalc. The 80k is yours.

If you get that, everything is installed and working. To finish, press Q for Quit, and you are back at 0:.

Change One Thing

  • Run the command with the ROM path spelled wrong - -rompath ~/romz on macOS, -rompath romz on Windows. MAME refuses before the machine even starts. Read what it says. Seeing that message once, deliberately, saves you ten minutes the day you see it by accident.
  • Start Turbo again and answer N to the first question. Look at the Free: figure on the menu, and compare it with the one above. What have you traded for the difference?

When It Goes Wrong

SymptomCause
MAME says mos12.i023 NOT FOUND and Required files are missingThe ROM is not where it is looking. Check that einstein.zip is in the roms folder and that -rompath points at that folder.
On Windows, mame.exe is not recognisedYou are not in the folder you unpacked MAME into. cd to it first, or type its full path.
MAME takes over the whole screenYou left out -window. MAME's own default is full screen.
You typed TURBO and nothing happensGive it longer. The disc is being read, and nothing moves on screen until it is done.
Esc closes MAME, or F3 restarts the EinsteinMAME's own control keys have been switched on. Forward delete on a Mac (Fn and Backspace on a laptop), or Scroll Lock on Windows, switches them off again.
The sign-on says EINSTEIN 80col.You are running the Turbo Pascal disc from the Downloads page rather than the course disc. It works, but it was set up for a different screen, and its editor will not behave as this course describes. Use the course disc.
Your work is not there after a restartYou are running from a .dsk image, and MAME will not write to one. Use the course disc, which is an .mfi.

Stopping A Program That Will Not Stop

Sooner or later you will write a program that runs for ever. Turbo Pascal has an answer, but only if you ask for it in advance.

  • If the program is waiting for you to type something, hold CONTROL and press C. The program stops, Turbo says User break, and you are back in charge. In MAME: CONTROL is Ctrl.
  • If it is going round a loop, CONTROL and C does nothing - unless the program's first line is {$U+}. That line tells Turbo to keep an eye on the keyboard while the program runs; with it there, CONTROL and C stops a loop too. The course puts it at the top of every program that could loop for ever, from S14 on, and says why when it gets there.
  • Otherwise, restart the Einstein, which loses whatever you have not saved. BREAK does nothing under the emulator.

So one habit makes the difference between a nuisance and a disaster: save before you run something new. S4 shows how; it is one key.

Summary

MAME plus the Einstein ROM gives you the machine; the course disc gives you Turbo Pascal set up for it, and somewhere to keep your work. One command starts the Einstein, TURBO loads Turbo, Y gives you its messages in words, and the menu is where you work from.

Next

S3, Talking To Turbo Pascal - the menu, one command at a time: naming your work, looking at the disc, opening the editor, and leaving.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.