PROGRAMMER'S GUIDESMPC Interface User's Manual
BackForward
SMPC Interface User's Manual

detail


■ Function

● System management system
The system management system has the following functions.

 function
 Intoback
 Non-intback
 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 disable
 ×
 Cartridge code acquisition
 ×
 Area code acquisition
 ×
 Get system status
 ×
 SMPC memory settings
 ×
 SMPC memory acquisition
 ×
 Time setting
 ×
 Get time
 × 
Issuing a clock change command directly to the SMPC is prohibited.
If you want to use it, use the SYS_CHGSYSCK () function in the system library.

● Peripheral control system
The library supports the following peripherals:

 game machine
 Peripheral name
 Saturn peripheral
 Digital device
 Analog devices
 Pointing device (mouse)
 keyboard
 Multi-tap (6P)
 Mega Drive Peripheral
 3 button PAD
 6 button PAD
 4P adapter
 mouse

● Library-incompatible peripherals
The following peripherals are not supported by this library.
See the documentation for each for details.

  1. Virtual Gun → Reference: Developer's Information STN-41
  2. Voice recognition → Added dedicated library (release date undecided )

■ Processing

● Issuing non-intback commands
This is a non-intback process.

● Issuing an into-back command

● Recommended example
Here are some recommended examples for the following three patterns:

● Explanation of the figure
Main processing
Intoback initialization (1): Specify system data acquisition
Intoback initialization (2): Specify peripheral data acquisition
Intoback initialization (3): Specify peripheral data acquisition + time data acquisition

SMPC processing
(1): System data collection process
(2): Peripheral data collection process
(3): Time data collection process

(1) Pattern 1

* When the game frame is 1 frame

* When 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 >>

<< Non-intback command issuing function >>

<< Intback command issuing function >>

System data acquisition (excluding time)

Peripheral data acquisition, time data acquisition

■ Peripheral control

Peripheral controls should be created to meet the game creation criteria.
This library does not process the data of the connected peripherals.
Checking unsupported peripherals (virtual guns) and checking the connection / non-connection of normal peripherals are all done on the application side.

● Policy
The peripheral acquisition process is created according to the following policy for flexible response to users.

● Method
(1) Number of peripherals to be acquired (2) Data size to be acquired

(example)

<Specified input value>

<Connection status>

<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 (number of valid bytes)
 0
 pointing
 3
 Acquired data (3)
 1
 Digital
 2
 Acquired data (2)
 2
 disconnected
 disconnected
 Indefinite value
 3
 analog
 Five
 Acquired data (3)
 Four
 disconnected
 disconnected
 Indefinite value
 Five
 disconnected
 disconnected
 Indefinite value
 6
 keyboard
 3
 Acquired data (3)
 7
 Indefinite value
 Indefinite value
 Indefinite value
 8
 Indefinite value
 Indefinite value
 Indefinite value

<Output 2: Multi-tap information data output>
 Multitap ID
 Number of multi-tap connectors
 Body terminal 1
 Direct connection
 1
 Body terminal 2
 Multi-tap connection
 6

■ Calling sequence

Calling sequence of pattern (3) of recommended example

#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 * /

● Intoback initialization (1) (immediately after V-BLANK OUT processing)

PER_LInit (PER_KD_SYS, 0, 0, 0, NULL, 0); / * Specify system data acquisition * /
 ...

● Intoback 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); / * All interrupts disabled * /
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 enabled * /
set_imask (0); / * All interrupts are valid * /
...

● Normally, MAIN-LOOP internal 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? * /
    ...

● Normally, the second and subsequent V-BLANK OUT interrupt processing

void vblank_out (void) {
    SCL_VblankEnd (); / * Give top priority to framebuffer switching * /
    PER_LGetPer ((PerGetPer **) & get_per, & mul_info); / * Get peripheral data * /
}


BackForward
PROGRAMMER'S GUIDESMPC Interface User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997