Tue Aug 23 20:09:56 1994  James Bonfield  (jkb@sillistra)

	* X11/key.c: Define a scan_key function. This knows about the
	column[] and row[] matrices of the 6522 and fills these
	appropriately.

Thu Aug 18 21:03:16 1994  James Bonfield  (jkb@sillistra)

	* 6522.c, keyboard.c: better keyboard code (_nearly_ working).

Sun Aug 14 22:18:14 1994  James Bonfield  (jkb@sillistra)

	* keyboard.c(new file),	6522.c: Added keyboard matrix and support
	for accessing this via the sysvia pb0-2 latch. Doesn't work yet,
	but "theoretically" :-) should.

Thu Aug 11 17:34:20 1994  James Bonfield  (jkb@arran)

	* raw_text/IO.c: new input/output module. This uses raw POSIX
	termios calls to turn off line by line input (ie cbreak). Only
	being used for testing and probably won't survive long.

Wed Aug 10 09:35:26 1994  James Bonfield  (jkb@arran)

	* unix_io.c: Add include of unistd.h (Thanks to Stephen Quan) for
	helping spot this.

Tue Aug  9 19:40:50 1994  James Bonfield  (jkb@sillistra)

	* 6522.c: read_via now clears more ifr flags (I missed T1-L, T1-H).
	write_via to ifr and ier now does the correct bit twiddling to
	disable/enable the various bits of the register.

	* opcodes.inc: Ensure B flag is never set by PLP or BRK. It should only
	EVER be set by the presence of a signal on the BRK pin of the 6502
	chip.

Tue Aug  9 14:12:10 1994  James Bonfield  (jkb@arran)

	* X11/6845.c: Add hardware scrolling. Currently only support
	Y scrolling, but this is enough for BASICs use of modes 0,1,2.

Wed Aug  3 16:46:12 1994  James Bonfield  (jkb@arran)

	* opcodes.inc: PLP always sets B flag too.

Fri Jul 15 10:17:30 1994  James Bonfield  (jkb@arran)

	* memory.c: Read to sideways ram now accesses mem[] rather than
	pointer to mem. Will only make a speed difference for memory read
	(not execution read) of sideways RAM.

Wed Jul 13 09:22:32 1994  James Bonfield  (jkb@arran)

	* X11/ula.c: Fixed memory corruption in colours[] array. (It was
	defined to be half its used size.)

	* X11/6845.c: init_screen initialised 0x8000 as a screen memory
	hook too!

	* X11/6845.c: Only refresh screen when something has been written
	to it.

	* manager.c: init_screen() needed to be called after the memory
	initialisation.

Tue Jul 12 09:48:10 1994  James Bonfield  (jkb@arran)

	* opcodes.inc: zp_x and zp_y addressing modes now perform the
	quick memory accesses. (We can safely assume that there's no mmap
	IO in zero page.)
	
Wed Jul  6 21:01:02 1994  James Bonfield  (jkb@sillistra)

	* opcodes.inc: It's faster to cast to unsigned char than to
	perform the ? : scheme of computing the relative offsets for
	branches. Currently this is only changed for BEQ for testing. Need
	to check other platforms too.

	* 6502.c, opcodes.c, opcodes.inc (was opcodes.c), unix_io.c, manager.c:
	I couldn't believe my original investigations into implementation that
	a huge switch statement was less efficient than an array of pointers
	to functions (for the 6502 emulation). I've now reimplemented the
	huge switch and requested registers to be assigned for the 6502
	registers. The outcome is that gcc REALLY freaks (it ate 10meg of
	memory!) before finally producing a program which is only 7%
	faster :-(. AGGGGH! Still, it does mean that with -DSUPERFAST we
	can get get ~83% of BBC speed (on the same trusty old 486SX25).

Tue May 31 20:00:42 1994  James Bonfield  (jkb@sillistra)

	* Makefile, *.[ch] (more or less!): Rationalised the different
	compilation options. We no longer require such things as the 6522
	unless we're using X windows. Things also now compile properly
	under such conditions.

	* memory.c, simple/simple.c, curses/text.c, X11/6845.c, X11/ula.c:
	Move #ifdefs of memory hook initialisation to the relevant display
	medium init code.

Tue May 10 20:57:29 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: Add X key code so that we can type directly into the
	X window. Also changes to the register read/write; honour
	read-only, read-write and write-only status correctly. Some simple
	and SLOW code to perform hardware scrolling. Better to implement
	this by changing the src and dest values for the XShmPutImage
	probably - non working presently anyhow.

Sun May  8 17:47:21 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: Remove hack requirement of Xaw library for startup.
	All in good 'ol Xlib now :-)

Tue Apr 19 20:06:08 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: Change init_mode() to use the new colours[] array.
	We have no palette control yet though, so logical colours and
	physical colours do not make much sense.

	* X11/ula.[ch]: Added init_ula() and get_colour() to allocate and
	define colours, by name, for X windows. UGH! 4Mb makes for a REAL
	slow X windows development!

Wed Mar 30 20:28:47 1994  James Bonfield  (jkb@sillistra)

	* X11/ula.[ch] (new file): provides colour information for the 6845.
	Currently nothing more than a bunch of #defines in preparation.

	* X11/6845.c: Uses XSHM extensions for fast update

Tue Mar 22 22:20:56 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: Added init_mode function to provide a method of
	initialising the trans array with the correct information for the
	selected mode. The information is now taken from the 6845
	registers. Need to add ULA colour support.

	* X11/6845.h, memory.c: added hooks for read/write fe00/01. (fe00
	is write-only actually)

Sat Mar 19 00:13:20 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: Uses new timer code to provide a refresh callback.
	Updated the mode 0 (yes - still nice and specific) code to use a
	translation table and colour table. This reduces the memory poke
	to a single memcpy (and a couple lookups).

Fri Mar 18 22:14:43 1994  James Bonfield  (jkb@sillistra)

    	* 6522.c: Uses new timer code. This should mean that both the
	system and user instances of the via can run without timer
	confliction. 

	* timer.[ch]: Add query_timer_expire and query_timer_interval
	routines to allow knowledge of the current timer value.

	* memory.c, data/hackrom: Add hackrom (V1.18) to the list of ROMS
	available at boot time.

Thu Mar 17 22:41:32 1994  James Bonfield  (jkb@sillistra)

	* timer.[ch]: A timer handling module to provide a method of
	handling more than one timer at once. Ideal for joint use of the
	system via, user via, and 6845 refresh.

Mon Mar 14 22:36:49 1994  James Bonfield  (jkb@sillistra)

	* X11/6845.c: X windows 6845 emulation. Currently only working for
	MODE 0, and somewhat iffily at that. But it DOES allow the PLOT
	command to work correctly! :-)

Sat Mar  5 22:31:27 1994  James Bonfield  (jkb@sillistra)

        * manager.c, 6522.c, 6522.h: 6522.c now compiled twice - to
	sysvia.o and usrvia.o. do_irq variable hence moved to manager.c.
	The init function now means that two itimers are started, which
	causes problems - need to implement our own library on top of
	itimers to handle several timers at once.

        * memory.c, 6522.c: write_sysvia()/write_usrvia() now return the
	correct type for special_mem_w[]. This type is byte - should be
	void (but I'm lazy and it's less work to change these two functions).

	* curses/text.c, memory.c: poke_char() function added to deal with
	direct access to mode 7 memory (ie via poke).

	* curses/text.c: fixed bug with delete in curses mode. (I had the
	x and y swapped for the move() call.) Delete _still_ seems to
	translate the next character read into a newline though - WHY!
	Also set noecho() and used read() instead of getch() for read_char().

Sat Feb 26 22:30:42 1994  James Bonfield  (jkb@sillistra)

	* 6522.[ch]: read and write functions for 6522 written. No T2
	support currently, and minimal T1. The IFR is correctly
	set/cleared by this memory IO. This includes checking the PCR for
	CA2/CB2 control mode of independent interrupt and, if set, not
	clearing the CA2/CB2 bit in IFR.

	* memory.c, 6522.[ch]: 6522 read/write hooks added onto memory
	system. Currently they simply do normal read write. Changed fe00
	page to read access by default. T1 time-out interrupt flag now set
	in 6522 when the itimer expires. Result is that events now work.

Sat Feb 12 17:20:25 1994  James Bonfield  (jkb@sillistra)

	* manager.c, 6522.c, 6522.h: added UNIX itimer code to simulate
	100Hz interrupt generated by 6522.

Sun Jan  9 16:45:27 1994  James Bonfield  (jkb@sillistra)

	* VERSION 1.0: (Version 0.0 I'll define to be the slower modular
	system from earlier hacks.)

	* memory.c: With ASSUME access to sideways RAM banks is broken.
	For stability of first release I've added back the memcpy to
	write_fe30().

Thu Dec 30 00:29:17 1993  James Bonfield  (jkb@sillistra)

	* unix_io.c: Added most basic OSFSC and OSFILE code to interface
	with UNIX. Implemented in OSFILE are 0x00(save) and 0xff(load).
	Implemented in OSFSC are 0x02(*/), 0x04(*RUN), 0x05(*CAT) and
	0x06(new fs).

Wed Dec 29 10:57:39 1993  James Bonfield  (jkb@sillistra)

	* memory.c: remove read_fe30 function. Replaced with the more
	accurate mem_nord function.

	* memory.c, memory.h: Now using (again!) pointers to functions for
	all memory IO. When used with -fomit-frame-pointer this is quite
	efficient and solves many problems. Hence sideways RAM is also
	fast for switching now (no longer performs a large memcpy).

	* opcodes.c, 6502P.h:  Combine the reset_Z() & reset_N() macros
	into a single reset_ZN(). The advantage is that we can use
	combined information such as A == 0 implies both Z and !N.
	Marginal speed increase though.

	* manager.c, dis6502.c: Added DEBUG define to enable/disable the
	debug code. The check for whether to debug slows things down by a
	suprisingly large amount (10%) and so is default no longer used.

Tue Dec 28 12:48:10 1993  James Bonfield  (jkb@sillistra)

	* Makefile: Added extra optimisations to gcc compiler. Yields
	maximum speed of now only 37% slower than beeb. Specifically,
	-fomit-frame-pointer helps considerably as none of the op functions
	are complex enough to require the frame pointer code. On simply
	-DASSUME we get 44% beeb speed reduction.

	* manager.c: Abolished module system and called opcodes directly
	from manager.c (no debug check either). Also, no update now called
	for memory (it wasn't doing anything anyway) and no time increment.
	ie fastest I can (currently) possibly get things. Our FOR loop now
	takes (on a 486SX25 running Linux) 8.76 seconds which is around 3.5
	times faster than the original 'BBC Emulator'. So our fastest is
	currently 1.52 times slower than the beeb itself

	* memory.h: Added SUPERFAST define to always use non mem mapped IO
	(+ no read only check) to enable a faster system.

Tue Dec 27 17:25:58 1993  James Bonfield  (jkb@sillistra)

	* Makefile, memory.h, opcodes.c, 6502P.h: Added ASSUME definition
	to add a few extra speedups such as always assuming opcode &
	operands are in non memory mapped io (ie the faster mem
	functions). Not necessarily true - but virtually always and a good
	speedup. Sillistra takes 20.12+0.4s to startup and FOR I%=0 TO
	30000:NEXT

	* memory.h, opcodes.c, 6502P.h: Added more mem io 'functions' for fast
	access. All zero page memory accesses now use these simple methods
	to speed things up.

Mon Dec 27 00:30:33 1993  James Bonfield  (jkb@sillistra)

	* memory.c: Yet another memory system. This time we have a
	'simple' array (one for each of read & write) which tells us
	whether simple IO to that memory will work, or whether we should
	use a pointer to a func instead. Non writable memory is
	implemented with a pointer to a func to do nothing. This probably
	isn't an overhead as it is not often we try to write to non
	writable memory.

Sun Dec 26 14:28:25 1993  James Bonfield  (jkb@sillistra)

	* memory.c: Load new os data (fe00) and addr 0-dff into memory.
	Hence we now have a beeping :) (but only the latter half) and 32K
	claiming BBC Computer.

	* unix_io.c: Added unix call 66 (decimal) to save memory contents
	as data/new.bbc

	* opcodes.c: BVS was infact BCS!

	* opcodes.c: BRK adds 2 to PC pushed rather than 1

	* opcodes.c: RTI no longer adds 1 to PC pulled.

	* unix_io.c: Added unix call 00 and 01 to clear and set debug
	flag. Should provide easier mechanism for debugging 6502 module
	from within the Emulator.

Sat Dec 25 01:03:55 1993  James Bonfield  (jkb@sillistra)

	* memory.c: Added back sideways RAM support, and for testing
	loaded in both BASIC and the 65C02 assembler ROMS. Problem:
	doesn't work. Workaround: place BASIC as ROM number zero so that
	it falls through to using it.

	* memory.c: Spotted oddity with loading os.bbc. For some reason it
	was initialising the BRK address (0xfffe/f) wrongly. Loading
	ff00.bbc after "fixed" it. A solution for a problem of, currently,
	unknown cause.

	* Happy Christmas folks. I _will_ get around to doing some more
	development soon... Honest!

Sun Dec 12 14:04:24 1993  James Bonfield  (jkb@sillistra)

	* memory.c: Added back support for those 'special' memory locations.
	However, disabled the latch at fe30 as this (for an unkwnon
	reason) was preventing correct startup. Now '30%' slower than
	'fast' version.

Sun Dec 12 00:23:07 1993  James Bonfield  (jkb@sillistra)

	* memory.h: Sped up again (too around 35% slower of 'fast'
	version) by using macros again instead of pointers to functions.
	(Isn't quite complex enough for what we need though.) Also added
	readbq and writebq macros for fast mem IO when we know there's no
	possibility of mapped IO (eg for PHA/PLA).

Sat Dec 11 17:33:26 1993  James Bonfield  (jkb@sillistra)

	* memory.[ch], opcodes.c: MAJOR changes to memory management. We
	now support sideways RAM, read only portions & memory mapped IO.
	The implementation is somewhat yicky - a table of pointers to
	functions for reading and writing for all 65536 addresses. Due to
	the modified macros in memory.h, the arguments passed must not
	contain expressions that change data (as they will be evaluated
	more than once). Hence opcodes.c has been changed.
	We are now twice as slow as before, so some mechanism should be
	provided for using the earlier, simpler but faster, method.

	* curses/text.c, simple/simple.c: Added simple curses support.
	Created subdirectories ``curses'' and ``simple'' for the two forms
	of screen IO currently supported.

	* manager.c: added -d (for debug) and -Ddir (to change directory)
	options to main().

Sat Dec 11 00:12:52 1993  James Bonfield  (jkb@sillistra)

	* 6502.c: set initial flags for P to BRK + Unused. Also ensure
	in PLP instruction that the unused bit is always set. Now means that
	errors (eg 'Mistake') work first time round.

Fri Dec 10 20:52:51 1993  James Bonfield  (jkb@sillistra)

	* opcodes.c: Fixed (again) overflow in SBC/ADC. Verified.

	* opcodes.c: Added RTI instruction (amazing it worked without).

Thu Dec  9 21:17:29 1993  James Bonfield  (jkb@sillistra)

	* opcodes.c: Fixes to SBC, ADC, ROR, RORA, ROL, ROLA. Now a
	working (except BRK is wrong) emulator!

Wed Dec  8 22:34:54 1993  James Bonfield  (jkb@sillistra)

	* unix_io.c, memory.c: Added more unix_io stuff - taken from
	Ian Stephenson's emulator in an attempt to get a working platform for
	further development from.

Tue Dec  7 19:58:12 1993  James Bonfield  (jkb@sillistra)

	* 6502P.h: addressing modes ind_xand ind_y where reading single
	byte rather than word! Amazing to think it worked as far as it did!

	* dis6502.c: minor additions. Beeps and stops for a sec when
	reaching an unimplemented op code.

	* unix_io.c (creation), memory.c, opcodes.c: Add opcode 0xd4 which
	is trapped and handed over to unix_call() to do various misc IO.
	In memory.c, edit the osbyte, oswrch, osrdch (etc) to invoke this
	new 0xd4 opcode.

	* memory.c: set beeb misc I/O memory (fc00-feff) to 0xff to work
	around various checks on 'boot up'.

	* manager.c: quick hack - global debug flag set when invoking with
	more than one arg (will change to -d sometime in future I guess).

	* opcodes.c: fix several MAJOR bugs: LDY set X; pullw() used by
	RTS assumed order of expression evaluation; BCC & BCS swapped
	around; BVC & BVS macros defined, but not used in the op_..()
	functions; LDA (aa),Y was using abs mode.

Mon Dec  6 20:39:20 1993  James Bonfield  (jkb@sillistra)

	* 6502P.h: parenthesise get_x() macros to yield correct answers.

	* memory.c: clear memory on initialisation

	* dis6502.[ch] (creation): an incomplete disassemble mechanism to
	aid debugging of the 6502 module.

	* opcodes.c: CPX & CPY added. I wondered why it was looping around
	and around :-)

	* opcodes.c: Added branch instructions:
	BCC, BCS, BEQ, BMI, BNE, BPL, BRA
	Bit (and more branch) instructions:
	BBR & BBS (all 8 of each), BIT, TRB, TSB
	Added final instruction: BRK.

Sun Dec  5 13:58:59 1993  James Bonfield  (jkb@sillistra)

	* opcodes.c, 6502P.h: Implemented more opcodes;
	TAX, TAY, TSX, TXA, TXS, TYA, ADC, SBC, JMP, ASL, LSR, ROL, ROR
	stack macros added. Hence added:
	PHA, PHP, PHX, PHY, PLA, PLP, PLX, PLY, JSR, RTS.

Sat Dec  4 21:38:01 1993  James Bonfield  (jkb@sillistra)

	* memory.c: simple code to read in bbc specific data files to
	initialise memory.

	* opcodes.c: Implement several 6502 opcodes; currently all of
	LDA, STA, LDX, STX, LDY, STY, STZ, AND, EOR, ORA, DEC, INC, NOP,
	CLC, CLD, CLI, CLV, SEC, SED, SEI, DEA, INA, DEX, INX, DEY, INY,
	CMP.

	* Stable, but minimal creation. Current files are:
	defs.h: standard defines, such as byte, word, etc
	manager.c, manager.h: the main() driver to everything. Coordinator.
	module_inc.h, public_template.h: some simple templates to aid module
	creation.
	memory.c, memory.h: Memory I/O. Currently very basic.
	6502.c, opcodes.c: the 6502 module code
	6502.h: public header for 6502 module
	6502P.h: private header for 6502 module
	6522.c, 6522.h: the 6522 module. Currently does nothing.
