This document assumes some familiarty with the Sega Mark III, Sega Master System (SMS) and Sega Game Gear (GG) game consoles. See the Technical Documents section of S8-Dev for information about these systems.
Binary (Base 2) numbers are represented using the WLA-DX format of the "%"
symbol follwed by a string of binary digits (0 and 1). An example of a valid
binary number representation is: %11100110.
The Sega Mark III Architecture (SM3A) is based on
the Zilog Z80 microprocessor. This microprocessor is a
little-endian machine, meaning that bytes
of a word are numbered starting from the least-significant byte. As a
result, the SM3A and AGAMA extensions are also
little-endian. The least-significant byte in a word will always be stored to
memory first, at the lower address, followed by the most-significant byte at
the higher address.
Diagrams of data structures in memory will have lower memory addresses
towards the bottom of the page, with higher addresses growing towards the top
of the page.
where:
For example:
In this example, LOOP1 is a label, LD is the mnemonic identifier for the
opcode, HL is the destination operand, and STARTVALUE is the source operand.
Note, though, that this specification deviates slightly from Z80 assembly
language with regard to the accumulator (the "A" register). In Z80 assembly
language, certain arithmetic instructions use an implied accumulator operand;
the accumulator is not explicitly specified in the instruction. For example,
the instruction:
Version 0.03.01: (April 2, 2004) Updated to include new Power-On Configuration
bit for SMS1-type bus in the device POCRs. This new POC bit is implemented in
the version of the Kokin.dll included with MesaDX 0.03a
Version 0.03.00 (March 13, 2004): Initial version. Coincides with release of
MesaDX version 0.03
Super Majik Spiral Crew, Jon, and Richard Talbot-Watkins: Their documents
describing the technical details of the Sega Master System and Sega Game Gear
are the foundations of the public's current understanding of these systems.
Andrew Lindsay: Designer of the MK1. His help with the SMS memory system
and ROM storage was invaluable. With this information I was able to design and
build the SMSARCH, a SMS cartridge backup unit.
James McKay: Provided me with my first glimpse of the SMS memory
architecture. Also, for providing miscellaneous information in a (publically
released) e-mail converstation with "Neon Spiral Injector."
Bock (or Zoop or Omar Cornut): Bock has been a strong presence in the
SMS/GG emulation community. His contributions have on many occasions inspired
my own efforts. Additionally, his founding and continuous support of S8-Dev has
been a great service to all of us still interested in software development for
Sega 8-bit systems.
Maxim: Maxim has made numerous contributions to the world of Sega 8-bit
emulation including utilities, demo programs, and technical documents. Maxim
is an active member of the S8-Dev forum and can always be depended on to step
up and answer the difficult technical questions. Maxim also wrote an
outstanding document covering the TI SN76489 sound chip.
Charles MacDonald: Charles' unending work documenting the minutae of the
various Video Display Processors used in various SM3A implementations has been
invaluable during the development of MesaDX. Charles has also written many
test programs and has on several occasions been kind enough to test demo
programs on a real SMS.
Martin Konrad: Martin Konrad is the brains behind the SDSC Debug Console.
He is also the author of an outstanding SMS debugging emulator, eSMS. eSMS is
the first emulator to include an SDSC Debug Console. Hopefully, MesaDX will
be the second.
Heliophobe: Heliophobe has made many technical contributions to Sega
8-bit emulation including demos and a SMS emulator for the Dreamcast: SMEG.
Heliophobe has also provided feedback and suggestions for improving MesaDX,
many of which have been implemented in MesaDX version 0.03.
S8-Dev: All the members of S8-Dev deserve to be thanked, not only for
their continuous interest in Sega 8-bit development, but also for perhaps being
the only people in the world who might be interested in using an emulator
like MesaDX
Quinntesson (Jeff Quinn, my brother, author of the Genesis/SegaCD/32X
emulator AGES): His understanding and interest in the more technical aspects
of emulation have greatly increased my own understanding of emulation. Our long
conversations about all things emulation-related have proved to be invaluable
during the (long) development of MesaDX.
Although 256 registers are available in each device, only 240 of them can be used for
device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also,
because this is a compulsory event, it cannot be silenced. Any attempt to set
the silent flags in the EHFR for this event will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also,
because this is a compulsory event, it cannot be silenced. Any attempt to
set the silent flags in the EHFR for this event will
trigger a KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
If the KOKINPROC_EVENT_BP_INCORRECT_RESPONSE_SIZE event ever triggers on a byte transaction
(port in, port out, memory read byte, memory write byte), or an AGAMA Extension
Register (AXR) access transaction (read AXR, write AXR) then there is an
implementation error in whatever devices are responding. The event should
never trigger on any of these types of transactions when KokinPROC is used with
other devices provided in the Kokin DLL. (These devices have been extensively
tested, ensuring that all the responses are valid for the given request type.)
The only time this event should ever trigger (when used with Kokin DLL devices)
is if a memory access crosses a device address boundary, and one device has
been disabled.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
This is a breakpoint event, so if no handling method is specified for this
event then the event is ignored and will not trigger. Also, because this is a
breakpoint event, the appropriate silent flag (depending on the current
operating mode) will automatically be set when the event triggers (this will be
reflected in the DEDR). The silent flag will be cleared
automatically when the current instruction retires.
Although 256 registers are available in each device, only 240 of them can be used
for device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT event.
Although 256 registers are available in each device, only 240 of them can be used
for device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
If a memory access to a protected region is attempted then a
KOKINSRAM_EVENT_PT_MEMORY_FETCH,
KOKINSRAM_EVENT_PT_MEMORY_WRITE, or
KOKINSRAM_EVENT_PT_MEMORY_READ,
protection event may trigger (depending on
the type of access and whether or not the event has been silenced).
The KokinSRAM device will respond differently to the access request depending on
whether an event triggers or not. If an event triggers (the event
was not silenced) the KokinSRAM device will respond indicating that an
internal event must be handled (protection events are always handled since they always
have at least one handling flag set in the EHFR: the SHUTDOWN flag). If an
event does not trigger (because its silent flag is set), the KokinSRAM device
will ignore the memory request and not respond at all, just as if the device
was disabled. In either case, the memory transfer is dropped: no data,
either to or from memory, will be transferred.
(Please see the Events and Event Handling
section in the AGAMA Specification for more information about protection
events.)
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
The KokinCARD device can be installed as a CARD or EXT0 device.
See Chapter 3: AGAMA Devices for
more information about specific device types.
Although 256 registers are available in each device, only 240 of them can be
used for device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
If a memory access to a protected region is attempted then a
KOKINCARD_EVENT_PT_MEMORY_FETCH,
KOKINCARD_EVENT_PT_MEMORY_WRITE, or
KOKINCARD_EVENT_PT_MEMORY_READ,
protection event may trigger (depending on
the type of access and whether or not the event has been silenced).
The KokinCARD device will respond differently to the access request depending on
whether an event triggers or not. If an event triggers (the event
was not silenced) the KokinCARD device will respond indicating that an
internal event must be handled (protection events are always handled since they
always have at least one handling flag set in the EHFR: the SHUTDOWN flag). If
an event does not trigger (because its silent flag is set), the KokinCARD device
will ignore the memory request and not respond at all, just as if the device
was disabled. In either case, the memory transfer is dropped: no data,
either to or from memory, will be transferred.
(Please see the Events and Event Handling
section in the AGAMA Specification for more information about protection
events.)
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
The KokinCART_A235 device can be installed as a BROM or EXT0 device.
See Chapter 3: AGAMA Devices for
more information about specific device types.
Although 256 registers are available in each device, only 240 of them can be
used for device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
If a memory access to a protected region is attempted then a
KOKINA235_EVENT_PT_MEMORY_FETCH,
KOKINA235_EVENT_PT_MEMORY_WRITE, or
KOKINA235_EVENT_PT_MEMORY_READ,
protection event may trigger (depending on
the type of access and whether or not the event has been silenced).
The KokinCART_A235 device will respond differently to the access request depending on
whether an event triggers or not. If an event triggers (the event
was not silenced) the KokinCART_A235 device will respond indicating that an
internal event must be handled (protection events are always handled since they always
have at least one handling flag set in the EHFR: the SHUTDOWN flag). If an
event does not trigger (because its silent flag is set), the KokinCART_A235 device
will ignore the memory request and not respond at all, just as if the device
was disabled. In either case, the memory transfer is dropped: no data,
either to or from memory, will be transferred.
(Please see the Events and Event Handling
section in the AGAMA Specification for more information about protection
events.)
This register is accessible via
writes to memory address $FFFC, but it cannot be read from this address. Reads
from memory address $FFFC return SRAM data. Since SRAM mirrors data at $DFFC to
$FFFC, a read from $FFFC cannot be guaranteed to be the last value written to
the BRCR. An intervening write to $DFFC will corrupt $FFFC so that it no longer
represents the data in BRCR.
This register is accessible via
writes to memory address $FFFD, but it cannot be read from this address. Reads
from memory address $FFFD return SRAM data. Since SRAM mirrors data at $DFFD to
$FFFD, a read from $FFFD cannot be guaranteed to be the last value written to
the PF0R. An intervening write to $DFFD will corrupt $FFFD so that it no longer
represents the data in PF0R.
This register is accessible via
writes to memory address $FFFE, but it cannot be read from this address. Reads
from memory address $FFFE return SRAM data. Since SRAM mirrors data at $DFFE to
$FFFE, a read from $FFFE cannot be guaranteed to be the last value written to
the PF1R. An intervening write to $DFFE will corrupt $FFFE so that it no longer
represents the data in PF1R.
This register is accessible via
writes to memory address $FFFF, but it cannot be read from this address. Reads
from memory address $FFFF return SRAM data. Since SRAM mirrors data at $DFFF to
$FFFF, a read from $FFFF cannot be guaranteed to be the last value written to
the PF2R. An intervening write to $DFFF will corrupt $FFFF so that it no longer
represents the data in PF2R.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This is a compulsory event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Any attempt to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
compulsory event, it cannot be silenced. Any attempt to set the silent flags
in the EHFR for this event will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event.
This event, along with the
Page Frame Configuration Register (PFCR) is intended to
allow Monitor Mode code to intercept all paging operations before they take
place. For example, the Monitor could intercept the paging operation,
replacing the intended page with a different page altogether. The Monitor can
also simply log the paging operation (for profiling purposes) and then allow
the normal paging operation to complete. The values in the
Device Event Address Register (DEAR)
and Device Event Data Register (DEDR) contain the
page frame register address and desired page number, respectively.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also, because this is a
protection event, it can be silenced but it will not be silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also,
because this is a protection event, it can be silenced but it will not be
silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also,
because this is a protection event, it can be silenced but it will not be
silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This is a protection event, so if no handling method is specified for this
event then SHUTDOWN will occur automatically. The SHUTDOWN bit in the
EHFR for this event is always set as a reminder of this
functionality. Attempting to reset the SHUTDOWN flag in the
EHFR will trigger a
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT event. Also,
because this is a protection event, it can be silenced but it will not be
silenced by default.
If the user wishes to silence a protection event, the silent flags must be set
manually or via Monitor software (the Monitor Mode handling flag must be set in
the EHFR for this event in order to enter Monitor Mode).
However, the silent flags will be RESET automatically when the current
instruction retires. Note that simply silencing a protection event will not
allow the desired access to proceed. Silencing just prevents the event from
triggering again during the current instruction. To allow the access to
proceed, the protection on that type of access must be removed.
This event is a breakpoint event, so providing no handling method (or silencing
the event) will allow the BRCR access to proceed. However, with no BRAM
preset, the write to BRCR has no effect. Page Frame 2 will still
contain the ROM page indicated by
Page Frame 2 Register (PF2R)
Currently, the MesaDX application always supplies 2 pages of BRAM to the
KokinCART_A235 device, so the BRAMPRESENT bit in the
Device Status Register (DSR) will always be set, and this
event can never trigger.
The KokinCART_A0CD device can be installed as a BROM or EXT0 device.
See Chapter 3: AGAMA Devices for
more information about specific device types.
This section will be filled out more in the future.
[To Be Completed]
The KokinCART_A0CD events are nearly identical to the
KokinCART_A235 Events. However, the KokinCART_A0CD device does not
support BRAM, so any references to events related to BRAM should be ignored.
This section will be filled out more in the future.
[To Be Completed]
The KokinCART_A0CD events are identical to the
KokinCART_A235 Power-On Self Test Codes.
This section will be filled out more in the future.
[To Be Completed]
Although 256 registers are available in each device, only 240 of them can be
used for device-specific functions. The first 16 AXRs are pre-defined and have
the same purpose in every AGAMA Device. At the minimum, each AGAMA device must
implement these 16 AXRs. They are described below.
The Device ID Register is one of the registers required by the
AGAMA Specification for all
AGAMA Devices. (Please see the
AGAMA Extension Register (AXR)
Files section in the AGAMA Specification for more information about
required AXRs.
The Power-On Configuration Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Model Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Version Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Status Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Handling Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Event Monitor Vector Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Code Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Address Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Data Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
The Device Event Flags Register is one of the registers required by the
AGAMA Specification for all
AGAMA Extension Register (AXR) Files
section in the AGAMA Specification for more information about required
AXRs.
I.1 About this Document
[To Be Completed]
I.2 Document Conventions
This document uses a specific notation for hexadecimal and binary numbers,
symbolic representation of instructions, and data-structure formats.
Familiarity with this notation is essential for effective use of the Kokin
Library and MesaDX.
I.2.1 Hexadecimal and Binary Numbers
Hexadecimal (Base 16) numbers are represented using the
WLA-DX format of the "$" symbol followed by a
string of hexadecimal digits (1-9 and A-F). The hexadecimal digits 'A' through
'F' will always be upper-case. An example of a valid hexadecimal number
representation is: $C0FF.
I.2.2 Bit and Byte Order
Bits are numbered starting from right to left, (i.e., least-significant to
most-significant.) All bytes consist of eight bits: 0 through 7.I.2.3 Reserved Bits
In certain register layout descriptions, various bits will be marked as
Reserved. These bits are reserved for future expansion of the
AGAMA specification, and all reserved bits are implicitly RESET (0). Software
should never attempt to SET these bits (to 1). Generally, if the modification
of a read-only or reserved bit is attempted an error will occur and the
entire write to the register will be discarded. Access to registers with
reserved bits should follow the guidelines below:
I.2.4 Instruction Operands
The main processor used in the
Sega Mark III Architecture (SM3A) is the Zilog Z80
microprocessor. Therefore, the symbolic representation of instructions is
taken directly from Z80 assembly language. The format is shown below:
When two operands are present, the right operand is the source and the left
is the destination.LOOP1: LD HL, STARTVALUE
AND B implies the accumulator is both a source
and a destination. In contrast, the assembly language used in this
specification always specifies the accumulator. The same instruction
is written as: AND A, B in this specification. The object codes
for these instructions are identical, just the instruction notation differs.
I.3 Revision History
Version 0.04.00: (September 23, 2006) Updated to correspond to MesaDX 0.04
release. Added KokinCART_A0CD (mapper) and KokinA246 (VDP) devices.
Updated AXR, Event and POST Code lists for all devices.
I.4 Acknowledgements
The Kokin Library and MesaDX could not have existed without the help of numerous people.
[To Be Completed]
Chapter1: Kokin Library Overview
Chapter2: Processor (PROC) Devices
2.1 KokinPROC Overview
2.2 KokinPROC AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
2.2.1 KokinPROC AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinPROC device.
The Device ID is assigned on Power-On and is used to address the KokinPROC
during certain types of bus transactions, such as AXR reads and writes.
Table 2.2.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
2.2.2 KokinPROC AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinPROC device. The KokinPROC device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinPROC device.
Table 2.2.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinPROC device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinPROC POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinPROC device powered-on in
Monitor Mode. Otherwise,
the KokinPROC device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinPROC device powered-on
suspended. If not set, the KokinPROC
device powered-on resumed and
immediately began fetching and executing instructions.
The KokinPROC device ignores this bit since its operation is
independent of the SMS or GG operating modes.
The KokinPROC device ignores this bit since its operation is
independent of the region setting of the machine.
The KokinPROC device uses this bit to determine how many instructions
to execute during a single scanline. (MesaDX currently uses a single
scanline as the smallest unit of emulation time.)
The KokinPROC device uses this bit to correctly emulate the
operation of a SMS1 Bus. A SMS1 Bus retains the previously
driven data value. In contrast SMS2/GG busses return $FF if no
data value is driven on the bus.
The KokinPROC device ignores this bit.
The KokinPROC device ignores these bits since its operation is
independent of the initial boot device.
These bits are reserved for future expansion.
2.2.3 KokinPROC AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinPROC device's model number: A080.
The 'A' indicates that the KokinPROC is an
AGAMA Device, and the '080' indicates
compatiblity with the Zilog Z80 microprocessor.
Table 2.2.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinPROC device's model number. The current model number for
this device is A080.
2.2.4 KokinPROC AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinPROC device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 2.2.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
2.2.5 KokinPROC AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinPROC device's current state.
Table 2.2.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Global Compatible Silent Set
Global Monitor Silent Set Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Halted Reserved
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinPROC device's
EHFR registers. If this bit is set and the KokinPROC device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinPROC device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
A COMPATBILESILENT flag is set in one of any of the system
device's EHFR registers. If this bit is set and the KokinPROC device is
in Compatible Mode then it
must issue a CLEARSILENTFLAGS message when the current
instruction retires. This ensures that specific breakpoint will only
trigger once per instruction.
A MONITORSILENT flag is set in one of any of the system
device's EHFR registers. If this bit is set and the KokinPROC device is
in Monitor Mode then it
must issue a CLEARSILENTFLAGS message when the current
instruction retires. This ensures that specific breakpoint will only
trigger once per instruction.
The KokinPROC device is enabled. This bit is always set in this
version of the KokinPROC implementation.
The KokinPROC device has entered
Shutdown. The KokinPROC device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions, and will not fetch or execute instructions.
A Power-On (Hard-Reset) is required to bring the KokinPROC device and
the rest of the system out of shutdown.
The KokinPROC device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinPROC device has suspended.
The device will still respond to bus traffic, but will not perform any
"active" processing such as fetching and executing instructions.
This bit is set if the KokinPROC device just executed a HALT
instruction. This bit is required to correctly emulated the behavior
of interrupts during a HALT instruction.
These bits are reserved for future expansion.
2.2.6 KokinPROC AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinPROC device can be found in Appendix
C: Event Code Summary.
Table 2.2.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
2.2.7 KokinPROC AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 2.2.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinPROC device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinPROC device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinPROC device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinPROC device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinPROC device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
2.2.8 KokinPROC AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinPROC
device's Monitor Mode handler. When a device event triggers and the Monitor
Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 2.2.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinPROC device's Monitor Mode handler.
2.2.9 KokinPROC AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 2.2.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
2.2.10 KokinPROC AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 2.2.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
2.2.11 KokinPROC AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 2.2.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
2.2.12 KokinPROC AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 2.2.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinPROC device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinPROC device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
2.2.13 KokinPROC AXR[$10]: Device State Update Register (DSUR)
This register is not implemented in this version of KokinPROC.
2.2.14 KokinPROC AXR[$11]: Interrupt Status Register (ISR)
This register contains information about pending INTs and NMIs, and whether
interrupts are enabled.
Table 2.2.14.a: Bit Fields of the CPU's Interrupt Status Register (ISR)
ISR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 INT Acknowledge Pending INT Pending
INT Accept INT Enable NMI Acknowledge Pending NMI Pending
NMI Accept NMI Enable
Access:
READ-ONLY
Bit Fields:
This bit is used by the processor to determine if an INT is pending.
During normal execution, this bit is equal to INT Pending. However,
during an NMI this bit is RESET, thus preventing the
processor from acknowledging the INT. Upon RETN from an NMI
handler INT Pending is copied into this bit. If an
INT was pending, the processor will now acknowledge it.
Indicates that an INT is pending.
When set, this bit indicates that INT's can be accepted. It is always
equal to INT Enable, except during execution of NMI.
This bit corresponds to IFF1 in a real Z80 processor.
Enables INTs. This bit is set with EI and cleared with DI.
It corresponds to IFF2 in a real Z80 processor.
This bit only has meaning in Monitor Mode. The
current version of MesaDX does not implement Monitor Mode.
This bit only has meaning in Monitor Mode. The current version of
MesaDX does not implement Monitor Mode.
This bit only has meaning in Monitor Mode. The current version of
MesaDX does not implement Monitor Mode.
This bit only has meaning in Monitor Mode. The current version of
MesaDX does not implement Monitor Mode.
These bits are reserved for future expansion.
2.2.15 KokinPROC AXR[$12]: Last Branch Source Register (LBSR)
This register contains the PC where the most-recently-executed branch (JP, JR,
CALL, RET) was executed.
Table 2.2.15.a: Bit Fields of the CPU's Last Branch Source Register
(LBSR)
LBSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 PC [15:8]
Byte 0 PC [7:0]
Access:
READ-ONLY
Bit Fields:
PC of the most-recently-executed branch instruction.
2.2.16 KokinPROC AXR[$13]: Last Branch Destination Register (LBDR)
Destination address of the most-recently-executed branch (JP, JR,
CALL, RET) instruction.
Table 2.2.16.a: Bit Fields of the CPU's Last Branch Destination Register
(LBDR)
LBDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 PC [15:8]
Byte 0 PC [7:0]
Access:
READ-ONLY
Bit Fields:
Destination address of the most-recently-executed branch instruction.
2.2.17 KokinPROC AXR[$14]: Monitor Event Program Counter Register (MEPCR)
This MEPCR is only used during Monitor Mode, which is not implemented in this version of
MesaDX. This register is Read-Only.
2.2.18 KokinPROC AXR[$15]: Monitor Event Stack Pointer Register (MESPR)
This MESPR is only used during Monitor Mode, which is not implemented in this version of
MesaDX. This register is Read-Only.
2.2.19 KokinPROC AXR[$20]: Register Read Breakpoint Register (RRBR)
This register is used to trigger REGISTER_READ events when the PROC's
general-purpose registers are read. REGISTER_READ events don't exist for
the PC or R registers since their values change with every instruction.
Table 2.2.19.a: Bit Fields of the CPU's Register Read Breakpoint Register
(RRBR)
RRBR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AFP HLP DEP BCP IY IX SP I
Byte 0 A F L H E D C B
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a REGISTER_READ event whenever the AF' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the HL' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the DE' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the BC' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the IY' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the IX' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the SP' register
is read.
Set this bit to trigger a REGISTER_READ event whenever the I register
is read.
Set this bit to trigger a REGISTER_READ event whenever the A register
is read.
Set this bit to trigger a REGISTER_READ event whenever the F register
is read.
Set this bit to trigger a REGISTER_READ event whenever the L register
is read.
Set this bit to trigger a REGISTER_READ event whenever the H register
is read.
Set this bit to trigger a REGISTER_READ event whenever the E register
is read.
Set this bit to trigger a REGISTER_READ event whenever the D register
is read.
Set this bit to trigger a REGISTER_READ event whenever the C register
is read.
Set this bit to trigger a REGISTER_READ event whenever the B register
is read.
2.2.20 KokinPROC AXR[$21]: Register Write Breakpoint Register (RWBR)
This register is used to trigger REGISTER_WRITE events when the PROC's
general-purpose registers are written to. REGISTER_WRITE events don't exist for
the PC or R registers since their values change with every instruction.
Table 2.2.20.a: Bit Fields of the CPU's Register Write Breakpoint
Register (RWBR)
RWBR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AFP HLP DEP BCP IY IX SP I
Byte 0 A F L H E D C B
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a REGISTER_WRITE event whenever the AF' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the HL' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the DE' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the BC' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the IY' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the IX' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the SP' register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the I register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the A register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the F register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the L register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the H register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the E register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the D register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the C register
is written.
Set this bit to trigger a REGISTER_WRITE event whenever the B register
is written.
2.2.21 KokinPROC AXR[$30]: Memory Attribute Address Register (MAAR)
The MAAR is used to index the memory attribute data (available in the
MADR). Memory attribute data is stored for every memory address.
The address in the MAAR indicates the address whose attribute data is
displayed in the MADR.
Table 2.2.21.a: Bit Fields of the CPU's Memory Attribute Address Register
(MAAR)
MAAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Address [15:8]
Byte 0 Address [7:0]
Access:
READ/WRITE
Bit Fields:
Memory address whose attributes should be displayed in the MADR.
2.2.22 KokinPROC AXR[$31]: Memory Attribute Data Register (MADR)
The attributes for the memory byte indicated in the MAAR. To set an
event to trigger for a specific address access, first place the desired memory
address in the MAAR. Next, set the bits representing the type of event
you want based on the bit positions in the table below.
Table 2.2.22.a: Bit Fields of the CPU's Memory Attribute Data Register
(MADR)
MADR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved Read Event
Write Event Fetch Event
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a MEMORY_READ event when the specified address
is read from.
Set this bit to trigger a MEMORY_WRITE event when the specified address
is written to.
Set this bit to trigger a MEMORY_FETCH event when an instruction is
fetched from the specified address. Note that if any byte of the
instruction (not just the first byte) occurs at this address, an
event will trigger.
These bits are reserved for future expansion.
2.2.23 KokinPROC AXR[$32]: Port Attribute Address Register (PAAR)
The PAAR is used to index the port attribute data (available in the
PADR). Port attribute data is stored for every I/O port.
The port number in the PAAR indicates the port whose attribute data is
displayed in the PADR.
Table 2.2.23.a: Bit Fields of the CPU's Port Attribute Address Register
(PAAR)
PAAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Port [7:0]
Access:
READ/WRITE
Bit Fields:
Number of the port whose attributes should be displayed in the PADR.
2.2.24 KokinPROC AXR[$33]: Port Attribute Data Register (PADR)
The attributes for the port indicated in the PAAR. To set an event to
trigger for the specific port access, first place the desired port address
in the PAAR. Next, set the bits representing the type of event you wnat
based on the bit positions in the table below.
Table 2.2.24.a: Bit Fields of the Port Attribute Data Register
(PADR)
PADR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved Port In Event
Port Out Event Reserved
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a PORT_IN event when the specified port is
read from.
Set this bit to trigger a PORT_OUT event when the specified port is
written to.
These bits are reserved for future expansion.
2.3 KokinPROC Events
2.3.1 Event[$04] KOKINPROC_EVENT_CP_WRITE_READONLY_AXR
This event triggers when a write to a read-only
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
$04 KOKINPROC_EVENT_CP_WRITE_READONLY_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0004
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.2 Event[$05] KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT
This event triggers when a write (that would change the state) of one or more
read-only bits in an
AGAMA Extension Register (AXR)
is attempted. Even though some bits in the AXR may be writable, none will be
updated at all if this event triggers (all write data is discarded). A
bit-mask of the read-only bits that would have been affected will be placed in
the DEDR.
$05
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0005
DEAR: Index of the destination AXR
DEDR: A bit-mask of the affected read-only bits
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.3 Event[$06] KOKINPROC_EVENT_CP_WRITE_RESERVED_AXR
This event triggers when a write to a reserved
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
$06
KOKINPROC_EVENT_CP_WRITE_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0006
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.4 Event[$07] KOKINPROC_EVENT_CP_READ_RESERVED_AXR
This event triggers when a read from a reserved
AGAMA Extension Register (AXR)
is attempted. Since the AXR is reserved noread data is returned. A value of 0
is placed in the DEDR.
$07
KOKINPROC_EVENT_CP_READ_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0007
DEAR: Index of the destination AXR
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.5 Event[$20] KOKINPROC_EVENT_CP_INVALID_INSTR
This event triggers when an invalid instruction (opcode) is encountered. An
invalid instruction is either one that is truly not part of the Z80 instruction
set (excluding the so-called "undocumented opcodes" which are mostly
implemented), or one that is not yet emulated (deliberately or by some
oversight on the part of the author). The Program Counter (PC) is not updated
if this event triggers. The PC will stay pointed to the invalid instruction.
See Appendix A for a complete list of the instructions
supported by the KokinPROC device.
$20
KOKINPROC_EVENT_CP_INVALID_INSTR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0020
DEAR: PC of the invalid instruction
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.6 Event[$80] KOKINPROC_EVENT_BP_INSTR_RETIRE
This event triggers when an instruction retires. This event is primarily used
to enable single-stepping through the instruction stream as this event can
trigger after every instruction completion. This is the only breakpoint-type
event in KokinPROC that cannot be silenced. Attempting to set the silence
flags in the EHFR for this event will trigger a
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BIT event.
$80
KOKINPROC_EVENT_BP_INSTR_RETIRE
Type BREAKPOINT
Default Action None
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0080
DEAR: PC of the retired instruction
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.7 Event[$81] KOKINPROC_EVENT_BP_UNDOCUMENTED_INSTR
This event triggers when an undocumented instruction is encountered. The event
will trigger before the instruction is executed, so the Program Counter
(PC) will still point to the undocumented instruction. This event can be used
to find instructions that are supported in the Z80 Instruction Set, but are not
officially documented in the Z80 specification. KokinPROC implements most of
the known undocumented instructions. See Appendix A
for a complete list of the instructions supported by the KokinPROC device,
including those that are considered to be 'undocumented' and can trigger this
event.
$81
KOKINPROC_EVENT_BP_UNDOCUMENTED_INSTR
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0081
DEAR: PC of the undocumented instruction
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.8 Event[$82] KOKINPROC_EVENT_BP_INCORRECT_RESPONSE_SIZE
This event triggers when a bus request made by the KokinPROC recieves the
incorrect response size. For example, if the KokinPROC issues a MEM_READ_WORD,
then it expects a response indicating two bytes are being returned. Though
this event can theoretically be triggered for any bus request type, it will
generally only trigger for multi-byte memory requests (read word, write word,
instruction fetch). The reason is that such memory accesses can cross an
address boundary where two different devices (e.g., cartridge ROM and System
RAM) should respond, but only one does (probably because the other has been
disabled). If no devices respond, then a separate group of events called
KOKINPROC_EVENT_BP_NORESPONSE_ON_* will trigger, depending on the original bus request type.
(These events are described below.)
$82
KOKINPROC_EVENT_BP_INCORRECT_RESPONSE_SIZE
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0082
DEAR: Address associated with the original request
DEDR: Data associated with the original request
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.9 Event[$90] KOKINPROC_EVENT_BP_HALT
This event triggers when a HALT instruction is encountered, but before the HALT
instruction executes. This event is one of several that can be used to set
breakpoints for specific types of instructions.
$90
KOKINPROC_EVENT_BP_HALT
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0090
DEAR: Current PC (pointing to HALT instruction)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.10 Event[$91] KOKINPROC_EVENT_BP_JP
This event triggers when a "Jump" instruction (conditional or unconditional) is
encountered. The event occurs before the instruction is executed, so the PC
still points to the jump, and not the jump destination. This event is one of
several that can be used to set breakpoints for specific types of instructions.
$91
KOKINPROC_EVENT_BP_JP
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0091
DEAR: Current PC (pointing to Jump instruction)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.11 Event[$92] KOKINPROC_EVENT_BP_CALL
This event triggers when a CALL instruction (conditional or unconditional) is
encountered. The event occurs before the instruction is executed, so the PC
still points to the CALL, and not the call destination. This event is one of
several that can be used to set breakpoints for specific types of instructions.
$92
KOKINPROC_EVENT_BP_CALL
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0092
DEAR: Current PC (pointing to CALL instruction)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.12 Event[$93] KOKINPROC_EVENT_BP_RET
This event triggers when a RET instruction (conditional or unconditional) is
encountered. The event occurs before the instruction is executed, so the PC
still points to the RET, and not the return destination. This event is one of
several that can be used to set breakpoints for specific types of instructions.
$93
KOKINPROC_EVENT_BP_RET
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0093
DEAR: Current PC (pointing to RET instruction)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.13 Event[$94] KOKINPROC_EVENT_BP_RST
This event triggers when a RST instruction is encountered. The event occurs
before the instruction is executed, so the PC still points to the RST, and not
the reset destination. This event is one of several that can be used to set
breakpoints for specific types of instructions.
$94
KOKINPROC_EVENT_BP_RST
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $0094
DEAR: Current PC (pointing to RST instruction)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.14 Event[$A1] KOKINPROC_EVENT_BP_NORESPONSE_ON_AXRWRITE
This event triggers when an AXR write is attempted, and there is no response
for the transaction. This event will not trigger in the event that the
target device's AXR was read-only or contained read-only bits. In that case,
the target device will signal an event (because the KOKINPROC_EVENT_CP_WRITE_READONLY_AXR,
KOKINPROC_EVENT_CP_WRITE_READONLY_AXR_BITS and KOKINPROC_EVENT_CP_WRITE_RESERVED_AXR events are compulsory in
all AGAMA devices). This signal will be included as part of the response to
KokinPROC, so this NORESPONSE event is not applicable. This event can be used
to set breakpoints for AXR writes that may not complete correctly due to the
target device being disabled.
$A1
KOKINPROC_EVENT_BP_NORESPONSE_ON_AXRWRITE
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00A1
DEAR: Bits[15:8]: Target Device ID,
Bits[7:0]: Index of the destination AXR
Current PC (pointing to RST instruction)
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.15 Event[$A2] KOKINPROC_EVENT_BP_NORESPONSE_ON_AXRREAD
This event triggers when an AXR read is attempted, but there is no response
for the transaction. This event will not trigger in the event that the
target device's AXR is a reserved AXR. In that case, the target device will
signal an event (because the KOKINPROC_EVENT_CP_READ_RESERVED_AXR event is compulsory in all
AGAMA devices). This signal will be included as part of the response to
KokinPROC, so this NORESPONSE event is not applicable. This event can be used
to set breakpoints for AXR reads that may not complete correctly due to the
target device being disabled.
$A2
KOKINPROC_EVENT_BP_NORESPONSE_ON_AXRREAD
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00A2
DEAR: Bits[15:8]: Target Device ID,
Bits[7:0]: Index of the destination AXR
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.16 Event[$A8] KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMFETCH
This event triggers when an instruction fetch is attempted, but there is no
response for the transaction. This event can be used to set breakpoints for
instruction fetches that may not complete correctly due to the device that
would normally resond to requests made in the addressed range being disabled.
$A8
KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMFETCH
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00A8
DEAR: Current PC (address of fetch)
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.17 Event[$A9] KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMWRITE
This event triggers when a memory write is attempted, but there is no response
for the transaction. This event can be used to set breakpoints for memory
writes that may not complete correctly due to the device that would normally
respond to requests made in the addressed range being disabled.
$A9
KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMWRITE
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00A9
DEAR: Target address
DEDR: Write data
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.18 Event[$AA] KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMREAD
This event triggers when a memory read is attempted, but there is no response
for the transaction. This event can be used to set breakpoints for memory
reads that may not complete correctly due to the device that would normally
respond to requests made in the addressed range being disabled.
$AA
KOKINPROC_EVENT_BP_NORESPONSE_ON_MEMREAD
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00AA
DEAR: Target address
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.19 Event[$AD] KOKINPROC_EVENT_BP_NORESPONSE_ON_PORTOUT
This event triggers when a port out write is attempted, but there is no
response for the transaction. This event can be used to set breakpoints for
I/O port writes that may not complete correctly due to the device that would
normally respond to requests made in the addressed range being disabled.
$AD
KOKINPROC_EVENT_BP_NORESPONSE_ON_PORTOUT
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00AD
DEAR: Target port
DEDR: Write out data
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.20 Event[$AE] KOKINPROC_EVENT_BP_NORESPONSE_ON_PORTIN
This event triggers when a port in read is attempted, but there is no response
for the transaction. This event can be used to set breakpoints for I/O port
reads that may not complete correctly due to the device that would normally
respond to requests made in the addressed range being disabled.
$AE
KOKINPROC_EVENT_BP_NORESPONSE_ON_PORTIN
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00AE
DEAR: Target port
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.21 Event[$B1] KOKINPROC_EVENT_BP_REGISTER_WRITE
This event triggers when a write to a general-purpose (Z80 architectural)
register is attempted, and that register's breakpoint bit in the Register Write
Breakpoint Register (RWBR) has been set. This event is used to implement
register write breakpoints by setting the SUSPEND bit in this event's Event
Handling Flags Register (EHFR), and when used in conjunction with the RWBR.
$B1
KOKINPROC_EVENT_BP_REGISTER_WRITE
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00B1
DEAR: Bit-mask of affected registers (as defined by RWBR)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.22 Event[$B2] KOKINPROC_EVENT_BP_REGISTER_READ
This event triggers when a read from a general-purpose (Z80 architectural)
register is attempted, and that register's breakpoint bit in the Register Read
Breakpoint Register (RRBR) has been set. This event is used to implement
register read breakpoints by setting the SUSPEND bit in this event's Event
Handling Flags Register (EHFR), and when used in conjunction with the RRBR.
$B2
KOKINPROC_EVENT_BP_REGISTER_READ
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00B2
DEAR: Bit-mask of affected registers (as defined by RRBR)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.23 Event[$B8] KOKINPROC_EVENT_BP_MEMORY_FETCH
This event triggers when an instruction fetch from memory is attempted and the
'Fetch Event' bit is set in the Memory Attribute Data Register (MADR) for any
of the accessed memory addresses. This means that with a multi-byte
instruction, the event can trigger on any of the bytes that make up the
instruction. For example, if the 4-byte instruction BIT 0, (IX) is located
at address $4000, then this event would trigger if the 'Fetch Event' bits were
set for any combination of the addresses from $4000 through $4003.
$B8
KOKINPROC_EVENT_BP_MEMORY_FETCH
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00B8
DEAR: Target address (fetch address, current PC)
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.24 Event[$B9] KOKINPROC_EVENT_BP_MEMORY_WRITE
This event triggers when a memory write is attempted and the 'Write Event' bit
is set in the Memory Attribute Data Register (MADR) for any of the accessed
memory addresses. This means that with a multi-byte write the event can
trigger on any of the addresses to be written to. For example, if a 2-byte
write was attempted to $D000, then the event will trigger if the WRITE_EVENT
bits were set for any combination of the addresses $D000 or D0001. The lowest
(first) address with its 'Write Event' bit set will appear in the DEAR.
$B9
KOKINPROC_EVENT_BP_MEMORY_WRITE
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00B9
DEAR: Lowest memory address with WRITE_EVENT set in MADR
DEDR: Write data
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.25 Event[$BA] KOKINPROC_EVENT_BP_MEMORY_READ
This event triggers when a memory read is attempted and the 'Read Event' bit is
set in the Memory Attribute Data Register (MADR) for any of the accessed memory
addresses. This means that with a multi-byte read the event can trigger on any
of the addresses to be read from. For example, if a 2-byte read was attempted
to $D000, then the event will trigger if the READ_EVENT bits were set for any
combination of the addresses $D000 or D0001. The lowest (first) address with
its 'Read Event' bit set will appear in the DEAR.
$BA
KOKINPROC_EVENT_BP_MEMORY_READ
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00BA
DEAR: Lowest memory address with READ_EVENT set in MADR
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.26 Event[$BD] KOKINPROC_EVENT_BP_PORT_OUT
This event triggers when a port OUT is attempted and the 'Port Out Event' bit
is set in the Port Attribute Data Register (PADR) for the accessed port.
$BD
KOKINPROC_EVENT_BP_PORT_OUT
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00BD
DEAR: Target Port
DEDR: Write data
DEFR: Current Event Handling Flags (EHFR) for this event
2.3.27 Event[$BE] KOKINPROC_EVENT_BP_PORT_IN
This event triggers when a port IN is attempted and the 'Port In Event' bit is
set in the Port Attribute Data Register (PADR) for the accessed port.
$BE
KOKINPROC_EVENT_BP_PORT_IN
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific?
Yes
Device Event
Register Updates
DECR: $00BE
DEAR: Target Port
DEDR: Undriven Bus Data ($FFFF)
DEFR: Current Event Handling Flags (EHFR) for this event
2.4 KokinPROC Power-On Self Test Codes
Message Code
Message Mnemonic
Description
$01
NO_HUB_FOUND
The KokinEXTD device requires access to a HUB
device for correct operation. During POST the HUB device
pointer was checked and found to be NULL (0). This POST code
should never occur when the Kokin DLL is used with a released
version of MesaDX. It is only likely to occur in the event
that the Kokin DLL is being used (incorrectly) by a third-party.
$03
REGISTER_ERROR
During POST the KokinPROC device checks that
reading and writing 8 and 16-bit values to and from the
general-purpose registers (e.g., AF, BC, DE, HL) works
correctly. This is necessary since the register implementation
depends on aspects of the C++ language that are
compiler-specific. This POST code should never occur in a
release version of the Kokin DLL. It is only likely to occur
in the event that the Kokin source code was recompiled by a
third-party using a different C++ compiler.
$04
FLAG_ERROR
During POST the KokinPROC device checks that
the symbolic definitions of certain flags in the flags register
(F) are defined correctly. Though symbolic definitions
are used throughout the source code when referring to the flags,
certain instructions require the flags to be in certain bit
positions to ease implementation or improve performance. If
the proper symbolic flag definitions are not preserved then
this POST code will be returned. This POST code should
never occur in a release version of the Kokin DLL. It is only
likely to occur in the event that the Kokin source code was
recompiled by a third-party and the flag definitions were
altered. This POST code is intended to be a final run-time
warning indicating that the changes made to the flag definitions
will affect correct operation.
$05
ISR_ERROR
During POST the KokinPROC device checks that
the symbolic definitions of certain bits in the Interrupt
Status Register (ISR) are defined correctly. Though symbolic
definitions are used throughout the source code when referring
to these bits, certain relationships amongst the bits must be
preserved to simplify the implementation of the ISR. If
the proper bit relationships are not preserved correctly then
this POST code will be returned. This POST code should
never occur in a release version of the Kokin DLL. It is only
likely to occur in the event that the Kokin source code was
recompiled by a third-party and the ISR bit definitions were
altered. This POST code is intended to be a final run-time
warning indicating that the changes made to the ISR definitions
will affect correct operation.
Chapter 3: Hub (HUB) Devices
3.1 KokinMIOH Overview
3.2 KokinMIOH AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
3.2.1 KokinMIOH AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinMIOH device.
The Device ID is assigned on Power-On and is used to address the KokinMIOH
during certain types of bus transactions, such as AXR reads and writes.
Table 3.2.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
3.2.2 KokinMIOH AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinMIOH device. The KokinMIOH device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinMIOH device.
Table 3.2.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinMIOH device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinMIOH POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinMIOH device powered-on in
Monitor Mode. Otherwise,
the KokinMIOH device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinMIOH device powered-on
suspended. If not set, the KokinMIOH
device powered-on resumed and
immediately began responding to all bus transactions.
The KokinMIOH device ignores this bit in the current release of the
Kokin Library.
If this bit is set, the KokinMIOH device powered-on as an
Export Region machine. Otherwise, the
KokinMIOH device powered-on as a
Japan Region machine. The KokinMIOH
device uses the setting of this bit to determine whether the TH
peripheral status bits should be inverted when they are read by
software. (The TR peripheral status bits are unaffected by the
region setting in the current KokinMIOH implementation.)
The KokinMIOH ignores this bit.
The KokinMIOH device uses this bit to correctly emulate the
operation of a SMS1 Bus. A SMS1 Bus retains the previously
driven data value. In contrast SMS2/GG busses return $FF if no
data value is driven on the bus.
The KokinMIOH device uses this bit to lock the specified boot device
into addressable memory space. Setting this bit will prevent the
specified boot device from being disabled and the other devices from
being enabled in its place (via writes to the
Device Disable Register (DDR)). Settings this
bit will prevent boot devices from accidentally mapping themselves out
of memory when memory address $C000 isn't properly initialized because
no Boot ROM (BIOS) was run. (The commercial SMS ROM 'Golvellius' will
do this.)
A 2-bit identifier indicating which memory device is initially
mapped into the processor address space. See Table 3.1.2.b in
section 3.1.2 [AXR01] Power-On
Configuration Register (POCR) of the AGAMA Specification for
the encodings of the Boot Device bits.
These bits are reserved for future expansion.
3.2.3 KokinMIOH AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinMIOH device's model number: A216.
The 'A' indicates that the KokinMIOH is an
AGAMA Device, and the '216' indicates
compatiblity with the I/O controller used in some versions of the Sega Master
System Model 1.
Table 3.2.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinMIOH device's model number. The current model number for
this device is A216.
3.2.4 KokinMIOH AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinMIOH device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 3.2.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
3.2.5 KokinMIOH AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinMIOH device's current state.
Table 3.2.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Reserved Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Reserved
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinMIOH device's
EHFR registers. If this bit is set and the KokinMIOH device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinMIOH device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
Normally, this bit means the device is enabled. However, for the
KokinMIOH device this bit takes on a slightly different meaning.
If this bit is set, the KokinMIOH will respond to I/O port accesses
in the range $C0 through $FF providing software with access to
peripheral status (e.g., controller button presses). If this bit
is disabled, the KokinMIOH will forward I/O requests in the $C0-$FF
region to the other hub devices allowing those devices to use
those I/O ports for various services. The FM Unit is an example of a
device requiring this functionality so that its I/O ports can be
accessed by software.
The KokinMIOH device has entered
Shutdown. The KokinMIOH device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions. A Power-On (Hard-Reset) is required to bring the
KokinMIOH device and the rest of the system out of shutdown.
The KokinMIOH device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinMIOH device has suspended.
The device will still respond to bus traffic. This bit does not have
much meaning for the KokinMIOH since it is a passive device and only
responds to other devices' bus transactions.
These bits are reserved for future expansion.
3.2.6 KokinMIOH AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinMIOH device can be found in Appendix
C: Event Code Summary.
Table 3.2.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
3.2.7 KokinMIOH AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 3.2.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinMIOH device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinMIOH device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinMIOH device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinMIOH device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinMIOH device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
3.2.8 KokinMIOH AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinMIOH
device's Monitor Mode handler. When a device event triggers and the Monitor
Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 3.2.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinMIOH device's Monitor Mode handler.
3.2.9 KokinMIOH AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 3.2.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
3.2.10 KokinMIOH AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 3.2.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
3.2.11 KokinMIOH AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 3.2.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
3.2.12 KokinMIOH AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 3.2.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinMIOH device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinMIOH device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
3.2.13 KokinMIOH AXR[$10]: Device State Update Register (DSUR)
This register is not implemented in this version of KokinMIOH.
3.2.14 KokinMIOH AXR[$12]: Last Message Information Register (LMIR)
The Last Message Information Register contains information about the most
recent message broadcast to all system devices by the KokinMIOH.
Table 3.2.14.a: Bit Fields of the KokinMIOH's Last Message Information
Register (LMIR)
MCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Device ID
Byte 0 Message Code
Access:
READ-ONLY
Bit Fields:
The ID of the device responsible for the last system message.
The messages code number. See
Appendix D: System Message Code Summary for a
list of all message codes.
3.2.15 KokinMIOH AXR[$13]: Last Message Data Register (LMDR)
The Last Message Data Register contains specific to the most recent message
broadcast to all system devices by the KokinMIOH.
Table 3.2.15.a: Bit Fields of the KokinMIOH's Last Message Data
Register (LMDR)
MCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Data[15:8]
Byte 0 Data[7:0]
Access:
READ-ONLY
Bit Fields:
Data specific to the last system message.
3.2.16 KokinMIOH AXR[$14]: Monitor Event Code Register (MECR)
This register is not implemented in this version of KokinMIOH.
3.2.17 KokinMIOH AXR[$15]: Monitor Event Address Register (MEAR)
This register is not implemented in this version of KokinMIOH.
3.2.18 KokinMIOH AXR[$16]: Monitor Event Data Register (MEDR)
This register is not implemented in this version of KokinMIOH.
3.2.19 KokinMIOH AXR[$17]: Monitor Event Flags Register (MEFR)
This register is not implemented in this version of KokinMIOH.
3.2.20 KokinMIOH AXR[$20]: Installed Devices Register (IDR)
The Installed Devices Register contains a bit mask indicating which device
IDs are associated with installed devices.
Table 3.2.20.a: Bit Fields of the KokinMIOH's Installed Devices Register
(IDR)
IDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 ID $0F ID $0E ID $0D ID $0C ID $0B ID $0A ID $09 ID $08
Byte 0 ID $07 ID $06 ID $05 ID $04 ID $03 ID $02 ID $01 ID $00
Access:
READ-ONLY
Bit Fields:
This bit is set if a device using ID $0F is installed.
This bit is set if a device using ID $0E is installed.
This bit is set if a device using ID $0D is installed.
This bit is set if a device using ID $0C is installed.
This bit is set if a device using ID $0B is installed.
This bit is set if a device using ID $0A is installed.
This bit is set if a device using ID $09 is installed.
This bit is set if a device using ID $08 is installed.
This bit is set if a device using ID $07 is installed.
This bit is set if a device using ID $06 is installed.
This bit is set if a device using ID $05 is installed.
This bit is set if a device using ID $04 is installed.
This bit is set if a device using ID $03 is installed.
This bit is set if a device using ID $02 is installed.
This bit is set if a device using ID $01 is installed.
This bit is set if a device using ID $00 is installed.
3.2.21 KokinMIOH AXR[$21]: Device Disable Register (DDR)
This register specifies which devices in the system should be disabled. The
low-order byte contains the last data written to I/O port $3E.
Table 3.2.21.a: Bit Fields of the KokinMIOH's Device Disable Register
(IDR)
IDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved FMU PSG VDP
Byte 0 EXT1 EXT0 CARD SRAM BROM HUB
Reserved
Access:
READ-ONLY
Bit Fields:
Set this bit to disable the FMU device. This bit is read is READ-ONLY
in this version of the KokinMIOH
Set this bit to disable the PSG device. This bit is read is always
forced to be RESET in this version of the KokinMIOH
Set this bit to disable the VDP device. This bit is read is always
forced to be RESET in this version of the KokinMIOH
Set this bit to disable the EXT1 device.
Set this bit to disable the EXT0 device.
Set this bit to disable the CARD device.
Set this bit to disable the SRAM device.
Set this bit to disable the BROM device.
Set this bit to prevent the HUB device from intercepting I/O accesses
in the $C0-$FF region (the peripheral port I/O ports).
These bits are reserved for future expansion
3.2.22 KokinMIOH AXR[$22]: Peripheral Configurationion Register (PCR)
The Peripheral Configuration Register contains the last data byte written to
port $3F. This register is only partially implemented in this version of MesaDX
and is Read-Only.
Table 3.2.22.a: Bit Fields of the MIOH's Peripheral Configuration Register
(PCR)
PCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Port $3F Data
Access:
READ-ONLY
Bit Fields:
Most recent data byte written to port $3F.
These bits are reserved for future expansion.
3.2.23 KokinMIOH AXR[$23]: Hub Configuration Register (HCR)
The Hub Configuration Register contains information about configuring the
Hub services.
Table 3.2.23.a: Bit Fields of the KokinMIOH's Hub Configuration Register
(HCR)
MCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved Enable Reset
Enable Pause Enable Peripheral Port 1 Peripheral Port 0
Access:
READ-ONLY
Bit Fields:
Set this bit to enable the system's Reset button
Set this bit to enable the system's Pause button
Set this bit to enable peripheral port 1. This bit is permanently
RESET and read-only in this version of the KokinMIOH.
Set this bit to enable peripheral port 0.
These bits are reserved for future expansion.
3.3 KokinMIOH Events
Table 3.3.a: KokinMIOH Events
Event Code Event Mnemonic
$00 - $03
AGAMA Reserved
$04
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR
$05
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT
$06
KOKINMIOH_EVENT_CP_WRITE_RESERVED_AXR
$07
KOKINMIOH_EVENT_CP_READ_READONLY_AXR
$08 - $0F
AGAMA Reserved
$10 - $FF
Reserved
3.3.1 Event[$04] KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR
This event triggers when a write to a read-only
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$04]
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0004
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
3.3.2 Event[$05] KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT
This event triggers when a write (that would change the state) of one or more
read-only bits in an
AGAMA Extension Register (AXR)
is attempted. Even though some bits in the AXR may be writable, none will be
updated at all if this event triggers (all write data is discarded). A
bit-mask of the read-only bits that would have been affected will be placed in
the DEDR.
Event[$05]
KOKINMIOH_EVENT_CP_WRITE_READONLY_AXR_BIT
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0005
DEAR: Index of the destination AXR
DEDR: A bit-mask of the affected read-only bits
DEFR: Current Event Handling Flags (EHFR) for this event
3.3.3 Event[$06] KOKINMIOH_EVENT_CP_WRITE_RESERVED_AXR
This event triggers when a write to a reserved
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$06]
KOKINMIOH_EVENT_CP_WRITE_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0006
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
3.3.4 Event[$07] KOKINMIOH_EVENT_CP_READ_RESERVED_AXR
This event triggers when a read from a reserved
AGAMA Extension Register (AXR)
is attempted. Since the AXR is reserved noread data is returned. A value of 0
is placed in the DEDR.
Event[$07]
KOKINMIOH_EVENT_CP_READ_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0007
DEAR: Index of the destination AXR
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
3.4 KokinMIOH Power-On Self Test Codes
Message Code
Message Mnemonic
Description
$02
NO_PROC_FOUND
The KokinMIOH device requires access to a PROC
device for correct operation. During POST the PROC device
pointer was checked and found to be NULL (0). This POST code
should never occur when the Kokin DLL is used with a released
version of MesaDX. It is only likely to occur in the event
that the Kokin DLL is being used (incorrectly) by a third-party.
$03
NO_BROM_FOUND
The KokinMIOH device requires access to a BROM
device for correct operation. In the event that the user does
not require a true BROM device to be installed, a 'dummy'
device must be installed in its place. During POST the
BROM device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$04
NO_SRAM_FOUND
The KokinMIOH device requires access to a SRAM
device for correct operation. In the event that the user does
not require a true SRAM device to be installed, a 'dummy'
device must be installed in its place. During POST the
SRAM device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$05
NO_CARD_FOUND
The KokinMIOH device requires access to a CARD
device for correct operation. In the event that the user does
not require a true CARD device to be installed, a 'dummy'
device must be installed in its place. During POST the
CARD device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$06
NO_EXT0_FOUND
The KokinMIOH device requires access to a EXT0
device for correct operation. In the event that the user does
not require a true EXT0 device to be installed, a 'dummy'
device must be installed in its place. During POST the
EXT0 device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$07
NO_EXT1_FOUND
The KokinMIOH device requires access to a EXT0
device for correct operation. In the event that the user does
not require a true EXT0 device to be installed, a 'dummy'
device must be installed in its place. During POST the
EXT1 device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$08
NO_VDP_FOUND
The KokinMIOH device requires access to a VDP
device for correct operation. In the event that the user does
not require a true VDP device to be installed, a 'dummy'
device must be installed in its place. During POST the
VDP device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$09
NO_PSG_FOUND
The KokinMIOH device requires access to a PSG
device for correct operation. In the event that the user does
not require a true PSG device to be installed, a 'dummy'
device must be installed in its place. During POST the
PSG device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$0A
NO_FMU_FOUND
The KokinMIOH device requires access to a FMU
device for correct operation. In the event that the user does
not require a true FMU device to be installed, a 'dummy'
device must be installed in its place. During POST the
FMU device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
$0F
NO_EXTD_FOUND
The KokinMIOH device requires access to a EXTD
device for correct operation. In the event that the user does
not require a true EXTD device to be installed, a 'dummy'
device must be installed in its place. During POST the
EXTD device pointer was checked and found to be NULL (0). This
POST code should never occur when the Kokin DLL is used with a
released version of MesaDX. It is only likely to occur in the
event that the Kokin DLL is being used (incorrectly) by a
third-party.
Chapter 4: System RAM (SRAM) Devices
4.1 KokinSRAM Overview
4.2 KokinSRAM AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
Table 4.2.a: KokinSRAM AGAMA Extension Registers
AGAMA Extension Register (AXR)
Register Name
AXR[$00]
Device ID Register (DIR)
AXR[$01]
Power-On Configuration Register (POCR)
AXR[$02]
Device Model Register (DMR)
AXR[$03]
Device Version Register (DVR)
AXR[$04]
Device Status Register (DSR)
AXR[$05]
AGAMA Reserved
AXR[$06]
AGAMA Reserved
AXR[$07]
AGAMA Reserved
AXR[$08]
Event Handling Code Register (EHCR)
AXR[$09]
Event Handling Flags Register (EHFR)
AXR[$0A]
Event Monitor Vector Register (EMVR)
AXR[$0B]
AGAMA Reserved
AXR[$0C]
Device Event Code Register (DECR)
AXR[$0D]
Device Event Address Register (DEAR)
AXR[$0E]
Device Event Data Register (DEDR)
AXR[$0F]
Device Event Flags Register (DEFR)
AXR[$10]
Device Event Flags Register (DSUR)
AXR[$11]-AXR[$2F]
Reserved
AXR[$30]
Memory Attribute Register (MAR)
AXR[$21]-AXR[$FF]
Reserved
4.2.1 KokinSRAM AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinSRAM device.
The Device ID is assigned on Power-On and is used to address the KokinSRAM
during certain types of bus transactions, such as AXR reads and writes.
Table 4.2.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
4.2.2 KokinSRAM AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinSRAM device. The KokinSRAM device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinSRAM device.
Table 4.2.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinSRAM device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinSRAM POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinSRAM device powered-on in
Monitor Mode. Otherwise,
the KokinSRAM device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinSRAM device powered-on
suspended. If not set, the KokinSRAM
device powered-on resumed and
immediately began responding to all bus transactions.
The KokinSRAM device ignores this bit since its operation is
independent of the SMS or GG operating modes.
The KokinSRAM device ignores this bit since its operation is
independent of the region setting of the machine.
The KokinSRAM device ignores this bit.
The KokinSRAM device ignores this bit.
The KokinSRAM device ignores this bit.
The KokinSRAM device ignores these bits since its operation is
independent of the initial boot device.
These bits are reserved for future expansion.
4.2.3 KokinSRAM AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinSRAM device's model number: A008.
The 'A' indicates that the KokinSRAM is an
AGAMA Device, and the '008' indicates
this device contains 8KBytes of RAM.
Table 4.2.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinSRAM device's model number. The current model number for
this device is A008.
4.2.4 KokinSRAM AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinSRAM device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 4.2.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
4.2.5 KokinSRAM AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinSRAM device's current state.
Table 4.2.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Reserved Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Reserved
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinSRAM device's
EHFR registers. If this bit is set and the KokinSRAM device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinSRAM device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
The KokinSRAM device is enabled. This bit is always set in this
version of the KokinSRAM implementation.
The KokinSRAM device has entered
Shutdown. The KokinSRAM device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions. A Power-On (Hard-Reset) is required to bring the
KokinMIOH device and the rest of the system out of shutdown.
The KokinSRAM device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinSRAM device has suspended.
The device will still respond to bus traffic. This bit does not have
much meaning for the KokinSRAM since it is a passive device and only
responds to bus transactions from the KokinMIOH device.
These bits are reserved for future expansion.
4.2.6 KokinSRAM AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinSRAM device can be found in Appendix
C: Event Code Summary.
Table 4.2.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
4.2.7 KokinSRAM AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 4.2.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinSRAM device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinSRAM device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinSRAM device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinSRAM device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinSRAM device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
4.2.8 KokinSRAM AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinSRAM
device's Monitor Mode handler. When a device event triggers and the Monitor
Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 4.2.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinSRAM device's Monitor Mode handler.
4.2.9 KokinSRAM AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 4.2.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
4.2.10 KokinSRAM AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 4.2.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
4.2.11 KokinSRAM AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 4.2.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
4.2.12 KokinSRAM AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 4.2.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinSRAM device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinSRAM device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
4.2.13 KokinSRAM AXR[$10]: KokinSRAM Device State Update Register (DSUR)
This register is not implemented in this version of KokinSRAM.
4.2.14 KokinSRAM AXR[$30]: Memory Attribute Register (MAR)
The Memory Attribute Register (MAR) is used to protect different regions of
memory against certain types of memory accesses. The KokinSRAM device responds
to memory accesses in the range $C000 through $FFFF. As defined by the
SM3A the region from $C000 through $DFFF is
considered normal work RAM space, while $E000 through $FFFF (high RAM or HRAM)
is a mirror image of that space. The MAR allows setting different protection
types for each of these ranges. The MAR can be used to protect each of these
regions against read, write, or fetch accesses or against any combination
thereof.
Table 4.2.14.a: Bit Fields of the Memory Attribute Register (MAR)
MAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved
HRAM Read Protect HRAM Write Protect HRAM Fetch Protect
Reserved
RAM Read Protect RAM Write Protect RAM Fetch Protect
4.3 KokinSRAM Events
Table 4.3.a: KokinSRAM Events
Event Code Event Mnemonic
$00 - $03
AGAMA Reserved
$04
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR
$05
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT
$06
KOKINSRAM_EVENT_CP_WRITE_RESERVED_AXR
$07
KOKINSRAM_EVENT_CP_READ_READONLY_AXR
$08 - $0F
AGAMA Reserved
$10 - $47
Reserved
$48
KOKINSRAM_EVENT_PT_MEMORY_FETCH
$49
KOKINSRAM_EVENT_PT_MEMORY_WRITE
$4A
KOKINSRAM_EVENT_PT_MEMORY_READ
$4B - $FF
Reserved
4.3.1 Event[$04] KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR
This event triggers when a write to a read-only
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$04]
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0004
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.2 Event[$05] KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT
This event triggers when a write (that would change the state) of one or more
read-only bits in an
AGAMA Extension Register (AXR)
is attempted. Even though some bits in the AXR may be writable, none will be
updated at all if this event triggers (all write data is discarded). A
bit-mask of the read-only bits that would have been affected will be placed in
the DEDR.
Event[$05]
KOKINSRAM_EVENT_CP_WRITE_READONLY_AXR_BIT
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0005
DEAR: Index of the destination AXR
DEDR: A bit-mask of the affected read-only bits
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.3 Event[$06] KOKINSRAM_EVENT_CP_WRITE_RESERVED_AXR
This event triggers when a write to a reserved
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$06]
KOKINSRAM_EVENT_CP_WRITE_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0006
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.4 Event[$07] KOKINSRAM_EVENT_CP_READ_RESERVED_AXR
This event triggers when a read from a reserved
AGAMA Extension Register (AXR)
is attempted. Since the AXR is reserved noread data is returned. A value of 0
is placed in the DEDR.
Event[$07]
KOKINSRAM_EVENT_CP_READ_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0007
DEAR: Index of the destination AXR
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.5 Event[$48] KOKINSRAM_EVENT_PT_MEMORY_FETCH
This event triggers when a code fetch from a code fetch-protected region of
memory is attempted. Code fetch protection is defined in the
Memory Attribute Register (MAR). The code fetch will be
ignored, and no data returned.
Event[$48]
KOKINSRAM_EVENT_PT_MEMORY_FETCH
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0048
DEAR: Address of memory access with code fetch protection
enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.6 Event[$49] KOKINSRAM_EVENT_PT_MEMORY_WRITE
This event triggers when a memory write to a write-protected region of memory
is attempted. Memory write protection is defined in the
Memory Attribute Register (MAR). The memory write will
be ignored, and no data will be updated. The write data will be placed in the
DEDR.
Event[$49]
KOKINSRAM_EVENT_PT_MEMORY_WRITE
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0049
DEAR: Address of memory access with write protection enabled.
DEDR: Intended write data
DEFR: Current Event Handling Flags (EHFR) for this event
4.3.7 Event[$4A] KOKINSRAM_EVENT_PT_MEMORY_READ
This event triggers when a memory read from a read-protected region of memory
is attempted. Memory read protection is defined in the
Memory Attribute Register (MAR). The memory read will be
ignored, and no data will be returned.
Event[$4A]
KOKINSRAM_EVENT_PT_MEMORY_READ
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $004A
DEAR: Address of memory access with read protection enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
4.4 KokinSRAM Power-On Self Test Codes
Message Code
Message Mnemonic
Description
$01
NO_HUB_FOUND
The KokinSRAM device requires access to a HUB
device for correct operation. During POST the HUB device
pointer was checked and found to be NULL (0). This POST code
should never occur when the Kokin DLL is used with a released
version of MesaDX. It is only likely to occur in the event
that the Kokin DLL is being used (incorrectly) by a third-party.
Chapter 5: Sega Card and Cartridge (CARD, EXT0, BROM) Devices
5.1 KokinCARD: A Sega CARD Compatible Device
5.1.1 KokinCARD AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
Table 5.1.1.a: KokinCARD AGAMA Extension Registers
AGAMA Extension Register (AXR)
Register Name
AXR[$00]
Device ID Register (DIR)
AXR[$01]
Power-On Configuration Register (POCR)
AXR[$02]
Device Model Register (DMR)
AXR[$03]
Device Version Register (DVR)
AXR[$04]
Device Status Register (DSR)
AXR[$05]
AGAMA Reserved
AXR[$06]
AGAMA Reserved
AXR[$07]
AGAMA Reserved
AXR[$08]
Event Handling Code Register (EHCR)
AXR[$09]
Event Handling Flags Register (EHFR)
AXR[$0A]
Event Monitor Vector Register (EMVR)
AXR[$0B]
AGAMA Reserved
AXR[$0C]
Device Event Code Register (DECR)
AXR[$0D]
Device Event Address Register (DEAR)
AXR[$0E]
Device Event Data Register (DEDR)
AXR[$0F]
Device Event Flags Register (DEFR)
AXR[$10]
Device Event Flags Register (DSUR)
AXR[$11]-AXR[$2F]
Reserved
AXR[$30]
Memory Attribute Register (MAR)
AXR[$31]-AXR[$FF]
Reserved
5.1.1.1 KokinCARD AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinCARD device.
The Device ID is assigned on Power-On and is used to address the KokinCARD
during certain types of bus transactions, such as AXR reads and writes.
Table 5.1.1.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
5.1.1.2 KokinCARD AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinCARD device. The KokinCARD device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinCARD device.
Table 5.1.1.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinCARD device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinCARD POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinCARD device powered-on in
Monitor Mode. Otherwise,
the KokinCARD device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinCARD device powered-on
suspended. If not set, the KokinCARD
device powered-on resumed and
immediately began responding to all bus transactions.
The KokinCARD device ignores this bit since its operation is
independent of the SMS or GG operating modes.
The KokinCARD device ignores this bit since its operation is
independent of the region setting of the machine.
The KokinCARD device ignores this bit.
The KokinCARD device ignores this bit.
The KokinCARD device ignores this bit.
The KokinCARD device ignores these bits since its operation is
independent of the initial boot device.
These bits are reserved for future expansion.
5.1.1.3 KokinCARD AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinCARD device's model number: A032.
The 'A' indicates that the KokinCARD is an
AGAMA Device, and the '032' indicates
this device contains 32KBytes of ROM.
Table 5.1.1.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinCARD device's model number. The current model number for
this device is A032.
5.1.1.4 KokinCARD AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinCARD device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 5.1.1.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
5.1.1.5 KokinCARD AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinCARD device's current state.
Table 5.1.1.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Reserved Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Reserved
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinCARD device's
EHFR registers. If this bit is set and the KokinCARD device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinCARD device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
The KokinCARD device is enabled. This bit is always set in this
version of the KokinCARD implementation.
The KokinCARD device has entered
Shutdown. The KokinCARD device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions. A Power-On (Hard-Reset) is required to bring the
KokinMIOH device and the rest of the system out of shutdown.
The KokinCARD device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinCARD device has suspended.
The device will still respond to bus traffic. This bit does not have
much meaning for the KokinSRAM since it is a passive device and only
responds to bus transactions from the KokinMIOH device.
These bits are reserved for future expansion.
5.1.1.6 KokinCARD AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinCARD device can be found in Appendix
C: Event Code Summary.
Table 5.1.1.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
5.1.1.7 KokinCARD AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 5.1.1.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinCARD device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinCARD device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinCARD device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinCARD device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinCARD device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
5.1.1.8 KokinCARD AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinCARD
device's Monitor Mode handler. When a device event triggers and the
Monitor Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 5.1.1.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinCARD device's Monitor Mode handler.
5.1.1.9 KokinCARD AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 5.1.1.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
5.1.1.10 KokinCARD AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 5.1.1.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
5.1.1.11 KokinCARD AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 5.1.1.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
5.1.1.12 KokinCARD AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 5.1.1.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinCARD device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinCARD device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
5.1.1.13 KokinCARD AXR[$10]: Device State Update Register (DSUR)
This register is not implemented in this version of KokinCARD.
5.1.1.14 KokinCARD AXR[$30]: Memory Attribute Register (MAR)
The Memory Attribute Register (MAR) is used to protect different regions of
memory against certain types of memory accesses. The KokinCARD device responds
to memory accesses in the range $0000 through $BFFF. This area is broken into
3 separate 16KB Page Frames, starting at
$0000, $4000 and $8000, respectively. The MAR allows setting different
protection types for each of these page frames. The MAR can be used to protect
each of these regions against read, write, or fetch accesses or against any
combination thereof.
Table 5.1.1.14.a: Bit Fields of the Memory Attribute Register (MAR)
MAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Frame 2 Read Protect Frame 2 Write Protect Frame 2 Fetch Protect
Byte 0 Reserved
Frame 1 Read Protect Frame 1 Write Protect Frame 1 Fetch Protect
Reserved
Frame 0 Read Protect Frame 0 Write Protect Frame 0 Fetch Protect
5.1.2 KokinCARD Events
Table 5.1.2.a: KokinCARD Events
Event Code Event Mnemonic
$00 - $03
AGAMA Reserved
$04
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR
$05
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT
$06
KOKINCARD_EVENT_CP_WRITE_RESERVED_AXR
$07
KOKINCARD_EVENT_CP_READ_READONLY_AXR
$08 - $0F
AGAMA Reserved
$10 - $47
Reserved
$48
KOKINCARD_EVENT_PT_MEMORY_FETCH
$49
KOKINCARD_EVENT_PT_MEMORY_WRITE
$4A
KOKINCARD_EVENT_PT_MEMORY_READ
$4B - $FF
Reserved
5.1.2.1 Event[$04] KOKINCARD_EVENT_CP_WRITE_READONLY_AXR
This event triggers when a write to a read-only
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$04]
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0004
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.2 Event[$05] KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT
This event triggers when a write (that would change the state) of one or more
read-only bits in an
AGAMA Extension Register (AXR)
is attempted. Even though some bits in the AXR may be writable, none will be
updated at all if this event triggers (all write data is discarded). A
bit-mask of the read-only bits that would have been affected will be placed in
the DEDR.
Event[$05]
KOKINCARD_EVENT_CP_WRITE_READONLY_AXR_BIT
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0005
DEAR: Index of the destination AXR
DEDR: A bit-mask of the affected read-only bits
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.3 Event[$06] KOKINCARD_EVENT_CP_WRITE_RESERVED_AXR
This event triggers when a write to a reserved
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$06]
KOKINSRAM_EVENT_CP_WRITE_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0006
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.4 Event[$07] KOKINCARD_EVENT_CP_READ_RESERVED_AXR
This event triggers when a read from a reserved
AGAMA Extension Register (AXR)
is attempted. Since the AXR is reserved noread data is returned. A value of 0
is placed in the DEDR.
Event[$07]
KOKINSRAM_EVENT_CP_READ_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0007
DEAR: Index of the destination AXR
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.5 Event[$48] KOKINCARD_EVENT_PT_MEMORY_FETCH
This event triggers when a code fetch from a code fetch-protected region of
memory is attempted. Code fetch protection is defined in the
Memory Attribute Register (MAR). The code fetch will be
ignored, and no data returned.
Event[$48]
KOKINCARD_EVENT_PT_MEMORY_FETCH
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0048
DEAR: Address of memory access with code fetch protection
enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.6 Event[$49] KOKINCARD_EVENT_PT_MEMORY_WRITE
This event triggers when a memory write to a write-protected region of memory
is attempted. Memory write protection is defined in the
Memory Attribute Register (MAR). The memory write will
be ignored, and no data will be updated. The write data will be placed in the
DEDR.
Event[$49]
KOKINCARD_EVENT_PT_MEMORY_WRITE
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0049
DEAR: Address of memory access with write protection enabled.
DEDR: Intended write data
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.2.7 Event[$4A] KOKINCARD_EVENT_PT_MEMORY_READ
This event triggers when a memory read from a read-protected region of memory
is attempted. Memory read protection is defined in the
Memory Attribute Register (MAR). The memory read will be
ignored, and no data will be returned.
Event[$4A]
KOKINSRAM_EVENT_PT_MEMORY_READ
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $004A
DEAR: Address of memory access with read protection enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.1.3 KokinCARD Power-On Self Test Codes
Message Code
Message Mnemonic
Description
$01
NO_HUB_FOUND
The KokinCARD device requires access to a HUB
device for correct operation. During POST the HUB device
pointer was checked and found to be NULL (0). This POST code
should never occur when the Kokin DLL is used with a released
version of MesaDX. It is only likely to occur in the event
that the Kokin DLL is being used (incorrectly) by a third-party.
$01
ROM_ERROR
The KokinCARD device supports either 1 or 2
16KB pages of ROM data. This POST code will be returned under
the following conditions:
1.) No ROM data was provided to the KokinCARD device at power-on.
(If no ROM data is required, than the KokinCARD device should
not have been installed.) 2.) More than 2 16KB pages of ROM
data were provided, or 3.) A non-integral number of 16KB pages
of ROM data was provided. This POST code is most likely the
result of using the wrong ROM image with the KokinCARD
device.
5.2 KokinCART_A235: A 315-5235 Compatible Mapper
5.2.1 KokinCART_A235 AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
5.2.1.1 KokinCART_A235 AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinCART_A235 device.
The Device ID is assigned on Power-On and is used to address the KokinCART_A235
during certain types of bus transactions, such as AXR reads and writes.
Table 5.2.1.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
5.2.1.2 KokinCART_A235 AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinCART_A235 device. The KokinCART_A235 device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinCART_A235 device.
Table 5.2.1.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinCART_A235 device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinCART_A235 POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinCART_A235 device powered-on in
Monitor Mode. Otherwise,
the KokinCART_A235 device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinCART_A235 device powered-on
suspended. If not set, the KokinCART_A235
device powered-on resumed and
immediately began responding to all bus transactions.
The KokinCART_A235 device ignores this bit since its operation is
independent of the SMS or GG operating modes.
The KokinCART_A235 device ignores this bit since its operation is
independent of the region setting of the machine.
The KokinCART_A235 device ignores this bit.
The KokinCART_A235 device ignores this bit.
The KokinCART_A235 device ignores this bit.
The KokinCART_A235 device ignores these bits since its operation is
independent of the initial boot device.
These bits are reserved for future expansion.
5.2.1.3 KokinCART_A235 AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinCART_A235 device's model number: A235.
The 'A' indicates that the KokinCART_A235 is an
AGAMA Device, and the '235' indicates
this device has functionality similar to the Sega 315-5235 mapper chip used
in many cartridges. The 315-5235 is a generic mapper, and almost all
commercial SMS software (excluding codemasters software) is compatible with
this mapper.
Table 5.2.1.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinCART_A235 device's model number. The current model number for
this device is A235.
5.2.1.4 KokinCART_A235 AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinCART_A235 device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 5.2.1.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
5.2.1.5 KokinCART_A235 AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinCART_A235 device's current state.
Table 5.2.1.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Reserved Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Reserved
BRAM Accessed BRAM Present
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinCART_A235 device's
EHFR registers. If this bit is set and the KokinCART_A235 device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinCART_A235 device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
The KokinCART_A235 device is enabled. This bit is always set in this
version of the KokinCART_A235 implementation.
The KokinCART_A235 device has entered
Shutdown. The KokinCART_A235 device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions. A Power-On (Hard-Reset) is required to bring the
KokinMIOH device and the rest of the system out of shutdown.
The KokinCART_A235 device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinCART_A235 device has suspended.
The device will still respond to bus traffic. This bit does not have
much meaning for the KokinCART_A235 since it is a passive device and only
responds to bus transactions from the KokinMIOH device.
This bit will be set if ever the 'Enable BRAM' bit is set
in the Backup RAM Configuration Register (BRCR).
'BRAM Accessed' indicates that at some point software wanted
to use BRAM.
This bit does not imply that a read or write to BRAM occurred, just that
BRAM was enabled at somepoint. This bit is a "sticky bit", and once it
is set it will remain set until the next Power-On (Hard Reset).
This bit is set if one or more pages of RAM are installed in in the
KokinCART_A235 device. If set, this bit indicates that RAM is present and
can be accessed by appropriate setting data in the
Backup RAM Configuration Register (BRCR). (Currently,
MesaDX always supplies 2 RAM pages to the KokinCART_A235 device, so this bit
will always be set.)
These bits are reserved for future expansion.
5.2.1.6 KokinCART_A235 AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinCART_A235 device can be found in Appendix
C: Event Code Summary.
Table 5.2.1.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
5.2.1.7 KokinCART_A235 AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 5.2.1.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinCART_A235 device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinCART_A235 device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinCART_A235 device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinCART_A235 device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinCART_A235 device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
5.2.1.8 KokinCART_A235 AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinCART_A235
device's Monitor Mode handler. When a device event triggers and the
Monitor Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 5.2.1.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinCART_A235 device's Monitor Mode handler.
5.2.1.9 KokinCART_A235 AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 5.2.1.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
5.2.1.10 KokinCART_A235 AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 5.2.1.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
5.2.1.11 KokinCART_A235 AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 5.2.1.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
5.2.1.12 KokinCART_A235 AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 5.2.1.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinCART_A235 device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinCART_A235 device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
5.2.1.13 KokinCART_A235 AXR[$10]: Device State Update Register (DSUR)
This register is not implemented in this version of KokinCART_A235.
5.2.1.14 KokinCART_A235 AXR[$20]: Page Count Register (PCR)
The Page Count Register indicates the number of ROM and RAM pages installed in
the device.
Table 5.2.1.14.a: Bit Fields of the Page Count Register (PCR)
PCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 RAM Page Count
Byte 0 ROM Page Count
Access:
READ-ONLY
Bit Fields:
The number of RAM pages installed (each page is 16KB). The KokinCART_A235
device supports up to 2 RAM pages.
The number of ROM pages installed (each page is 16KB). The KokinCART_A235
device supports up to 256 ROM pages. This value is used to ensure that
only pages that are physically present can be mapped into page frame
when a Page Frame Register (PFR) is written. The page that gets mapped
is the Page Frame Register data modulo the ROM page count. For
example, if there are 16 ROM pages, but 17 is written to a Page Frame
Register, then page number 1 gets mapped into the page frame. Note,
though, that 17 will still appear as the PFR value. The modulo
operation does not modify the data written to the PFR, it only
limits the mapping of pages to physically existing pages.
This behavior is necessary as a lot of commercial software will
set the high bit of the PFR writes. This would lead to a non-existent
page being loaded if the range check wasn't performed. This behavior
only applies to PF0R, PF1R and PF2R. It does not affect BRCR writes.
5.2.1.15 KokinCART_A235 AXR[$21]: Page Frame Configuration Register (PFCR)
The Page Frame Configuration Register can be used to enable or disable the
paging mechanism for the page frames within the KokinCART_A235 memory range.
If a page swap is attempted in a page frame where paging has been disabled,
then a KOKINA235_EVENT_PT_PAGINGDISABLED protection event may trigger (depending on whether
or not the event has been silenced).
The KokinCART_A235 device will respond differently to the paging request depending
on whether the event triggers or not. If the event triggers (the event
was not silenced) the KokinCART_A235 device will respond indicating that an
internal event must be handled (protection events are always handled since they always
have at least one handling flag set in the EHFR: the SHUTDOWN flag). If the
event does not trigger (because its silent flag is set), the KokinCART_A235 device
will ignore the paging request and not resopnd at all, just as if the device
was disabled. In either case, no page swap will occur. The original page
will remain in the given page frame.
Table 5.2.1.15.a: Bit Fields of the Page Frame Configuration Register (PFCR)
PFCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved
Fix First 1K
Enable Backup RAM Paging
Enable Page Frame 2 Paging
Enable Page Frame 1 Paging
Enable Page Frame 0 Paging
Access:
READ-ONLY
Bit Fields:
Set this bit to keep the first 1K of ROM ($0000 - $0400) permanently
mapped into the first 1K of address space. This bit prevents that 1K
from being swapped out when a new page is mapped into page frame 0.
Set this bit to enable paging of Backup RAM pages in the page frame
covering the range $8000 to $BFFF (page frame 2). This bit only covers
paging for Backup RAM pages in page frame 2 (See the Backup Ram
configuration Register (BRCR) description for details on mapping
backup RAM pages into page frame 2). For normal ROM pages, use the
Enable Page Frame 2 Paging' bit to control paging for page frame 2.
Set this bit to enable paging in the page frame covering the range
$8000 to $BFFF (page frame 2). This bit covers paging for normal ROM
pages in page frame 2. If Backup RAM is enabled for Frame 2 (see the
Backup Ram configuration Register (BRCR) for details), then the
'Enable Backup RAM Paging' bit must be used to control paging in page
frame 2.
Set this bit to enable paging in the page frame covering the range
$4000 to $7FFF (page frame 1).
Set this bit to enable paging in the page frame covering the range
$0000 to $3FFF (page frame 0).
These bits are reserved for future expansion.
5.2.1.16 KokinCART_A235 AXR[$30]: Memory Attribute Register (MAR)
The Memory Attribute Register (MAR) is used to protect different regions of
memory against certain types of memory accesses. The KokinCART_A235 device responds
to memory accesses in the range $0000 through $BFFF. This area is broken into
3 separate 16KB Page Frames, starting at
$0000, $4000 and $8000, respectively. The MAR allows setting different
protection types for each of these page frames. The MAR can be used to protect
each of these regions against read, write, or fetch accesses or against any
combination thereof.
Table 5.2.1.16.a: Bit Fields of the Memory Attribute Register (MAR)
MAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Backup RAM Read Protect Backup RAM Write Protect Backup RAM Fetch Protect
Reserved
Frame 2 Read Protect Frame 2 Write Protect Frame 2 Fetch Protect
Byte 0 Reserved
Frame 1 Read Protect Frame 1 Write Protect Frame 1 Fetch Protect
Reserved
Frame 0 Read Protect Frame 0 Write Protect Frame 0 Fetch Protect
5.2.1.17 KokinCART_A235 AXR[$FC]: Backup RAM Configuration Register (BRCR)
The Backup RAM Configuration Register controls the enabling and mapping of
backup RAM pages in Page Frame 2 (memory $8000-$BFFF). This register is
accessible via writes to memory address $FFFC.
Table 5.2.1.17.a: Bit Fields of the Backup RAM Configuration Register (BRCR)
BRCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Reserved
Enable BRAM
Use BRAM Page 1
Reserved
Access:
READ-ONLY
Bit Fields:
Setting this bit will force RAM pages to be mapped into page frame 2
($8000-$BFFF) rather than ROM pages.
If this bit is set, the second BRAM page (page 1) will be mapped into
page frame 2. If the bit is clear, the BRAM page 0 will be mapped into
page frame 2.
These bits are reserved for future expansion.
5.2.1.18 KokinCART_A235 AXR[$FD]: Page Frame 0 Register (PF0R)
The Page Frame 0 Register contains the desired page number to map into page
frame 0 (memory $0000-$3FFF). This value may not be the actual page in that
frame, however. The actual page number is calculated by taking the PF0R value
modulo the total number of installed ROM pages. (See the definition for the
Page Count Register.)
Table 5.2.1.18.a: Bit Fields of the Page Frame 0 Register (PF0R)
PF0R Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Desired Page Number
Access:
READ-ONLY
Bit Fields:
The number of the desired page to be mapped into page frame 0.
The actual page number used is this value modulo the ROM page
count. For example, if there are 16 ROM pages, but 17 is written to
this register, then page number 1 gets mapped into the page frame 0.
This ensures that only physically existing pages are mapped into
page frame 0, regardless of the value written to this register.
This behavior is necessary as a lot of commercial software will
set the high bit of the PFR writes. This would lead to a non-existent
page being loaded if the range check wasn't performed.
These bits are reserved for future expansion.
5.2.1.19 KokinCART_A235 AXR[$FE]: Page Frame 1 Register (PF1R)
The Page Frame 1 Register contains the desired page number to map into page
frame 0 (memory $4000-$7FFF). This value may not be the actual page in that
frame, however. The actual page number is calculated by taking the PF1R value
modulo the total number of installed ROM pages. (See the definition for the
Page Count Register.)
Table 5.2.1.19.a: Bit Fields of the Page Frame 1 Register (PF1R)
PF1R Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Desired Page Number
Access:
READ-ONLY
Bit Fields:
The number of the desired page to be mapped into page frame 1.
The actual page number used is this value modulo the ROM page
count. For example, if there are 16 ROM pages, but 17 is written to
this register, then page number 1 gets mapped into the page frame 1.
This ensures that only physically existing pages are mapped into
page frame 1, regardless of the value written to this register.
This behavior is necessary as a lot of commercial software will
set the high bit of the PFR writes. This would lead to a non-existent
page being loaded if the range check wasn't performed.
These bits are reserved for future expansion.
5.2.1.20 KokinCART_A235 AXR[$FF]: Page Frame 2 Register (PF2R)
The Page Frame 2 Register contains the desired page number to map into page
frame 2 (memory $8000-$BFFF) when BRAM isn't being mapped. This value may not
be the actual page in that frame, however. The actual page number is
calculated by taking the PF2R value modulo the total number of installed ROM
pages. (See the definition for the
Page Count Register.) The actual page also depends on
whether BRAM is enabled. (See the definition for the
Backup RAM Configuration Register.)
Table 5.2.1.20.a: Bit Fields of the Page Frame 2 Register (PF2R)
PF2R Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Desired Page Number
Access:
READ-ONLY
Bit Fields:
The number of the desired page to be mapped into page frame 2.
The actual page number used is this value modulo the ROM page
count, when BRAM isn't enabled. For example, if there are 16 ROM pages,
but 17 is written to this register, then page number 1 gets mapped into
the page frame 2.
This ensures that only physically existing pages are mapped into
page frame 2, regardless of the value written to this register.
This behavior is necessary as a lot of commercial software will
set the high bit of the PFR writes. This would lead to a non-existent
page being loaded if the range check wasn't performed.
These bits are reserved for future expansion.
5.2.2 KokinCART_A235 Events
Table 5.2.2.a: KokinCART_A235 Events
Event Code Event Mnemonic
$00 - $03
AGAMA Reserved
$04
KOKINA235_EVENT_CP_WRITE_READONLY_AXR
$05
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT
$06
KOKINA235_EVENT_CP_WRITE_RESERVED_AXR
$07
KOKINA235_EVENT_CP_READ_READONLY_AXR
$08 - $0F
AGAMA Reserved
$10 - $40
Reserved
$41
KOKINA235_EVENT_PT_PAGING_DISABLED
$42 - $47
Reserved
$48
KOKINA235_EVENT_PT_MEMORY_FETCH
$49
KOKINA235_EVENT_PT_MEMORY_WRITE
$4A
KOKINA235_EVENT_PT_MEMORY_READ
$4B - $7F
Reserved
$80
KOKINA235_EVENT_BP_NOBRAMPRESENTACCESS
$81 - $FF
Reserved
5.2.2.1 Event[$04] KOKINA235_EVENT_CP_WRITE_READONLY_AXR
This event triggers when a write to a read-only
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$04]
KOKINA235_EVENT_CP_WRITE_READONLY_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0004
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.2 Event[$05] KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT
This event triggers when a write (that would change the state) of one or more
read-only bits in an
AGAMA Extension Register (AXR)
is attempted. Even though some bits in the AXR may be writable, none will be
updated at all if this event triggers (all write data is discarded). A
bit-mask of the read-only bits that would have been affected will be placed in
the DEDR.
Event[$05]
KOKINA235_EVENT_CP_WRITE_READONLY_AXR_BIT
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0005
DEAR: Index of the destination AXR
DEDR: A bit-mask of the affected read-only bits
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.3 Event[$06] KOKINA235_EVENT_CP_WRITE_RESERVED_AXR
This event triggers when a write to a reserved
AGAMA Extension Register (AXR)
is attempted. The write attempt is ignored, and the destination AXR value does
not change. The write data is placed in the DEDR when
this event triggers.
Event[$06]
KOKINA235_EVENT_CP_WRITE_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0006
DEAR: Index of the destination AXR
DEDR: The write data intended for the destination AXR
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.4 Event[$07] KOKINA235_EVENT_CP_READ_RESERVED_AXR
This event triggers when a read from a reserved
AGAMA Extension Register (AXR)
is attempted. Since the AXR is reserved noread data is returned. A value of 0
is placed in the DEDR.
Event[$07]
KOKINA235_EVENT_CP_READ_RESERVED_AXR
Type COMPULSORY
Default Action SHUTDOWN
Silent Flags Always 0. This event cannot be silenced.
Device Specific?
No. This event is defined for all AGAMA devices.
Device Event
Register Updates
DECR: $0007
DEAR: Index of the destination AXR
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.5 Event[$41] KOKINA235_EVENT_PT_PAGING_DISABLED
The KokinCART_A235 device supports disabling paging in any or all of the
page frames via configuration bits in the
Page Frame Configuration Register (PFCR). If a write to
one of the Page Frame Registers (BRCR,
PF0R,
PF1R,
PF2R) is attempted while the corresponding disable bit
is set in the Page Frame Configuration Register (PFCR),
then this event will trigger.
Event[$41]
KOKINA235_EVENT_PT_PAGINGDISABLED
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0041
DEAR: Address of paging register ($FFFC through $FFFF)
DEDR: Desired page number
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.6 Event[$48] KOKINA235_EVENT_PT_MEMORY_FETCH
This event triggers when a code fetch from a code fetch-protected region of
memory is attempted. Code fetch protection is defined in the
Memory Attribute Register (MAR). The code fetch will be
ignored, and no data returned.
Event[$48]
KOKINA235_EVENT_PT_MEMORY_FETCH
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0048
DEAR: Address of memory access with code fetch protection
enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.7 Event[$49] KOKINA235_EVENT_PT_MEMORY_WRITE
This event triggers when a memory write to a write-protected region of memory
is attempted. Memory write protection is defined in the
Memory Attribute Register (MAR). The memory write will
be ignored, and no data will be updated. The write data will be placed in the
DEDR.
Event[$49]
KOKINA235_EVENT_PT_MEMORY_WRITE
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0049
DEAR: Address of memory access with write protection enabled.
DEDR: Intended write data
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.8 Event[$4A] KOKINA235_EVENT_PT_MEMORY_READ
This event triggers when a memory read from a read-protected region of memory
is attempted. Memory read protection is defined in the
Memory Attribute Register (MAR). The memory read will be
ignored, and no data will be returned.
Event[$4A]
KOKINA235_EVENT_PT_MEMORY_READ
Type PROTECTION
Default Action SHUTDOWN
Silent Flags No change, but can be manually SET by
user or Monitor Code. Automatically RESET when current instruction
retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $004A
DEAR: Address of memory access with read protection enabled.
DEDR: $0000
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.2.9 Event[$80] KOKINA235_EVENT_BP_NOBRAMPRESENTACCESS
This event triggers when (it's enabled and) a write to the
Backup RAM Configuration Register (BRCR) is attempted via
memory address $FFFC but no BRAM has been installed in the device (the
BRAMPRESENT bit in
Device Status Register (DSR) is clear, indicating no
BRAM is present).
Event[$80]
KOKINA235_EVENT_PT_NOBRAMPRESENTACCESS
Type BREAKPOINT
Default Action None
Silent Flags Automatically SET when event triggers.
Automatically RESET when current instruction retires.
Device Specific? Yes
Device Event
Register Updates
DECR: $0080
DEAR: $FFFC
DEDR: Data intended for BRCR
DEFR: Current Event Handling Flags (EHFR) for this event
5.2.3 KokinCART_A235 Power-On Self Test Codes
Message Code
Message Mnemonic
Description
$01
NO_HUB_FOUND
The KokinCART_A235 device requires access to a HUB
device for correct operation. During POST the HUB device
pointer was checked and found to be NULL (0). This POST code
should never occur when the Kokin DLL is used with a released
version of MesaDX. It is only likely to occur in the event
that the Kokin DLL is being used (incorrectly) by a third-party.
$02
ROM_ERROR
The KokinCART_A235 device supports between 1 and 256
16KB pages of ROM data. This POST code will be returned under
the following conditions:
1.) No ROM data was provided to the KokinCART_A235 device at power-on.
(If no ROM data is required, than the KokinCART_A235 device should
not have been installed.) 2.) More than 256 16KB pages of ROM
data were provided, or 3.) A non-integral number of 16KB pages
of ROM data was provided. This POST code is most likely the
result of using the wrong ROM image with the KokinCART_A235
device.
$03
BRAM_ERROR
The KokinCART_A235 device supports between 0 and 2
16KB pages of RAM data. This POST code will be returned under
the following conditions:
1.) More than 2 16KB pages of RAM data were provided, or 2.) A
non-integral number of 16KB pages of RAM data was provided.
This POST code is most likely the result of using the wrong
RAM image with the KokinCART_A235 device.
$0F
INTERNAL_ERROR
This POST code will be returned if the
KokinCART_A235 is unable to allocate all the memory it needs for
correct operation. This code may occur in release versions
of MesaDX if system resources are low.
5.3 KokinCART_A0CD: A CodeMasters Compatible Mapper
5.3.1 KokinCART_A0CD AGAMA Extension Registers
The KokinCART_A0CD AXRs are nearly identical to the
KokinCART_A235 AXRs. However, the KokinCART_A0CD device does not
support BRAM, so any references to BRAM status or configuration bits should be
considered Reserved in the KokinCART_A0CD device AXRs.
Also the Backup RAM Configuration Register does not
exist in the KokinAOCD device.
5.3.2 KokinCART_A0CD Events
5.3.3 KokinCART_A0CD Power-On Self Test Codes
Chapter 6: Video Display Processor (VDP) Devices
6.1 KokinVDP_A124: A 315-5124 (SMS1 1) Compatible VDP
6.1.1 KokinVDP_A124 AGAMA Extension Registers
Each AGAMA Device includes a 256-entry 16-bit AGAMA Extension Register (AXR)
file. The AXRs contain device configuration and status information. Both
software and external debuggers can access the AXRs to change device behavior
or to collect device status.
6.1.1.1 KokinVDP_A124 AXR[$00]: Device ID Register (DIR)
The Device ID Register contains the 4-bit Device ID for the KokinVDP_A124 device.
The Device ID is assigned on Power-On and is used to address the KokinVDP_A124
during certain types of bus transactions, such as AXR reads and writes.
Table 6.1.1.1.a: Bit Fields of the Device ID Register (DIR)
DIR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 AGAMA Reserved
Device ID[3:0]
Access:
READ-ONLY
Bit Fields:
The 4-bit Device ID for the device.
These bits are reserved for future expansion.
6.1.1.2 KokinVDP_A124 AXR[$01]: Power-On Configuration Register (POCR)
The Power-On Configuration Register contains the initial configuration
settings of the KokinVDP_A124 device. The KokinVDP_A124 device will sample all the
configuration settings and save them in the POCR, but not all the settings are
used. The bit field descriptions below indicate which Power-On Configuration
settings are ignored by the KokinVDP_A124 device.
Table 6.1.1.2.a: Bit Fields of the Power-On Configuration Register (POCR)
POCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 POST Code
AGAMA Reserved Monitor Mode Suspended
Byte 0 GG Mode Export Region 50Hz
AGAMA Reserved SMS1 Bus Lock Boot Device
Boot Device
Access:
READ-ONLY
Bit Fields:
A 4-bit code indicating the result of the
Power-On Self Test (POST) for the
KokinVDP_A124 device. A zero value indicates that the device passed POST.
A non-zero value indicates a failure. A list of the KokinVDP_A124 POST
failure codes, along with detailed descriptions for each code, can be
found in Appendix B: Power-On Self Test (POST)
Code Summary
If this bit is set, the KokinVDP_A124 device powered-on in
Monitor Mode. Otherwise,
the KokinVDP_A124 device powered-on in
Compatible Mode. Monitor mode
is disabled in the current release of the Kokin Library, so this bit
will always be reset (0).
If this bit is set, the KokinVDP_A124 device powered-on
suspended. If not set, the KokinVDP_A124
device powered-on resumed and
immediately began responding to all bus transactions.
The KokinVDP_A124 device ignores this bit since its operation is
independent of the SMS or GG operating modes.
The KokinVDP_A124 device ignores this bit since its operation is
independent of the region setting of the machine.
The KokinVDP_A124 uses this bit to render video frames at 50Hz.
The KokinVDP_A124 device ignores this bit.
The KokinVDP_A124 device ignores this bit.
The KokinVDP_A124 device ignores these bits since its operation is
independent of the initial boot device.
These bits are reserved for future expansion.
6.1.1.3 KokinVDP_A124 AXR[$02]: Device Model Register (DMR)
The Device Model Register contains the KokinVDP_A124 device's model number: A124.
The 'A' indicates that the KokinVDP_A124 is an
AGAMA Device, and the '124' indicates
this device has functionality similar to the Sega 315-5124 VDP used in early
version of the Sega Master System Model 1.
Table 6.1.1.3.a: Bit Fields of the Device Model Register (DMR)
DMR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Model Number
Byte 0 Model Number
Access:
READ-ONLY
Bit Fields:
The KokinVDP_A124 device's model number. The current model number for
this device is A124.
6.1.1.4 KokinVDP_A124 AXR[$03]: Device Version Register (DVR)
The Device Version Register specifies the implementation version of the
KokinVDP_A124 device. Currently, the version number is 00.00 for all devices
in the Kokin library.
Table 6.1.1.4.a: Bit Fields of the Device Version Register (DVR)
DVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Major Version
Byte 0 Minor Version
Access:
READ-ONLY
Bit Fields:
The major version number of the device implementation.
The minor version number of the device implementation.
6.1.1.5 KokinVDP_A124 AXR[$04]: Device Status Register (DSR)
The Device Status Register contains general information about the
KokinVDP_A124 device's current state.
Table 6.1.1.5.a: Bit Fields of the Device Status Register (DSR)
DSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Set Monitor Silent Set
Reserved Device Enabled
Shutdown Monitor Mode Suspended
Byte 0 Reserved
Access:
READ-ONLY
Bit Fields:
A COMPATBILESILENT flag is set in one of the KokinVDP_A124 device's
EHFR registers. If this bit is set and the KokinVDP_A124 device is in
Compatible Mode when it
receives a CLEARSILENTFLAGS message then the
COMPATIBLESILENT and MONITORSILENT flags in all of the
EHFR registers are reset. See the Event Handling Flags
Register (EHFR) section for more information about the
SILENT flags.
A MONITORSILENT flag is set if one of the KokinVDP_A124 device's
EHFR registers. If this bit is set and the device is in
Monitor Mode when it receives a
CLEARSILENTFLAGS message then the MONITORSILENT flags in
all of the EHFR registers are reset. See the Event
Handling Flags Register (EHFR) section for more information about
the SILENT flags.
The KokinVDP_A124 device is enabled. This bit is always set in this
version of the KokinVDP_A124 implementation.
The KokinVDP_A124 device has entered
Shutdown. The KokinVDP_A124 device will
no longer respond to bus transactions, other than SYSMESSAGE
transactions. A Power-On (Hard-Reset) is required to bring the
KokinMIOH device and the rest of the system out of shutdown.
The KokinVDP_A124 device is operating in
Monitor Mode. All Monitor Mode
functionality has been disabled in this release of the Kokin library,
so this bit will always be reset (0).
The KokinVDP_A124 device has suspended. The
device will still respond to bus traffic, but will not perform any
"active" processing such as refreshing the video display.
These bits are reserved for future expansion.
6.1.1.6 KokinVDP_A124 AXR[$08]: Event Handling Code Register (EHCR)
The Event Handling Code Register is used to control the data appearing in the
Event Handling Flags Register (EHFR). Together, the EHCR
and EHFR control the access to the event flags that indicate how an event should
be handled when it occurs. The event flags in the EHFR correspond to the event
code in the EHCR. Writing a new event code to the EHCR will update the EHFR
with that event's flags which can then be modified via the EHFR. The event
codes for the KokinVDP_A124 device can be found in Appendix
C: Event Code Summary.
Table 6.1.1.6.a: Bit Fields of the Event Handling Code Register (EHCR)
EHCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ/WRITE
Bit Fields:
The Event Code indicates which event the flags in the Event Handling
Flags Register (EHFR) correspond to.
These bits are reserved for future expansion.
6.1.1.7 KokinVDP_A124 AXR[$09]: Event Handling Flags Register (EHFR)
The Event Handling Flags Register is a window into the 256-entry event flags
table. Together, the EHCR and EHFR control the access to the event flags that
indicate how an event should be handled when it occurs. The event flags in the
EHFR correspond to the event code in the EHCR. Writing a new event code to the
EHCR will update the EHFR with that event's flags which can then be modified via
the EHFR.
Table 6.1.1.7.a: Bit Fields of the Event Handling Flags Register (EHFR)
EHFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ/WRITE
Bit Fields:
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinVDP_A124 device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinVDP_A124 device receives a CLEARSILENTFLAGS message
while in Compatible Mode, this bit (along with the Monitor Silent bit)
is cleared for all 256 events. If the device is in Monitor Mode, this
bit is not affected by a CLEARSILENTFLAGS message.
If this bit is set, then the event (whose code is specified in the EHCR)
will be silenced (and will not trigger) the next time it occurs while
the KokinVDP_A124 device is in
Compatible Mode. (Note:
Compulsory Events, cannot be silenced.
Please see the section on
Events and Event
Handling in the AGAMA Specification for more information about the
different types of device events.) This bit is used as a flag for events
so that they only trigger once during the execution of an instruction.
When the KokinVDP_A124 device receives a CLEARSILENTFLAGS message
while in Monitor Mode, this bit is cleared for all 256 events.
Setting this bit indicates that the system should enter
Shutdown mode when the event triggers.
This flag is only examined if no other event handling flag is set
(such as Monitor Mode or Suspend described below).
Shutdown mode is used when an error or event occurs and no error
recovery is possible. For example, if the KokinVDP_A124 device encounters
an unknown opcode the system may enter shutdown if no other event
handling is specified. For Events and
Event Handling for more information about shutdown and the
different types of device events.
Setting this bit indicates that the system should enter
Monitor Mode when the event
triggers. This bit is read-only for all devices in this version of the
Kokin Library.
Setting this bit indicates that the system should
suspend execution when the event
triggers.
These bits are reserved for future expansion.
6.1.1.8 KokinVDP_A124 AXR[$0A]: Event Monitor Vector Register (EMVR)
The Event Monitor Vector Register (EMVR) contains the address of the KokinVDP_A124
device's Monitor Mode handler. When a device event triggers and the
Monitor Mode event flag is set, the device will request that the system
enter Monitor Mode and program flow will jump to the address specified in this
register. Monitor mode is not available in the current release of the Kokin
Library, so this register is not used, but it can be written to.
Table 6.1.1.8.a: Bit Fields of the Event Monitor Vector Register (EMVR)
EMVR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Monitor Vector Address[15:8]
Byte 0 Monitor Vector Address[7:0]
Access:
READ/WRITE
Bit Fields:
The address of the KokinVDP_A124 device's Monitor Mode handler.
6.1.1.9 KokinVDP_A124 AXR[$0C]: Device Event Code Register (DECR)
The Device Event Code Register (DECR) contains the 8-bit event code of the
last event that triggered. This register will retain its value until another
event is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Address Register (DEAR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 6.1.1.9.a: Bit Fields of the Device Event Code Register (DECR)
DECR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 AGAMA Reserved
Byte 0 Event Code
Access:
READ-ONLY
Bit Fields:
The 8-bit event code for the last triggered event.
These bits are reserved for future expansion.
6.1.1.10 KokinVDP_A124 AXR[$0D]: Device Event Address Register (DEAR)
The Device Event Address Register (DEAR) contains the 16-bit address (or 8-bit
port) specific to the last event that triggered. For example, if a memory
write event triggered, then this register will contain the address the data
was to be written to. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Data Register (DEDR), and
Device Event Flags Register (DEFR),
Table 6.1.1.10.a: Bit Fields of the Device Event Address Register (DEAR)
DEAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Address[15:8]
Byte 0 Event-specific Address[7:0]
Access:
READ-ONLY
Bit Fields:
A 16-bit address (or 8-bit port) specific to the event that triggered.
For example, if a memory write event was triggered then this register
will contain the address the data was to be written to. This register
retains its value until another event is triggered.
6.1.1.11 KokinVDP_A124 AXR[$0E]: Device Event Data Register (DEDR)
The Device Event Data Register (DEDR) contains data specific to the last event
that triggered. For example, if a memory write event triggered, then this
register will contain the write data. This register will retain its value
until another event is triggered. Silenced events do not trigger and will not
update this register. Other information about the last triggered event can be
found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Flags Register (DEFR),
Table 6.1.1.11.a: Bit Fields of the Device Event Data Register (DEDR)
DEDR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Event-specific Data[15:8]
Byte 0 Event-specific Data[7:0]
Access:
READ-ONLY
Bit Fields:
16-bits of data specific to the event that triggered. For example, if a
memory write event was triggered then this register will contain the
write data. This register retains its value until another event is
triggered.
6.1.1.12 KokinVDP_A124 AXR[$0F]: Device Event Flags Register (DEFR)
The Device Event Flags Register (DEFR) contains a copy of the
Event Handling Flags Register (EHFR) for the event that
triggered. This register will retain its value until another event
is triggered. Silenced events do not trigger and will not update this
register. Other information about the last triggered event can be found in the
Device Event Code Register (DECR),
Device Event Address Register (DEAR), and
Device Event Data Register (DEDR),
Table 6.1.1.12.a: Bit Fields of the Device Event Flags Register (DEFR)
DEFR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Compatible Silent Monitor Silent
AGAMA Reserved Shutdown Monitor Mode Suspend
Byte 0 AGAMA Reserved
Access:
READ-ONLY
Bit Fields:
The Compatible Silent flag is set for the triggered event.
The next time this event occurs while the KokinVDP_A124 device is in
Compatible Mode the event will be silenced and will not trigger.
See the section on the Event Handling Flag Register
(EHFR) for more information about this bit.
The Monitor Silent flag is set for the triggered event.
The next time this event occurs while the KokinVDP_A124 device is in
Monitor Mode the event will be silenced and will not trigger. See the
section on the Event Handling Flag Register (EHFR)
for more information about this bit.
The Shutdown flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Shutdown mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Monitor Mode flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to enter
Monitor Mode. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
The Suspend flag is set for the triggered event, indicating
that one possible mechanism for handling the event was to
suspend execution. See the section on
the Event Handling Flag Register (EHFR) for more
information about this bit.
These bits are reserved for future expansion.
6.1.1.13 KokinVDP_A124 AXR[$10]: Device State Update Register (DSUR)
This register is not implemented in this version of KokinVDP_A124.
6.1.1.14 KokinVDP_A124 AXR[$11]: VDP Configuration Register (VCR)
This register is used to set various configuration options for the VDP. These
options don't exist in the real SM3A VDP; they are provided by the KokinVDP_A124
device for convenience and may be useful during software development or for
debug.
Table 6.1.1.14.a: Bit Fields of the VDP Configuration Register (VCR)
VCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0
Use High CRAM for Tile View
Reserved
Enable Sprite Limit Reserved
Render Sprites
Render Patterns Render Backdrop
Access:
READ/WRITE
Bit Fields:
The KokinVDP_A124 displays information on two virtual screens. The primary
screen contains the standard video output. The secondary screen is
used for displaying other graphical information such as the pattern table
or palette. When in Mode4, the secondary screen displays the pattern
table and palette. If this bit is set (while in Mode4) the tiles will be
displayed on the secondary screen using the colors in High CRAM. If this
bit is reset the tiles will be displayed using the colors in Low CRAM.
While in mode 'Graphics2', if this bit is set the pattern table is shown
in the secondary screen. If this bit is cleared while in 'Graphics2',
then the sprites are shown near the top of the screen and palette is shown
near the bottom. The function of this bit while in 'Graphics2' may change
in future versions of this device.
When this bit is SET the sprite line limit restriction is enforced
(8 sprites in Mode4, 4 sprites in Graphics2). If the bit is RESET, there
is no line
sprite limit, and all of the available sprites may be displayed on a
line. This bit is SET at power-on, and it is recommended to leave it
SET when doing software development to see how the sprites will
appear on a real SM3A system.
When this bit is SET, sprites will be displayed on the primary VDP
screen. RESETing this bit will prevent sprites from being displayed;
RESETing this bit may be
useful for debugging background display issues without having to
adjust the sprite table. This bit is SET at power-on.
When this bit is SET, the background tiles will be displayed on the
primary VDP screen. RESETing this bit will prevent the background from
being shown. RESETing this bit may be
useful for debugging sprite issues without the visual "noise" of the
background tiles. This bit is SET at power-on.
When this bit is SET, the backdrop (overscan) area is rendered on the
left and right edges of the primary VDP screen. Rendering the backdrop
may prove useful to developers who wish to see how the chosen backdrop
color appears in the context of the normal video display. RESETing this
bit will prevent the backdrop from being shown. This bit is SET at
power-on.
These bits are reserved for future expansion.
6.1.1.15 KokinVDP_A124 AXR[$14]: Command Word Register (CWR)
This register contains the last command word written to the VDP. Updates to
this register are accomplished in two steps of one byte each. The first byte
is stored in the least-significant byte of the CWR. The second byte completes
the command and is stored in the most-significant byte of the CWR. The
'Command Sync' flag in the
VDP Status Register (VSR) indicates the phase of the
command word write operation. If the 'Command Sync' flag is set,
then only the first byte of the command has been written and another write
is expected to complete the command.
Table 6.1.1.15.a: Bit Fields of the Command Word Register (CWR)
CWR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Command
VRAM Address [13:8]
Byte 0 VRAM Address [7:0]
Access:
READ-ONLY
Bit Fields:
The last command issued to the VDP.
This description will be
expanded on in the future. For now, please see the Bibliography for
a list of references on the SMS1 VDP and the different commands it
supports.
The VRAM address specified for the last command.
This description will be
expanded on in the future. For now, please see the Bibliography for
a list of references on the SMS1 VDP and the different commands it
supports.
6.1.1.16 KokinVDP_A124 AXR[$15]: VRAM Address Register (VAR)
This register contains the VRAM address that will be used during the next
data access. For VRAM reads, this is the address that will be used to refill
the Data Buffer Register (DBR). For writes, it is the
VRAM address that will be written to. This address will auto-increment after
a data access, so it does not always equal to the VRAM address specified in the
Command Word Register (CWR).
Table 6.1.1.16.a: Bit Fields of the VRAM Address Register (VAR)
VAR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
VRAM Address [13:8]
Byte 0 VRAM Address [7:0]
Access:
READ-ONLY
Bit Fields:
The VRAM address to be used during the next VRAM data access.
This description will be
expanded on in the future. For now, please see the Bibliography for
a list of references on the SMS1 VDP its operation.
These bits are reserved for future expansion.
6.1.1.17 KokinVDP_A124 AXR[$16]: Data Buffer Register (DBR)
This register contains the data byte that will be returned during the next
data read. It is the data from the VRAM address previous to the address
specified in VRAM Address Register (VAR).
Table 6.1.1.17.a: Bit Fields of the VRAM Address Register (VAR)
DBR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
Byte 0 Data
Access:
READ-ONLY
Bit Fields:
VRAM data from the previous VRAM address
These bits are reserved for future expansion.
6.1.1.18 KokinVDP_A124 AXR[$17]: VDP Status Register (VSR)
This register contains architectural VDP status bits (in contrast to the
Device Status Register (DSR) which contains AGAMA device
status'Command Sync' bit which is used to help
implement the command-word functionality of the VDP. The low-order byte is
software accessible via an I/O port. These status bits are defined in the
315-5124 (SMS1) VDP. The status bits in the high byte are only accessible via
an AXR access (in Monitor Mode or by the External Debugger (EXTD) device).
Table 6.1.1.18.a: Bit Fields of the VDP Status Register (VSR)
VSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Command Sync Reserved
Byte 0 V-Sync Sprite Overflow
Sprite Collision Reserved
Access:
READ-ONLY
Bit Fields:
When set, only one byte of the command word has been received. (See the
Command Word Register (CWR) section for more information on the
VDP Command Word.) When this bit is cleared it indicates that a
complete command word has been recieved.
When set this bit indicates the VDP has reached the vertical blank section of
the frame. If the V-Sync interrupts are enabled (via bit 5 in VDP
Register 1) then the VDP interrupt line will be asserted while this
bit is set. This is a sticky big and will remain set until the VDP
Status Register (VSR) is read via an I/O port. (It will not be cleared
by an AXR read of this register.)
This bit is set if too may sprites appear on a scan line. In Mode 4
the sprite limit is 8. In Graphics2 the sprite limit is 4.
This bit is set if two (or more) sprite pixels appear on top of one
another.
These bits are reserved for future expansion.
6.1.1.19 KokinVDP_A124 AXR[$18]: Current Scanline Register (CSR)
This register is the number of the scanline currently being render.
Table 6.1.1.19.a: Bit Fields of the Current Scanline Register (CSR)
CSR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Current Scanline [15:8]
Byte 0 Current Scanline [7:0]
Access:
READ-ONLY
Bit Fields:
The current scanline being rendered. This includes scanlines in the
vertical blanking area.
6.1.1.20 KokinVDP_A124 AXR[$19]: Line Count-Down Register (LCR)
This register contains the number of scanlines that will be rendered before the
next line interrupt is generated.
Table 6.1.1.20.a: Bit Fields of the Line Count-Down Register (LCR)
LCR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Count [15:8]
Byte 0 Count [7:0]
Access:
READ-ONLY
Bit Fields:
The number of scanlines remaining until the next line count interrupt
is generated (when line interrupts are enabled via bit 4 on VDP register
0).
6.1.1.21 KokinVDP_A124 AXR[$21]: Register Write Breakpoint Register (RWBR)
This register is used to trigger a
KOKINVDP_A124_EVENT_BP_VREG_WRITE
event when the VDP's registers are written.
Table 6.1.1.21.a: Bit Fields of the Register Write Breakpoint Register (RWBR)
RWBR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Reserved
VReg $0A VReg $09 VReg $08
Byte 0 VReg $07 VReg $06 VReg $05 VReg $04
VReg $03 VReg $02 VReg $01 VReg $00
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $0A is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $09 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $08 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $07 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $06 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $05 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $04 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $03 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $02 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $01 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_VREG_WRITE
when VReg $00 is written.
These bits are reserved for future expansion.
6.1.1.22 KokinVDP_A124 AXR[$22]: CRAM-Low Write Breakpoint Register (CLWBR)
This register is used to trigger a
KOKINVDP_A124_EVENT_BP_CRAM_WRITE
event when the VDP's low ($00 through $0F) palette entries in Color RAM (CRAM) are
written.
Table 6.1.1.22.a: Bit Fields of the CRAM-Low Write Breakpoint Register (CLWBR)
CLWBR Bit 7 Bit 6
Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
Byte 1 Entry $0F Entry $0E Entry $0D Entry $0C
Entry $0B Entry $0A Entry $09 Entry $08
Byte 0 Entry $07 Entry $06 Entry $05 Entry $04
Entry $03 Entry $02 Entry $01 Entry $00
Access:
READ/WRITE
Bit Fields:
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0F.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0E is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0D is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0C is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0B is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $0A is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $09 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $08 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $07 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $06 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $05 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $04 is written.
Set this bit to trigger a KOKINVDP_A124_EVENT_BP_CRAM_WRITE
when Palette entry $03 is written.
Set this bit to trigger a