BBC Model B Emulator Version 0.99c. 13/5/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. Not used anymore.

This program is the 13th (lucky you!) alpha release of an attempt to emulate
the total hardware of a BBC Model B by Acorn Computers.


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 FREEWARE as long as the archive is distributed un-altered,
with only the above six(7) 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/RAM 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 (Stuffing 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, or the -sb option). It has been reported to me that the emulator will
run at 100% with sound on a 486-66.

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. White/periodic 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.

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.
-eachscanline
  Slower than -scanlines but *perfectly* accurate, use only with REVS and
  ELITE!! N.B. there are no bounds checking with this option, so it can
  overflow and cause a protection fault with other programs.
-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 (VGA) 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 640x272 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.


To do
~~~~~
Add a SNAPSHOT function. I am working on this - details will appear on the
mailing list soon
GUI [under progress]
1770 and 8271 (information on them please!)
Reproduce WHITE/PERIODIC noise more faithfully - I don't know what it is!
Add the joystick support (Although PC analogue joysticks are just as crap as
the Beeb ones!).
Finish my DFS support


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

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


GAME INCOMPATIBILITY LIST :
~~~~~~~~~~~~~~~~~~~~~~~~~~~

NONE - As far as I am aware, all games work.


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.
Information on the 1770 and 8271 disk controller chips.
An oscilloscope!?! [really]


THANKS TO (no particular order):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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. All I need now is a real one
to play with!! [Anyone??]
Everyone who has sent me encouragement (and cash) - you know who you are,
many thanks.

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 then 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/RAM!, because you spent months
   developing this software, for my enjoyment
A: Sure go right ahead!
