Ricoh RP-5C01
This page was last modified 02:07, 24 April 2017 by RetroTechie. Based on work by Mars2000you and Sander and others.
Ricoh RP-5C01

Contents

The clock chip

An RP-5C01 clock chip (or compatible) can be found in most MSX2 and higher computers. Besides time and calendar features, it stores parameters that are used every time the computer boots. This data is battery-backed.

Memory

Nibbles

This chip has four memory blocks. However, they are not organized in 8 bits registers, but in 4 bits registers (as nibbles). There are 13 nibbles in each block for the storage of data. The three last nibbles are used for programming the clock chip.

Registers (Nibbles)
0 to C Data storage
D Mode Register
E Test Register
F Reset Register


Data storage

All the stored parameters are described later in this text with reference to the file used by emulators to store these data.

Block
0 Current Time and Day
1 Alarm, Hour Mode, Year Type
2 Adjust, Screen, Beep, Logo Screen, Language
3 Title, Password, Prompt


Special Registers

Mode Register (Register D)

Bit Name Remark
3 TE Enable Seconds (0=Freeze, 1=Active)
2 AE Alarm Enable (0=Disable, 1=Enable) Not used in MSX
1-0 M1-0 Select Block


Test Register (Register E)

Bit Name
3 T3 Increment Days at a rate of 16384Hz
2 T2 Increment Hours at a rate of 16384Hz
1 T1 Increment Minutes at a rate of 16384Hz
0 T0 Increment Seconds at a rate of 16384Hz


Reset Register (Register F)

Bit Name Remark
3 C1 Enable 1Hz clock output (0=Enable) Not used in MSX
2 C16 Enable 16Hz clock output (0=Enable?) Not used in MSX
1 CR Reset fractions smaller than 1 second (1=Reset)
0 AR Reset all Alarm Registers to zero (1=Reset)


Tools for programming

I/O Ports

Port 0B4h allows to select the RTC register (0-15) for writing, port 0B5h allows to read or write specific data in the RTC. Bits 4 to 7 of these ports are not used.

BIOS Routines

The MSX standard does not recommend to use directly the I/O ports. It's better to use the routines REDCLK (01F5H) and WRTCLK (01F9H) that are available in the MSX2 subrom.

References


The data stored in the RTC

Preliminary remark: this section make a comparison between the real chip and the file used in the emulators to store the RTC data. You will notice some differences, as this file has a size of 53 bytes in blueMSX (52 bytes in openMSX). Besides, the Russian Yamaha computers with network have an additionnal byte that comes after #26 in blueMSX, so, for these machines, #27 to #34 are replaced by #28 to #35 in blueMSX.

Block 0

This block stores the current time, day of the week and date.

Register Bit 3 Bit 2 Bit 1 Bit 0 Data
0 x x x x Units counter for seconds
1 - x x x Tens counter for seconds
2 x x x x Units counter for minutes
3 - x x x Tens counter for minutes
4 x x x x Units counter for hours
5 - - x x Tens counter for hours
6 - x x x Weekday counter
7 x x x x Units counter for days of the month
8 - - x x Tens counter for days of the month
9 x x x x Units counter for months
A - - - x Tens counter for months
B x x x x Units counter for years
C x x x x Tens counter for years


Current Time (registers 0 to 5 of block 0)

  • #00 and #01 in blueMSX and openMSX

These bytes store the seconds of the current time by starting with the last digit and ending with the first digit of the seconds.

Example for 43 seconds: 03 in #00 and 04 in #01

  • #02 and #03 in blueMSX and openMSX

These bytes store the minutes of the current time by starting with the last digit and ending with the first digit of the minutes.

Example for 18 minutes: 08 in #02 and 01 in #03

  • #04 and #05 in blueMSX and openMSX

These bytes store the hours of the current time by starting with the last digit and ending with the first digit of the hours.

Example for 21 hours: 01 in #04 and 02 in #05

Current Day of the Week (register 6 of block 0)

  • #06 in blueMSX and openMSX

This byte stores a value from 00 to 06 corresponding to the current day of the week, but this feature is not used in the MSX2 (or higher) computers.

Value Day of the week
00 Sunday
01 Monday
02 Tuesday
03 Wednesday
04 Thursday
05 Friday
06 Saturday


Current Date (registers 7 to C of block 0)

  • #07 and #08 in blueMSX and openMSX

These bytes store the day of the current date by starting with the last digit and ending with the first digit of the date.

Example for 25: 05 in #07 and 02 in #08

  • #09 and #0A in blueMSX and openMSX

These bytes store the month of the current date by starting with the last digit and ending with the first digit of the month.

Example for 10: 00 in #09 and 01 in #0A

  • #0B and #0C in blueMSX and openMSX

These byte store the difference between the year of the current date and 1980, by starting with the last digit and ending with the first digit of the difference.

Example for 2015: 05 in #0B and 03 in #0C (2015 - 1980 = 35)

Block 1

This block stores the alarm time, day of the week and date, the hour mode and the year type.

Register Bit 3 Bit 2 Bit 1 Bit 0 Data
0 - - - - Not used
1 - - - - Not used
2 x x x x Units counter for minutes of alarm
3 - x x x Tens counter for minutes of alarm
4 x x x x Units counter for hours of alarm
5 - - x x Tens counter for hours of alarm
6 - x x x Weekday counter for alarm
7 x x x x Units counter for days of the month (alarm)
8 - - x x Tens counter for days of the month (alarm)
9 - - - - Not used
A - - - x Hour mode
B - - x x Year type
C - - - - Not used


Alarm Time (registers 2 to 5 of block 1)

  • #0F and #10 in blueMSX and openMSX

These bytes store the minutes of the alarm time by starting with the last digit and ending with the first digit of the minutes.

  • #11 and #12 in blueMSX and openMSX

These bytes store the hours of the alarm time by starting with the last digit and ending with the first digit of the hours.

Alarm Day of the Week (register 6 of block 1)

  • #13 in blueMSX and openMSX

This byte is used to store a value from 00 to 06 corresponding to the alarm day of the week, but this feature is not used in the MSX2 (or higher) computers.

Alarm Date (register 7 and 8 of block 1)

  • #14 and #15 in blueMSX and openMSX

These bytes store the day of the alarm date by starting with the last digit and ending with the first digit of the date.

Hour Mode (register A of block 1)

  • #17 in blueMSX and openMSX

This byte stores how the hours are counted:

- from 0 to 11 (AM), and then from 20 to 31 (PM) if stored value is 00
- from 0 to 23 if stored value is 01

On the MSX2 and higher computers, the 24 hour mode is used.

Year Type (register B of block 1)

  • #18 in blueMSX and openMSX

This byte stores a value from 00 to 06 corresponding to the formula R = D MOD 4 with D = difference between year of the current date and 1980 and R = remainder after division of D by 4. When the value of R is 00, it's a leap year with an extra day (29 February).

Block 2

This block stores several parameters of the computer. Note that the file used by the blueMSX emulator includes 2 additionnal data, related to computer and network working.

Register Bit 3 Bit 2 Bit 1 Bit 0 Data
0 x x x x RTC working
1 x x x x x-Adjust
2 x x x x y-Adjust
3 - x x x Screen after booting
4 x x x x Width, low
5 - - x x Width, high
6 x x x x Foreground color
7 x x x x Background color
8 x x x x Border color
9 x x x x Keylist display, keyboardclick, printertype and cassette writing speed
A x x x x Beep
B - - x x Logo screen
C x x x x Language


Computer Working

  • #1A only in blueMSX

This byte has always the 0D value. It's maybe a way to check the working of the computer.

RTC Working (register 0 of block 2)

  • #1B (#1A in openMSX)

This byte needs to have the value 0A. It indicates to the computer that the Real Time Clock is working and that the values stored in the next bytes need to be used. In case of power failure of this chip, the value will become 00 and the computer will use the default parameters that are included in the extension rom (or subrom).

Adjust (registers 1 and 2 of block 2)

  • #1C and #1D in blueMSX (#1B and #1C in openMSX)

The first byte stores the <x> coordinate, the second byte stores the <y> coordinate of the top left point of the MSX screen (without the borders).

Value x or y Value x or y Value x or y Value x or y
00 0 04 -4 08 8 0C 4
01 -1 05 -5 09 7 0D 3
02 -2 06 -6 0A 6 0E 2
03 -3 07 -7 0B 5 0F 1


Screen after booting (register 3 of block 2)

  • #1E in blueMSX (#1D in openMSX)

This byte stores the SCREEN mode and the displaymode that will be used after booting.

Bit Meaning
3 Reserved for future use
2 Originally unused. On newBIOS, sets the video frequency (0=60Hz, 1=50Hz)
1 0=progressive scan, 1=interlacing enabled
0 Text screen mode (screen 0 or screen 1)


It gives the following values:

Value SCREEN Displaymode Frequency (*)
00 0 Normal 60Hz
01 1 Normal 60Hz
02 0 Interlaced 60Hz
03 1 Interlaced 60Hz
04 0 Normal 50Hz
05 1 Normal 50Hz
06 0 Interlaced 50Hz
07 1 Interlaced 50Hz

(*) only with newBIOS

Width after booting (registers 4 and 5 of block 2)

  • #1F and #20 in blueMSX (#1E and #1F in openMSX)

These bytes store the WIDTH value of the screen that will be used afer booting. They need to be read with the formula (16 x value in #20) + value in #1F
Examples:
Width 40 - value 08 in #1F and value 02 in #20 - (16 x 2) + 8 = 40
Width 80 - value 00 in #1F and value 05 in #20 - (16 x 5) + 0 = 80

Colors after booting (registers 6 to 8 of block 2)

  • #21 in blueMSX (#20 in openMSX)

This byte stores the foreground color that will be used afer booting (00 to 0F)

  • #22 in blueMSX (#21 in openMSX)

This byte stores the background color that will be used afer booting (00 to 0F)

  • #23 in blueMSX (#22 in openMSX)

This byte stores the border color that will be used afer booting(00 to 0F)

Other parameters after booting (register 9 of block 2)

  • #24 in blueMSX (#23 in openMSX)

This byte stores 4 parameters that will be used after booting : keylist display, keyboardclick, printertype and cassette writing speed. The last parameter is ignored on MSX Turbo R.

Bit Meaning
3 Cassette writing speed (0=1200 baud, 1=2400 baud)
2 Printer type (0=MSX, 1=No MSX)
1 Keyboardclick (0=No, 1=Yes)
0 Keylist display (0=OFF, 1=ON)


It gives the following values:

Value KEY Keyclick Printer Cassette speed Value KEY Keyclick Printer Cassette speed
00 OFF No MSX 1200 baud 08 OFF No MSX 2400 baud
01 ON No MSX 1200 baud 09 ON No MSX 2400 baud
02 OFF Yes MSX 1200 baud 0A OFF Yes MSX 2400 baud
03 ON Yes MSX 1200 baud 0B ON Yes MSX 2400 baud
04 OFF No No MSX 1200 baud 0C OFF No No MSX 2400 baud
05 ON No No MSX 1200 baud 0D ON No No MSX 2400 baud
06 OFF Yes No MSX 1200 baud 0E OFF Yes No MSX 2400 baud
07 ON Yes No MSX 1200 baud 0F ON Yes No MSX 2400 baud


Remark: In Korean Daewoo CPC-300, using a value corresponding to 'No MSX Printer" has as effect to skip the built-in software MSX-TUTOR when booting.

Beep (register A of block 2)

  • #25 in blueMSX (#24 in openMSX)

This byte stores the timbre (bits 3 and 2) and the volume (bits 1 and 0) of the 'beep' sound. It gives the following values:

Value Timbre Volume Value Timbre Volume
00 1, High tone 1, Very low 08 3, 2-tone 1, Very low
01 1, High tone 2, Low 09 3, 2-tone 2, Low
02 1, High tone 3, Medium 0A 3, 2-tone 3, Medium
03 1, High tone 4, High 0B 3, 2-tone 4, High
04 2, Low tone 1, Very low 0C 4, 3-tone 1, Very low
05 2, Low tone 2, Low 0D 4, 3-tone 2, Low
06 2, Low tone 3, Medium 0E 4, 3-tone 3, Medium
07 2, Low tone 4, High 0F 4, 3-tone 4, High


Logo Screen (register B of block 2)

  • #26 in blueMSX (#25 in openMSX)

This byte stores the colours of the initial logo screen at system startup.

Value Logo screen Background MSX logo Logo rectangle
00 1 Dark blue White Black
01 2 Green White Light blue
02 3 Red White Purple
03 4 Yellow White Red


Network Working

  • #27 only in blueMSX for Russian Yamaha computers with network

This additionnal byte has always the 0D value. It's maybe a way to check the working of the MSX-Network. For these machines, the standard #27 to 34 bytes become #28 to #35.

Language (register C of block 2)

  • #27 in blueMSX (#26 in openMSX)

This byte stores the main language corresponding to the keyboard of the computer, except in the case that the machine comes with a built-in software allowing to choose different languages (for example : the Sony HB-F9P and HB-F9S). For Arabic machines, English or French is viewed as main language.

However, a few computers don't follow these 'rules' (especially the Sony HB-F700D) and there's no any standard language code for the Brazilian machines upgraded to MSX2 or higher.

Machines without specific built-in software to change language:

Value Keyboard Language
00 Japanese
01 Russian (Sanyo and Sony machines)
02 English - International
03 English - UK
04 French
05 German
07 Spanish
09 Korean
0A Russian (only Yamaha machines)


Sony HB-F9P:

Value Language
04 English
05 (default value) Dutch
06 French
07 Italian


Sony HB-F9S:

Value Language
04 English
05 (default value) Spanish
06 French
07 Italian


Block 3

This block stores a string of characters that are used for one of these three features of the computer: the title, the password or the prompt.

Register Bit 3 Bit 2 Bit 1 Bit 0 Data
0 - - x x Type of string
1 x x x x Character 1, low
2 x x x x Character 1, high
3 x x x x Character 2, low
4 x x x x Character 2, high
5 x x x x Character 3, low
6 x x x x Character 3, high
7 x x x x Character 4, low
8 x x x x Character 4, high
9 x x x x Character 5, low
A x x x x Character 5, high
B x x x x Character 6, low
C x x x x Character 6, high


Type of string (register 0 of block 3)

  • #28 in blueMSX (#27 in openMSX)

This byte stores the type of strings of characters X$ that are saved in the next bytes

Value Type
00 Title
01 Password
02 Prompt


Title, Password, Prompt (registers 1 to C of block 3)

  • #29 to #34 in blueMSX (#28 to #33 in openMSX)

If value in #28 is 00 or 02, these bytes store the 6 first characters of the string X$, by using 2 bytes for saving the ASCII code of each character.

Example with "hello!"

- #29: 08 - #2A: 06 - ASCII code of 'h' is 68
- #2B: 05 - #2C: 06 - ASCII code of 'e' is 65
- #2D: 0C - #2D: 06 - ASCII code of 'l' is 6C
- #2E: 0C - #30: 06 - ASCII code of 'l' is 6C
- #31: 0F - #32: 06 - ASCII code of 'o is 6F
- #33: 01 - #34: 02 - ASCII code of '!' is 21

If value in #28 is 01, these bytes are used for the password as following:

- #29 to #2B in blueMSX (#28 to #2A in openMSX)
If a correct password has been entered, these bytes work as a security to avoid that a power failure introduces a wrong password. They need to have always respectively the values 01, 02 and 03.

- #2C to #2F in blueMSX (#2B to #2E in openMSX)
The password is a string of characters X$ (between 0 and 255 characters). These bytes store it in form of a 16bit CRC value.

- #30 in blueMSX (#2F in openMSX)
When the value is different from 00, the computer will read the optional 'key cartridge value' (a 16 bit password) via I/0 port 7F and compare it with the contents of the 4 previous bytes.

- #31 to 34 in blueMSX [#30 to #33 in openMSX)
These bytes are not used for the password.