5 ms·
I coded a Pascal compiler for transputer as a teen in 1993
- andrewstuart 2y agoThe Byte Book of Pascal I think led to the creation of a lot of Pascal implementations.
- pjbk 2y agoAnd us poor C folks had to be grateful for Ron Cain's small C compiler that was published in Dr Dobbs, along all its derivatives.
- willvarfar 2y agoJaw droppingly awesome :) Brings up a strong nostalgia from me. Around that time computers were becoming mainstream and available where I was in the UK, and I grew up acquiring old cast-off computers and tinkering. For me there was an 'assembly language masterclass' book (I was a beginner and this was my first serious tech book and I had to sink or swim) that went into a lot of 32-bit programming for the 386 (which I never had) but got me far enough along. It was that and computer magazines which were really programming magazines, which were a thing and quite popular back then. Remember fondly how transformative it was to move from Basic to a copy of Turbo Pascal 6 and it's asm keyword that I got passed on a floppy disk in the playground. Ah that was the time when it was just obvious that you could entertain yourself on a computer by creating things, however small, instead of just consuming them. By the time I got computer games, I was thinking about them as programs not games and I got my entertainment by getting into the modding scene.
- ikari_pl 2y agoDo you also feel like you did projects in your teen years that you wouldn't pull off today? I coded assembly (Z80) in a disk editor, having no assembler, just a handwritten list of opcodes. I wrote a chat client app (in Delphi) HAVING NO INTERNET at home, I went to a cafe, recorded a dump with Wireshark, printed it on a dot matrix printer, and used a marker pen to highlight the bytes I understand the meaning of. I miss it so much.
- smokel 2y agoYup. I wrote a TSR program to extend Deluxe Paint II on PC with animation features. Never heard about APIs, and simply copied data from the VGA memory, overlaying my own user interface on top of DP. The thought of doing this with contemporary systems just seems ... wrong :)
- SmellTheGlove 2y agoWell back then we didn’t have all of that memory for those fancy abstraction layers. Sticking your finger in the framebuffer probably wasn’t the worst way to do that!
- ddalex 2y agoI wrote lots of TSR extensions, I remember one that would allow you to switch between DOS programs.... it broke when the next version of DOS came out. I was most fond of my image viewer program that worked only on my video card (a cirrus logic) but was 10x faster then others because it used some hw acceleration on the card (not remembering details right now). It's basically impossible to replicate this level on todays extra-locked-down machines - the bar to entry and just tinker is so much higher.
- kimixa 2y agoIt's all still available, arguably more accessible from a cost and documentation point of view - I'd argue that the bar to getting something is so much higher. You can today start banging registers on GPUs, or write your own shader programs, there's well documented modern hardware (e.g. [0]) and completely open-source drivers just sitting there for reference. The issue is that there's so moving parts now that to get anything visible to actually happen it's not just wiring up a couple of registers, but thousands just to get it into a state you can even see the registers you want, then a thousand more. [0] https://gpuopen.com/amd-gpu-architecture-programming-documentation/ https://gpuopen.com/amd-gpu-architecture-programming-documen...
- smokel 2y agoHah, I spent countless hours poking bits around in the Cirrus Logic card that I had. I found an undocumented (to me, at least) mode that showed 16-bit images by alternating two 8-bit images. I put it in a demo to show at a demoparty, but the projector system did not have a compatible VGA card :(
- lukaslalinsky 2y agoWhen I was teen moving into adulthood, I couldn't understand why Pascal is being abandoned and people are moving into C and C++. I often think how would the software world look like if that did not happen. It's such a shame that we lost such a simple, yet productive language, in the commercial settings. And now we have Rust as the next winning choice, language even more complex than C++.
- p0w3n3d 2y agoWhy would you say that Pascal was (is?) a simple and productive? I wrote some software in Turbo Pascal and Delphi at that time, and was usually envying the C++ freedom. All the headers had to be translated to Pascal first. Pointer arithmetic was kludgy. I really wonder how could I do more complicated things, like large byte buffer with variant structures, parsing in Pascal.
- lukaslalinsky 2y agoI mostly meant the DOS era, when you accessed hardware directly, there were pretty much no libraries. Further on, if people did not start using C++, Pascal would have to evolve to allow writing the things that were previously done in assembly, and libraries would be done in that language as well. That did not happpen, so C++ won and writing Pascal code was even more complex because you had to brindge the C APIs.
- ikari_pl 2y agoWhat things that were previously done in assembly do you mean? I remember Delphi nicely allowed including C++ files and assembly in the project too, so there's that. It is a very wordy language, but apart from the need to separate declarations and implementation, was pretty nice to use, and powerful.
- lukaslalinsky 2y agoMany kinds of byte or bit-level operations. I don't have access to much Turbo Pascal code, but it was always Pascal with a lot of inline assembly for specific things. Just found this using google, for example, https://github.com/nickelsworth/swag/blob/7c21c0da2291fc249b9dc5cfe121a7672a4ffc08/graphics/0203.pas#L20 https://github.com/nickelsworth/swag/blob/7c21c0da2291fc249b... This kind of code was pretty typical.
- begueradj 2y agoThat was the era where we had to buy compilers to run C, Pascal ... code. That's why even SQL had (and maybe still has) its own C compiler.
- neverartful 2y ago"SQL had (and maybe still has) its own C compiler" Oh? Are you referring to something different from a database's precompiler?
- lukeh 2y agoINMOS (morally) lives on as XMOS, with its funky dialect of C (XC), which incidentally I quite enjoy.
- kitd 2y agoMoreover, David May at INMOS also created OCCAM for the transputer. Rob Pike credits OCCAM's channels as being the inspiration for those in Golang.
- marstall 2y agowhat a beautiful story. thanks for sharing, OP. shades of my own youth peeking into 6502land on my AppleIIe in the early 80s. Also thanks for the Transputer deep dive, TIL! Love the source code you posted on Github with its Spanish comments.
- agumonkey 2y agoBeing exposed to the dragon book at that age. Interesting.
- larodi 2y agoIf I understand right you were living in Mexico at that time and not going too fancy shmancy school for rich kids? If so - doubles the magnitude of this achievement.
- anonzzzies 2y agoIn those days, unless you were very privileged, you had to learn things from a maybe 1 book, maybe a magazine (some matrix printed stapled pages in my province) and, in my case, without having a computer for the first year of learning basic & assembly. I just had a 2nd hand book + those magazines and some old folk telling me I should learn it. When we did get a computer (borrowed), I knew listings by heart which I typed in, changed and explored. It was somehow nicer than instant gratification we have now. I worked out assembly listings in HEX (I did not know what an assembler was or that it existed) on paper in class (school was of course boring af) and typed it in when the borrowed computer was back. Very nice times.
- kragen 2y agoMexico surely made it harder, but his father was a bigger advantage than any school. And school fanciness does not reliably correlate with the realness of its instructors.
- nickcw 2y agoI loved reading this write-up. It was a wonderful trip down memory lane. Writing a PASCAL compiler is very impressive. I only got as far as the assembler! In 1989 I designed and built a board with 3 transputers on it as part of my (physics) degree project. The transputers were T212 I think, so only 16 bit and no floating point with 2k of local RAM. They ran at 20 Mhz and the all important chip to chip network ran at 10 Mhz. Ostensibly it was so I could do Ising spin simulations on it but actually all I wanted to do was calculate Mandelbrot sets having seen a demo of a box with 256 transputers in doing that. My transputer box was connected to a BBC Micro and to program the transputer I wrote an assembler in BBC Basic. The transputer instruction set was quite funky - everything was variable length. Which meant when calculating the jump instructions, sometimes my assembler would take 7 passes to find the optimium encoding for everything. The BBC Micro only had 32k of RAM which wasn't nearly enough RAM to hold the assembler, the symbol table and the code you were assembling. So the assembler would write each pass to disk! To floppy disk! It was very slow as you can imagine but I did end up writing both an Ising spin simulation and a Mandelbrot set plotter. The Ising spin simulator ran slightly faster than a FORTRAN version I wrote for the university mainframe which I was very pleased with. I got to learn about parallel processing using message passing and managed to make my first concurrency bug where the program would work on 1, 2 but not 3 transputers! I didn't write programs for multi-processor machines again for more than 10 years. The transputer seems so ahead of its time, even now 36 years later. I sometimes wonder what it would be like if we'd continued down that path. Maybe your laptop would have 10,000 processors in it each with a few MB of RAM and we'd be writing very different programs in languages where message passing was a first class construct.
- com 2y ago> I sometimes wonder what it would be like if we'd continued down that path. Maybe your laptop would have 10,000 processors in it each with a few MB of RAM and we'd be writing very different programs in languages where message passing was a first class construct. It sounds a bit like the Erlang BEAM VM to be honest, the BEAM processes tend to be small and there are a lot of them in real-world applications, and message passing is a first class construct (along with some others like ETS which are “cheats” that offer other tradeoffs for specific cases)
- 2y ago
- jll29 2y agoFantastic, well done! - I remember the Inmos Transputers (T800), and there was Occam, the curious language, from which I remember just two operators, ? and ! to read and write from the four(?) fast serial ports that connected one transputer with its neighbors. Pascal was beautiful, clean, simple and fast, and computer science has never reached that height again, IMHO - look at how slow Python is, how unstructured many programs are, when python permitted nested functionsa and procedures (C/C++/Rust still cannot do that today). And the fast compilers, TurboPascal, TurboModula, and TurboC that made Borland famous and wealthy are in some sense also unrivalled: on machines 1000x slower than what I have now in my desk, you felt like you had the fastest PC money can buy.
- rurban 2y agoIn one of my previous jobs I've used such an Occam transputer, which got replaced by Pascal, and later by C. It got worse and worse. Eventually we couldn't get the hardware anymore and replaced everything in C. The Occam code was easy to understand and maintain - very complicated controller logic used in power train test sites. The Pascal code not so much anymore and finally floodgates opened with C. Go wasn't around then yet. I've learned Go and wrote the cygwin port after I've left that job. But the fast hardware made up for that mess.
- ingen0s 2y agoSweet. This was my first language, also in ealry 90's
- marcodiego 2y agoFamilia Toledo. They're abnormally gifted. I wonder what could have happened if they were thrown into Linux development in the early days.
- stuaxo 2y agoA great read. What's needed to actually implement FILE, are there any transputer emulators to run this on?
- nanochess 2y agoI've included a transputer emulator in the git for using the Pascal compiler. The FILE functions are missing probably because I couldn't figure a method to ask for host services and interleave data in the input/output channel.
- jgrahamc 2y agoTruly wonderful story and brought back a lot of memories because my 1992 DPhil thesis is in a combination of CSP and occam: https://blog.jgc.org/2024/03/the-formal-development-of-secure.html https://blog.jgc.org/2024/03/the-formal-development-of-secur...
- mmmlinux 2y agoIn case anyone else is unfamiliar with what a "transputer" is. https://en.wikipedia.org/wiki/Transputer https://en.wikipedia.org/wiki/Transputer
- CyberDildonics 2y agoThis seems like a cpu with a slightly different architecture that someone decided to name differently so people would think it was a larger innovation than it really was.
- hi_hi 2y agoI have fond memories of Pascal. As a 16 - 17 year old in the late 90's I developed a primitive drawing package in Turbo Pascal for a school project. The only reason I was able to achieve this was thanks to a unit (library) called VGraph which I came across on a floppy disk at a random computer fair. It was a game changer, allowing me to access high resolution modes (640 x 480 ha) previously unattainable to me, along with some other graphics primitives around line drawing and mouse cursors. I still have the program source, but the required Vgraph dependency has been lost to time, so I'm sadly unable to run it. I've searched online but never had much luck. If this lib sounds familiar to anyone, I would love to hear about it.
- wkjagt 2y agoAwesome read. I wish I'd started programming when I was a teenager. I mean, I did some BASIC on a Commodore 64, but nothing as advanced as OP was doing in his teens. By the way, I also have OP's "Programming Boot Sector Games" book, which is an amazing book.