[fpc-devel] EBCDIC (was On a port of Free Pascal to the IBM 370)

rvmartin2 at ntlworld.com rvmartin2 at ntlworld.com
Mon Jan 30 18:37:30 CET 2012


michael.vancanneyt at wisa.be wrote the following on 30/01/12 16:35:20:
> 
> 
> On Mon, 30 Jan 2012, rvmartin2 at ntlworld.com wrote:
> 
> > michael.vancanneyt at wisa.be wrote the following on 30/01/12 14:49:53:
> >
> >> I think the reason for producing an ASCII version first is very simple:
> >> All FPC sources - including the compiler - are in ASCII encoding.
> >
> > I don't understand this statement - ASCII and EBCDIC are just human representations of a computer's internal code.
> > I write my programs in the Latin (or Roman) alphabet and the computer does the rest.
> > When I was writing VS/Pascal programs I used the same source code as input to VS/Pascal on the mainframe and to Virtual Pascal on the PC.
> >
> > Unless the FP source code is to be fed into a mainframe compiler like
> > IBM's VS/Pascal or the Stanford compiler then the first step is surely to
> > write a backend for the (eg PC) compiler to produce 370 assembler code. 
> > Producing EBCDIC rather than ASCII sounds a trivial part of the task.
> 
> I had in mind the following scenario:
> 
> 1) Somehow we build - using cross-compilation - a first version of the
>    compiler that actually runs on the 370. This binary is transferred to a
>    370 machine.
> 
> 2) The sources of the compiler and RTL are transferred to the 370.
>     I assume that after the file transfer, the sources are still in ASCII format ?


No - sending source code from a PC to a 370 performs an automatic translation to EBCDIC (and vice versa).


> 
> 3) At that point the compiler can try to recompile itself on the 370
>     machine.
> 
> Unless you have performed some tranformation of the compiler/RTL sources, 
> the compiler in step 3 will read and compile from ASCII sources, no ?

IBM 370 doesn't use ASCII, anywhere, but it has a hardware instruction (TRT _ Translate and Test) which can convert between character sets in a single instruction using a suitable table.  
 








More information about the fpc-devel mailing list