BBC Model B Emulator Version 0.99a. 16/3/98
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Written by D.C.Devenport.
Copyright (c) 1998. All rights reserved.
EMail : DDevenp666@aol.com
Snail : 40 High Street
        Belper
        Derbyshire
        DE56 1GF
        England


DISCLAIMER:
~~~~~~~~~~~

I will not be held responsible for any damage caused by the use/misuse of
this software. Use it at your own risk. Please DO NOT distribute it with ROMs.
Do not ask me for ROMs, or where to find them. I am sure you know how to
use a search engine, or a least know a man who can.
For some reason I find myself writing www.emulation.net, how bizarre!


RELEASE INFO:
~~~~~~~~~~~~~

All code written by me D.C.Devenport (DDevenp666@@aol.com) (c) 1998.
All rights reserved.
Except TWKUSER.C/H which is public domain written by Robert Schmidt
of Ztiff Zox Softwear, 1992-93. (I know software is spelt wrong and
so does he!).


The DOS Extender PMODE/W is Copyright (c) 1994-1997, Charles Scheffold
and Thomas Pytel. All rights reserved.


The executable archive should contain the following
(and only the following files):
    BBC.EXE     - The virtual BBC Model B machine.
    DCDDFS.ROM  - My filing system ROM.
    README.TXT  - This file
    CHANGES.TXT - History of releases
    M8          - this is the 'mode 8' program out of the AUG simply
    M8.INF        CHAIN"M8"
and possibly
    DOS4GW.EXE


This program is the 11th alpha release of an attempt to emulate the total
hardware of a BBC Model B by Acorn Computers. This program is FREEWARE as
long as the archive is distributed un-altered, with only the above six files
in it. It must not be sold without the written consent of the author (which
you won't get).
If you use this program, all I ask in return is that you send me an email
or preferably a postcard, and let me know what you think. You can also
send money/CDs if you like.


You will most probably find an up-to-date version and screen shots of this
program at :
My home page - http://members.aol.com/ddevenp666/index.htm
or
'The BBC Lives!' - http://www.nvg.unit.no/bbc/bbc.html, this site is worth
a visit anyway - especially if you want some games. You can also find other
BBC Emulators here.



This program is written in C using Watcom 10.6. There are a couple of ASM
portions (Putting mode 7 characters to the VGA card, and stuffing the
graphics mode screens to the VGA card).

According to Mark de Wager 28/7/97, this is 'by far the fastest BBC Emulator
I know'. :)

Have fun - Long may the beeb live on....

Cheers

Dave.


System Requirements:
~~~~~~~~~~~~~~~~~~~~

First you need two files (Don't ask me for them)
OS.ROM    - this is an image of the OS 1.2 ROM
BASIC.ROM - this is an image of the BASIC2 ROM
A 486 or better PC.

Additionally, if you have EXMON.ROM and/or DOCTOR.ROM in the same directory
as the emulator, they will also be loaded. (I suppose you could load other
ROMs by simply naming them DOCTOR.ROM and EXMON.ROM - do not use other DFS
ROMs, they won't work!

This program is has been compiled/optimised for a 486 processor.
It *may/should* run on a 386 - I have not used BSWAP in my assembler
routines.

On my crappy 486-100 it runs at approximately 110% BBC speed - this includes
totally redrawing the screen once every two VSYNC signals (this is normally
25 times each emulated 'second' - but the 6845 registers can be altered to
change the video refresh frequency. Note this is without the -scanlines
option, of the -sb option).

I have mostly rewritten the 6502 core emulation in ASM - but it hardly seems
worth finishing it now.


Hardware currently supported and emulated (correctly I hope) :)

    6502 processor - Some 'illegal' opcodes still missing (I haven't found
                     anything that uses them yet)
    6522 VIA's     - Both System and User. Almost completely only the Shift
                     Register is not emulated (nothing seems to use it).
    ROM Paging     - Both ROMs and 'sideways' RAM.
    ADC Controller - Although I haven't yet bothered transferring information
                     from the PC joystick port to the ADC registers.
    Sound          - Channels 1-3 perfectly. Channel 0 is iffy.
                     White noise still doesn't sound harsh enough though.
    6845 CTRC      - Almost entirely (only horizontal sync is not used).
    Video ULA      - All the standard modes + mode '8' catered for.
    Serial ULA     - Just the cassette motor LED.
    Keyboard       - See below for keyboard mappings.
                     Most keyboard information was gleaned from disassembling
                     the OS ROM... It may be wrong.
                     LEDs Numlock=Casette Motor (LEDs disabled at the moment)
                          Capslock=CAPS lock    
                          Scrollock=SHIFT lock

Running
~~~~~~~

Simply type BBC and press enter - not too hard eh?

Command line options:

-scanlines
  You can turn on scanline drawing with this opition which allows split mode
  screens to appear correctly (ELITE!). Default disabled. Using this option
  will slow down emulation somewhat. Needed to make Rocket Raid work.
  Also if your 'man'/ other sprites disappear in games try using this option.
-frameskip##
  ## is a value from 1 to 25 inclusive. Default value is 1.
  Normally VSYNC interrupts occur at 50Hz (50 times a 'BBC' second), every
  other interrupt is ignored. A value of 1 means redraw the screen 25 times a
  'BBC' second and a value of 25 means redraw the screen once a 'BBC' second.
  NOTE: The BBC uses an interlaced display, ODD scanlines drawn on one VSYNC
  and EVEN scanlines on the next - hence a whole screen update every 25
  seconds
-sb
  Turn on sound blaster, sound emulation.
-noclear
  Stops RAM clearance on break. Even if *fx200,3 etc is used.
-doublebuffer
  Allows double buffering (actually page flipping) of the graphics display.
  Try this option with FireTrack :)
  The screen still occasionally appears to flicker - this is due to
  reprogramming the palette registers outside of a vertical blank.
-exact
  Slows the emulation down to a real BBC speed. Default disabled.

Games/Files to be loaded by the emulator currently need to be located within
the same directory as BBC.EXE.
Currently it only loads/saves files that are in Wouter Scholten's Archive
format (.INF) type files.


Known problems:
~~~~~~~~~~~~~~~

Filing system only allows Save/Load/*DISK/*DISC/*DIR/*RUN,
*CAT/BPUT/BGET/OPEN etc are not implemented at this moment
After BREAK, you may need to type *DIR $ to get stuff to load again. Hard
resets at this time do not reset the current directory.

Aspect ratio not quite correct on MODE 7 (or graphics modes for that matter).
If you manage to 'tweak' a better aspected 240x250x256 please let me know.
(Also my 640x264 x 16 colours mode doesn't yet fill the screen vertically -
again let me know)
No cursor is yet displayed in graphics modes - I simply haven't bothered to
draw it yet.
Sometimes -scanlines and -sb used together crash the emulator - it is to do
with DPMI memory locking. Note: the program is much more stable now, I
haven't managed to make it crash with this version.


To do
~~~~~
Add better sound support.
Add the joystick support (Although PC analogue joysticks are just as crap as
the Beeb ones!).


Keyboard mappings (different from PC)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ͻ      
 Beeb    PC                
͹
 BREAK  f12                
 f0-f9  f1-f10 (f0 is f10) 
 up     up                 
 down   down               
 left   left               
 right  right              
 - =    -                  
 ^ ~    =                  
 3 #    3                  
 6 &    6                  
 7 '    7                  
 8 (    8                  
 9 )    9                  
 0      0                  
 DEL    BACKSPACE          
 COPY   KEYPAD 0           
 ; +    ;                  
 : *    ' (right quote)    
 @      ` (left quote)     
  _    #                  
 SLOCK  NUM LOCK           
ͼ      

Keypad 7 and 8 are CAPS/CTRL for zalaga left/right...
Keypad 4 and 5 are DEL/COPY for roadrunner

Also left ALT works for CTRL too! (remember to turn off ALT/CTRL+key
combinations in windows)
SCROLL LOCK - holding this down freezes the emulation, till released
HOME - If you are using the scanlines option, then this toggles whether or
not the split appears on or after the screen row where it appears. Try
it in Elite/Strikers Run.

Also F11 allows *LOADing, *SAVEing and also quitting the program.


Some of the games I have successfully ran 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

All the Scott Adams adventures
Alien 8
Arcade action
Arcadians
Atic atac
Aviator
Blagger
Blitzkreig
Castle Quest
Chess - acornsoft
Chess - program power
Chuckie Egg
Cybertron
Dave Devil Dennis
Dr Who and the mines of terror!
Elite - The BBC disk version is 'BEST GAME EVER', so there!
Exile
Felix in the factory
Firebug
Fire Track
Frak!
Galaforce
Ghouls
Hopper
Hunchback
JCB digger
Jet-Pac
Killer Gorilla
KIX
Knight Lore
Labyrinth
Level 9 adventures
Match Day
Maze
Mr. Ee
Mr Wimpy
Palace of Magic
Pengo
Pharoahs curse
Positron
Repton
Rocket Raid
Sentinel
Space Adventure
Spy Hunter
Starship Command
Stock car racer
Striker
Syncron
Thrust
Twin Kingdom Valley
Ultron
Warlords
Wizadore
Zalaga


WANTED :
~~~~~~~~

A job in the games industry - I know the odd machine inside out :)
Information on how to simply LOCK the whole CODE and DATA areas using
DPMI under DOS4GW.
Loan of a 6502 second processor.


THANKS TO :
~~~~~~~~~~~

Robert Schmidt for The BBC Lives!
Tom Seddon, his emulator convinced me it could be done - he also supplied
some information on the 6845. (Good luck with the Williams Emulator)
Nicola Salmoria for supplying the sound chip data sheet.
Charles Scheffold and Thomas Pytel for their DOS extender (no longer used).
lance@123.co.nz (also Tom Seddon) for supplying a pyhsical frequency to OPL
value formula - not actually used in the end - samples were preferred, see
SOUND.TXT in the source release.
David Ralph Stacey (drs1@doc.ic.ac.uk) for pointing out how the VIA timers
are correctly reset. (It turned out to be +2, not +4!!) :)
Christopher Solomon for the 6522 data sheets - most handy - cheers chap!
Stuart McConnachie for 6502 2nd processor info.
Everyone who has sent me encouragement - you know who you are.

Good luck to all the other BBC emulator authors who have been in touch -
persevere, you will get it up and running - especially that bastard keyboard!


PROBLEM SOLVING :
~~~~~~~~~~~~~~~~~

P: I run the emulator, the BBC Computer text appears and it freezes
A: Bad ROMS

P: The emulator runs too fast
A: Use the -exact command line option

P: I feel I must send you some money/CD's, because you spent months developing
   this software, for my enjoyment
A: Sure go right ahead!
