Changes in the Source Files
===========================

This is the latest stable release of Emu][. There have been a lot of changes, too many to mention them all. The whole source was revised, rewritten, reorganized, restructured, cleaned, improved, shortened, expanded... and a lot more. It may not be obvious from the executable but the organisation of the code was changed drastically.
Here are just a few major 'improvements':
- Almost every source file now has a seperate '.h'-file that can be included
  within other source files. The '.h'-files contain all those public
  functions, variables that other parts of the program are allowed to
  access.
- To avoid unnecessary repeated inclusion of these '.h'-files, _all_ files
  now define a value called 'DEF_INC_NAMEOFFILE_FILEEXTENSION' that is
  checked against at the beginning of the file. The drawback of this
  programming approach is, of course, that 'mk.bat' grew very long since it
  has to check for a lot of dependencies now. On the other hand, programming
  becomes a lot easier, so I think it's worth it.
- An additional folder has been created called 'libs'. This folder contains
  source files or object files that are not Emu][ specific but can be (and
  also are) used by other programs as well.
- If possible, a function looks like this:
  a) If no specific return value is given, the function will return a
     pointer to an error string if an error occured or NULL if there was
     no error. Only if speed demands it, 'void' will be 'returned'.
     Otherwise, I think it's a good idea to inform the user as well as the
     programmer of what's going on in your code and describe it in an
     understandable way not with some cryptic error codes. (like "error
     45982: An error occured.")
  b) Best way of returning an error is by calling function 'taskseterror'
     (from general.c). This function will put the pointer into a static
     variable so the value can be retrieved later by 'taskgeterror' for
     further use. For debugging purposes it is also possible to write error
     messages to a log file from within 'taskseterror'.
  c) So far (gcc 3.3..), gcc does not seem to make any use of loading AL
     and AH or other 8 bit registers with different variables although
     they might fit into 8 bit like 'char'. Rather the opposite, using
     'char' will often cause gcc to generate additional instructions like
     "AND eax,0xff" to clean the unused upper bits. For this reason,
     'unsigned int' or 'int' are used for passing any kind of numbers even
     if they could fit into 'unsigned char', since 'unsigned int' or 'int'
     will normally use the full size of the registers (32 bit on 80x86).
  d) Use 'unsigned int' or 'unsigned char' if possible when working with
     any kind of unsigned values. This might help transfering the code to
     later processors with a register size greater than 32 bit.
- The file 'dapple.h' now contains the basic definitions 'EMUZ80',
  'CPU_CYCLEEXACT', 'CPU_ASM', and 'REECOP'. You may  change them here
  according to your needs. Please note: when using 'CPU_ASM', you will also
  have to link the (provided) file 'cpu6502asm.o'.


How to Compile
==============

There are three dfferent ways how to compile the source files:

1.) Use 'mk.bat' under DOS or Windows. This will compile the source files
    seperately and link them together. Using 'mk.bat' is a good idea when
    developing the code.
2.) Use 'mk1.bat' under DOS or Windows. This will put the source files all
    together and compile them in one go. This is the simplest way to build
    the final executable. May also be good for some compiler optimisations
    that cannot be done when compiling the source files seperately.
3.) Do your own compiling by manually invoking gcc and passing 'build.c' as
    a source file and 'asmlib.o' as an object file to be linked with. This
    may also work under other platforms than DOS or Windows, although the
    code generated will only run under DOS/Windows or from a DOS emulation.

Note: the file 'build.c' only contains a lot of 'include'-statements, so the
compiler will put together all source files. Apart from that there is _no_
additional code in there. So if you want to use 'mk.bat' only, you can even
delete 'build.c' if you want.
