-

Packages Execution PORT MSX

From HI-TECH C for CP/M Fan WIKI(EN)
Revision as of 08:35, 2 November 2017 by Kumokosi (talk | contribs) (The READ.ME that was included with the adapted C.COM)
Jump to: navigation, search

HITECH-1.PMA

Hitech-C for MSX

Comments from Wiki editor

This document is a overview of difference between original HI-TECH C for CP/M and "HI-TECH C for MSX" ported by Pierre Gielen.

MSX adjusted files are located in HITECH-1.PMA and HITECH-4.PMA.

HITECH-1.PMA Basic files which are adjusted for MSX HITECH-4.PMA Routines which are adjusted for MSX in the meantime, and some other useful programmes.

This document descrives about HITECH-1.PMA.

  • READ.ME
  • C.C
  • EXEC.H
  • STDIO.H.

Comments, explanation of these files below are contained and edited in this document adding chapter names.

Refer Manual of HI-TECH C for CP/M about details as well.


READ.ME

About

This HITECH-1.PMA contains:

The HITECH-C compiler for CP/M.

Programmes adapted to MSX by Pierre Gielen:

  • C.COM
  • C.C
  • EXEC.H
  • STDIO.H.

(So all the other files are just the same as in the CP/M version, as far as I know. I'm not 100% sure, though.)

RMt.

The original readme

 The HI-TECH Z80 CP/M C compiler V3.09 is provided free of charge for any
 use, private or commercial, strictly as-is. No warranty or product
 support is offered or implied.

 You may use this software for whatever you like, providing you acknowledge
 that the copyright to this software remains with HI-TECH Software.

The READ.ME that was included with the adapted C.COM

Hitech-C for MSX

This archive contains the C-command for Hitech-C, an almost fully ANSI-compatible C for CP/M and MSX-DOS. Because the routines EXECUTE and GETENV in the standard (CP/M) library don't work on an MSX, the original C.COM crashed. I have adjusted the programme so that it makes a batchfile that is started via the commandline (thus: the batchprocessor of MSX-DOS). The effect of this is that cammandlines cannot be longer than 128 bytes. That is why the filenames are shortened: The object files now end with .O instead of .OBJ. The object headerfile that has to be in every programme was named CRTCPM.OBJ and has now been renamed to CRT.O. These things can be found in the source of C.COM.

Also, EXEC.H has been adjusted already. It now contains some variables for starting via the commandline. To STDIO.H, the variable DOSVER has been added. This gives 0 running with MSX-DOS 1 and the DOS version in BCD code running under MSX-DOS 2 (for example: DOS 2.2 gives 0x22 in DOSVER.)

With this, Hitech-C isn't finished yet. The standard library contains more routines that can be adjusted for MSX. But before we get that far, Hitech-C is , at any rate, a good and not to mention free (!) alternative for ASCII-C. Hitech-C can handle LONGs without any problem and is ahead of ASCII in compatibility with the 'bigger' professional C compilers!

What else do you need:

HITECH-2.PMA  
sources of the standaard and floating point libraries
HITECH-3.PMA  
english documentation

(Note: HITECH-4.PMA contains some routines that have been adjusted for MSX in the meantime, and some other useful programmes.)

Pierre Gielen, sept. 1993

C.C

About

Copyright (C) 1984-1987 HI-TECH SOFTWARE

MSXDOS modifications by Pierre Gielen 1993:

  • Replaced EXECL routines (C produces a batch file now)
  • Added -Q switch to write batch file without executing
  • Changed object file types to .O and temporary file
 types to .T to allow more commands per line (note:
 crt.o = crtcpm.obj). Changed library types back to .LIB.
  • Commented out calls to GETENV (for now) because it locks up
 the computer (still to be changed in the standard library)

HITECH C is almost ANSI C compatible, but it does not recognize the '#pragma nonrec' directive.


HITECH SOFTWARE has given kind permission to copy this software for personal use.

C command

C command MSXDOS version

C [-C] [-O] [-I] [-F] [-U] [-D] [-S] [-X] [-P] [-Q] [-W] [-M] files {-Llib}


[Comment from WIKI editor] Refer manual of HI-TECH C for CP/M as well


EXEC.H

Definitions of the EXEC format

#define	EXITIT	0x80
#define	EXEC	0x81
#define	IGN_ERR	0x82
#define	DEF_ERR	0x83
#define	SKP_ERR	0x84
#define	TRAP	0x85
#define	IF_ERR	0x86
#define	IF_NERR	0x87
#define	ECHO	0x88
#define	PRINT	0x89
#define	RM_FILE	0x8A
#define	RM_EXIT	0x8B
#define keybuf 0xfbf0				/* MSX */
#define putpnt (*(unsigned int *)0xf3f8)	/* MSX */
#define getpnt (*(unsigned int *)0xf3fa)	/* MSX */

STDIO.H

#define DOSVER (*(char *)0xf313)	/* MSX: 0=DOS1 */

#if	z80
#define	BUFSIZ		512
#define	_NFILE		8
#else	z80
#define	BUFSIZ		1024
#define	_NFILE		20
#endif	z80

#ifndef FILE
#define	uchar	unsigned char

extern	struct	_iobuf {
	char *		_ptr;
	int		_cnt;
	char *		_base;
	uchar		_flag;
	char		_file;
} _iob[_NFILE];

#endif	FILE

#define	_IOREAD		01
#define	_IOWRT		02
#define	_IORW		03
#define	_IONBF		04
#define	_IOMYBUF	010
#define	_IOEOF		020
#define	_IOERR		040
#define	_IOSTRG		0100
#define	_IOBINARY	0200

#ifndef	NULL
#define	NULL	((void *)0)
#endif	NULL

#define	FILE		struct _iobuf
#define	EOF		(-1)

#define	stdin		(&_iob[0])
#define	stdout		(&_iob[1])
#define	stderr		(&_iob[2])
#define	getchar()	getc(stdin)
#define	putchar(x)	putc(x,stdout)
/*	getc() and putc() must be functions for CP/M to allow the special
 *	handling of '\r', '\n' and '\032'. The same for MSDOS except that
 *	it at least knows the length of a file.
 */ 

#if	UNIX
#define	getc(p)		(--(p)->_cnt>=0?(unsigned)*(p)->_ptr++:_filbuf(p))
#define	putc(x,p)	(--(p)->_cnt>=0?((unsigned)(*(p)->_ptr++=x)):_flsbuf((unsigned)(x),p))
#else	UNIX
#define	getc(p)		fgetc(p)
#define	putc(x,p)	fputc(x,p)
#endif	UNIX

#define	feof(p)		(((p)->_flag&_IOEOF)!=0)
#define	ferror(p)	(((p)->_flag&_IOERR)!=0)
#define	fileno(p)	((uchar)p->_file)
#define	clrerr(p)	p->_flag &= ~_IOERR
#define	clreof(p)	p->_flag &= ~_IOEOF

#define	L_tmpnam	34		/* max length of temporary names */

extern int	fclose(FILE *);
extern int	fflush(FILE *);
extern int	fgetc(FILE *);
extern int	ungetc(int, FILE *);
extern int	fputc(int, FILE *);
extern int	getw(FILE *);
extern int	putw(int, FILE *);
extern char *	gets(char *);
extern int	puts(char *);
extern int	fputs(char *, FILE *);
extern int	fread(void *, unsigned, unsigned, FILE *);
extern int	fwrite(void *, unsigned, unsigned, FILE *);
extern int	fseek(FILE *, long, int);
extern int	rewind(FILE *);
extern int	setbuf(FILE *, char *);
extern int	printf(char *, ...);
extern int	fprintf(FILE *, char *, ...);
extern int	sprintf(char *, char *, ...);
extern int	scanf(char *, ...);
extern int	fscanf(FILE *, char *, ...);
extern int	sscanf(char *, char *, ...);
extern int	remove(char *);
extern FILE *	fopen(char *, char *);
extern FILE *	freopen(char *, char *, FILE *);
extern FILE *	fdopen(int, char *);
extern long	ftell(FILE *);
extern char *	fgets(char *, int, FILE *);
extern char *	_bufallo(void);