Controller Firmware

       The controller firmware was tough to dis-assemble and comment because it is compiled code.  As difficult as it is to follow assembler sometimes compiled code is a nightmare.  Most everything is referenced into the stack.  As soon as you push something onto the stack all the reference indexes change.   When you get a stack that is 12-20 words deep that is always moving up and down it is very difficult to keep track of where the working values are.  You'll see many odd notes scattered here and there through out the code.  I put them there so I wouldn't go (to) insane trying to follow the flow of the code.  Being this is compiled code it is not very efficient and tight, a trait of all compiled code.  There is the usual useless overhead and unused routines tossed in through out.  The strings are another messy area.  If you needed to print the word 'The' a dozen times instead of pointing to the same three byte string (cost you nothing extra) the compiler creates a dozen strings of the same three characters over and over again (much wasted space).  Another space and speed waster is the fact that most memory addressing was forced to extended mode instead of direct.  This takes an extra byte and extra cycles to process for no useful purpose (more compiler baggage).  The code as it stands just about fills the entire 16 Kbytes of ROM space (72 bytes shy of 16k).  I haven't yet had a need to change anything in this code set yet.  When and if I do chopping out all the waste will give back quite a bit of room to work in.  One thing to keep in mind if changes are made are that this controller and main ECU are tied together at the hips.  The memory locations containing the operational parameters and the fuel/spark maps are hard coded into this firmware.  If a key memory location is changed in the main ECU code it will have to be changed here also in the controller code.  The communication protocol is commented in the source code.  Basically a preamble, a command code (read or write), a ECU memory location, data space, and a checksum byte construct the communication packet sent back and forth between the controller and ECU.  Determining the address of key memory locations in the ECU eased the commenting of the ECU code.  It was, and still is, a huge task but armed with what I learned here it at least gave me a few hooks into the ECU code.
 

CM 1.1 03-21-96 Controller Code    (HTML)
CM 1.1 03-21-96 Controller Code    (ZIP'd)