HARDWARE ManualSMPC User's Manual
BackForward
SMPC User's Manual / Chapter 2 SMPC Commands

■ 2.4 Non-reset system management command

The details of the non-reset system management command are shown in a table format. How to read the table of each command and notes are as follows. Also, by using the status flag in all commands, you can manage the double issuance of commands.

● SMPC interrupt
Those described as "occurred" generate an SMPC interrupt to SH-2 via the SCU at the end of the command. In addition, interrupts can be enabled / disabled by setting the SCU.

● IREG, OREG

By using with the status flag (SF)

Can be judged.

● Execution time
Shows the execution time calculated from the number of steps in the SMPC internal firmware. If it collides with an internal task such as RTC increment, the command execution time will change, so it is described in the range of the minimum value and the maximum value.


List | ▲ Back | Next

No.1

INTBACK

Interrupt back

(Get SMPC status)

Command code 10H
SMPC interrupt occurrence IREG 0 ~ 2
OREG 0-31
Execution time max = 320msec
        min = xxx

Function content
Acquires each status and peripheral data of SMPC. This section describes how to get SMPC status. See Chapter 3 for getting peripheral data.

Command parameters
The command parameters of the INTBACK command when acquiring peripheral data are shown below.

● IREG0
IREG0 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100001H SMPC status acquisition switch ( 00H or 01H )
Indefinite initial value / Write Only

IREG0: SMPC status acquisition switch setting value
IREG0 setting value explanation
00H Date and time, cartridge code, area code, terminal status, SMEM,
Does not return each data of the reset button
01H Date and time, cartridge code, area code, terminal status, SMEM,
Returns each data of the reset button

When using the INTBACK command, be sure to set one of the above settings.
IREG0 is also used to control peripherals. See Chapter 3 for usage.

● IREG1
IREG1 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100003H P2MD1 P2MD0 P1MD1 P1MD0 PEN 0 OPE 0
Indefinite
W
Indefinite
W
Indefinite
W
Indefinite
W
Indefinite
W
Indefinite
---
Indefinite
W
Indefinite
---

Bits 7,6: Port 2 mode
Bit 7 Bit 6 explanation
P2MD1 P2MD0
0 0 15 byte mode
0 1 255 byte mode
1 0 SEGA RESERVED ( setting prohibited )
1 1 0 byte mode

Bits 5, 4: Port 1 mode
Bit 5 Bit 4 explanation
P1MD1 P1MD0
0 0 15 byte mode
0 1 255 byte mode
1 0 SEGA RESERVED ( setting prohibited )
1 1 0 byte mode

Bit 3: Peripheral data enable
Bit 3 explanation
PEN
0 Do not return peripheral data
1 Returns peripheral data

Bit 1: Optimization of peripheral data acquisition time
Bit 1 explanation
OPE
0 Optimize
1 Do not optimize

● IREG2
Initial value: Indefinite
IREG2 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100005H F0H
Write Only

Be sure to set F0H to IREG2 when issuing the INTBACK command.

Result parameters
The result parameters limited to SMPC status acquisition are shown below.

● SR
SR bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100061H 0 1 PDE RESB

Bit 5 explanation
PDE
0 No remaining peripheral data
1 Remaining peripheral data available

Bit 4 explanation
PRESB
0 Reset button OFF
1 Reset button ON

● OREG0
OREG0 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100021H STE RESD

Bit 7 explanation
STE
0 Not SET TIME after SMPC cold reset Note 1
1 SET TIME after SMPC cold reset Note 1

Bit 6 explanation
RESD
0 Reset enable
1 Reset disable (default)

Note 1
SMPC cold reset occurs under the following conditions
  1. When the reset switch in the battery box on the back of Sega Saturn is pressed
  2. When the main power is turned on (ON) when the battery is not installed or when it is exhausted
  3. When the battery is inserted while the power is off

● OREG1, OREG2, OREG3
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OREG1 20100023H Year 1000 (BCD) Year 100th (BCD)
OREG2 20100025H Year 10th (BCD) First place in the Christian era (BCD)
OREG3 20100027H Day of the week (hexadecimal) Note 2 Month (hexadecimal) Note 3

Note 2
day of week Sunday Monday Tuesday Wednesday Thursday Friday Saturday
value 0H 1H 2H 3H 4H 5H 6H

Note 3
Month January February March April May June July August September October November December
value 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH

● OREG4, OREG5, OREG6, OREG7, OREG8
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OREG4 20100029H Day 10 (BCD) First place in the day (BCD)
OREG5 2010002BH Toki tenth place (BCD) First place in time (BCD)
OREG6 2010002DH Tenth place (BCD) 1st place (BCD)
OREG7 2010002FH Second place (BCD) First place in seconds (BCD)
OREG8 20100031H 0 0 0 0 0 0 CTG1 CTG0
CTG0: Cartridge code 0
CTG1: Cartridge code 1

● OREG9
OREG9 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100033H Area code (00H ~ 0FH)

code area Main country names, etc.
0H Do not use
1H Japan region Japan
2H Asia NTSC region Taiwan, South Korea, Philippines
3H SEGA RESERVED
4H North America United States, Canada, Latin America NTSC region (Brazil only)
5H SEGA RESERVED
6H SEGA RESERVED
7H SEGA RESERVED
8H SEGA RESERVED
9H SEGA RESERVED
AH SEGA RESERVED
BH SEGA RESERVED
CH European PAL region Europe, Australia, South Africa, Latin America PAL region
DH SEGA RESERVED
EH SEGA RESERVED
FH Do not use

● OREG10
OREG10 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100035H 0 DOTSEL 1 1 MSHNMI 1 SYSRES SNDRES

・ System status 1 (Status of each control signal output from SMPC 0: OFF 1: ON )
-The DOTSEL signal indicates the current screen mode (horizontal resolution). ( 0:320 1:352 )

● OREG11
OREG11 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
20100037H CDRES

・ System status 2 (Status of each control signal output from SMPC 0: OFF 1: ON )
・ " - " Is RESERVED.

● OREG12, OREG13, OREG14, OREG15
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OREG12 20100039H SMEM1 retention data
OREG13 2010003BH SMEM2 retention data
OREG14 2010003DH SMEM3 retention data
OREG15 2010003FH SMEM4 retention data

● OREG31
OREG31 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
2010005FH 0 0 0 1 0 0 0 0

Note: The command code (OREG31) may be overwritten in the peripheral data.

remarks

■ How to use the INTBACK command
This section describes how to use the INTBACK command to get the SMPC status.
The INTBACK command can be used in the following three ways.

  1. Get only SMPC status
  2. Acquire peripheral data following SMPC status acquisition
  3. Get only peripheral data

In this chapter, we will focus on acquiring SMPC status. Here, with respect to the 3. explains to obtain the status of 1. and 2., are described in Chapter 3.

1. 1. How to get only SMPC status
To get only the status, set the command parameters as follows and issue the INTBACK command.

IREG0 setting value = 01H
-Returns date / time, cartridge code, area code, terminal status, SMEM, and reset button mode data.

IREG1 setting value = 00H
・ Terminal 2 mode (P2MD1, P2MD0) = 00B → 15-byte mode
・ Terminal 1 mode (P1MD1, P1MD0) = 00B → 15-byte mode
-Peripheral data enable (PEN) = 0B → Do not return peripheral data
・ Optimization of peripheral acquisition time (OPE) = 0B → Optimize

IREG2 setting value = F0H
・ Please set F0H unconditionally

With the above settings, SF is cleared, the INTBACK command ends, and the result parameters are acquired. It also requests an SMPC interrupt at the end of the command. Execution time is from minimum TBD to maximum TBD.

2. How to get peripheral data following SMPC status acquisition
Following the acquisition of SMPC status, when acquiring peripheral data, set the command parameters as follows and issue the INTBACK command. The setting value of IREG1 can be set to the value desired by the application side.

IREG0 setting value = 01H
-Returns date / time, cartridge code, area code, terminal status, SMEM, and reset button mode data.

IREG1 setting value = 08H
・ Terminal 2 mode (P2MD1, P2MD0) = 00B → 15-byte mode
・ Terminal 1 mode (P1MD1, P1MD0) = 00B → 15-byte mode
-Peripheral data enable (PEN) = 1B → Returns peripheral data
・ Optimization of peripheral acquisition time (OPE) = 0B → Optimize

IREG2 setting value = F0H
・ Please set F0H unconditionally

With the above settings, SMPC will request an SMPC interrupt when it executes a command and sets the result parameters.
When the SMPC interrupt is requested, the SF is "1". The time from issuing the command to completing the result parameter setting is from the minimum TBD to the maximum TBD.
After acquiring the result parameter related to the status, by inverting bit 7 of IREG0, SMPC considers it as continue and continues to acquire peripheral data.

This method is an effective method for applications that acquire various statuses and peripheral data every frame.


List | ▲ Back | Next

No.2

SETSMEM

SMPC memory settings

Command code 17H
SMPC interrupt cannot occur IREG 0 ~ 3
ORAG 31
Execution time max = xxx
        min = 40μsec

Function content
SMPC provides 4-byte battery-backable memory (SMEM). This command sets the data to SMEM.

Command parameters
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
OREG0 20100001H Data setting to SMEM1
OREG1 20100003H Data setting to SMEM2
OREG2 20100005H Data setting to SMEM3
OREG3 20100007H Data setting to SMEM4

Result parameters
OREG31 bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
2010005FH 0 0 0 1 0 1 1 1

remarks
● The contents of SMEM are cleared to 0 at the time of SMPC cold reset.

SMPC cold reset occurs under the following conditions
  1. When the reset switch in the battery box on the back of Sega Saturn is pressed
  2. When the main power is turned on (ON) when the battery is not installed or when it is exhausted
  3. When the battery is inserted while the power is off

● With the SETEMEM command, 4 bytes are set at the same time. When updating the contents, use the INTBACK command to read and demoify the currently held data.

● If the power is turned off (OFF) while issuing the SETEMEM command,

  1. If the internal processing of the SETSMEM command can be executed before the power off sequence, all data will be updated.
  2. If the power off sequence is executed first, the data before issuing the command is retained.


BackForward
HARDWARE ManualSMPC User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997