🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.atari16
Article #873

Re: Mini-review of Megamax C

#873
From: braner
Date: Fri, 13 Jun 1986 05:38
95 lines
3673 bytes
[]
    Although these objections hold, I would even overlook
segmentation (!) to get a bug-free (?) malloc() and a 15 sec
compile & link time (on RAM disk). For my (scientific) work,
the worst bug was the floating point comparision bug (it
claimed that -2 is greater than -1). 'Was', because here...
... (ta-da!) is the fix:
    I took a close look, using the mmdis disassembler,
at the double.o file (extracted from the double.l library with
the mmlib program.) Only one (1) byte is wrong, looks like a typo.
In the routine _fcom, where it says BSET #31,D1 it should say D2.
To patch it, use the following 'bth' program (compile it with mmcc).
    Bth.prg translates the bytes of any file into both hex and
ASCII representation. The output can be edited on any text editor,
and then fed into the htb program (posted earlier) to get it back
into binary. (Only the hex part needs to be changed, the ASCII part
is treated as a comment.) (Yes, Virginia, there is no way to assemble
the output of mmdis!)
    In this case, tell bth.prg to read double.l. In the output file,
look (on line 47) for the sequence "46 82 46 83 08 C1".
Change the C1 to C2. Run it through htb.prg to create newdbl.l,
and your done. From now on, mmlink yourprog.o newdbl.l.

/* Program to create a hex file from a binary file.
   by Moshe braner, 860613.
*/

#include <stdio.h>

#define  hinibble(b)  (((b)>>4) & 0x0F)
#define  lonibble(b)  ((b) & 0x0F)
#define  tohex(b)     ((b)<0xA ? ((b)+'0') : ((b)-0xA+'A'))

main() {
	register int c, b, i, t;
	int  n, m;
	FILE *infp, *outfp;
	char infname[80], outfname[80];
	char col[16];

	printf("\n\nBinary To Hex conversion program.  MB 8606.\n\n");
	printf("Enter name of source file: ",stdout);
	gets(infname);
	/* open file with "br" to avoid skipping of '\r's
	   by Megamax library
	*/
	if ((infp=fopen(infname,"br")) == NULL) {
		printf("cannot open source file!\n");
		exit(0);
	}
	printf("Enter name of output file: ");
	gets(outfname);
	if ((outfp=fopen(outfname,"w")) == NULL) {
		printf("cannot open output file!\n");
		exit(0);
	}
	m = 0;
	for (n=0; ; n++) {
		b=getc(infp);
		if (b != EOF)
			col[m++] = b;
		if ((b==EOF && m>0) || m>=16) {
			for (i=0; i<m; i++) {
				t = col[i];
				c = tohex(hinibble(t));
				putc(c, outfp);
				c = tohex(lonibble(t));
				putc(c, outfp);
				putc(' ', outfp);
			}
			for (; i<16; i++) {
				putc(' ', outfp);
				putc(' ', outfp);
				putc(' ', outfp);
			}
			putc(' ', outfp);
			putc('*', outfp);
			putc(' ', outfp);
			for (i=0; i<m; i++) {
				c = col[i];
				if (c>=' ' && c<='~')
					putc(c, outfp);
				else
					putc('.', outfp);
			}
			putc('\n', outfp);
			m = 0;
		}
		if (b == EOF)
			break;
	}
	printf("\nRead and translated %d bytes.\n", n);
}

/* - Moshe Braner, Cornell, 607-272-3487 */
Technical Details
Message-ID: <460@batcomputer.TN.CORNELL.EDU>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!tektronix!uw-beaver!bullwinkle!batcomputer!braner
References: <564@ssc-bee.UUCP> <526@druhi.UUCP> <1497@cwruecmp.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site batcomputer.TN.CORNELL.EDU
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!tektronix!uw-beaver!bullwinkle!batcomputer!braner
From: braner@batcomputer.TN.CORNELL.EDU (braner)
Newsgroups: net.micro.atari16
Subject: Re: Mini-review of Megamax C
Message-ID: <460@batcomputer.TN.CORNELL.EDU>
Date: Fri, 13-Jun-86 01:38:35 EDT
Article-I.D.: batcompu.460
Posted: Fri Jun 13 01:38:35 1986
Date-Received: Tue, 17-Jun-86 08:23:48 EDT
References: <564@ssc-bee.UUCP> <526@druhi.UUCP> <1497@cwruecmp.UUCP>
Reply-To: braner@batcomputer.UUCP (braner)
Distribution: net
Organization: Theory Center, Cornell University, Ithaca NY
Lines: 95