Saturday, March 9, 2019

METRIC2

Table of Contents ] [ List of Example Programs ] [ METRIC2 Disk Image ]

METRIC2 is a Pascal program (Listing 7-4) that appears on page 89 of the book, Pascal Primer, by David Fox and Mitchell Waite. This program has a menu with four options. One option is for exiting the program. The other three options are for performing various conversions from USCS (United States Customary System) to Metric. This program is very similar to METRIC1 from the same book, but it wraps the main program in a REPEAT/UNTIL loop and it adds some error checking around the menu menu item selection.



As with the other samples from this book, all of the programs were originally written for UCSD Pascal on the Apple II platform.

While I was working on porting this program from the Apple II UCSD Pascal version to the Atari Pascal Language System, I got tired of some of the minor annoyances with AtariWriter 80 running under the Altirra emulator. I'm not sure if the issues that I was seeing are with AtariWriter 80 itself, or because I'm using it with Altirra. I decided to switch to a different editor. The editor I chose to use was The Last Word, specifically The Last Word 3.21b.


Along with switching editors, I had to deal with working around the Atari Pascal Language System "READ CHAR" bug.



In addition, the METRIC2 program listing (7-4) as printed on page 89 of the book has a bug. This version of the program declares a global CONST variable type named Conversions. Later in the program, a variable named Conversion is referenced. I renamed the declared variable to Conversion. This may not have been a problem in UCSD Pascal if only the first eight characters are recognized as significant.



 The link command looks like:

LINKER V1.0
*D2:METRIC2,D2:PEEKPOKE,FPLIB,GRSND,PASLIB/S

When you run the program, it looks like:


No comments:

Post a Comment