The Microprocessor Page
updated 10-16-2003


The AVR Page

STR912 Arm 9 Page


68000 Disassembler Function

Works for 68000, 68008, 68HC000, 68HC001, 68EC000 and any other 68K core processor.

    This function was originally written for my Atari ST using Megamax C.  It was latter ported over to an ANSI C style to be used with Cross Code C (SDS).  This function has only been used running on a 68000.  If you were going to use it to disassemble 68K binary code on another target, you will most likely have to modify the code.  I am sure that Big VS Little Endian is going to cause portability problems.  You are on your own in this regards.

extern void *dis(void *c,char *s);

    You pass the function a pointer to the op you wish to decode (parameter c) and a pointer to a character string where the disassembled code will be put (parameter s).  The function will return a pointer to the start of the next instruction.  The string parameter must be large enough to accept the disassembled code. (128 should be enough).

Update

    As of 9-6-2002, I have gone through the code looking for bugs...it was in 1991 the last time I worked on this code, after all...  Somebody who used the code in his program sent me a list of problems (patches) to fix the bugs, but alas, I never got around to it, and then the company I worked for shut down and the email was lost forever.  So, I hope I got them all.  I wrote a piece of code using the cross code assembler that has, as near as I can tell, every combination of assembler instruction you can have and used this as a test.  Unless I missed something going through the output, I believe it is working pretty good now.  You can email me if you find any more.

         C++ Source Code for Disassembler
         Header File for Disassembler


68000 Multi Tasking Kernel

   Here is a simple multitasking kernel.  It does have some minor disadvantages right off the bat.

    1. It is written in C++.  You can convert it to C if you like, but that is an exercise that is left up to you.

    2. It is for the 68000.  This version should be able to run on the 68000, 68008, 68HC001, 68HC000, 68EC000( the one I have run it on).

    3. Portability to other compilers is going to be problematic.  In fact the compiler I use (SDS Cross Code C) is not even portable from version to version.  The portability issue stems form the way the compiler generates code and makes use of the stack.  The one function (ExitInterrupt() in file task.cpp) is commented as to what to look out for.  Also, there are some assembly language routines that will need to be dealt with.

    4. This is an original work by myself (I hope).  However, I am no genius, I was inspired after reading Jean Labrosse's book on the micro C kernel.  Many of the function calls have the same names.  The biggest difference is that Jean used a lookup table of some sort to determine which task to switch to next, I use a priority queue.  The priority queue lowers the performance a bit, but it does allow me to have tasks with the same priority.  Also, I have created an I/O manager so that I can logically access both character and blocked based i/o.  There is an example of a RAMDISK and RS232 driver in the archive.

    5. I only have one sort of event object, a TSemaphor.  From this object, I derive other event type objects.  There are a few examples of them in the queue.cpp file.  So you will not find things like mailboxes and message queues like you do in micro C OS.

    So, here it is, my multi tasking kernel.  At the very least, I hope you learn something by it.

    Update

    As of 9-6-2002, I am in the process of trying to get this thing to run on a MC68008.  Funny thing is, I have no problems with it on a 68000 based system, but am having trouble with the 68008.  As soon as I locate this, I will repost the code.

    Another Update

    As of 9-28-2002, I now have the kernel running on the MC68008.  Turns out there was no problem with the kernel.  In the init code, where I created all of the tasks, turns out the stack space I allocated exceeded the amount of ram I actually had...do, of course, it didn't run very good.  The code was written to run my Glockenspiel.


Tiny Basic

    Well, this tiny basic is not really all that tiny, in that the amount of memory it occupies is pretty large.  But, this is because it is implemented in a way that it is easy to change, rather than compactness.

    This Tiny Basic is implemented using Anagram from Parsifal Software.  Anagram is a LALR(1) parser generator.  Of all the parser generators I have used (yacc, bison) or have tried to use, Anagram is the one I have had the most success with.  Heck, I don't know my terminal production from a hole in the ground, and yet I have written successfully a number of parsers using this tool.  Tiny Basic is the most complicated one I have ever done.  I probably could not do anything more complicated.  This one was hard enough.

    Now, just how Basic is my Tiny Basic...well, all I can say is that it has the look and feel of basic, but it does differ in many ways.  What I was really after was a scripting language for a project I did that could be run as a thread under the multi tasking kernel I wrote (see above).

    How it runs as a thread is mostly due to how I compiled the module.  Tiny Basic is compiled such that all globals within that module are referenced via address register A5.  This means several things.  First, the Tiny Basic module cannot reference any external globals.  Also, any external module cannot reference any of the globals in Tiny Basic.  When the thread is created, a chunk of memory is allocated that will be used to store the global variables for Tiny Basic.  In this way, I can have as many Tiny Basic threads running as I need, as long as I have plenty of memory.  Also, this means that there is only one copy of Tiny Basic (code section) in memory at any time.

    Here you will find two copies.  A version that is written to be used in an embedded 68000 environment, and a test version, that runs under MS-DOS.

     Tiny Basic Demo for MS-DOS

     Tiny Basic Version for 68000 RTOS

    If you go to the Parsifal web site, you can download a 30 day free trial version of Anagram.  You should note that the code generated by Anagram requires no other external libraries.  Anagram is one of the few parser generators that is suitable for embedded systems (yacc and bison will work also).

    This Tiny Basic code is free.  You may use it in your projects freely.  I would like to receive credit...


C Compiler

    I only wrote part of this code.  Most of it came as a demo as part of the Anagram Parser Generator....unfortunately, Jerome Holland, who wrote that wonderful program has passed away, sometime in 2003.  A sad thing really.  Anyway, here is the C compiler, with many additions by myself.  It gets so far as to generate symbol tables and an abstract syntax tree.  To see this, use the following command line:

cc -c <input file> <output file>

example

cc -c c.inp c.out

    Download C compiler Source and Executables

Last time I worked on this was in 1995....hard to say if it would ever really work.