[Coco] Converting ANSI-C to K&R(Microware) - Ansifront didn't work

gene heskett gheskett at wdtv.com
Sun Jan 9 01:19:04 EST 2011


On Sunday, January 09, 2011 12:40:35 am Michael Furman did opine:

> On Jan 8, 2011, at 6:29 PM, gene heskett wrote:
> >> Well, you need the MW C Compiler and the LII development system.
> >> You can grab c.comp from Gene's web site but you didn't hear that
> >> from me! ;-)
> > 
> > and TBT Willard, running that as two pieces (c.pass1, c.pass2) puts a
> > lot less memory pressure on the coco, so while its nice, I'm not so
> > sure its better.
> 
> I've noted that cc252 calls c.pass1 and c.pass2.  Is there any real
> difference between this and c.comp?  How do I switch them?
 
There is not a functional difference between them other than the slightly 
smaller memory footprint for the two piece version, they will both generate 
identical code whose crc's match. c.comp I assume, will only run on a 
coco3, I never tried it on a coco2 but would presume it would throw out of 
memory errors on a level 1 system.

As for switching them, you might have to rebuild cc252 after editing the 
call to c.pass1 to use c.comp, and to comment out the verse that calls 
c.pass2.  And of course adjust the temp filenames to fit.

> >> commands From RTSI:
> >> ansifront012.lzh*
> >> COpt2_1_1.lzh*  ansifront012.readme*  cc_2_5_2.lzh 
> >> rma_1_3_patch.lzh* Make_TK.lzh*    cb_C_Beautifier.lzh*  cprep19.lzh
> >> rma_6309_Patch.lzh*
> 
> After going through this much I got cc252 to compile something.  Can
> either of you confirm my findings?
> 
> c.prep [ used by cc1 ]
> c_prep19 [ Can replace c.prep ?, cc252 expects this to be named c_prep ]

Rename c.prep to c.prep-old, then copy c_prep19 to /dd/cmds/c.prep, should 
work.  If not, fix the internel name with ded too, and don't forget to 
(v)erify the fixed name with ded.  However, I ran it for yonks with the 
internal name of c_prep, see this:

{t2|07}/DD/MAXTOR/CMDS:vfy c.prep        
Length of file: $00005219

Module found at offset $00000000 in this file
Header for    : c_prep
Header parity : $63 (good)
Module size   : $5219
Edition       : $09
Ty/La At/Rv   : $11   $81
Program module, 6809 object, Re-enterable, R/O
Exec. off     : $0021
Data Size     : $781E
Module CRC is : $ACA5CB (good)

Bytes read    : $00005219

One could fix the _ to be a . with ded.  However it's a shrug as long as 
the called name matches.
 
> rmxlab [ ? ]

I don't recall this rmxlab, and don't recall using it, at least 
intentionally.

> c.opt [ used by cc1, cc252 ]
> copt2 [ can replace c.opt ? ]

No, it should follow c.opt, they do slightly different functions.
 
> The rest of the stuff I installed in /dd/cmds makes sense:
> 
> make
> 
> cb  [ call from makefile ]
> 
> cc1 [ CC = cc1 in makefile ]
> cc2 [ CC = cc2 in makefile ]
> cc252 [ CC = cc252 in makefile ]
 
If using cc252, the makefile is moot, that would be for use with make_TK, 
Tim Kientzles make utility.  It works well also, but hacking up a makefile 
is not one of my strong suites.

> ansifront [ cc252 -A ]
> 
> c.pass1 [ used by cc1, cc252 ]
> c.pass2 [ used by cc1, cc252 ]
> c.comp [ ? ]

See above, I'd just use the two piece.
 
> c.asm [ used by cc1 ]
> rma [ used by cc252 ]
> r63 [ cc252 -N ]

c.asm is the original assembler for the c compiler.
rma means Relocating Macro Assembler and is a bit smarter, while r63 is rma 
but adapted to make use of 6309's code extensions.  When I was using it 
frequently 15-20 years ago, I often told cc to stop after generating the 
.asm file, and I had favorite bits and pieces that I would snip out and 
substitute in the much faster hand optimized versions, my favorite snip 
being the 8 bit left or right shift, which got replaced with a tfr a,b; 
clra or tfr b,a; clrb, which dependent on which way the shift was commanded 
and which does exactly the same thing in way fewer clocks.  Such tricks as 
that, and substituting a table lookup for the rather complex crc 
calculation in rzsz found about a 250 cps increase in transfer speeds for 
rzsz for either cpu.

Overall however, looking at the .asm output of the compiler taught me a few 
coding tricks over the years.  Recommended by Grandpa Gene for a well 
rounded course in assembler, which was my favorite language. ;-)

> c.link [ used by cc1 ]
c.link is for c.asm output

> rlink [ used by cc252 ]
rlink is the matching linker for rma/r53 output.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Are you mentally here at Pizza Hut??



More information about the Coco mailing list