
   The Real Story of VICE, the Versatile Commodore Emulator / Simulator
   --------------------------------------------------------------------

 "The question isn't if there is any need for an emulator. The point
  is just the fun writing one."				-- Authors


	Index
	   How It All Began
	      The Youth of X64
	      Why April the 1st ?
	      ... And the rest is history
	      X64 Strikes Back
	      Hmm. X64's Son ?
  	      The return of -- the VICE
              An almost completely new beast: VICE 0.12!
	      

	   X64 Revision History

	   VICE Revision History


   -----------------------------------------------------------------------

	How It All Began

		The Youth of X64

X64 project was originated by Vesa-Matti Puro in the spring 1991 when he
came up with an idea of writing a simulator for the 6502 microprocessor.
However, his studies kept him busy until mid of May 1991 when he started
programming the simulator. 
The next two weeks he used to implement ML instructions decoded by a look-up
table which contained pointers to the actual functions.

During the next winter Vesa got all documented machine language instructions
programmed, except that he implemented ADC and SBC only in binary mode.
At this time a very simple machine language interpreter was written in C
for debugging the simulator. This is the same line assembler still found
in the x64 even though it has been enhanced later.

During the development, C64 Kernal was used as a test program for the CPU, but
there was not any interfacing circuits nor memory management implemented yet.
At this point Jarkko Sonninen took over and rewrote the CPU code in order
to make a C64 emulator, because there wasn't one available yet.

The first task was to implement memory management and, in order to use BASIC,
the most necessary parts of VIC on X11.

In short time BASIC interpreter took its first tottering steps on x64 which
did not even have CIAs yet. Thus, a small hack was needed to send incoming
keystrokes directly into the keyboard buffer.

Next autumn, after Jarkko had became responsible for the whole project
Jouko Valta joined the team. With invaluable advises (which we discarded,
though ;) given by Hannu Helminen, local X11 guru, x64 (version 0.1) was made
to see the daylight April 1st 1993. For some reason the date seemed to,
however, cause confusion and disbelief among people.  ;-)


		Why April the 1st ?

The tradition the 1st of April being the April Fools Day originates from the
celebration of Summer taking over of Winter. The event also caused everything
to go upside down and invited fools for a visit.

Which day would be more suitable for releasing an emulator ?  (-:

(Hint: After installing VICE, attach a note to each workstation saying
   the operating system has been upgraded. ;)


	    ... And the rest is history

In few days the prejudiced people began to notice they were fooled after
all, altough the program provided very limited operation. The manpage
stated it was meant for testing only. However, it was already capable to
run other than heavily display oriented stuff, and as mentioned above, at
that time there were virtually no emulators available - definitely none for
XWindows.

The capabilities of x64 were quickly tested out among large amount of people,
and a lot of improvements were loudly requested. The most delightful thing was
that also patches and some ideas which we had not even thouhgt about, were
received. (:
The most significant contribution was the emulation of the 1541 disk drive
(including standalone version) as well as traps for the serial bus, made by
Teemu Rantanen, who was working on a similar emulator.

Within six weeks time requests were raised and the authors were pushed to
release a better version of x64. The "X64 Revision History" section below
tells details what really was done, and also states it took over two months
to get it ready for release.
This was due debugging, which still continued until the next autumn when even
the hardest bugs finally began to gave in. Thanks for this go to Richard Hable
who has helped in improving the x64 ever since.

In the end of January 1994 the delay in releasing patches began to interfere
installing any enhancements, so it was time to remove any unfinished deve-
lopment code, document bugs that were found, and there it was.

The next step was to reduce the secrecy surrounding the project, so maintenance
distribution was taken into use, and new developers were encouraged to join,
since old members began to fade off.
Despite the little luck, during the next six months the code was significantly
rearranged and several improvements were realized.


		X64 Strikes Back

As it turned out, the line "C128 is a lot more complex than C64" in the CBM FAQ
did not tell the whole truth. In fact, Basic v7.0 started to run on modified
x64 (x128) in mid February, i.e. shortly after the way was cleared by releasing
the deferred patch, 0.2.1. (Ever since, I've regret hurrying it up, as this
happened only a couple weeks after the release...)

The next year was pretty silent, merely  -- among the abovementioned changes --
weeding off its mysterical crashes, vanishing outputs and bugs still lingering
in the CPU, which didn't affect operation in the C64 mode.
Most people already thought X64 had died, as no patches were released. But that
was only because there always was something under transition, which prevented
patching.

Surprisingly, the hardest thing to implement on x128 was the standard C64/128
serial bus. Eventually, the problem was located in lacking support of opening
random channel on the disk drive when testing the drive itself a year later.
This delay resulted in release of x128 occurring at the second anniversary of
x64 ... April 1st 1995.

This time people were better informed, so there was nothing special in the
release date. As a curiosity, the first patch arrived that very day.

However, it turned out that the disk drive emulator was quite buggy still, not
only because of hurrying it for April 1st, but there were older misfeatures as
well. Thanks to Dan Fandrich and drive guru Olaf Seibert, who pointed out and
patched majority of them.


		Hmm. X64's Son ?

Despite the fact a year had passed, the basic concept in emulation was still
the same as in 0.2.2. The main difference was more portable and maintainable
source code, and not better emulation. Plans for development were the same,
and even though 0.3.0 was significantly late from the earliest schedule, many
things planned to be included hadn't made it.

So, as one might expect, Xvic, the VIC-20 emulator finally got the video chip,
serial bus, and eventually the VIAs to handle keyboard. And it worked!
 -- Why I didn't mention the memory handling needed, too ?  Well, it was there
all the time...

The obvious move was to make PET (8032) emulation next. In case this doesn't
sound so obvious, I'd like to remind that video chip/screen emulation was due
to be rewritten, and there already was some code waiting, so it was easiest to
add other emulations at that point.

Meanwhile, Ettore Perazzoli - the new X64 programmer since June '95 - took the
responsible task making the long-awaited improvement and completely rewrote
the video emulation.  (:
As it turned out, he succeeded to comply the high requirements set to the task,
and althogh we lost XVIC and XPET for some time, the result is much better in
every aspect.
With this enhancement, it was time to add full cycle counting on the CPU. The
missing occasions were extra cycles for branches and page boundary crossing.


		The return of -- the VICE

Three years later, here we stand in the starting point again. After X64 had
left the competitors far behind, it occurred to us we had gone way beyond
the original plan in making a _C64_ emulator. Thus the ultimate goal of the
project was appropriately redefined to making the only one fully portable
Versatile Commodore Emulator -- hence the name VICE.
To ease the use, an additional set of tools is included as The VICE Toolkit.

During the early months of 1996, Ettore Perazzoli and Andre Fachat didn't
leave virtually any part of the program untouched; the program was reorganized
almost completely. With major improvements taking place every day, and loads
of more games beginning to work, even the documentation hardly kept up-to-date
with details.

With the speed and portability as the rule, Ettore finished the implementation
of his completely rewritten video emulation. As anyone knows, this is the
pivotal element of the whole emulation, inadequacy of which the x64 earlier
suffered from.
Ettore also found one more bug in the CPU (incorrect decimal SBC), thereby
proving false the assuption RTI having been the last...

On the PET emulators as well as serial and, naturally, the parallel code, in
turn, you'll see the mark of Andre Fachat, a PET guru, previously also kown
as the author of XCBM.

As usual, a huge load of bugs came out with the first official release, which
was VICE 0.10.0. So Andre Fachat took the heavy effort to massively improve
the most buggy part, which was the interrupt and CIA implementation... his
changes, which almost completely replaced the old code, increased the level of
compatibility considerably, allowing VICE to run almost all of the games which
the other popular (non-free) emulators could run. Moreover, Ettore slightly
changed the memory addressing method so that the speed of the CPU was doubled;
the C128 MMU was also better implemented and the VIC-II emulator was provided
with the exact timings and bad lines, so that more effects could be emulated
correctly. Moreover, two very important features were added: D64 and T64 image
attaching.

Since VICE could run more and more games, many people loudly requested a SID
implementation; so Lionel Ulmer (author of the Linux joystick patch) and Teemu
Rantanen (one of the fathers of the early versions of x64) started working on
that. Unluckily, none of the emulations was completely ready for the 0.11.0
release, which was made available in July, so they were included as
experimental code only.


		An almost completely new beast: VICE 0.12!

After 0.11.0 was released, it was apparent that some radical changes had to be
done to improve the performance and ease of use of the emulator.  This was not
very easy, as many parts had to be heavily patched...  and piece by piece many
of the most crucial parts were almost completely replaced.

First of all, the whole graphic code was turned from Xlib to Xt style and the
sources were modularized to provide easier porting to different platforms and
user interface.  The first important result was a really slow and buggy MS-DOS
version of VICE 0.11.0 that was born in August 1996 but was never actually
released to the public.  This also showed that the code had to be re-organized
to be more efficient, so the old video chip emulators were completely rewritten
to provide more speed; in the meantime, other features (such as the video cache
toggle and the double window size) were added.

Then came the most important changes, that related to the emulation details.
The first important limitation that had to be removed was the timing: most of
the timings in 0.11.0 where far from being exact, so the whole CPU, VIC-II and
CIAs had to be adapted to obtain higher accuracy.  Right after this one, a new
developer, Daniel Sladic, joined the team and provided the first core for a
hardware-level 1541 emulation, that started working at the beginning of 1997.
As this new feature needed some additional performance to be usable and since
adapting the old CPU code to emulate two CPUs was becoming troublesome, Ettore
also decided to write a completely new CPU code that could also be faster
than the previous one.

In the meantime, Teemu Rantanen had improved his SID emulation, which finally
gave speech to our Creature.  By modifying the SID code, also the PET and VIC20
emulators could be provided with sound as well.

Unluckily, all of these substantial changes caused the project to become harder
to maintain, and this made the authors postpone the release date many times... 
Unluckily, the traditional April 1st release could not be done, but the new 
creature finally saw the light in May 1997. 


	... to be continued


   -----------------------------------------------------------------------

   
	X64 Revision History


Version 0.1		-  1 April 1993
---------------------------------------
Features:
	8 sprites, multicolour text and graphics (slow), extended colour mode,
	complete 6510 instruction set (with undocumented commands) and
	Machine Language Monitor/Debuger with command line editor.
	No sound nor raster effects.
	BASIC text CBM <-> ASCII conversion utility.
	Supplied with documentation on the CPU.


Version 0.2.0		- 21 June  1993
---------------------------------------
	Added C64 game cartridge support, fixed several bugs and made more...
	implemented REU with help of Richard Hable
	disabled most of debug information
	Installed serial bus emulation & traps, 1541 disk drive (#8) and
	  FS drive (#9) emulator written by Teemu Rantanen


Version 0.2.1 Alpha	- 10 Nov   1993
	Maintenance release
---------------------------------------
	Fixed severe bugs in asm and mon; now handles argument '0' correctly.
	New command line editor, also ported for Linux.
	Offensive ifdef for REL_ADDR removed and 1541 patched in order to gain
	  more portability.
	Disk block allocation fixed by Dan Miner's patch.
	REU fixed by Richard Hable
	added routine for run-time Kernel patch and wrote printer emulator,
	  both suggested by Peter Weighill.


Version 0.2.1		- 26 Jan   1994
---------------------------------------
	Changes mentioned above completed, except printer.
	Revision History included.
	"blist" renamed to "petcat", BASIC extensions implemented
	directory printout cleaned up and (SEQ) text conversion added.
	corrected tokenizing routine that corrupted the output.
	Implemented image write and found a bug in image dump function.
	tried to enhance keyboard reliability
	set some outlines for future development of VIC-20 and C128 modes.


Patch to 0.2.2		-  9 June  1994
---------------------------------------
   Note: The changes mentioned between 0.2.2 and 0.2.3 do not necessarily
   tell the chronological order of implementing, because 0.2 patch 2 was
   mostly a downscaled version of the development code.

	Disk block hex dump and 'number' in monitor
	Manpage for petcat too; implemented control code crunching and V3.5.
	SX64 (Rev 67) and 4064 (Rev 100) Kernel patch data added.
	Added "Emulation" file
	In core monitor now saves I/O and CPU states in addition to RAM data
	ROM image validity check and freeze status.
	A directory linking bug fix in the disk drive and option for copying
	  files from *.t64 tape images to X64 disks.


Version 0.2.3 Alpha	- 11 June  1994
	Maintenance release
---------------------------------------
	Memory management for C128 mode (in fact it's in the 0.2.2 too)
	New Xdebugger and argument parser, supports long keywords for command
	  line arguments, and X11 resource database.
	Enabled printers #4 and #5 with limited Epson compatible emulation.
	Set up the DOC directory with more files.
	Added Makefile to distribution. Makefile.sun64 got '64' in its name.
	Developing another (faster) VIC chip emulation started.


Version 0.2.x Alpha	- Several revisions
	Maintenance releases
---------------------------------------
	Removed the doubled K & R style function headers. Code also rearranged
	and cleaned up. Better compilation discipline.
	Help command in the Monitor knows 65xx instructions.
	Adopted the Emulator Detection system introduced by Wolfgang Lorenz.
	Separate subdirectories for ROM images.
	Atari ST port turned out to be way too slow.  ):


Version 0.3.0 Alpha 0	- 26 Jan   1995
	Maintenance release (0.2.5)
---------------------------------------
	A couple of bugs in the CPU were reported.
	Up to 4 Disk drives supported. Installed the Mon Shell to c1541 too.
	More verbose 'info' command and disk description added.


Version 0.3.0		-  1 April 1995
---------------------------------------
	C128's slow-speed serial bus implemented.
	Serial EOF and EOI fixed.
	C1541 imports 40-track D64 images including errors as well. (Not used.)
	Run-time peripheral set-up control.
	Filename and -type parsing fixed in c1541 disk drive.
	Disk hexdump moved from monitor to c1541 standalone.
	Drive's Ascii <=> Petscii conversions rewritten.
	New commands COPY and SCRATCH. IPE error codes.
	Needed updates to User interfaces made.
	C128 Kernel patch data added.


Patch to 0.3.1		-  7 Sep   1995
---------------------------------------
	Run front-end utility for the Monitor by Peter Weihgill
	Petcat learned 2 more Basics and the graphics characters.
	Validate bug in formatting, and filename parsing in LIST corrected.
	Arguments on TAPE import command were misused.
	More corrections: BAM was not saved correctly, nor read after import.



	VICE Revision History


Version 0.10.0		-  1 April 1996
---------------------------------------
	Faster screen handling.  (-:
	Completely new VIC-II emulation
	File Conversions added in Emulation.
	P00 file support added on petcat, emulators, and c1541.
	Embarrassing bug preventing keyboard buffering to work corrected
	  with event time comparison.
	Keyboard is now scanned more often for fluent operation.
	Zilog Z80 support on C128. (optional on compilation time.)
	Real-time Bus access display.  (optional on compilation time.)
	C128 80 column emulation
	C128 Numeric Keypad
	VIC-20 emulator
	PET 3032/4032/8032 emulator with hardware IEEE488 emulation
	  (well, this parallel stuff is fast enough... ;-)
	Standalode printer 'PetLP' for printing Commodore files
	PostScript(R) code generator for printers.   -- still debug only
	bugfixes for FS drive
	Expand ~ on pathname to $HOME
	MITSHM support
	-80 and -40 allow the user to select video emulations on x128 and xpet
	-80 option also emulates the 40/80 mode key on C128.
	-speed allows custom speed execution (0 = maximum speed);
	-/+checkss and -/+checksb enable/disable sprite collision registers;
	-joyport specifies the port for numpad-based joystick emulation
	-refresh specifies the refresh rate.
	The above resources have monitor variable counterparts
	Sorted the options so that they are now easier to find out
	Added a new rasterutil.c module which provides new access
	  methods to the video emulation (higher level);
	Some minor changes to the bootstrap procedure to make it look a bit
	  better;
	New colour allocation method, with support of private colormap.
	Added the new char_128.c, char_VIOC20.c and char_PET.c files.
	Removed lots of warnings
	Documentation updated
        Fixed the SBC bug
	Fixed a bug in drive.c: when opening files for read, it gave
	unnecessary FILE MISMATCH errors
        Reworked error/command channel handling. The error message is now
	 ended with a carriage return as it should, the right error message
	 is printed and it can be read even with GET# commands. 
	IEEE488 parallel bus
	The last byte sent via IEC bus, i.e. the one with EOF, was bogus.
        Now the last _valid_ byte is sent with an EOF as it should be.


Version 0.11.0		-  31 July 1996
---------------------------------------

	2.3 times faster CPU emulation :->
	Better VIC-II emulation, with bad lines and correct timing.
	Better (almost completely rewritten) interrupt handling and
         CIA/VIA timers emulation
	Faster Sprite Collision checking
	Direct D64/T64 support
	IEEE-488 interface emulation
	The 6510 IO register has been fixed
	Better 1541 error/command channel handling
	Better FS driver, with command/error channel and directory
         handling commands
	Diskimages can be attached as unit #9
	Better VDC emulation, with variable screen and character sizes
         and monochrome bitmap mode
	Better MMU support in x128, with true common RAM
	Better xdebugger (still to be worked on)
	More decimal mode bugs fixed
	

Distant future
---------------------------------------
	Plus/4 series emulators
	b/w & truecolor modes
	run-config file
	MS-DOS (or maybe Win95) port
	1571 and 1581 simulations
	Printer features: postscript generation, text formatting,
	  support for ~10 languages and 7 printing colours.
	Printer commands under construction
	SID emulation
	Graphical User Interface
	Faster CPU emulation
