Restored F80 compiler code for CP/M

412 views
Skip to first unread message

Андрей Никитин

unread,
Feb 8, 2022, 4:11:47 PMFeb 8
to
The restored program is located on
https://github.com/nikitinprior/dF80

Andrey

dxforth

unread,
Feb 8, 2022, 6:16:37 PMFeb 8
to
On 9/02/2022 08:11, Андрей Никитин wrote:
> The restored program is located on
> https://github.com/nikitinprior/dF80

Thanks for your work. AFAIK the last official F80 release was version 3.44
dated 10-Dec-81. Seems unlikely MS would still been involved with CP/M in 1985.

Udo Munk

unread,
Feb 9, 2022, 2:50:27 AMFeb 9
to
dxforth schrieb am Mittwoch, 9. Februar 2022 um 00:16:37 UTC+1:
> Thanks for your work. AFAIK the last official F80 release was version 3.44
> dated 10-Dec-81. Seems unlikely MS would still been involved with CP/M in 1985.

Microsoft still was involved in CP/M in 1985, for example:

A>d:mbas529
BASIC-85 Rev. 5.29
[CP/M Version]
Copyright 1985-1986 ? by Microsoft
Created: 28-Jul-85
34872 Bytes free
Ok

Don't know about F80.

dxforth

unread,
Feb 9, 2022, 3:29:27 AMFeb 9
to
That would be the one that's byte identical to

BASIC-80 Rev. 5.21
[CP/M Version]
Copyright 1977-1981 (C) by Microsoft
Created: 28-Jul-81

except for sign-on string? And what is a 'BASIC-85' anyway - 1985?

Андрей Никитин

unread,
Feb 9, 2022, 10:12:37 AMFeb 9
to
среда, 9 февраля 2022 г. в 11:29:27 UTC+3, dxforth:
The F80 package for the TRS-80 ("FORTRAN-80 Ver. 3.4 Copyright 1978, 79, 80 (C) By Microsoft" Created: 01-Dec-80 produce Z80-mnemonics.

Possibly Disassembled FORTRAN-80 Ver. 3.4 Copyright 1978, 79, 80 (C) By Microsoft Created: 19-Feb-85 was adapted for CP/M from it.

If someone has the opportunity to test the work of this compiler on TRS-80 or in the emulator, please do so.

To do this, compile the following small program and execute it.

A>type V2.for
C 234567
DIMENSION K(5)
DO 10 I=1,3
K(I)=100+I
10 CONTINUE
WRITE(1,100) K(1),K(2),K(3),K(4),K(5)
100 FORMAT(1X,5 I7)
END

A>V2 (compiled with F80 v3.44 "Created: 10-Dec-81")

101 102 103 0 0

A>V2 (compiled with F80 v3.4 "Created: 19-Feb-85") ***

0 101 102 103 0

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** writes the value expected BUT puts it into the WRONG slot!

Please report the results. If there is no error in the TRS-80 version, then I will compare these programs and look for an error in the CP/M version.

Andrey

ogd...@gmail.com

unread,
Feb 9, 2022, 11:02:30 AMFeb 9
to
Andrey
Have you tried linking the 3.44 libraries with code generated by v3.4. It is possible that the bug lies in the libraries.
As to the TRS-80 version, it may be the same core compiler with modified I/O routines to adapt it to run on the TRS80 and some minor changes to emit z80 code names.

Mark

Андрей Никитин

unread,
Feb 9, 2022, 11:47:20 AMFeb 9
to
среда, 9 февраля 2022 г. в 19:02:30 UTC+3, ogd...@gmail.com:
Mark
The error is in the compiler.
When compiling with the listing option, there is a string that is different from the listing generated by the correct compiler. I used the library from the compiler kit with an error.

FORTRAN-80 Ver. 3.4 Copyright 1978, 79, 80 (C) By Microsoft
BYTES: 36777
Created: 19-Feb-85 ;Created: 10-Dec-81
1 C234567 ;1 C234567
2 DIMENSION K(2) ;2 DIMENSION K(2)
3 DO 10 I=1,2 ;3 DO 10 I=1,2
***** 0000' LD BC,$$L ;***** 0000' LXI B,$$L
***** 0003' JP $INIT ;***** 0003' JMP $INIT
4 K(I)=I ;4 K(I)=I
***** 0006' LD HL,0001 ;***** 0006' LXI H,0001
***** 0009' LD (I),HL ;***** 0009' SHLD I
5 10 CONTINUE ;5 10 CONTINUE
***** 000C' LD HL,(I) ;***** 000C' LHLD I
***** 000F' ADD HL,HL ;***** 000F' DAD H
***** 0010' LD DE,K ;***** 0010' LXI D,K-0002 <== ERROR
***** 0013' ADD HL,DE ;***** 0013' DAD D
***** 0014' LD (T:000000),HL ;***** 0014' SHLD T:000000
***** 0017' LD HL,(I) ;***** 0017' LHLD I
***** 001A' EX DE,HL ;***** 001A' XCHG
***** 001B' LD HL,(T:000000) ;***** 001B' LHLD T:000000
***** 001E' LD (HL),E ;***** 001E' MOV M,E
***** 001F' INC HL ;***** 001F' INX H
***** 0020' LD (HL),D ;***** 0020' MOV M,D
6 WRITE(1,100) K(1),K(2) ;6 WRITE(1,100) K(1),K(2)
***** 0021' LD HL,(I) ;***** 0021' LHLD I
***** 0024' INC HL ;***** 0024' INX H
***** 0025' LD A,02 ;***** 0025' MVI A,02
***** 0027' SUB L ;***** 0027' SUB L
***** 0028' LD A,00 ;***** 0028' MVI A,00
***** 002A' SBC H ;***** 002A' SBB H
***** 002B' JP P,0009' ;***** 002B' JP 0009'
***** 002E' LD DE,100L ;***** 002E' LXI D,100L
***** 0031' LD HL,[01 00 00 00] ;***** 0031' LXI H,[01 00 00 00]
***** 0034' CALL $W2 ;***** 0034' CALL $W2
7 100 FORMAT(1X,2I3) ;7 100 FORMAT(1X,2I3)
***** 0037' LD DE,K ;***** 0037' LXI D,K
***** 003A' LD HL,[01 00 00 00] ;***** 003A' LXI H,[01 00 00 00]
***** 003D' LD A,02 ;***** 003D' MVI A,02
***** 003F' CALL $I0 ;***** 003F' CALL $I0
***** 0042' LD DE,K+0002 ;***** 0042' LXI D,K+0002
***** 0045' LD HL,[01 00 00 00] ;***** 0045' LXI H,[01 00 00 00]
***** 0048' LD A,02 ;***** 0048' MVI A,02
***** 004A' CALL $I0 ;***** 004A' CALL $I0
***** 004D' CALL $ND ;***** 004D' CALL $ND
8 END ;8 END
***** 0050' CALL $EX ;***** 0050' CALL $EX
***** 0053' 01 00 00 00 ;***** 0053' 01 00 00 00

Program Unit Length=0057 (87)
Bytes
Data Area Length=0011 (17) Bytes

Andrey

Андрей Никитин

unread,
Feb 9, 2022, 12:00:51 PMFeb 9
to
среда, 9 февраля 2022 г. в 19:47:20 UTC+3, Андрей Никитин:
Mark

Based on date, it is most likely that a CP/M version was made from the TRS-80 version.

Andrey

dxforth

unread,
Feb 10, 2022, 1:42:49 AMFeb 10
to
On 10/02/2022 02:12, Андрей Никитин wrote:
> среда, 9 февраля 2022 г. в 11:29:27 UTC+3, dxforth:
>> On 9/02/2022 18:50, Udo Munk wrote:
>> > dxforth schrieb am Mittwoch, 9. Februar 2022 um 00:16:37 UTC+1:
>> >> Thanks for your work. AFAIK the last official F80 release was version 3.44
>> >> dated 10-Dec-81. Seems unlikely MS would still been involved with CP/M in 1985.
>> >
>> > Microsoft still was involved in CP/M in 1985, for example:
>> >
>> > A>d:mbas529
>> > BASIC-85 Rev. 5.29
>> > [CP/M Version]
>> > Copyright 1985-1986 ? by Microsoft
>> > Created: 28-Jul-85
>> > 34872 Bytes free
>> > Ok
>> That would be the one that's byte identical to
>>
>> BASIC-80 Rev. 5.21
>> [CP/M Version]
>> Copyright 1977-1981 (C) by Microsoft
>> Created: 28-Jul-81
>>
>> except for sign-on string? And what is a 'BASIC-85' anyway - 1985?
>> >
>> > Don't know about F80.
>
> The F80 package for the TRS-80 ("FORTRAN-80 Ver. 3.4 Copyright 1978, 79, 80 (C) By Microsoft" Created: 01-Dec-80 produce Z80-mnemonics.
>
> Possibly Disassembled FORTRAN-80 Ver. 3.4 Copyright 1978, 79, 80 (C) By Microsoft Created: 19-Feb-85 was adapted for CP/M from it.

I don't have the TRS-80 version but the dates looks plausible. It needs to be
tested whether it has the bug.

The second one looks suspicious from the outset. I can't imagine MS bungling
the copyright and creation dates.

ogd...@gmail.com

unread,
Feb 10, 2022, 5:00:10 AMFeb 10
to
Andrey
I have versions 3.36, 3.4 and 3.44 for CP/M all copyrighted from 1978. The TRS80 was only delivered in Nov 1977, and CP/M was well established by then. This would suggest that the CP/M version was probably the original version.

On a separate note, was the TRS80 version for its own DOS or for its version of CP/M, which loaded programs higher in memory. I am aware that the Basic compiler had a version for the TRS80 version of CP/M, so the Fortran compiler may be similar.
Mark

ogd...@gmail.com

unread,
Feb 10, 2022, 5:07:01 AMFeb 10
to
Andrey
I just looked at the distributed cpmio.mac source that came with F80 v3.44 and it clearly suggests the TRS80 version was probably for it's version of CP/M.
The top of the file is
TITLE CPMIO CONSOLE I/O ROUTINES FOR CP/M
ENTRY $TTYIN,$TTYOT,$LNPTR,$CPMBF,$LINBF
TANDY EQU 0
CPMSBC EQU 0
;
IF2
.PRINTX /CPMIO/
IFT TANDY
.PRINTX/TANDY VERSION/
ENDIF
IFT CPMSBC
.PRINTX/CPM SBC VERSION/
ENDIF
IFF TANDY OR CPMSBC
.PRINTX/NORMAL CPM VERSION/
ENDIF
ENDIF

Mark

ogd...@gmail.com

unread,
Feb 10, 2022, 5:50:21 AMFeb 10
to
Checking the 3.33, 3.36, 3.4 and 3.44 compilers on CP/M.
The error you highlight was only present in the 3.4 version.

What is interesting is that the 3.4 version uses Z80 mnemonics whilst the other versions use the intel ones. This suggests that Microsoft offered 8080 and z80 versions of the compiler. It is not clear whether the code generated or libraries were optimised for the z80.
Mark

Андрей Никитин

unread,
Feb 10, 2022, 6:09:56 AMFeb 10
to
четверг, 10 февраля 2022 г. в 13:50:21 UTC+3, ogd...@gmail.com:
I think that only a new executable file was made for TRS 80. Most likely, the libraries were not changed, since the compiler generates i8080 commands and changes the mnemonics to z80 only in the listing.

Andrey

fridtjof.ma...@gmail.com

unread,
Feb 11, 2022, 9:52:43 AMFeb 11
to
Thank you Andrey for this! I very much appreciate your work.

Martin

unread,
Feb 11, 2022, 11:09:16 PMFeb 11
to
These irregularities are very obvious.
You are not the first one noticing something.

I remember two threads discussing this:

comp.lang.fortran
19.10.09 23:20
"it's too late for a bug report"
https://groups.google.com/forum/?_escaped_fragment_=topic/comp.lang.fortran/1_Oky1YqTo4

comp.os.cpm
06.06.14 08:16
"F80 date puzzle"
https://groups.google.com/forum/?_escaped_fragment_=topic/comp.os.cpm/bkAz1RCpvho


I only have saved the old google groups links from that time, sorry.
Hope you can find them,


Андрей Никитин

unread,
Feb 14, 2022, 11:52:42 AMFeb 14
to
суббота, 12 февраля 2022 г. в 07:09:16 UTC+3, Martin:
I assume that for CP/M the FORTRAN compiler is 80 Ver. 3.4 Copyright 1978, 79, 80 (C) Microsoft Created: 19-Feb-85 was remade from the executable code of the FORTRAN-80 Ver compiler. 3.4 Copyright 1978, 79, 80 (C) Microsoft Created: 01-Dec-80 for TRS-80.

It is most likely that the original compiler for TRS-80 was prepared directly by Microsoft. Disassembly of the source file F80.CMD showed the presence in the executable file of a set of traps placed by the authors of the program to complicate its disassembly. Fragments of superfluous code were excluded from the program modified for CP/M and a number of other actions were performed to overcome the protection against disassembly. A mistake was made in some place.

Who performed this transformation will remain unknown.

However, I disassembled the compiler F80 Ver. 3.44 for CP/M. The file with the program has the name F.MAC. Compiling this file results in the creation of an executable file completely identical to the original program.

Andrey

Steven Hirsch

unread,
Feb 14, 2022, 2:12:14 PMFeb 14
to
On 2/14/22 11:52, Андрей Никитин wrote:
> It is most likely that the original compiler for TRS-80 was prepared
> directly by Microsoft. Disassembly of the source file F80.CMD showed the
> presence in the executable file of a set of traps placed by the authors of
> the program to complicate its disassembly. Fragments of superfluous code
> were excluded from the program modified for CP/M and a number of other
> actions were performed to overcome the protection against disassembly. A
> mistake was made in some place.
>
> Who performed this transformation will remain unknown.
>
> However, I disassembled the compiler F80 Ver. 3.44 for CP/M. The file with
> the program has the name F.MAC. Compiling this file results in the creation
> of an executable file completely identical to the original program.

Microsoft put hooks into many of their tools that check for an Apple 2
SoftCard Z80 environment. I have a bypass patch for the "ALDS" version of M80
(recognizes .Z80, .8080 and .6502 directives) and I think there's one floating
around for F80 as well.


dxforth

unread,
Feb 14, 2022, 7:56:01 PMFeb 14
to
On 15/02/2022 03:52, Андрей Никитин wrote:
>
> I assume that for CP/M the FORTRAN compiler is 80 Ver. 3.4 Copyright 1978, 79, 80 (C) Microsoft Created: 19-Feb-85 was remade from the executable code of the FORTRAN-80 Ver compiler. 3.4 Copyright 1978, 79, 80 (C) Microsoft Created: 01-Dec-80 for TRS-80.
> ...

Does this mean there was never an official F80 V3.4 release for CP/M ?

> It is most likely that the original compiler for TRS-80 was prepared directly by Microsoft. Disassembly of the source file F80.CMD showed the presence in the executable file of a set of traps placed by the authors of the program to complicate its disassembly. Fragments of superfluous code were excluded from the program modified for CP/M and a number of other actions were performed to overcome the protection against disassembly. A mistake was made in some place.
>
> Who performed this transformation will remain unknown.

Or why given V3.44 already existed. It seems a lot of effort to expend just to
have Z80 mnemonics.

Андрей Никитин

unread,
Feb 15, 2022, 6:30:28 AMFeb 15
to
вторник, 15 февраля 2022 г. в 03:56:01 UTC+3, dxforth:
Microsoft released the FORTRAN compiler for CP/M and made releases with a binding to work in the TRS-80 and Apple 2 SoftCard environments. Perhaps even for some environments. The Microsoft manual even mentions Intel's ISIS II operating system. But I have not found any implementations for ISIS II.

I found several implementations of the F80 compiler on the Internet.
There is version 3.4 for TRS-80 and "Apple 2 SoftCard". Both version in the listing generate Z80 mnemonics and both do not work under CP/M control.

The implementation for Apple 2 SoftCard should be closest to the version for CP/M. In this version, need to disable hardware binding.

Only managers who worked at the company at that time know how Microsoft licensed its products.

A license to work on another operating system clearly had a much higher cost. In this regard, third-party manufacturers could not purchase all the released versions for financial reasons. In addition, Microsoft maintained its priority in this matter.

dott.Piergiorgio

unread,
Feb 23, 2022, 3:40:40 AMFeb 23
to
On 09/02/22 09:29, dxforth wrote:

> except for sign-on string?  And what is a 'BASIC-85' anyway - 1985?

from the name, I guess a version of basic for the intel 8085...

someone can try to disassemble and see if is only cosmetic or actually
use RIM/SIM ?

Best regards from Italy,
dott. Piergiorgio.

Udo Munk

unread,
Feb 23, 2022, 6:17:21 AMFeb 23
to
In 1985 Microsoft re-released several software packages under the new name product-85 instead of product-80. Has nothing to do with the 8085 CPU.

dxforth

unread,
Feb 23, 2022, 8:58:59 AMFeb 23
to
On 23/02/2022 22:17, Udo Munk wrote:
> In 1985 Microsoft re-released several software packages under the new name product-85 instead of product-80. Has nothing to do with the 8085 CPU.

Looking at MBASIC version '5.29' again, the characters representing copyright
symbol in the sign-on was changed from (C) to a single byte $A4. It turns out
the Amstrad CPC code to display the copyright symbol is $A4. Coincidentally
if run on a terminal that strips bit 7 it becomes $24 which is the ascii code
for '$'.



Андрей Никитин

unread,
Mar 22, 2022, 8:33:20 AMMar 22
to
среда, 23 февраля 2022 г. в 16:58:59 UTC+3, dxforth:
Due to my preference for Z80 mnemonics, I chose an unsuccessful version of the executable file with an error to disassemble the Microsoft F80 compiler, then disassembled the latest version of this compiler with Intel mnemonics. It doesn't seem to have errors. However, my interest in this compiler has not disappeared. From various Internet sources, I received several more executable files for different operating systems.
At this stage, I was able to establish that Microsoft was selling its compiler under its own name and as an OEM product for other systems. The compiler core remained unchanged, but various tricks were added to the program text to complicate disassembly. Perhaps other developers were provided with parts of the compiler in object code format with instructions on how to use them to obtain an executable file for a particular system. I have collected several compilers of version 3.4. Apparently this is one of the versions that was intended for use on third-party equipment. In the initial versions, there was no possibility of using included files. In the latest versions, it appeared, but was added in a hurry. Some of the routines are made in the form of stubs. The processing functions of included files are most developed in the compiler version for the Z80 board on Apple computers. The advent of 16-bit processors stopped the further development of this compiler. Restoring the source code reminds me of excavating cities of ancient civilizations. We find ancient and useless shards now and try to understand how people used to live and think. You have to spend a lot of effort on this activity, manually move tons of soil to get a result. But if this is not done, it will not be possible to preserve the history of the development of our civilization.

Andrey

Udo Munk

unread,
Mar 22, 2022, 2:17:01 PMMar 22
to
That should be the first OEM version:

0930: 01 21 01 00 22 9B 01 C3 B2 5F 46 4F 52 54 52 41 .!.."...._FORTRA
0940: 4E 2D 38 30 20 56 65 72 2E 20 33 2E 30 35 20 43 N-80 Ver. 3.05 C
0950: 6F 70 79 72 69 67 68 74 20 31 39 37 38 20 28 43 opyright 1978 (C
0960: 29 20 42 79 20 4D 69 63 72 6F 73 6F 66 F4 49 4D ) By Microsof.IM
0970: 53 41 49 20 46 4F 52 54 52 41 4E 20 31 39 37 38 SAI FORTRAN 1978
0980: 20 56 65 72 2E 20 33 2E 30 B5 7E 12 23 13 05 C2 Ver. 3.0.~.#...

dxforth

unread,
Mar 22, 2022, 7:38:33 PMMar 22
to
At least the release and copyright dates match. This one quotes a future
copyright :)

5F70: 21 7F 0C C3 76 5D 0D 0A 0A 4F 77 6E 65 64 20 62 !...v]...Owned b
5F80: 79 20 4D 69 63 72 6F 73 6F 66 74 0D 0A 00 20 42 y Microsoft... B
5F90: 79 74 65 73 20 66 72 65 65 00 42 41 53 49 43 2D ytes free.BASIC-
5FA0: 38 35 20 52 65 76 2E 20 35 2E 32 39 0D 0A 5B 43 85 Rev. 5.29..[C
5FB0: 50 2F 4D 20 56 65 72 73 69 6F 6E 5D 0D 0A 43 6F P/M Version]..Co
5FC0: 70 79 72 69 67 68 74 20 31 39 38 35 2D 31 39 38 pyright 1985-198
5FD0: 36 20 20 A4 20 20 62 79 20 4D 69 63 72 6F 73 6F 6 . by Microso
5FE0: 66 74 0D 0A 43 72 65 61 74 65 64 3A 20 32 38 2D ft..Created: 28-
5FF0: 4A 75 6C 2D 38 35 0D 0A 00 00 00 00 00 00 00 00 Jul-85..........
Reply all
Reply to author
Forward
0 new messages