112 points · by pjmlp · 7y ago · 38 comments
I never tried to write a Pascal compiler, but I think it is pretty easy - I wrote a source-code debugger for one implementation of the language, which I think involved reverse-engineering the targeted compiler (can't really remember - too long ago). I had never before encountered a source-code debugger for any language at all (other than 8086 Assembler, which only just counts).
I just thought it was a cool idea, and one that would help me in my work. It was a "hobby" task, and I had a full-time job, a young wife, and kids. It can't have taken more than a handful of weekends.
It looks like this one has a lot of constraints for easy 6502 code generation, like only allowing 8-bit variables in a FOR loop.
The problem is you really wouldn't write code for these machines the same way you write code for a bigger machine. Not least because most of them had so little memory that keeping track of an assembly program that size was not really a big deal. A lot of C64 demos were written in machine code monitors with no labels, no macros, no variable declarations, that just assembled/disassembled line by line, and saved by just saving the memory regions to disk - no separate source-code. It was a revelation to get a proper assembler...
But that meant self-modifying code (often seen used for 16 bit loops...) and effectively global variables all over the place (= data in fixed memory locations...) was extremely common as well. Trying to shoehorn that into a language like Pascal means basically writing everything in the main block and not call any functions, and even then you're unable to use most of the dirtier tricks..
Pascal was an approachable language and was exactly what I needed at the time to push forward, revisiting C in my highschool years. I built dumb Dragon Warrior clones, homework helpers, etc. It was super readable for me too.
Of course I look back with rose tinted glasses on but Pascal was a huge part of my programming growth - I will always remember it fondly!!
Timex 2068 Basic, Z80, GW-Basic, Turbo Basic, 80x86 and then came to learn Turbo Pascal (started with 4.0 and did all of them up to Delphi 2).
Thanks to this path I got to learn systems programming in high level mostly safe languages, modules, OOP and my very first framework experiences, Turbo Vision (OWL, VCL as well).
For me this was a very lucky path, because I never got tainted that C and C++ were the only God sent programming languages for systems programming.
And best of all, I never had any issues to deal with pointers in C and C++.
I remember being annoyed initially because i had to declare my variables before using them, but it was worth it since unlike GW-BASIC, Turbo Pascal was able to create EXE files (which was the only reason i decided to use it :-P).
How do you know that?
Most of the people I've worked with in the last decade have favoured weakly-typed languages, and Pascal in particular has been a target for ridicule (among the small proportion of my colleagues who have ever looked at the language).
The version of Pascal on which I was raised was an Intel Pascal; I can't find a link just now. It was definitely not Turbo Pascal, which I think was Borland. But both versions had this restriction on the size of a compiled module, complete with stack and data - 64K, the size of a 8086 memory "segment". These 8086 vices have genes that survive in Intel architectures to the present day.
I also did some work with PL/M ("Programming Language for Microprocessors", I think), a much nicer language than Pascal, targeted at those same 1980s 8-bit chips. Pascal was invented as a teaching language; PL/M was an IBM product designed for production work - a cut-down version of PL/1, which was a heavy-duty mainframe language. Pascal and PL/M are similar, and they're all children of ALGOL.
I taught college classes using Turbo Pascal; I had barely any experience with that compiler, and the students were a nightmare (it was not by any measure a "top school"). I faked it, and I got away with it.
If you want a Pascal compiler on the C64, see: http://www.gammon.com.au/GPascal/ and interview with the author at https://web.archive.org/web/20180911174601/http://www.superc... and the author's writeup at https://www.gammon.com.au/forum/?id=11203
Edit; actually remembered I had that setup before using/having TP I think; C and asm compiling and crashing were equally annoying. I switched to TP because I opened a company with a family member and he did all in TP and already had a large (I thought at the time) codebase.
But.. why?
The author had a C64 as a kid, but never got the hang of understanding proper programming until the x86 era of the 90s. This is his way of mending the hole in is soul. In addition, he hopes that he’ll get filthy rich & famous off this project.
Pricing
Free of charge. How the “rich” part will be achieved is still up for debate.
The demo video linked from the website is well worth watching as well. Some punny stuff in there, like "Rogue Burger One".
https://www.youtube.com/watch?v=WhJSG7TiHAE
edit: spelling
Is a very strange product name. Only a programmer would think this would not damage the success of the project.
I nearly closed the page as soon as I hit it, thinking that somehow I had landed on some page where someone is trying to resolve a programming problem.
It's a Pascal compiler for Commodore 64.
I don't think naming is the factor that would inhibit the widespread use of this compiler.
Not to mention, it's a good enough name: everyone's going to remember "Turbo Rascal", which conveys all the information necessary (like Turbo Pascal, but not really).
So my route to coding was first of all BASIC, then assembly language. At the time I was 11-12 years old and it didn't seem like a huge jump, though I guess I can see it was now!
I think my learning went BASIC -> Assembly, on the z80. Then later QBASIC on the PC to assembly, edited with debug.com, and after that I started doing "real" programming with C, Perl and all the other languages that followed.
I'm still sad that most people don't have any built-in programming environment to their computers that is so easy to start with these days. I guess javascript is close, since everybody has a browser. But it's not quite the same.
And in many countries piracy was anyway rampant, so if one really wanted them, it wasn't a big issue to find a shop selling copied tapes, with copied manuals and stuff.
The biggest issue was fitting everything into 64KB, or switching tape/floppies all the time.
But it wouldn't be surprising for somebody else to use the same name.
On most machines, one can get a bitmap. Addressing varies, but the rest makes sense. Give people a software blitter and that is portable.
Colors. Stick to the basics, that is portable ish.
Most machines can make a sound, display a character, bitmap, take keyboard in, etc...
Now, if one wants to see closer to peak performance, yeah. That is a labor of love at this point. Asm, hacks, the whole nine.
So just trying to blit in anything remotely portable manner would be a problem in itself. E.g. on the Amiga you can place things anywhere you want. On the C64 you'd place things on character boundaries (or take seconds to draw images, like a few adventure games that used bitmap mode did), and if you needed smoother movements you'd either smooth-scroll the entire screen or have two different versions of graphics, or use hardware sprites (even sometimes for background features).
If you want a common lowest denominator you pretty much end up with a mostly text-display (~22x23 characters unless you ditch the VIC-20), monochrome, unless you ditch the PETs, only beeps for sound, unless you ditch the PETs, 4-5KB total for code and assets (unless you ditch the VIC-20 and some of the PETs) and so on.
It might be a "fun" exercise for the sake of it to see what the best you could do in a portable manner, but it would really boil down to what the best you could do on one of the most memory-limited PETs is, I suspect.
I mean you certainly could do Infocom style text adventures... Small ones anyway.
If you cut it down to the NES, C64 and Amiga (and maybe Plust4), then you'd be able to start doing something somewhat more interesting, but the architectures are still so wildly different that you'd end up something unable to stretch the capabilities of any one of them. For slow-ish moving strategy dominated games it might work.
E.g. Sid Meier's Pirates! was partly written in BASIC on the C64, and while the Amiga port is an upgrade it's a small-ish upgrade (more colours, higher resolution mainly). That kind of game would be feasible to do portably if you exclude the VIC20's and PET's, and stick to C64-level graphics. Games like Defender of the Crown, likewise, though they'd lose the graphics quality on the Amiga that was 90% of the appeal of the Cinemaware titles on the Amiga (though ironically, Defender of the Crown is often considered better on the C64 (and some other platforms) - they fixed various parts of the strategy elements of the game).