• Please review our updated Terms and Rules here

I wrote a (subset-of-)Pascal compiler for Tektronix 4050 BASIC

stepleton

Veteran Member
Joined
Jan 1, 2020
Messages
535
Location
London, UK
The Tektronix 4050-series machines are incredible, but I just don't want to write code in BASIC. Structured programming was a pretty good idea. I'm not allergic to GOTOs, but I prefer my jumps to remain in assembly language.

So I wrote a compiler. Now I can program in a reasonably spacious subset of Pascal and have it compile to BASIC. The compiler is written in Python 3.10 (so it runs on your modern computer, not the Tek), and the only third-party library you'll need is the Lark parser library.

You can find it (and use it at your own risk --- it's definitely a work in progress!) at https://github.com/stepleton/mupas

The first thing I programmed was your obligatory fractal curve, now that recursion is so easy (pardon the uncalibrated display):

koch_curve.jpg

but I'm hoping to write more elaborate programs very soon. In fact, this is why I can guarantee ZERO support or assistance with the compiler ;) I'm going to be too busy writing my own programs for the next few weeks. You can be certain that bugs will be fixed and features added as I do. I have a specific program in mind that I'll start working on soon...

I'm in a bit of a hurry, in fact: my Tek 4054A is not mine! It's borrowed, and the owner will be getting it back in a little while --- too soon! Which is why I'm very keen to know if anyone out there has a 4050-series machine that they might be willing to part with. I'm willing to look into getting one from just about anywhere. I hope stunts like this one show that your machine would find a good home with me!

But in the meantime I'll try to enjoy the time I have and (with the help of my compiler) really put it through its paces. Stay tuned! :)

(Link to project acknowledgements, including some members of this forum.)


Footnote: Connoisseurs know that the 4052A and 4054A are capable of some structured programming thanks to enhancements to the built-in BASIC. My compiler uses none of those, as I'd like to support as much of the range as I can --- plus, who knows what variety of 4050-series machine I might be able to get my hands on somewhere down the line?
 
Very cool.

At first I thought you had written a compiler to 6800 assembly language for the 4050 computers. We have the complete set of assembly language entry points for the 4051 BASIC ROM in this doc:
https://github.com/mmcgraw74/Tektronix-4051-4052-4054-Program-Files/blob/master/4051-Assembler/Tek%204051%20Assembler%20Program%20Instructions%20Tekniques%20Vol%207%20No4%20062-7456-01.pdf

4051 BASIC ROM Calls start on pdf page 28 including AFPITT (convert ASCII to Tek floating point) and display calls on page 37 including DSDRAW, DSMOVE, DSPAGE, DSPCHR.
 
Nope! The "BASIC" in the subject line is a hint :)

If I had more time with this computer, I'd consider it. But as I also mentioned, this computer is not mine, and I'm not willing to risk running without the safety rails that programming in BASIC provides. I'd have nightmares about searing a permanent dot into the display thanks to a programming mistake.

However, if anyone has a surplus 4050 machine lying around, perhaps I could embark on a second compiler project...
 
Back
Top