Pascal for ZX81

Discussion about ZX80 / ZX81 Software
User avatar
Vorticon
Posts: 69
Joined: Tue Mar 01, 2022 1:14 pm

Re: Pascal for ZX81

Post by Vorticon »

I found this article in the Byte issue of September 1981 benchmarking various languages available at the time using Eratosthene's sieve prime numbers algorithm converted to only use integer calculations, and it included listings for the most popular 10 languages one of which being Pascal.
Well of course I had to check out the performance of Partial Pascal!
Here 's the program listing and end result. This was done on the real machine with a tape recorder and ZX printer.
20220404_194437_resized.jpg
20220404_190732_resized.jpg

One limitation though: I had only room for a 2K array whereas the original listings used an 8K array for the prime numbers, so I figured I'll simply multiply the calculation time by 4 to roughly compensate.

Calculation time was 450 seconds for the 2K array, equivalent to 1800 seconds for 8K. In looking at the benchmark results table provided in the article, Partial Pascal beats all the interpreted Basics of the time although Microsoft MBasic for Z80 comes very close, but comes in dead last by a significant margin compared to the compiled languages. Here's the original Byte article:
Erastosthenes sieve benchmark.pdf
(11.29 MiB) Downloaded 198 times
So in my view, from a practical standpoint, the main reason to use Partial Pascal would be if one is a fan of Pascal and is willing to work with the substantial language limitations imposed by this particular version.
User avatar
Vorticon
Posts: 69
Joined: Tue Mar 01, 2022 1:14 pm

Re: Pascal for ZX81

Post by Vorticon »

I've made a short video demo of running Partial Pascal on the TS1000 to give a real sense of what it took to work with it back in the day...
https://youtu.be/YsoJmPtr_o8
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Pascal for ZX81

Post by stefano »

Well done, it answers a lot of doubts I had on how it worked.
Nice to see it had a real editor !

The benchmark article is very nice , they surely had to put a lot of effort in comparing so many different technologies !

It is also gives interesting hints on what they thought to be the edge software technologies: many of that stuff is nowadays almos forgotten, like the RATFOR language. The "Rational Fortran" was a nice hack for the FORTRAN compilers permitting to write programs in a syntax very close to the C language.
A RATFOR preprocessor was then used to convert the program in standard FORTRAN. I think I could use z88dk to provide RATFOR for the ZX81, but then we'd miss a FORTRAN compiler :D

https://github.com/z88dk/z88dk-ext/tree/master/ratfor77
https://github.com/zx70/Carousel-CP-M-Tools
Last edited by stefano on Thu Apr 28, 2022 10:16 am, edited 2 times in total.
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Pascal for ZX81

Post by Paul »

There is a thread in the German Forum which gives possibilities to use partial Pascal without the need of using tape.
It's for 48K RAM only, so not suitable for plain ZXPAND users.
https://forum.tlienhard.com/phpBB3/viewtopic.php?t=4076
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
Vorticon
Posts: 69
Joined: Tue Mar 01, 2022 1:14 pm

Re: Pascal for ZX81

Post by Vorticon »

I was never particularly fond of Fortran personally, which is probably because of the very dry way it was taught in high school back in 1981. I still have the Fortran 77 texbook we used then and it is absolutely horrible. I did manage to dabble with Fortran again a couple of years ago on the TI 99/4A computer and it was a better experience, but it still felt archaic compared to Pascal. Here's a little demo I did calculating and graphing the logistic equation.

https://youtu.be/eBsiPVFYcv4

I saw a mention of a supercard for the Zeddy in that thread. What is it?
User avatar
Paul
Posts: 1511
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Pascal for ZX81

Post by Paul »

It's a card with a USB- Drive and 64K of RAM and 64K of ROM where you can select for each 8x8K block wether it's unassigned, ROM or RAM.
Initially I tried to develop and produce it, but due to sickness my mental capacity isn't sufficient any more to accomplish the task. ZXHeinz got some prototypes from me which he corrected and brought to work. He asked permission from me to have it produced which I happily gave, but it still didn't get released.
In theory, there is no difference between theory and practice. But, in practice, there is.
Moggy
Posts: 3232
Joined: Wed Jun 18, 2008 2:00 pm

Re: Pascal for ZX81

Post by Moggy »

Nice demo of the logistic equation, something, It's chaotic element, I use for random number generation and cipher programs when wanting to pass a happy hour and your demo has given me the prod to try it in forth. :D
User avatar
Vorticon
Posts: 69
Joined: Tue Mar 01, 2022 1:14 pm

Re: Pascal for ZX81

Post by Vorticon »

Paul wrote: Thu Apr 28, 2022 12:58 pm It's a card with a USB- Drive and 64K of RAM and 64K of ROM where you can select for each 8x8K block wether it's unassigned, ROM or RAM.
Initially I tried to develop and produce it, but due to sickness my mental capacity isn't sufficient any more to accomplish the task. ZXHeinz got some prototypes from me which he corrected and brought to work. He asked permission from me to have it produced which I happily gave, but it still didn't get released.
That's really a shame. Sounds like an awesome product. Heck with 64K maybe we could run CP/M on the Zeddy! :D
User avatar
Vorticon
Posts: 69
Joined: Tue Mar 01, 2022 1:14 pm

Re: Pascal for ZX81

Post by Vorticon »

Moggy wrote: Thu Apr 28, 2022 2:50 pm Nice demo of the logistic equation, something, It's chaotic element, I use for random number generation and cipher programs when wanting to pass a happy hour and your demo has given me the prod to try it in forth. :D
Ah yes, Forth... Love that language.
Great idea to use the logistic equation to generate random numbers.
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Pascal for ZX81

Post by mrtinb »

Vorticon wrote: Thu Apr 28, 2022 9:33 pm
Paul wrote: Thu Apr 28, 2022 12:58 pm It's a card with a USB- Drive and 64K of RAM and 64K of ROM where you can select for each 8x8K block wether it's unassigned, ROM or RAM.
Initially I tried to develop and produce it, but due to sickness my mental capacity isn't sufficient any more to accomplish the task. ZXHeinz got some prototypes from me which he corrected and brought to work. He asked permission from me to have it produced which I happily gave, but it still didn't get released.
That's really a shame. Sounds like an awesome product. Heck with 64K maybe we could run CP/M on the Zeddy! :D
The hardware sound a lot like PokeMon's ZXblast hardware, he released in 2016. (It has 512k RAM though.) I should be able to test this Pascal patch with my ZXblast. However this weekend there will not be time for it.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Post Reply