Date : Wed, 15 Feb 1995 17:44:48 +0000 (GMT)
From : Bonfield James <jkb@...>
Subject: Re: Emulating I/O
Neil wrote:
>I am a fairly new member to the mailing list and wondered if anyone could
>help me with a few problems. I am not actually emulating a beeb, but
>writing a 6502 emulator for my 3rd year CS project (using C on a Linux
>system). However, I figured trying OS1.20 would be a good way of testing my
>code.
>
>Firstly, I think I should get away with only emulating some bits between
>FE40 and FE4F as far as I/O goes,but how much of this will I need to
do to get
>as far as the startup message? I haven't done any interrupts as yet either.
It is possible to get BASIC and OS1.2 running with no interrupts, no 6845
(crtc) and no 6522. One of my early (and the only one I ever publically
released unfortunately) versions of my emulator was running in this manner.
Basically, I intercept osfsc & osfile (for some noddy and bug ridden
file IO),
oswrch and osrdch to leap out into my own routines. I don't think having
BASIC
always mapped is a problem either. The interceptions use the 'add an extra
special opcode' technique that I pinched from Ian Stephenson's changes to the
apple II emulator.
It may well be that the OS will not boot correctly unless it finds the
correct
data in various memory mapped hardware registers. It may also be true that
having this memory writable causes boot problems. The configuration I
have is:
0000-7fff read/write
8000-bfff sideways ram read/write (set to read only will do)
c000-fbff read only
fc00-fdff no read/write
fe00-feff no read/write
fe30 write_latch (a specific routine for ram bank switching)
ff00-ffff read only
For memory that is set to no read I return all bits set (ie FF).
I suspect the fe30 specific bit isn't needed either. I haven't got an older
version around without this so I cannot test.
My data loads are:
basic 8000 (at a specific rom in my case)
os1.2 c000
dump 0000-0dff
"dump" is a *SAVE (after a memcopy) of 0000-0DFF on a running beeb. I don't
know whether it's needed or not, but it was for the very earliest bootup
sequences I was testing.
My os1.2 rom also includes a block of FFs over the IO sections, and the last
page (FF00-FFFF) which is further ROM data. Hence this file is 16K long.
So, to summarise it is indeed very possible to boot with support for no other
chips than the 6502.
If you need further information then I can provide my source and the "dump"
file. This goes for others wishing to write emulators - it's pretty daunting
to
look at some of the "complete" systems and it's not obvious to know how to
start.
James