FORTRAN on the Sharp MZ-700
Yes, really!
The sharpmz.no site has a number of programs preserved for download. One of them is the BBG RealFortran compiler, v1, written by Bialke, Berendsen and Gliszczynski. I converted the .mzf file to a .wav, recorded it to a cassette tape and loaded it onto my machine. However as the only manual available for the compiler was in German, I needed to spend some time translating it into English before I could start.
My English translation of the Sharp MZ-700 BBG RealFortran manual
For people used to early FORTRAN dialects (I cut my teeth as a programmer on FORTRAN 66) some of it will seem familiar – like the arithmetic IF statement. But there’s a lot that is either missing or unfamiliar.
Some of the more obvious missing features are Hollerith, logical, double precision and complex data types, the ability to define meaningful subroutines or functions (variable scope is program wide – so common blocks, equivalence and data statements are all unsupported too), continuation lines and logical expressions.
The compiler supports implicit typing only. This means that a variable name starting in the range I-N is always treated as an integer. Any other variable name implies it’s a real. The format statement is unimplemented, but formatting is supported by means of a non-standard implementation of the read and write statements.
There are a number of extensions, the most notable being the mem function, which serves as an equivalent to poke and peek in Sharp BASIC.
The documented IRND function (generate a random integer) is missing from the compiler, so at some point I will have a go at patching in a Z80 routine of my own to compensate. Most attempts at games programming would need a random number generator!
Given its limitations, could I write a program to do anything in it? Well, yes. My (t)rusty sieve of Eratosthenes prime number algorithm is simple enough to implement.
0:C PRIME NUMBER GENERATOR
1:C TIM HOLYOAKE 13/06/2021
2: DIMENSION IP(255)
3: WRITE(/,”Prime no. limit”)
4: READ(“( < 32767 ) ? “,L.I)
5: WRITE(//,”. 2 3”)
6: IP(1)=3
7: N=1
8: DO 700 IX=5,L,2
9: 100 M=IFIX(SQRT(FLOAT(IX))+0.5)
10: DO 200 J=1,N
11: IW=IP(J)
12: IF (IW-M),,300
13: IF (IX-IW*(IX/IW)),500,
14: 200 CONTINUE
15: 300 N+N+1
16: IF (N-255),,400
17: IP(N)=IX
18: 400 WRITE(“ .”,IX)
19: GOTO 700
20: 500 WRITE(“ . .”)
21: 700 CONTINUE
22: WRITE(//,N+1,” primes found”,/)
23: END
And here’s the output from the end of a run to generate the first 168 prime numbers (i.e. all the prime numbers in the range 1 to 1,000). Total execution time is around 20 seconds.

There’s another Fortran compiler (SOSZ80) for the MZ-700 available on sharpmz.no so I may give that a spin too in the future.
The challenge with that complier is that there’s no manual available at all!
Update 15th June 2021: It would appear that the other Fortran compiler is the one BBG RealFortran was originally based on. My rationale for this conclusion is that everything seems identical, apart from:
- The header of the compilation message is correctly formatted (there’s a missing left bracket in the message the BBG RealFortran compiler issues when compilation starts)
- Complier mode commands cannot be abbreviated – i.e. COMPIL, RUN & EDIT are required instead of C,R & E – suggesting this is an earlier version
- The IRND function is present and functional in this version – suggesting that it may have been overwritten by an error introduced by the changes made to create the BBG RealFortran version.
