I've been writing code for the HC11 for a while using the GCC port, but have been a bit frustrated by the reams of code it produces; it was quickly eating into my 32K of EEPROM and I still have all this code to write. There also seemed to be these instances where bugs would turn up, I'd stare at the C source and assembly output for a while, put in a few printf debug statements and then the bug would mysticly disappear without any personal intervention on my part. This is not a flame of the guys at coactive, god knows that if I had to do the port it would probably never get done, and they have done a decent job. Well, I started looking around the world for an HC11 compiler to call my own and got sticker shock (my HC11 board maybe cost me US$25.00 and the compilers were gonna cost US$350 to US$700). Then my life changed, when I looked at demo version of HI-TECH's C Compiler for the HC11 for DOS. It produced very small code (less than half the size of GCC, it even does string comparisions to combine multiply used strings), and has most ANSI features. My biggest problems with it are that it only supports 16 bit int bitfields, which does not merge well to the HC11 register map, so I end up masking and setting bits myself, rather than letting the compiler do it for me, it is kinda picky about types (this might be a feature to some), it usually passes the first parameter of a function call in the D register, and the demo is only available on the PC. demo version available for anon ftp: > HI-TECH C V3.09 for CP/M is now available via anonymous ftp from: > > design.fen.qut.edu.au in the directory pub/hitech. [NOTE: actually in hitech > directory -- no pub] > > All files are (DOS) self-extracting archives created with LHARC. > The files are: > > z80read.me Blurb file > z80v309.exe Compiler itself > z80doc.exe Manual > libsrc.exe Library source > z8051h83.exe DOS hosted cross compiler demo for Z80, > 8051 and H8/300 > motorola.exe DOS hosted cross compiler demo for 68HC11, > 6805, 68000 and 6809. > > All software remains copyright, but is freely resdistributable. > -- > Clyde Smith-Stubbs | HI-TECH Software, | Voice: +61 7 300 5011 > clyde@hitech.com.au | P.O. Box 103, Alderley, | Fax: +61 7 300 5246 > ...!nwnexus!hitech!clyde | QLD, 4051, AUSTRALIA. | BBS: +61 7 300 5235 > HI-TECH Software: C Compilers for all manner of machines The big problem with that the demo version is that it is crippled; it produces hosed code, and doesn't include the linker or assembler. So I spent some time at the FAX machine and got some information on how to get this compiler for myself. Talked electronically to Clyde Smith-Stubbs (clyde@hitech.com.au) and got the scoop. HI-TECH's HC11 Compiler/Linker/Assembler/DevSys for the PC (only) is available for about US$500 (or US$350 with a student ID, ask about the educational special.) I didn't have the $350 (let alone the $500) and couldn't find anyone who wished to share the cost (I know, that's software piracy). So I started looking at the code that the demo version of the compiler produced and found three things that needed to be fixed in the assembler output: * A push to the stack is done before the function label is declared and the stack frame is built on functions called with parameters. * all branches are short (maybe their assembler/linker fixes these?). * indirect function calls do not load the first parameter into the AB/D register. So I needed a small C program to fix the first two problems by mucking with the assembly output (see below). The third problem is more difficult and my current workaround is to kludge functions that are to be called indirectly as follows: #define CheapSkateC void bindable_f( #ifdef CheapSkateC short int dummy, #endif short int p1, char *p2 ) { } The next problem I encountered was with the as11 assembler, both the one that I got with the GCC port and the 6.270 one. They don't produce code for the BRCLR/BRSET instructions correctly: as11 test.asm -l 6811 assembler 10-Aug-91 original program by Motorola. a few modifications by Randy Sargent (rsargent@athena.mit.edu) 0001 0002 _location: 0003 0000 3c pshx 0004 0001 3c pshx 0005 0006 0007 0002 1f 00 00 fa brclr 0,x,23,_location ^^ This should be: 17 I fixed this in util.c by adding ',' as a white space character, this is probably not the best fix, but it seems to work. /* * skip_white --- move pointer to next non-whitespace char */ char *skip_white(ptr) char *ptr; { while(*ptr==BLANK || *ptr==TAB || *ptr==',') ptr++; return(ptr); } I don't know why this problem has not been caught until now, my only guess it that brclr is a bit difficult to remember and use. (GCC does not produce brclr instructions). The HI-TECH code is riddled with these instructions. Since there is no linker/assembler I still develop my code my making one big source file: all.c: #include "start.c" #include "next.c" #include "last.c" The demo version also has problems with finding its subparts in the DOS file system, so it works best when you have the .exe files in the directory your compiling in. You will need these files out of the motorola.exe archive: democ68.exe cpp.exe p1.exe opt68.exe cg68.exe Now all I needed to do was fix the stack frame and branch problem, when lo and behold a bit of C code appeared on my disk drive to do just that. It was in a file called hifix11.c and after compiling it I found it to worked just right for me. So here I am telling you all about it and I decided to zip the source for hifix.c up as well as my hic.bat file (which does all the stuff I need to make my code from the all.c file) and make it available to to warrentee free world. I'm not using the miniboard so I didn't test it out for you MB users out there. My guess is the only trouble you will have is with the stack frame which passes the first parameter in the D register, unless of course you use indirection. This allows HI-TECH demo program to provide a much better demonstration of it abilities. After trying it out you may want to purchase a full feature version, as it include an assembler, linker, development environment, and a source level debugger. A great deal for about US$500. I have put the following files on cher.media.mit.edu in the directory pub/miniboard/incoming/CheapSkateC : cheapc.zip - a zip file containing: hifix11.c : the source for the fix program hifix11.exe : the executable for the fix program as11.exe : my fixed as11 executable. hic.bat : a batch file for the compiler histart.asm : a startup asm file test.c, stdtypes.h, hc11.h : a test program cheapc.txt - this information. You can get the HI-TECH stuff as detailed above.