asm68c a68c - Code
Assembles M6800 and 6801 assembly language source code. (and Forth)
Brought to you by:
reiisi
Motorola 6800/01 absolute assembler by Joel Matthew Rees between 10 October and 17 October 1985. Copyright 2010 Joel Matthew Rees. Written for cs432 at Brigham Young University for J. J. Ekstrom The author(s) grant permission to use or distribute this program under the terms of version 3.0 of the GNU General Public License (GPL). (See <http://www.gnu.org/>.) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Refer to the file LICENSE.text included with the source. If that file was not included, see <http://www.gnu.org/licenses>. The original project should be at <http://asm68c.sourceforge.net>. ============================================= No makefile necessary: cc -Wall -o asm68c *.c will do the trick just fine. (It's a really simple assembler.) ============================================= --------------------------------------------------------------------------- Files in the distribution: asm68c.c defines the main funtion and the overall flow. asm68c.h is the global header information. asmspec is the specification which was approved by the teacher for the project. exp.c/h is the expression evaluater code (easy recursive descent). mne68c.c/h is the mnemonics table. The table is sorted and converted to a balanced binary tree at startup. It contains 6801 extensions. I may be able to add 68HC11 extensions, as well. (Added the sorting and balancing, August 2012 -- JMR). ops68c.c/h is the operand parser. LICENSE.text is the license (GPL3) extended by the original author. (.text because I sometimes thumb my nose at certain lax practices.) README.text is this file. newtest.68c is a really, really short test source file. (I couldn't find the source code I used to pass the thing off.) newtestlc.68c is newtest.68c in lower case. (No, the current version doesn't.) longertest.68c is a slightly longer test source file. tek.68c was something that shouldn't have been here, but was. (No it doesn't assemble, either.) --------------------------------------------------------------------------- Notes: Two tricks I slipped in that I shouldn't have: Write "LDAA" and "LDAB" as "LDA" and LDB"; likewise, "STAA" and "STAB" as "STA" and STB", also OR. I was wishing for a 6809 at the time, I think. I'll have to untangle them from LDD and STD to make them standard. Or maybe I'll add dual syntax by macros. Or something. (Stupid fetish with pulling the A/B/D parameters off the ends of the operator mnemonics. Logical games that waste time.) The short funtion names and file names derive from the work environment we had back then. (6~8 significant characters.) Much of the structure derives from my prior experience with BASIC, ForTran, Pascal, FORTH, early M6800 assemblers etc., my lack of experience with separate compile, and my personal take on the older K&R syntax. The brittle hand-optimized binary tree symbol table was something I repeated in BIF-6809, and it remains in bif-c as I write this. This program took too much of my time relative to the class. The quality of my implementation caused one of the TAs to suspect I had copied the code from somewhere. She grilled me on the techniques, and I guess she was satisfied. But I ran out of time, had to take an incomplete and finish the coursework after I dropped out. Oh, BIF-6809, my FORTH was what I finished the course with. I still don't understand what level the teachers intended us to work at on the homework. Why bother having students do any homework if there's no time for understanding, only time for going through the motions? And, ultimately, you just copy what the teacher shows you and try to fill in the gaps, and if you're unlucky enough to be off the teacher's wavelength, you're dead meat. Well, everybody else just copied from the board. I tried to really understand. I was dead meat. I think this was the course that I let do me in, trying too hard. --------------------------------------------------------------------------- Began code cleanup on 23 July 2010. Completed initial cleanup on 26 July 2010, cleanly compiled on gcc and assembled a short test file. More code cleanup, added op-code table sorting and balancing, 20-24 August 2012. --------------------------------------------------------------------------- To do (if I could ever justify the time, in no particular order): Find or produce a real test file that does something useful. (And what would I run it on?) Fix the S1/S9 object output (or was it S1/S10?) and checksum code. (I'm sure it's wrong.) * Checksum fixed, 2012.08.21. * S9 record needs some way to know the entry point (pseudo-op). * Workaround: ORG start at the end, no code after. Convert the symbol table code to better support adding mnemonics. (Such as macro definitions and relative pseudo-ops?) Build an emulator to run the code on. (Fun stuff! 8-)) I should be able to relax the checks that require the image array. Convert it to assemble M6809 source code. (Lost opportunities. Oh, the lost opportunities. <:-< )