[net.micro] Converting 8080/z80 to C?

pugsly@UCB-VAX.ARPA (10/02/85)

Is there any easy way to convert 8080/Z80 asm. language to 'C'?
Like some kind of translator or something?
(I have a feeling I am wishing!)
Thanks in advance.
			David A. Roth
		...decvax!pur-ee!isrnix!pugsly
			Indianapolis,IN

petera@hcrvax.UUCP (Smith) (10/05/85)

	Converting from 8080 or Z80 to C would be pretty simple. The actual
C code produced could just be a sequence of simple assignments, logical
operations and jumps. The resulting code produced by the C compiler would
not be as good as the original code but it could be done. The only hard thing
would me getting the operating system interface correct. I suppose that a 
CPM to MSDOS translator could be written for well behaved programs but 
it would be a bit tricky to get correct. The format of file names, info 
that goes into FCB's etc. would all cause real headaches. So: Well behaved
Z80/8080 to C using say single character I/O and simple file I/O would
be quite possible but any fancy programs that do things like modify their
own code (like an 8080 16 bit multiply may do) would not work.

	Peter Ashwood-Smith
	Human Computing Resources,
	Toronto, Ontario.

kbb@faron.UUCP (Kenneth B. Bass) (10/18/85)

In article <1994@hcrvax.UUCP> petera@hcrvax.UUCP (Smith) writes:
>
>                                                         I suppose that a 
>CPM to MSDOS translator could be written for well behaved programs but 
>it would be a bit tricky to get correct. The format of file names, info 
>that goes into FCB's etc. would all cause real headaches. So: Well behaved
>Z80/8080 to C using say single character I/O and simple file I/O would
>be quite possible but any fancy programs that do things like modify their
>own code (like an 8080 16 bit multiply may do) would not work.
>
>	Peter Ashwood-Smith
>	Human Computing Resources,
>	Toronto, Ontario.

One of the original design features of MS-DOS (all versions) was a
CPM compatible interface.  Compare CPM function calls and lower DOS
functions.  Also, DOS functions can be invoked via a call to 0005h,
same as CPM.  This feature was really intended for CPM programs in
8080 code that were converted to 8086 code; only a direct conversion
of object code was needed.  As for format of file names, FCB info etc.,
if the original program was 100% CPM compatible, then there would be
no translation problem, since CPM file names, FCB's, etc. are all
subsets of DOS, and most of the fancy stuff is done internal to DOS.

BTW, in it's DOS 2.10 Technical Reference Manual, Microsoft recommends
that use of this feature not be used, hinting perhaps that in later
versions it will not be supported at all....


			"It ain't necessarily so"
			ken bass
			linus!faron!kbb