• Please review our updated Terms and Rules here

Was there a pascal version for 8080 posting on vcfed recently

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
2,393
Location
USA
I remember seeing a screenshot of it and it was some sort of turbo pascal clone but worked for 8080 I thought...
 
I know TP is Z80 only and I know someone was trying to make a way to run its programs on 8080 that there was a big thread about.

It was a clone of TP that worked with 8080 and there was a screenshot of it that showed an older style +-------+ type menu. I think some of the text in that menu was inverted. There was a second post where someone was like "I'll check this out". It had a name with pascal in it, but some other word before it. Perhaps I dreamed it !?!
 
There's a Russian clone of Turbo Pascal for the 8080, however it only runs on one specific machine. One important feature it seems to absolutely require is an extra 48K (IIRC) memory bank, so it isn't a simple job of patching it, and almost certainly couldn't be made to work on a system which doesn't have that.

But you can run it in an emulator and it should be able to compile programs for generic CP/M-80.

 
That IS it!!! I see it is from 2020, but someone must have posted a reply and made it popup in the new again. Thanks!
 
I was interested in this too. Has this thread been mentioned yet?


Also this thread:


Turbo Pascal started life as BLS (integer) Pascal, a 12k ROM for the Nascom 1, which might be worth looking at.
tommythorn.github.io/nascomhomepage.com

The other one to look at is Hisoft's very good Pascal compiler for the Z80, which was a 24k (ish) compiler/editor for the 48k spectrum, amstrad, and ( I think) cp/m, etc..
 
Last edited:
Question: is there any source available of a (Turbo) Pascal for Z80? I assume not otherwise it could be used to create an 8080 one.

Somebody posted a link on that said it could create the source code of Tubo Pascal 3. It worked, although there were some errors. I solved these errors and now I have a code that creates a compatible COM file. "Compatible" because NASM doesn't use the same opcodes for some instructions as MASM. But it works.
If somebody is interested, he/she can have these source codes and convert them into 8080. (Is there a tools that can do that?) Or disassemble TP3 for Z80, compare the result with my files and turn the Z80 opcodes into 8080 ones.

Being a TP fan I would love to do that myself but I already have to many projects on my plate :(
 
I think you misunderstood that. As I understand it, these tools are written for CP/M-80, not the sources. I opened some of the source files and they contain Z80 code.
 
Sorry about that - I didn't mean that it was 8080 compatible instructions - which I realize "CPM/80" does mean. I meant that the source was for the Z80 version and not the DOS version.
 
Yeah... in the 80's Z80 machines dominated CPM.
Few remembered (or cared) CPM was spec'd to run on an 8080, therefore Z80 instructions were to be avoided.
However, Borland made Turbo Pascal to run on a Z80, and will not run on an 8080 system running CPM.
Not just fine print wording - I actually tried it and it failed.
-J
 
One little addition here - a while back I did see 8080 listed as a target for freePascal (it might be an old version). Also there is a pascal to c converter around, then use a c80 compiler?
 
Looking at free pascal further, I only find a z80 (for spectrum, msxdos, embedded) backend:

https://wiki.freepascal.org/Z80

But I guess, since its a compiler designed for many processors, editing that to 8080 is easier than trying to convert TP (though that would also be cool).
 
The Z80 contains a few very useful abilities for compiled languages, and it massively dominated the 8080/8085 processors. There were very few reasons not to target the Z80.

Adapting the code generator and runtime to produce 8080 code ranges from "almost trivial" to "next to impossible", depending on which features are used. Replacing (IX+n) and (IY+n) addressing modes will not be cheap.
 
Sure, I was suggesting adding an 8080 mode in addition to the z80, not replacing the z80. Although its interesting on this thread that some of the uses of z80 code by TP are actually faster recoded for 8080!
I think you would work by writing new code framework for the psuedo-ops freepascal generates, rather than trying to use macros to replace uses of IX/IY etc.
You never know, a clever 8080 rewrite version might turn out faster!
 
Although its interesting on this thread that some of the uses of z80 code by TP are actually faster recoded for 8080!
Most Z80 extensions (including use of IX/IY) require an additional machine cycle to read the extra opcode byte. So optimizing for speed on a Z80 requires carefully choosing when not to use its capabilities.

However, the Z80 provides two additional pointer registers (reducing pressure on HL, which does double duty as 16-bit accumulator), which can substantially reduce register shuffling or spilling. The new (IX+n) and (IY+n) addressing modes are great for structure/record member accesses, which the 8080 is quite bad at. There are a few other enhancements worth using.

The runtime library needs to be highly optimized for good performance, so it tends to be the bigger issue. But looking at the FreePascal sources ... most of it not implemented for Z80 in the first place (just memset, memmove, inport and outport), which leaves the code generator itself.

Yeah, seems doable. But I am not going to do it. :)
 
Fair enough! I posted this up in case someone was still trying to do this. Did anyone get very far with a conversion of Turbo Pascal?
Anyway for FreePascal to start a quick hack would be to use macros for these extensions, with static vars for IX/IY etc, just to get it running, then go back and recode sections with proper 8080 code.
But yes, still a fair bit of work, but maybe less than recoding TP.
 
Last edited:
Did anyone get very far with a conversion of Turbo Pascal?
The Turbo Pascal source code is not public. Doing this requires both rewriting Turbo Pascal itself, its code generator and its runtime library. There is no point doing this in the first place. So the answer is no.

It is easier to write a new TP-compatible compiler from scratch. This has been done, the result was linked earlier in this thread.

Regarding FreePascal, it is probably easy enough to just copy the Z80 code generator and stub out all instances where it generates Z80-specific code. But given the lack of an optimized runtime, I can't imagine anyone using it productively. Today, Pascal is a niche language.
 
Back
Top