■Function
- ●System management system
- The system management system has the following functions.
function into back non-intoback | | |
Master SH2 ON | × | ○ |
Slave SH2 ON | × | ○ |
Slave SH2 OFF | × | ○ |
sound on | × | ○ |
Sound OFF | × | ○ |
CD ON | × | ○ |
CD OFF | × | ○ |
Whole system reset | × | ○ |
NMI request | × | ○ |
hot reset enable | × | ○ |
Hot reset disabled | × | ○ |
Get cartridge code | ○ | × |
Get area code | ○ | × |
Get system status | ○ | × |
SMPC memory settings | × | ○ |
SMPC memory acquisition | ○ | × |
Time setting | × | ○ |
Get time | ○ | × |
| It is prohibited to issue clock change commands directly to SMPC.
If you wish to use it, please use the SYS_CHGSYSCK() function in the system library. |
---|
- ●Peripheral control system
- The library supports the following peripherals.
game machine Peripheral name | |
saturn peripherals | digital device |
analog device |
Pointing device (mouse) |
keyboard |
Multi tap (6P) |
mega drive peripherals | 3 button PAD |
6 button PAD |
4P adapter |
mouse |
- ●Peripherals not compatible with libraries
- The following peripherals are not supported by this library.
Please refer to the respective documentation for details.
Virtua Gun → Reference: Developer's Information STN-41 Speech recognition → Added dedicated library (release date undecided )
■Processing
- ●Issue non-intback command
- This is non-intback type processing.
- ●Issuing an intoback command
- System data acquisition (excluding time)
- Peripheral data acquisition, time data acquisition
This process is necessary for each frame.
- ●Recommended example
- Recommended examples are shown for the following three patterns.
- pattern 1
Into back initialization (3) → Peripheral data acquisition + Time data acquisition
- pattern 2
Issue non-intoback command → Intoback initialization (2) → Obtain peripheral data
- pattern 3
Into back initialization (1) → System data acquisition → Into back initialization (3) → Peripheral data acquisition + time data acquisition
- ●Explanation of the figure
- Main processing
- Intoback initialization (1): Specify system data acquisition
- Into back initialization (2): Specify peripheral data acquisition
- Into back initialization (3): Specify peripheral data acquisition + time data acquisition
- SMPC processing
- (1): System data collection processing
- (2): Peripheral data collection processing
- (3): Time data collection processing
- (1) Pattern 1
- *If the game frame is 1 frame
- *If the game frame is 2 frames
- Peripheral data acquisition* does not acquire peripheral data.
- (2) Pattern 2
- (3) Pattern 3
- ●Restrictions
- << Common to all commands>>
- Do not issue commands for 300μs after V-BLANK IN.
- Do not issue any commands after issuing the Into Back command until the next V-BLANK IN.
- Notes on running multiple tasks
When using the library with multiple tasks, if you switch interrupt tasks, the library does not have exclusive control of SMPC, so SMPC may deadlock or malfunction.
Therefore, when executing with multiple tasks, exclusive control of the library must be performed separately by the user.
- Please refer to the SMPC User's Manual for restrictions from slave SH2.
- Command processing time may vary by 20μS to 100μs due to SMPC internal processing once per second.
- << Non-intback command issuing function>>
- There are no restrictions other than the common (above).
- << Intoback command issue function>>
- System data acquisition (excluding time)
- There are no restrictions other than the common (above).
- Peripheral data acquisition, time data acquisition
- Do not issue any commands after issuing the Into Back command until the next V-BLANK IN.
- Please issue the intoback command 14ms before the instructed V-BLANK IN.
- Peripheral data collection processing within SMPC is performed during one vertical display period.
- Data that could not be obtained (timeout) from the time the Into Back command was issued until the instructed V-BLANK IN cannot be obtained thereafter.
- If timeouts occur frequently, treat the peripheral as unconnected.
- In SMPC, peripheral acquisition starts 1ms before V-BLANK IN, which is the specified end of peripheral acquisition.
- V-BLANK IN skip number
The V-BLANK IN skip count instructs the execution timing of peripheral data collection processing within the SMPC after issuing the intoback command.
It is provided for games that change frames in two or more frames.
Peripheral data collection processing within the SMPC is executed during V-DISP before the (V-BLANK IN skip number + 1)th V-BLANK IN after issuing the into-back command.
If you want to execute it at V-BLANK IN immediately after issuing the intoback command, set it to 0.
■Peripheral control
- Peripheral controls must be created to meet game creation standards.
This library does not process the data of connected peripherals.
All tasks such as checking for unsupported peripherals (virtual guns) and checking whether peripherals are connected or unconnected are all done on the application side.
- ●Policy
- The peripheral acquisition process is created based on the following policy to provide flexible support to users.
- We will support peripherals that will be released in the future as much as possible.
- Take measures against failures.
- ●Method
- Specify the following items for input specifications when initializing the library.
- (1) Number of peripherals to be acquired (2) Size of data to be acquired
- (example)
- < Input specified value>
- Number of peripherals to get = 9
- Data size to retrieve = 3
- < Connection Status>
- Main unit connector 1 = Shuttle mouse
- Main body connector 2 = Multi terminal 6
- Multi-tap connector 1=Saturn standard PAD
- Multi-tap connector 2 = not connected
- Multitap connector 3=Mission stick
- Multi-tap connector 4=not connected
- Multi-tap connector 5=not connected
- Multitap connector 6=Saturn keyboard
- < Output 1: Peripheral data output>
- The library is divided into peripheral ID → peripheral type + data size and output.
No. | Peripheral type | Data size | Peripheral data (effective number of bytes) |
0 | pointing | 3 | Acquired data (3) |
1 | Digital | 2 | Acquired data (2) |
2 | disconnected | disconnected | undefined value |
3 | analog | 5 | Acquired data (3) |
4 | disconnected | disconnected | undefined value |
5 | disconnected | disconnected | undefined value |
6 | keyboard | 3 | Acquired data (3) |
7 | undefined value | undefined value | undefined value |
8 | undefined value | undefined value | undefined value |
- < Output 2: Multi-tap information data output>
| Multi-tap ID | Number of multi-tap connectors |
Main unit terminal 1 | direct connection | 1 |
Main unit terminal 2 | multi-tap connection | 6 |
■Calling sequence
- Recommended example pattern (3) calling sequence
#difine GET_NUM (9) /* Number of peripheral data you want to get */
#difine GET_SIZE (4) /* Maximum data size of the corresponding peripheral */
#define WORKSIZE (GET_NUM * (GET_SIZE + 2) * 2) + GET_SIZE) /* Work size */
Uint32 work[WORKSIZE / 4]; /* Peripheral data acquisition work area */
/* Note: Be sure to define it as a global variable */
typedef struct {
Uint8 type;
Uint8 size;
Uint16 data;
Uint8 extend_data[(GET_SIZE - 2)];
}PeriData;
PerGetSys *sys_data; /* System data */
PeriData *get_per; /* Peripheral output data pointer */
PerMulInfo *mul_info;
Uint8 *get_tim; /* Time output data pointer */
- Into back initialization (1) (immediately after V-BLANK OUT processing)
PER_LInit(PER_KD_SYS, 0, 0, 0, NULL, 0); /* Specify system data acquisition */
...
●Intback initialization (3) (immediately after V-BLANK OUT processing)
sys_data = PER_GET_SYS(); /* Get system data */
PER_LInit(PER_KD_PERTIM, GET_NUM, GET_SIZE, work, 0);
/* Specify peripheral data + time data acquisition. V-BLANK skip count is 0 */
set_imask(0xF); /* Disable all interrupts */
INT_SetScuFunc(INT_MSK_VBLK_OUT, vblank_out ); /* Register V-BLANK_OUT interrupt function */
INT_ChgMsk(INT_MSK_VBLK_OUT, INT_MSK_NULL); /* V-BLANK_OUT interrupt enable */
set_imask(0); /* Enable all interrupts */
...
● Normally, MAIN-LOOP processing (immediately after V-BLANK OUT processing)
...
get_tim = PER_GET_TIM(); /* Get time */
if((mul_info[0].con + mul_info[1]) >= 3 ){ /* Check the number of valid terminals */
if( (get_per[2].id != PER_ID_NCON_UNKNOWN) && /* Unconnected check */
(get_per[2].id != PER_ID_PNT) ){ /* Non-mouse check */
if(((get_per[2].data) & PER_DGT_U) == PER_DGT_U){
/* Is the current peripheral data of connector 3 UP? */
...
●V-BLANK OUT interrupt processing from the second time onwards
void vblank_out(void){
SCL_VblankEnd(); /* Give top priority to frame buffer switching */
PER_LGetPer((PerGetPer **)&get_per, &mul_info); /* Get peripheral data */
}