$Id: SnapshotFormat,v 1.5 2000/08/16 18:07:15 james Exp $

BBC Micro Emulator Snapshot Format
==================================

[ Mon Feb 12 22:07:43 GMT 1996 ]

Here's my current proposal for a BBC emulator snapshot format.  I already
have several of these working.  However, this is, as far as I can tell,
missing some required features.  I intend to change the format radically
in the very near future to allow for greater portability.  Be warned
if you are relying on anything listed here!


All snapshot files have the extension ".sst".  Currently the files are
33044 bytes long, ordered as follows :


 1. Magic number, bytes 0x0000 to 0x0001

    Stored lo/hi.  Value always 0x0bbc.


 2. Version number, bytes 0x0002 to 0x0003

    Stored lo/hi.  Value currently 0x0001


 3. User RAM, bytes 0x0004 to 0x8003.

    Stored in address order.  No provision is currently made for RAM
    stored in paged areas.  I think this should be addressed in a later
    version of the specification.


 4. CPU state, bytes 0x8004 to 0x8013.

    0x00  A
    0x01  X
    0x02  Y
    0x03  SR
    0x04  SP
    0x05  PC (lo)
    0x06  PC (hi)
    0x07  No. of outstanding IRQ's.

    0x08 to 0x0f are reserved for future use.  I always like to have a
    little slack to take up for when I find out I've forgotten something.
    It's less work to take up a spare byte than to move everything about.


 5. ADC state, bytes 0x8014 to 0x801b.

    0x00  register 0

    0x01 to 0x07 reserved.  These will need to be used, but until there's
                 a meaningful ADC emulation, they're unused.


 6. ACIA state, bytes 0x801c to 0x8023.

    0x00  Write control register
    0x01  Transmit Data register
    0x02  Status register
    0x03  Read Data register.
    0x04  Transmit IRQ outstanding.
    0x05  Receive IRQ outstanding.

    0x06,0x07 reserved for expansion.


 7. Keyboard state, bytes 0x8024 to 0x8083.

    0x00 to 0x4f  current status of all keys, in internal key number order
                  0x01 == pressed, 0x00 == released.

    0x50 to 0x57  reserved for expansion

    0x58          CAPS LOCK led status ( 0x00 == off, other == on )
    0x59          SHIFT LOCK led status ( 0x00 == off, other == on )

    0x5a to 0x5f  reserved for expansion


 8. ROM select register state, bytes 0x8084 to 0x808b.

    0x00  ROM select register (&FE30)

    0x01 to 0x07 reserved.


 9. Serial ULA state, bytes 0x808c to 0x8093.

    0x00  register 0

    0x01 to 0x07 reserved.


10. System VIA, bytes 0x8094 to 0x80b3.

    0x00  ORB/IRB
    0x01  ORA/IRA
    0x02  DDRB
    0x03  DDRA
    0x04  T1CL
    0x05  T1CH
    0x06  T1LL
    0x07  T1LH
    0x08  T2CL
    0x09  T2CH
    0x0a  SR
    0x0b  ACR
    0x0c  PCR
    0x0d  IFR
    0x0e  IER
    0x0f  ORA/IRA (non-handshaking, a duplicate of 0x01)
    0x10  T2LL
    0x11  Reserved
    0x12  Reserved
    0x13  Reserved
    0x14  Reserved
    0x15  Reserved
    0x16  Reserved
    0x17  Reserved
    0x18  T2 interrupts enabled flag (non-zero for enabled)
    0x19  Value of latch containing settings for current screen length
    0x1a  Current Port A pin levels
    0x1b  Current Port B pin levels
    0x1c  Reserved
    0x1d  Reserved
    0x1e  Reserved
    0x1f  Reserved


11. User VIA, bytes 0x80b4 to 0x80d3.

    As for System VIA, but location 0x19 is unused.


12. Video ULA, bytes 0x80d4 to 0x80f3.

    0x00 to 0x0f  Current colour map.
    0x10          Register 0
    0x11 to 0x1f  reserved.


13. CRTC, bytes 0x80f4 to 0x8113.

    0x00 to 0x11  Registers 0 through 17, in order
    0x12 to 0x13  reserved
    0x14          currently accessible register
    0x15 to 0x1f  reserved.


This specification doesn't deal with contents of sideways RAM/ROM,
the Fred/Jim memory-mapped IO areas, the Tube ULA, the Econet interface
or the disk interface.  I see these as being more appropriate for a later
version when code has been produced and we know what needs to be saved.

Comments please, mailed to bbc-micro@cloud9.co.uk so that everyone
can see them.

James.


Revision History
================

$Log: SnapshotFormat,v $
Revision 1.5  2000/08/16 18:07:15  james
Updates for CloudNine domain

Revision 1.4  1996/10/13 17:17:17  james
Updates for move to NETCOM.

Revision 1.3  1996/10/10 22:34:51  james
Updates for v0.3.

Revision 1.2  1996/09/23 19:35:18  james
Updates to snapshot format as a result of development on Xbeeb v0.2.

