Date : Fri, 12 Aug 1994 08:43:30 WET DST
From : Bonfield James <jkb@...>
Subject: Re: i see basic! :-)
Hello,
>Thanks for your pointers I finally see BASIC coming up. I used the
>OS ROM hack in James B emulator (Ian Stapleton should get a mention
>in here too!) to intercept OSWRCH and OSRDCH and the system booted
Ian Stephenson too, who I took the idea from ;-)
>I am now ready to start implement the rest of the BBC, but don't
>know where to start. Any pointers? My first question is what does
>the real OSWRCH and OSRDCH do? I suspect that I can let the real
>OSWRCH loose only when I have implemented some of the 6845, but
>without disassembling I am clueless on how OSRDCH might work.
>Does it just go into some kind of wait loop waiting for a keyboard
>interrupt???
Well, OSWRCH as you say requires the 6845, or if you're working in mode 7, at
the very least of cheat using a bunch of memory hooks for &7C00 to &7FFF that
simply write to the correct screen locations (ie a "print tab").
OSRDCH I'm working on myself at present (having got OSWRCH working in my 6845
code). As far as I recall, it reads the two byte key rollover stored at &EC
and &ED. These bytes are updated by the OS automatically.
The 6522 generates an interrupt when CA2 (I think) is triggered by a keypress.
The OS then in turn reads the data (presumably from [io]rb? not sure of this
yet) and stores the results in &EC/&ED.
>Another question. The Advance User Guide gives a decent memory
>usage for the first couple of pages (my 1 page = 256 bytes). Things
>such as the joystick, the system clock and so on. When I get around
>to emulating those should I directly update these bytes or does some
>other ROM do that? The 6522 perhaps?
As shown with the above example, it's the OS that keeps all this memory up to
date. Typically, you should emulate NONE of this sort of stuff. All you need
to worry about is screen memory and chips (ie sheila) and everything else is
done for you. However, I guess cheating now and again during the emulators
development is OK, provided it's just to help it along until the real code is
written.
James