[ Table of Contents ] [ List of Example Programs ] [ Disk Image ]
FIBONACCI is a short program from page 123 of the book "Introduction To PASCAL (Including UCSD PASCAL) Second Edition Revised" by Rodnay Zaks and published by Sybex.
This program demonstrates how to use recursion in PASCAL. Recursion is the ability of a function or procedure to repeatedly call itself until some condition is met.
When you run the compiled and linked program D2:FIBONACC.COM, the output looks like:
Tuesday, April 16, 2019
Thursday, April 4, 2019
GREETING
[ Table of Contents ] [ List of Example Programs ] [ GREETINGS Disk Image ]
Moving on to another book!
GREETINGS is an example program from page 6 of the book "Introduction To PASCAL (Including UCSD PASCAL) Second Edition Revised" by Rodnay Zaks and published by Sybex.
This is just another Hello, World! type program.
As you can see, in ATARI PASCAL, like many versions of PASCAL, uppercase and lowercase can be used interchangeably.
When you run the compiled and linked program D2:GREETINGS.COM, it looks like:
Moving on to another book!
GREETINGS is an example program from page 6 of the book "Introduction To PASCAL (Including UCSD PASCAL) Second Edition Revised" by Rodnay Zaks and published by Sybex.
This is just another Hello, World! type program.
As you can see, in ATARI PASCAL, like many versions of PASCAL, uppercase and lowercase can be used interchangeably.
When you run the compiled and linked program D2:GREETINGS.COM, it looks like:
Saturday, March 16, 2019
STRARRAY
[ Table of Contents ] [ List of Example Programs ] [ STRARRAY Disk Image ]
STRARRAY is an example program (Listing 10-2) from page 148 of the book "Pascal Primer" by David Fox and Mitchell Waite.
This example shows how to use arrays of STRING variables. When the program runs, it accepts five strings from the user, then displays the entered strings in the reverse order that they were entered as well as the individual strings in reverse order.
The link command looks like:
LINKER V1.0
*D2:STRARRAY,PASLIB/S
When you run the program, it looks like:
STRARRAY is an example program (Listing 10-2) from page 148 of the book "Pascal Primer" by David Fox and Mitchell Waite.
This example shows how to use arrays of STRING variables. When the program runs, it accepts five strings from the user, then displays the entered strings in the reverse order that they were entered as well as the individual strings in reverse order.
The link command looks like:
LINKER V1.0
*D2:STRARRAY,PASLIB/S
When you run the program, it looks like:
Friday, March 15, 2019
INTCONST
[ Table of Contents ] [ List of Example Programs ] [ INTCONST Disk Image ]
INTCONST is an example program (Listing 9-9) from page 122 of the book "Pascal Primer" by David Fox and Mitchell Waite.
The program takes an INTEGER and attempts to convert it to a STRING. It is the opposite of the VALDEMO example program. It doesn't take any input from the user. It uses the predefined value MAXINT (32767) and converts it to a STRING. This program makes use of the string INSERT procedure. It also uses the ABS function. Since the Atari Pascal built-in ABS() function is buggy, I overrode it with my own simple ABS() function.
The link command looks like:
LINKER V1.0
*D2:INTCONST,PASLIB/S
When you run the program, it looks like:
INTCONST is an example program (Listing 9-9) from page 122 of the book "Pascal Primer" by David Fox and Mitchell Waite.
The program takes an INTEGER and attempts to convert it to a STRING. It is the opposite of the VALDEMO example program. It doesn't take any input from the user. It uses the predefined value MAXINT (32767) and converts it to a STRING. This program makes use of the string INSERT procedure. It also uses the ABS function. Since the Atari Pascal built-in ABS() function is buggy, I overrode it with my own simple ABS() function.
The link command looks like:
LINKER V1.0
*D2:INTCONST,PASLIB/S
When you run the program, it looks like:
Thursday, March 14, 2019
VALDEMO
[ Table of Contents ] [ List of Example Programs ] [ VALDEMO Disk Image ]
VALDEMO is an example program (Listing 9-8) beginning on page 120 of the book "Pascal Primer" by David Fox and Mitchell Waite.
It takes a number as a STRING as input, tests it, and tries to convert it to an INTEGER.
I ran into a bug with the intrinsic absolute value function ABS() built into the Atari Pascal Language System. After some testing, I wrote my own quick and dirty ABS() function to override the existing buggy one.
The link command looks like:
LINKER V1.0
*D2:VALDEMO,GRSND,PASLIB/S
When you run the program, it looks like:
Wednesday, March 13, 2019
BUG: ABS()
[ Table of Contents ] [ List of Example Programs ] [ TESTABS Disk Image ]
I was attempting to test an example program that uses the intrinsic ABS() function built into the Atari Pascal Language System. The function doesn't seem to give the correct results.
Here is a simple test program TESTABS.
Given the integer number -151, I'd expect the ABS() function to return an integer value of 151. But it returns 32617.
My own quick and dirty (with no error or range checking) ABS2() function returns what I expected.
I tried passing the ABS() function a negative number < -128. Still, the result is incorrect.
I tried passing the ABS() function a REAL number, but the compiler choked on that, so I commented it out.
I'm not sure if this is a bug or an overflow issue. I need to double check the documentation and do some more testing with this function.
I was attempting to test an example program that uses the intrinsic ABS() function built into the Atari Pascal Language System. The function doesn't seem to give the correct results.
Here is a simple test program TESTABS.
Given the integer number -151, I'd expect the ABS() function to return an integer value of 151. But it returns 32617.
My own quick and dirty (with no error or range checking) ABS2() function returns what I expected.
I tried passing the ABS() function a negative number < -128. Still, the result is incorrect.
I tried passing the ABS() function a REAL number, but the compiler choked on that, so I commented it out.
I'm not sure if this is a bug or an overflow issue. I need to double check the documentation and do some more testing with this function.
SPACEOUT
[ Table of Contents ] [ List of Example Programs ] [ SPACEOUT Disk Image ]
SPACEOUT is an example program (Listing 9-6) on page 117 of the book "Pascal Primer" by David Fox and Mitchell Waite.
This example program shows how to use intrinsic Pascal STRING functions and procedures. The LENGTH() function returns the number of characters in a string. The INSERT() procedure will insert a string into another string.
SPACEOUT is an example program (Listing 9-6) on page 117 of the book "Pascal Primer" by David Fox and Mitchell Waite.
This example program shows how to use intrinsic Pascal STRING functions and procedures. The LENGTH() function returns the number of characters in a string. The INSERT() procedure will insert a string into another string.
The link command looks like:
LINKER V1.0
*D2:SPACEOUT,PASLIB/S
When you run the program, it looks like:
Subscribe to:
Posts (Atom)