6 ms·
This site doesn't describe the internals of Borland's Turbo Pascal compiler. It describes a compiler written in Turbo Pascal that can compile some subset of Tur
by barrkel 11y ago
This site doesn't describe the internals of Borland's Turbo Pascal compiler. It describes a compiler written in Turbo Pascal that can compile some subset of Turbo Pascal's language.
Borland's Turbo Pascal compiler was written in 16-bit x86 assembly, mostly by Anders Hejlsberg.
There is an explanation of this on the front page of the site, but it's not clear from the headline.
(I used to work at Borland on the Delphi compiler, and had access to the source of tpc.exe.)
- jgord 11y ago.. thats the story I was hoping to read, and have been waiting for, for many years. I went from the necessity of A86 assembler, thru the desperation of GW-Basic .. finally finding Turbo Pascal, which was a revelation at the time, just this phenomenal product and superb piece of engineering. Pulldown text menus, draggable text windows, editor out of the box .. fast compilation, wow - to me its one of the great monuments of computer history. I feel intensely nostalgic looking back on it now. And their manuals were first rate.. classy all round.
- Supraperplex 11y agoDesperation of GW-Basic?! Be glad you had that one. The other BASICs of those times where much more limited! GW was a little bit of awesome in it's own way. Oh, and POKE and PEEK.
- insulanian 11y agoYeah, my first lines were in QuickBASIC :)
- analog31 11y agoMy dad, who knew nothing about computers, saw an article in the Wall Street Journal about this guy with a new business model for selling software. On a whim, he got me a copy for my birthday. It was TP version 1. I stuck with TP through version 5, and even convinced my college teachers to let me use it for my programming assignments rather than whatever was on the college mainframe. The manuals were indeed a huge asset. You didn't really need to know anything about the OS, or go digging for third party documentation online, which was important because there was no online.
- vetinari 11y agoI learned programming by digging through TP6 online help. That and Ralf Brown's Interrupt List, so I could do something useful.
- analog31 11y agoOops! What I meant was, there was no such thing as "online" at all, when TP1 came out. ;-)
- vetinari 11y agoOnline as in "hlp file that's shown when you press F1". At the time online meant "not printed" :-)
- analog31 11y agoAh, yes. Now I get it. I'm kinda slow on the uptake sometimes. ;-) I stopped with TP5. At that point, I was up to my ears in my thesis project, and was not going to change any of my tools. Plus I'm a real tightwad. By the time I finally finished my degree, got a new job, and a new computer, it was an Apple Mac. And the modern OS's kind of killed my interest in programming for a while.
- ido 11y agoLightspeed Pascal (later renamed THINK Pascal) was a similarly solid compiler+IDE from about the same era for the early Macintosh.
- Tloewald 11y agoIt all went downhill after they got bought by Symantec.
- antimagic 11y agoI have very fond memories of just how blazingly fast Turbo Pascal was at compiling on my Mac. It stunned me every time. I remember spending most of one summer writing a text adventure game with it, based in the Australian Gold Rush. It even had NPCs which was quite advanced for text adventures of the day (I think the only NPCs in adventure games that I had encountered up to that point were those in the Hobbit, and of course the bloody thief in Zork (although he wasn't really an NPC, but was implemented as a bunch of semi-random encounters)... Good times. In particular, I remember having to implement my own strings, because for a text adventure you often want to have access to strings longer than 255 characters... Sadly, I never managed to make the jump from writing console applications with TP to writing proper Mac GUI apps. But "Inside Macintosh" cost an absolute fortune at the time (for a 10 year-old kid at any rate), so I ended up scraping enough money together to buy another text book whose name escapes me. I must have read the first few chapters about a million times - they talked about handles and graphics ports etc, but I could never get any code from them to run in TP (I think they were assuming that you would be using MPW?). Which brings me to the point of this long rambling message - did TP really support graphics programming on the Mac? I know my version of TP was an official bought copy, so we had the manual, but I don't remember ever seeing anything that explained GUI programming in there.
- pjmlp 11y agoWell you also had Apple's Object Pascal as the original OS system programming language, which was the inspiration for the OOP approach Turbo Pascal adopted. With that one, you could surely do graphics programming on the Mac. As for Turbo Pascal itself, I wasn't aware it was available on the Mac as well.
- ido 11y agoA more popular alternative to Apple's MPW on the mac was the 3rd party Lightspeed Pascal (later renamed THINK Pascal), which in many ways was quite similar to Turbo Pascal on the PC. IIRC TP was just a quick port & had a very short life on the mac.
- Supraperplex 11y ago
- Olivier26 11y agoTurbo Pascal was also available on CP/M (so 8080/Z80 8-bit). It was the most powerful language on Amstrad CPC 6128, the only 8-bit low cost computer to offer CP/M compatibility.
- vidarh 11y ago> the only 8-bit low cost computer to offer CP/M compatibility. The Commodore 128 also offered CP/M compatibility (through a second CPU...), though rarely used.
- Olivier26 11y agoYou're right, in Europe the Amstrad was less expensive than the Commodore and hence far more popular. The CPC 6128 was probably at this time the less expensive computer to run Turbo Pascal. The Apple II has an optional Z80 card, but the total price was not for everyone, at least in Europe.
- vidarh 11y agoI don't remember the 6128 being cheaper than the C128, and the prices I've found online doesn't seem to support that either. I'm sure it might have been the case in some markets, or some configuration (since the C128 could be bought without a hard drive and without a monitor) but it seems far from universal. Amstrad also sold far less than C128. The whole Amstrad CPC line sold about 3 million vs 5 million C128's. I don't know the breakdown between the Amstrad CPC models, but I'd bet a substantial percentage of that was the 464. I'm sure the Amstrads were more common for CP/M, though. Of the few people I knew with C128's, most used it as a glorified C64, and nobody used the CP/M mode. (Incidentally you could also get CP/M support for C64 through a cartridge that housed a Z80...)
- Olivier26 11y agoThe floppy disc reader was required for CP/M (and a 80 column monitor), so the comparison is with the C128 + 1571 or with the C128D. If in 1985 the C128 had been cheaper than the 6128, I'd have bought the Commodore instead.
- shdon 11y agoAccording to the author, it is not just a subset and actually produces the same binary files as actual TP would (with the exception of debug info). I can't currently verify that claim, but here's what he says on the downloads page: "It can compile any source code compatible with Turbo Pascal 7 syntax. It will generate the same executable file and unit files as the original Borland compiler."
- barrkel 11y agoIt's unlikely to be 100% bug compatible with TP 7. There are various obscure bits in most languages that have been around for a while, where the implementation choices are a bit arbitrary and interaction between different features can turn up unexpected behaviour. Turbo Pascal was a much smaller language than what Delphi became, so I can't point you out examples off the top of my head. If I were looking into compatibility issues, I'd play around with things like alignment and packing rules, TP's various hacks to get around Standard Pascal's fixed length strings (e.g. OpenString {$P+}), etc.
- samuell 11y agoTo me, FreePascal, with its upcoming 3.0 release, is much more interesting. Interestingly, in 3.0, it will support compiling JVM byte code. [1] [1] http://wiki.freepascal.org/FPC_New_Features_3.0#Support_for_the_Java_Virtual_Machine_and_Dalvik_targets http://wiki.freepascal.org/FPC_New_Features_3.0#Support_for_...
- pvg 11y agoTurbo Pascal was originally written for and targeted the (8-bit) Z80, unless Wikipedia has it backwards. https://en.wikipedia.org/wiki/Turbo_Pascal#CP.2FM_and_DOS_versions https://en.wikipedia.org/wiki/Turbo_Pascal#CP.2FM_and_DOS_ve... The Turbo Pascal compiler was based on the Blue Label Pascal compiler originally produced for the NasSys cassette-based operating system of the Nascom microcomputer in 1981 by Anders Hejlsberg. Borland licensed Hejlsberg's "PolyPascal" compiler core (Poly Data was the name of Hejlsberg's company in Denmark), and added the user interface and editor. Anders Hejlsberg joined the company as an employee and was the architect for all versions of the Turbo Pascal compiler and the first three versions of Borland Delphi.
- TD-Linux 11y agoThat's correct, I even have a version of it for the Z80 Softcard on the Apple II. Even in that day, the license was still only for 1 CPU and you had to mail in a license registration card to be able to use the software (I don't think that sort of EULA is legally enforceable, though)
- pvg 11y agoHow did that licensing work? Like any self-respecting 11-year-old, my Apple ][ CP/M copy of Turbo Pascal was pirated.
- TD-Linux 11y agoThe book just told you to mail in the registration card with strong language. I don't think it was legally enforceable in any way. There wasn't a license key or anything.
- kjs3 11y agoThat's correct. I first used it on a Z-80 CP/M machine.
- FullyFunctional 11y agoActually, the CP/M version was called COMPAS Pascal, but it was very nearly the same code.
- cataflam 11y agoInteresting! Any stories you could share from your time at Borland ? I started programming with Turbo Pascal pretty much (if one doesn't count a small bit of BASIC before). I also have a vivid memory of Delphi, both programming in Delphi (which was a breeze) and reverse engineering programs written in Delphi (which was a nightmare).