Programming on the QuickPAD Pro


CONTENTS


GENERAL INFORMATION


Introduction

This page has notes about some DOS-based compilers and interpreters that I tried on the QuickPAD Pro. This is not meant to be a comprehensive list, just a list of the ones that I tried myself, and that might be useful to most QuickPAD Pro users.

The primary goal was to find compilers and interpreters that allow you to write programs directly on the machine itself (on-board programming), as opposed to "cross compilers" where you create the executable on a PC and transfer it to the QuickPAD Pro.

For all the compilers and interpreters I tested, I made some notes on how they were installed. Some had to be installed on my PC (running Windows 98), and then copied to the QuickPAD Pro.

I also noted the disk space that was required. Some use a lot of disk space, and the only way they would run on the QuickPAD Pro is from the D: CompactFlash drive.

Terminology: In the notes below, an "integrated environment" means you can both edit programs and run them from the text editor, without having to exit to DOS.


The Test Program

On most of the compilers and interpreters I ran a similar small program as a final test. I wanted to run something a little more substantial than the classic "Hello, world" program, but yet keep it simple. This is the algorithm of the test program:

	Input a character string from the user
	Open a text file called test.txt and write the string there.
	Open the text file test.txt and read back the string.
	Print the string on the screen.
The purpose of the test program was to do a simple test of both console I/O and file I/O. Also, to keep things simple, there is no error checking (file open errors, buffer overflows, etc.).

Here is a sample run of the test program, where the user types in 'abc' at the first line:

	Input a string: abc
	String is: abc
The test program will also create an output file called test.txt that also contains 'abc'.


INTERPRETERS


Awk - GNU Awk 3.0.4

Description

Awk is an interpreter, but it's a bit different than the other programming languages.

Here is a description of Awk from the GNU Awk home page:

Awk may not be as well-known as some of the other programming languages on this page, so I'll add some extra explanation around the Awk test program below.

Installation

When you expand the gawk304x.zip archive, you will see many files there, but you only need the file called gawk.exe. You can put it in a directory that is available from the DOS path.

Execution

Awk only runs in text mode. You execute the 'gawk' command to run Awk scripts.

Running on the QuickPAD Pro

The size of the gawk.exe program is 220K, so it could fit on the B: drive.

Since Awk only runs in text mode, you can use the QuickPAD Pro word processor (edit.exe) to write Awk scripts and data files, and then run the scripts with gawk.exe.

The Test Program

Let's create a real-world test program for Awk that demonstrates some of Awk's capabilities. (The following program was taken from the book "Sed & Awk", published by O'Reilly.)

Here is a text file called grades.txt with a list of students and their grades:

	John 85 92 78 94 88
	Andrea 89 90 75 90 86
	Jasper 84 88 80 92 84
Let's write an Awk script that will calculate the average grade for each student.

Think of the data file this way: each line of the data file contains "words" and we want to find the average of the second through sixth "word" on each line (add them and divide by 5).

Here is the resulting Awk script called 'test.awk' that I wrote on the QuickPAD Pro:

	{ total = $2 + $3 + $4 + $5 + $6
	  print $1, total / 5 }
That calculation will be applied to every line of the data file.

This is the command line to run the script:

	gawk -f test.awk grades.txt
Here is the output:
	John 87.4
	Andrea 86
	Jasper 85.6
The Awk test program worked fine on the QuickPAD Pro.

Web Links

GNU Awk 3.0.4 is available free. Here is a direct link to the ZIP file.

To learn more about Awk:


BASIC - GW-Basic 3.22

Description

GW-Basic is a BASIC interpreter that came with some versions of DOS. It does NOT create standalone executable files. It is an integrated environment; you can write and edit BASIC programs and run them without exiting to DOS.

Installation

GW-Basic only requires that the gwbasic.exe program be in a directory in the DOS path.

Execution

You can either run gwbasic.exe interactively, or execute 'gwbasic filename.bas' to load and run an existing BASIC program.

Running on the QuickPAD Pro

The gwbasic.exe program is only about 70K so it can be easily copied and stored on the B: drive.

When gwbasic.exe is executed on the QuickPAD Pro, it runs fine, except for one small problem with scrolling. On my machine, it assumes that you are using a 24-line screen. That means that it won't scroll the output until it reaches the twenty-fourth line. Lines 16 to 23 will just write over each other on the last line of the screen.

For example, this program prints integers 1 to 25, one number per line:

	10 for i=1 to 25:print i:next
On MS-DOS on a PC, the output looks fine. But on the QuickPAD Pro, the output contains only 1, 2, 3, ..., 14, 15, then 24, 25. Line 16 to 23 were overwritten by line 24.

Therefore, it's a good idea to start every program with 25 blank lines so that all subsequent lines will print and scroll correctly:

	10 for i=1 to 25: print " ": next

The Test Program

Here is the test program I wrote on the QuickPAD Pro, called test.bas:
	10 for i=1 to 25: print " ": next
	20 input "Input a string: ",s$
	30 open "test.txt" for output as #1
	40 print #1, s$
	50 close #1
	60 open "test.txt" for input as #2
	70 input #2, t$
	80 close #2
	90 print "String is: ", t$
	100 end
The command line to run it was:
	gwbasic test.bas
The test program ran fine.

Web Links

You can try looking for gwbasic.exe in old versions of DOS. You can also learn more about GW-Basic by doing a Google search using the keywords gwbasic, GW-BASIC, or "gwbasic.exe".


BASIC - QBasic 1.1

QBasic 1.1 was a BASIC interpreter that came with the later versions of DOS and was included on the Windows 95 installation CD in the 'oldmsdos' directory.

Unfortunately, QBasic 1.1 did not run on my machine. It hung the machine and I had to use the Reset button to recover.

I'm including QBasic 1.1 here just to warn you that it may hang your machine.


Perl4

Description

Perl4 is a freely available interpreter for version 4 of the Perl scripting language (which came out around 1991).

Perl4 uses less disk space than Perl5, the latest version of Perl. If you don't need a specific routine from the Perl5 libraries, Perl4 might be sufficient for your needs.

Installation

The perl419x.zip archive contains a lot of files, but you only really need perl.exe and perlglob.exe, which I copied to a directory in the DOS path.

Execution

Perl4 for DOS only runs from the command line; it does not have an integrated environment. Just type 'perl' followed by the name of the perl script file.

Running on the QuickPAD Pro

The perl.exe and perlglob.exe programs are about 330K total, so they might fit on the B: drive.

You can use the QuickPAD Pro word processor (edit.exe) to write Perl scripts, and then use perl.exe to run them.

The Test Program

Here is the 'test.pl' Perl script that I tested on the QuickPAD Pro:
	#!perl

	print "Input a string: ";
	chop($s = <STDIN>);
	
	open(OUTFILE, ">test.txt");
	print OUTFILE "$s\n";
	close(OUTFILE);
	
	open(INFILE, "<test.txt");
	chop($t = <INFILE>);
	close(INFILE);
	
	print "String is: $t\n";
The command line was:
	perl test.pl
The program ran fine.

Web Links

Perl4 is available here (in file perl419x.zip).


XLisp

I have been informed that XLisp works on the QuickPAD Pro. I haven't had time to test it yet, but here are the links.

XLisp is available free from this link. It is in the Microsoft MS-DOS section, where it says "Otherwise, you will need to run the generic MS/DOS (138k) version which will run on just about anything."

Here is a direct link to the ZIP file.


COMPILERS


BASIC - QuickBasic 4.5

Description

When it's run on a PC, QuickBasic is both a BASIC interpreter, with its own integrated environment, and a BASIC compiler.

It can support structured (indented) BASIC programs and you don't need to number each line as you did with earlier versions of BASIC.

Installation

To install QuickBasic 4.5, just unzip the qb45.zip archive to its own directory. I used "C:\QB45".

Execution

On a PC, the qbasic.exe program runs the integrated environment. The bc.exe program is the command line compiler, and link.exe coverts the *.obj files into an executable.

Running on the QuickPAD Pro

The size of the C:\QB45 directory is approximately 1.5MB. I installed the directory to the CompactFlash card on the QuickPAD Pro.

The qbasic.exe program (the full-screen integrated environment) did not work on the QuickPAD Pro. The machine got hung and I had to press the Reset button to recover.

The bc.exe program (the command line compiler) worked fine. Therefore, you can use the QuickPAD Pro word processor (edit.exe) to write programs, and then compile them with bc.exe.

The Test Program

Here is the test program that I ran on the QuickPAD Pro:
	input "Input a string: ",s$
	open "test.txt" for output as #1
	print #1, s$
	close #1

	open "test.txt" for input as #2
	input #2, t$
	close #2

	print "String is: ", t$

The command lines were:

	bc test.bas
	link test.obj
and it created an executable file called test.exe, that requires that the runtime module brun45.exe be in the DOS path.

The test program worked fine.

WARNING: Executables created with QuickBasic 4.5 require the brun45.exe runtime module. On a PC, the 'bc' command can also create executables that do not requirement brun45.exe with the command line 'bc test.bas /o'. However, the resulting test.exe executable caused my QuickPAD Pro to hang and it required a reset to recover.

Web Links

For more information about QuickBasic 4.5, you can do a search at Google using the keywords qbasic, QuickBasic, or "qb45.zip".


C - Turbo C 2.01

Description

Turbo C 2.01 was written in 1991. From the README file, it sounds like it was written before the ANSI-C standard was finalized. However, it does support ANSI-style function definitions, so it should be able to compile most current C source code.

Installation

Turbo C 2.01 comes in an archive file called tc201.zip. I expanded it on my PC and it created three directories: DISK1, DISK2, and DISK3. The setup program is on DISK1 and is called install.exe. Unfortunately, it assumes that you are installing from floppy disks and stops and asks you to insert the second and third floppy disks. Therefore, I had to abort the installation, remove the C:\TC directory on the hard drive, copy each directory to its own floppy disk, and run a:install.exe from DISK1.

The installation program will create a directory on your hard disk called C:\TC, and it will print instructions on how to modify your autoexec.bat to include C:\TC in your DOS path.

Execution

There are two ways to run Turbo C 2.01 on a PC. You can either use the full-screen "integrated environment" (by running tc.exe), or you can compile using the DOS command line program (tcc.exe).

Running on the QuickPAD Pro

The compiler, header files, and libraries take up approximately 2.1MB, so I didn't try to copy it to the B: drive. Instead, I copied it to a CompactFlash card, where it was stored as D:\TC.

Since it was installed to hard disk on the PC as "C:\TC", and on the QuickPAD Pro it is now in "D:\TC", I had to edit the configuration file D:\TC\turboc.cfg and replace two occurrences of 'C:' with 'D:'.

The tc.exe program (the full-screen integrated environment) did not work on the QuickPAD Pro. The screen went blank and I had to press the ESCAPE key a few times to return to the DOS prompt.

The tcc.exe program (the command line compiler) worked fine. Therefore, you can use the QuickPAD Pro word processor (edit.exe) to write programs, and then compile them with tcc.exe.

The Test Program

Here is the test program I wrote on the QuickPAD Pro, called test.c:

	#include <stdio.h>

	int main()
	{
		FILE *fp;
		char s[80], t[80];

		printf("Input a string: ");
		fgets(s, 80, stdin);
	
		fp = fopen("test.txt", "w");
		fprintf(fp, "%s\n", s);
		fclose(fp);

		fp = fopen("test.txt", "r");
		fgets(t, 80, fp);
		fclose(fp);
		printf("String is: %s\n", t);

		return 0;
	}

The command line I used was:

	tcc test.c
and it created an executable called test.exe.

The test program compiled on the QuickPAD Pro and ran fine.

Web Links

Turbo C 2.01 is available at this link.


C++ - Turbo C++ 1.01

Description

Turbo C++ 1.01 was written in 1991, so it won't support the newer C++ features like namespaces. But it can still be useful as a testbed for object oriented programming. Plus, it can compile regular ANSI C programs.

Installation

I expanded the tcpp101.zip file on my PC and it copied all the files into one directory. I ran the install.exe to install it to C:\TC.

The installation program print instructions on how to modify your autoexec.bat to include C:\TC in your DOS path.

By the way, C:\TC is also the default install directory used by Turbo C 2.01. If you want to install both Turbo C 2.01 and Turbo C++ 1.01, you'll have to install one of them to a different directory.

Execution

The tc.exe is the integrated environment, and tcc.exe is the compiler you can run from the command line.

Running on the QuickPAD Pro

The compiler takes up 5.7 MB so I copied it to the CompactFlash card in the directory D:\TC.

Since it was installed to the hard disk on the PC as "C:\TC", and on the QuickPAD Pro it is now "D:\TC", I had to edit the configuration file D:\TC\BIN\turboc.cfg and replace two occurrences of 'C:' with 'D:'.

The tc.exe program (the full-screen integrated environment) did not work on the QuickPAD Pro. The screen was garbled and I had to press Alt-F then Alt-X, to return to the DOS prompt.

The tcc.exe program (the command line compiler) worked fine. Therefore, you can use the QuickPAD Pro word processor (edit.exe) to write programs, and then compile them with tcc.exe.

The Test Program

Here is the test program I wrote on the QuickPAD Pro, called test.cpp:
	#include <iostream.h>
	#include <fstream.h>

	int main()
	{
		char s[80], t[80];

		cout << "Input a string: ";
		cin.getline(s, 80);

		ofstream fpo("test.txt", ios::out);
		fpo << s << endl;
		fpo.close();

		ifstream fpi("test.txt", ios::in);
		fpi.getline(t, 80);
		fpi.close();

		cout << "String is: " << t << endl;
		return 0;
	}
And the command line was:
	tcc test.cpp
It created an executable called test.exe.

The test program compiled on the QuickPAD Pro and ran fine.

Web Links

Turbo C++ 1.01 is available at this link.


Forth - F-PC 3.6

Description

F-PC is a Forth compiler for DOS. It can also support inline assembly instructions, but I didn't do any tests with assembly language.

Installation

I unzipped the fpc36.zip archive into a temporary directory on the hard disk of my PC. I then ran install.com and did a full installation to C:\FPC.

Execution

On a PC, the 'f' command runs the F-PC integrated environment, which includes a full-screen editor.

To bypass the full-screen interface, you can add Forth words to the command line to open and load a program. For example:

	f open test.seq 1 load runtest bye
It will then execute those words in text mode.

Running on the QuickPAD Pro

The full installation used approximately 3.2MB of disk space, so I copied it to the CompactFlash card.

F-PC comes with many help files and sample programs, which is very useful if you are learning Forth. But if you don't need those extra files, you can remove those directories to save disk space.

Actually, all you need is f.exe (if it is configured correctly) and kernel.com. Together they use only about 200K of disk space.

The full-screen interface of f.exe produced garbled characters on the QuickPAD Pro screen, so I had use the 'bye' command to end the program.

At first, F-PC didn't run in text mode either, because it was trying to do fast screen writes to the screen. I had to edit the f-pc.cfg configuration file and replace the 'FAST' word with 'SLOW'. Then I reloaded the configuration file with this command:

	f-pc - fsave f bye
After that change, the 'f' command ran fine in text mode.

Therefore, you can use the QuickPAD Pro word processor (edit.exe) to create scripts and run them using the 'f' command, or you can open and load a program from the 'f' command line and use the Forth text-mode environment interactively from that point on.

The Test Program

Here is the 'testqpp.seq' test program I ran on the QuickPAD Pro:
	handle outhcb
	handle inhcb
	variable s 40 allot
	variable t 40 allot
	create filebase ," test"
	create fileext ," txt"

	: TESTQPP
	         cr ." Input a string: "  \ print prompt
	         s 40 2dup erase expect   \ read string s
	
	         filebase outhcb $>handle \ set up outfile basename
	         fileext outhcb $>ext     \ set up outfile ext
	         outhcb hcreate drop      \ open outfile handle
	         s 40 outhcb hwrite drop  \ write string s
	         outhcb hclose drop       \ close output file

	         filebase inhcb $>handle  \ set up infile basename
	         fileext inhcb $>ext      \ set up infile ext
	         inhcb hopen drop         \ open infile handle
	         t 40 inhcb hread drop    \ read string t
	         cr ." String is: "       \ print output label
	         t 40 type cr             \ output string t
	         inhcb hclose drop        \ close input file
	;
Here is the command line and the results:
	[D:\FPC] f open testqpp 1 load testqpp bye
	of 910 bytes.
	Loading..
	Input a string: qwerty
	String is: qwerty
	 Leaving..[D:\FPC]
The test program worked fine.

Web Links

F-PC 3.6 is available at this link.

To learn F-PC Forth, there are some good links at this page:


Pascal - Turbo Pascal 3.0.2

Turbo Pascal 3.0.2 is an integrated environment for Pascal that creates very small and fast *.COM executables. You run the integrated environment by running 'turbo.com'.

It does NOT include a compiler that can be run from the command line, and I wasn't able to get the full-screen editor working on the QuickPAD Pro, so I don't think it is suitable for on-board programming. However, it works fine for compiling on a PC and then transferring the executable to the QuickPAD Pro.

If you want to experiment with on-board compiling, note that the 'tinst' program didn't work on my machine when the files were on the D: compactFlash drive. I had to copy them to the B: RAM drive in order for 'tinst' to save the configuration changes without an error message.

Turbo Pascal 3.0.2 is available at this link.

Manuals are available at this link


Pascal - Turbo Pascal 5.5

Description

Turbo Pascal 5.5 contains both an integrated environment and a compiler you can call from the command-line. It was written in 1989.

Installation

When you expand the tp55.zip archive, it creates two directories: DISK1 and DISK2. The installation program install.exe in the DISK1 directory assumes that you are installing from floppy disks and it will stop and ask you to insert disk2. I had to abort the installation, remove the C:\TP directory on the hard disk, copy each directory to its own floppy, and run a:install.exe from the first floppy.

The installation program will create a directory on your hard disk called C:\TP, and it will print instructions on how to modify your autoexec.bat to include C:\TP in your DOS path.

Execution

There are two ways to run Turbo Pascal 5.5 on a PC. You can either use the full-screen integrated environment (by running turbo.exe), or you can compile using the DOS command line program (tpc.exe).

Running on the QuickPAD Pro

Turbo Pascal 5.5 uses about 1.6MB of disk space, so I copied it to the CompactFlash card.

Since it was installed to the hard disk on the PC as "C:\TP", and on the QuickPAD Pro it is now in "D:\TP", I had to edit the configuration file D:\TP\tpc.cfg and replace two occurrences of 'C:' with 'D:'.

The turbo.exe program (the full-screen integrated environment) did not work on the QuickPAD Pro. The screen went blank and I had to press the ESCAPE key a few times to return to the DOS prompt.

The tpc.exe program (the command line compiler) worked fine. Therefore, you can use the QuickPAD Pro word processor (edit.exe) to write programs, and then compile them with tpc.exe.

The Test Program

Here is the test program I wrote on the QuickPAD Pro, called test.pas:
	program TestQPPRO;
	var
		s, t : string[80];
		fp : text;

	begin
		Write('Input a string: ');
		Readln(s);

		Assign(fp, 'test.txt');
		Rewrite(fp);
		Writeln(fp, s);
		Close(fp);

		Assign(fp, 'test.txt');
		Reset(fp);
		Readln(fp, t);
		Close(fp);

		Writeln('String is: ', t);
	end.
And the command line was:
	tpc test.pas
It created an executable called test.exe.

The test program compiled on the QuickPAD Pro and ran fine.

Web Links

Turbo Pascal 5.5 is available at this link.

Manuals are available at this link


Return to Victor's QuickPAD Pro home page