
                              The History of !STem
                             ======================


This file lists the entire history of STem in reverse chronological order. All
major changes, additions and other important details have been recorded.


Version 1.03
============
  1st May, 1998
     Version 1.03 was released.

  27th April, 1998
     Tests showed that the NEGX instruction sometimes produced the wrong X and
      C flags. This has now been corrected.

  24th April, 1998
     Large changes were made to the address decoding mechanisms to better suit
      the capabilities of the ARM processor. A speed increase of about 2 percent
      was detected by the QuickIndex benchmark program.

  16th April, 1998
     A major bug in the emulation of the MFP chip was fixed. The wrong
      interrupts were being generated when programs switched into
      automatic-end-of interrupt mode, thus causing all sorts of unwanted
      side-effects. In particular, packets of data from the keyboard processor
      were being ignored, and the 200Hz system timer was not being updated.

  14th April, 1998
     Fixed a minor bug in the IKBD code for sending time/date packets. The C
      functions for obtaining the month of the year return a number in the range
      0-11, whereas the IKBD is required to return a number in the range 1-12.

  6th April, 1998
     Speeded up the MFP timer C so that it is now only 128 times slower than
      the real thing. The only noticable effect on the emulator is that the
      time taken for TOS 2.06 to boot has been reduced to approximately 2
      minutes.

  3rd April, 1998
     Memory accesses were speeded up by removing some code which checked for
      pending bus and address errors - these checks were wasteful since errors
      are relatively rare. Instead, the memory mappings are temporarily altered
      when an error is detected so as to prevent further accesses. The original
      memory mappings are then restored when the error has been dealt with.

  29th March, 1998
     One or two bug fixes were made to the DMA controller. In particular, the
      method of persuading the atari operating system to ignore all unconnected
      devices on the DMA bus (by generating pseudo errors - as mentioned in a
      previous history entry) proved to be unsuitable for TOS 2.06. This version
      of the operating system will retry failed communications on the DMA bus
      several times before giving up - hence making the boot procedure
      excessively time consuming. It is better to pretend that all devices on
      the DMA bus are connected to something, but to pass a useless boot sector
      when requested.

  22nd March, 1998
     Added keyboard control for joystick port 1. When NUM LOCK is off, the main
      joystick can be controlled using the numeric keypad. When NUM LOCK is on,
      the keys revert to their normal mappings.

  14th March, 1998
     The code for STOP instruction was finally written. This removes the
      'unimplemented instruction' error, and means that emulation of the 68000
      processor is now complete.

  8th March, 1998
     Fixed a bug in the calculation of the carry flag for the SUB, CMP and NEG
      instructions. As mentioned in an earlier history entry, the C flag on the
      68000 is the opposite to the C flag on the ARM processor for some
      operations, so an inversion is required. Tests showed that the previous
      fix was not entirely correct, hence the need for further amendments. TOS
      2.06 now boots, however it takes approximately 15 minutes on a 233MHz
      Strong ARM computer :-(


Version 1.02
============
  8th March, 1998
     Version 1.02 was released.

  3rd March, 1998
     Added a test to the initialisation code to ensure STem is not being run in
      a task window. This is necessary since when STem is running it makes
      various changes to the system which could have adverse effects on other
      programs.

  2nd March, 1998
     A minor change was made to the emulation of the intelligent keyboard. It
      can now respond to requests to read it's internal clock, and will return
      the current time and date. This now allows the CONTROL.ACC program to run
      without locking up.

  23rd February, 1998
     I finally got around to writing code to identify French, German, Italian,
      Swedish and US ROM images. The code for identifying Spanish and UK ROMs
      was already in place. With the exception of Spanish ROMs, all keyboard
      mappings will be the same as for the UK ROMs - this is not correct, but
      working out the proper mappings is a tedious process.

  14th February, 1998
     Added some code to handle accesses to the STe microwire bus. It's
      implementation is not correct, but it now allows STOS basic to run. A side
      effect is that TOS versions 1.06 and 1.62 must always have 'DMA Playback'
      enabled, otherwise they will fail to boot properly.

  9th February, 1998
     Modified the debugging code so that it can be enabled at any time, not
      just while I am developing it. This will hopefully make it easier to
      diagnose problems other people are having with STem.

  6th February, 1998
     Changed the way in which instructions in the newer members of the MC680x0
      family are decoded. Each instruction needs to be checked to ensure it is
      valid for the currently selected processor - this is now done once when
      the emulator is loaded, instead of doing it each time an instruction is
      executed.

  3rd February, 1998
     Timer C in the MFP chip was modified so that it maintains time accurately.
      It now 'ticks' according to the value of the monotonic timer and takes
      account of it's settings. However, to avoid overloading the emulator it is
      necessary to scale the timer. On average it will be 512 times slower than
      it ought to be.

  1st February, 1998
     All known blitter related problems were solved. Of these, three were
      caused by programming errors in my blitter chip emulator. A fourth was
      due to some highly suspicious code in the Atari operating system which
      made too many assumptions about the speed of the blitter chip - this had
      the effect of starting the blitter more than once for each task.

  31st January, 1998
     In an attempt to speed up the emulator the code for reading data from the
      ROM was rewritten in assembler. In order to avoid the overhead caused by
      converting data between big and little endian formats, I have devised a
      method which alleviates the problem somewhat. It involves storing the
      contents of the ROM in a non-sequential manner, i.e. bytes which are
      logically next to each other will no longer be physically next to each
      other. This means that when the data is subsequently read back it will
      automatically be in the correct byte order.


Version 1.01
============
  28th January, 1998
     Version 1.01 was released.

  19th January, 1998
     Moved all of the help messages out of the configuration program, and
      placed them in the 'Messages' file. The MessageTrans module is now used to
      access the messages instead.

  14th January, 1998
     Modified the addressing range of the YM2149 sound chip so that it's
      shadow registers will be decoded properly, instead of producing bus
      errors. This enables a few demo programs to work without crashing.

  4th January, 1998
     Added some code to ensure that only 512 byte sectors are used on disks and
      disk images. This is necessary because of limitations in the Atari
      operating system and the DMA hardware. All other size sectors will cause
      STem to abort with an error message.

  3rd January, 1998
     I discovered that the Atari operating system was trying to read the boot
      sector from each of the 8 DMA devices. However, due to the fact that I
      hadn't fully implemented the DMA chip the boot sector from the floppy disk
      was being loaded instead. The virus contained within the floppy disk boot
      sector was only designed to be loaded once, hence the reason why it
      crashed. It was not sufficient to send signals to the operating system to
      tell it that there were no DMA devices present, because this caused it to
      retry the failed operation again and again. The solution was to pretend
      that there were 8 hard disks connected to the DMA bus, but that they were
      all broken - not very elegant, but it works:-) The virus now loads without
      crashing!

  1st January, 1998
     I decided to investigate a disk containing some games which crashed when
      the boot sector was loaded. Lo and behold I found out that the boot sector
      was infected with a virus - and worse still, I had been using the very
      same disk for the past 6 years without noticing it! But why wasn't the
      virus working properly? Hmmm...

  31st December, 1997
     More problems associated with mode changes were discovered whilst
      attempting to get Gauntlet running. The first was due to the way that
      RISC OS resets the user defined palette when the mode is changed - this
      was fixed by forcing STem to do a complete palette update after each mode
      change. The second was that mode changes cause a temporary glitch in the
      graphics, because the screen is cleared by RISC OS, then immediately
      updated by STem. In some cases the glitch can be avoided, because the mode
      before and after is exactly the same, so we don't need to involve RISC OS
      at all.

  31st December, 1997
     The problem of the mouse pointer sometimes getting positioned in the top
      right corner of the screen during the boot process was solved. It was down
      to the way RISC OS repositions the mouse whenever a screen mode change
      occurs, thus causing spurious mouse movement packets to be send by my IKBD
      emulator.

  28th December, 1997
     A compiler warning alerted me to a minor problem in the intelligent
      keyboard emulation - the function call for executing IKBD commands had
      been completely omitted. After adding the necessary function call it then
      became apparent that the mouse handling code was incorrect, because all
      mouse movements in the Y direction were inversed. This bug was then fixed.

  27th December, 1997
     Many tiny optimisations were made to the assembler code - notably to the
      shift and rotate instructions. Better use was made of the ability to
      conditionally execute ARM instructions, particularly to avoid unnecessary
      load and saves to memory. A bug in the ASL instruction was also fixed.


Version 1.00 Beta
=================
  13th December, 1997
     The entire strategy for decoding MC68000 instructions was changed, and as
      a result of this the emulator now runs 25% faster than it did previously.
      The executable size remained almost constant, but the run-time memory
      requirements increased by 256Kbytes.

  8th December, 1997
     The first beta version was released. Compatibility with the StrongARM
      processor was confirmed.

  6th December, 1997
     A major problem involving relocatable programs being loaded incorrectly
      was solved. It turned out that the EXT.W instruction was setting the
      condition code flags based on data which was slightly corrupted.

  4th December, 1997
     Using a module for emulating the YM2149 sound chip, supplied by Andreas
      Stroiczek, I managed to persuade STem to output some simple beeps and
      pings. Unfortunately, this is the best that is possible at the moment,
      because STem does not generate timing interrupts at the correct rate.
      These interrupts are used by programs to control the playback of sound,
      and are absolutely necessary.

  29th November, 1997
     At last, a long standing problem involving double sided disks not being
      readable by the operating system, was finally resolved. The problem was
      due to an assumption I made about the layout of DOS format disks, which
      subsequently turned out to be wrong.

  23rd November, 1997
     Modified the address decoding of the blitter chip, because I discovered
      that various parts of memory were being corrupted whenever this chip was
      used. The blitter chip still doesn't work properly :-(

  21st November, 1997
     Spent a considerable amount of time hunting down a bug which was causing
      TOS 1.06 to crash when booting. Eventually, I concluded that the ROM image
      was corrupt (as it turns out, by being 192Kbytes long instead of
      256Kbytes!), and after obtaining a new ROM image, I managed to get it
      booting successfully.

  14th November, 1997
     Added the ability to create long exception stack frames for processors
      greater than the MC68000. In general, the extra information which is
      stored for bus/address errors is meaningless, and could not be used to
      resume execution of the aborted instruction.

  10th November, 1997
     Doubts surfaced about some instructions which were loading/storing the
      wrong size of data when using the address registers. This was subsequently
      confirmed after I obtained an updated version of the MC68000 users manual.
      Although this bug would only have surfaced in a tiny number of very
      specific cases, I suspect that it was responsible for a large number of
      unexpected crashes which I experienced. Needless to say, this problem has
      now been fixed.

  9th November, 1997
     A bug in the disassembly code was fixed. Attempting to disassemble the
      MOVEM instruction would cause the instruction to be executed instead, thus
      corrupting the registers and memory.

  8th October, 1997
     Modifications were made to the execution and disassembly code to enable
      emulation of the 68010 processor. This is an optional feature and it is
      still possible to emulate the 68000 processor as well.

  2nd October, 1997
     Spotted and fixed a minor bug whilst browsing through the assembly
      language source code. Also did a small amount of general optimisation.

  28th September, 1997
     Added a 68000 disassembler to the code to speed up error location.
      Currently the disassembler is only used when specific breakpoints are set
      in the source code, but eventually I plan to make use of it in an
      integrated debugger.

  23rd September, 1997
     Support was added for the MessageTrans module, so that all textual
      messages can be kept in a separate file, instead of being stored with the
      code.

  19th September, 1997
     The two instructions NBCD and SBCD, for handling binary coded decimal
      numbers, were finally implemented. This means that STem can now emulate
      the entire 68000 instruction set, although there are still a few
      discrepancies in the way the condition code flags are set.

  14th September, 1997
     More changes were made to the configuration program. It is now possible to
      enter the filename of TOS and disk images directly into the program,
      instead of having to manually enter them from the command line. Several
      minor bugs were also removed.

  13th September, 1997
     The configuration program was improved by allowing multiple groups of
      settings to be created and saved.

  7th September, 1997
     Vast portions of the disk controller code were re-written with the aim of
      improving error detection and handling. A basic ability to read and write
      sectors to the real floppy disk drive were added, but this is not yet as
      robust as I would like - a few of my tests resulted in corrupted disks!

  5th September, 1997
     Yet another bug was discovered in the code for emulating the division
      instructions of the microprocessor. When a signed division was being
      performed and the quotient ended up negative, the remainder was
      inadvertently being set to minus one.

  2nd September, 1997
     The code for emulating the WD1772 floppy disk controller was substantially
      re-written. Previously, all commands to the disk controller were executed
      immediately - an entirely unrealistic situation as disk drives are very
      slow. This has been solved by allowing the disk controller to execute
      commands at it's own pace, whilst allowing the other sub-systems of the
      emulator to continue working simultaneously.

  6th August, 1997
     Some proper documentation, about how to setup and use the emulator, was
      written. It will be distributed with all copies of STem, and can be
      accessed via the 'Help' option in the filer menu. At a later date, it may
      be converted into HTML and/or OvationPro format, so that screen shots and
      diagrams can be included as well.

  2nd August, 1997
     Support was added for joysticks, and STem should be able to automatically
      detect whether there are any installed. None of the joystick code has been
      tested yet, so just incase it doesn't work correctly it is disabled by
      default. A command line option is provided to re-enable it.

  31st July, 1997
     As a trial, STem was compiled and linked using the Shared C Library,
      instead of UnixLib. The resulting 50% reduction in code size, and
      seemingly better memory management, was enough to make the change a
      permanent one.

  29th July, 1997
     A small modification was made to the code which decodes instructions.
      Some illegal instructions were being wrongly identified and then
      executed, when they should have been generating exceptions. This resulted
      in a debugger, which uses illegal instructions as breakpoints, from
      stopping at the required place.

  25th July, 1997
     The graphics system has been improved by allowing the emulator to
      automatically select the resolution, pixel depth, and frequency from all
      those available on the host computer. When the requested screen
      resolution cannot be obtained exactly, it will try to use a larger
      resolution instead. Where there is a choice of vertical frequencies, the
      mode with the higher one will always be chosen.

  24th July, 1997
     The trace state of the processor was altered slightly so that the trace
      exception will now occur at the correct part of the fetch-decode-execute
      cycle. Also, the question of exception priorities has been resolved, e.g.
      if a trace occurs at the same time as an external interrupt whilst a
      trap instruction is being executed, then they will be dealt with in the
      correct order.

  22nd July, 1997
     Eventually tracked down and fixed an obscure bug, which caused the
      operating system to crash when loading some programs. The operating
      system was trying to save the stack pointer on the stack itself, but this
      was being done incorrectly, leading to all the registers being corrupted.
      Though why the operating system should want to do this is beyond me?

  14th July, 1997
     Various minor changes were made to the 68000 emulator and the memory
      management unit, resulting in a small increase in speed. The
      write-protect status for the floppy disk drives are now reported
      correctly. Several other bugs were also eliminated.

  26th June, 1997
     The multitasking front end was completely re-written. It is now much more
      user friendly, and can provide on-line help for all features.

  24th June, 1997
     The keyboard was mapped in, and characters can now be send via the ACIA
      chips to the processor. A basic mouse handler was installed, which means
      that GEM menus and dialogue boxes can be accessed.

  21st June, 1997
     The microprocessor was optimised, and a few more instructions were
      implemented. A major milestone was reached, with the GEM desktop
      appearing for the first time.

  16th June, 1997
     Removed the operating system patches for the floppy/hard disk routines,
      and provided proper emulation of the DMA/FDC chips instead. Also, a bug
      in the ALU, whereby the CCR was not being updated after logic operations,
      was fixed.

  11th June, 1997
     A very nasty problem involving the carry flag was discovered - it turns
      out that the 68000 processor sets this flag differently to the ARM
      processor under certain circumstances! The exact details of the C flag
      are not mentioned in any assembler books, so I have no idea whether my
      current implementation is correct.

  10th June, 1997
     The graphics system was improved, so that rather than redrawing the
      screen continuously, it will only be updated when something has changed.
      Also, the routine to change the palette is now much faster, because a
      look-up table is used instead of doing lots of complex maths.

  3rd June, 1997
     Located & fixed a major bug in the division instructions (sounds similar
      to a certain Pentium problem, doesn't it?). The destination register
      was being zeroed, instead of storing the results of the division.

  13th May, 1997
     A program was successfully loaded from a disk image and executed. The
      program was contained in the boot sector of the disk, and displayed a
      smiley face on the screen.

  27th April, 1997
     TOS crashed, and displayed the familiar 'cherry bombs' on the screen -
      thus providing evidence that the emulated video system was working
      correctly.

  9th February, 1997
     The very first instruction was fetched, decoded and executed. The
      instruction was NOP, so it didn't do anything useful.

  7th February, 1997
     The project was started. I don't quite remember why, but I'm sure I had
      a good reason at the time!



!STem is  Copyright Samuel Ellis, 1998.
