Shinra team

Nova - Non-volatile RAM and RTC for Amstrad CPC

Introduction

Nova provides a real-time clock and non-volatile (battery backed up) RAM for the CPC.

There are two main uses identified for it, but it can be used to do many things.

The real-time clock can be used by filesystem/mass storage ROMs to set the correct file creation or modification dates.

The NVRAM can be used to store settings from ROMs and other software (but in a lot of cases, it is just as easy to store that on disk).

The RAM is accessed as normal RAM, in 8K pages. The scheme is intentionally not compatible with standard memory expansions. This allow mapping the RAM in and out as needed, which can be very useful if you use it as a debugging tool or a temporary buffer for something that should not use the main RAM for whatever reason.

Ordering information

The card costs 35€ including shipping (it is a bit more expensive than other cards due to the price of the NVRAM chip and battery)

Orders are open. Contact PulkoMandy by email, by IRC (#CPC on freenode) or on the cpcwiki forum for more information and to select a payment method.

Usage documentation

The interface uses port FE82 for mapping the NVRAM in and out. It is possible to map it at any address multiple of &2000.

The high 4 bits determine the base address.

For example:

OUT &FE82,&0x ' to map at 0000-1FFF
OUT &FE82,&2x ' to map at 2000-3FFF
...
OUT &FE82,&Ex ' to map at E000-FFFF

The NVRAM, when it is enabled, masks 8K of RAM or ROM and replaces it with its own contents.

The low 4 bits determine what is mapped:

OUT &FE82,x8 ' map the first 8K page
OUT &FE82,x9 ' map the second 8K page
OUT &FE82,xA ' map the third 8K page
OUT &FE82,xB ' map the fourth 8K page

For the 8K version, only page 4 is available.

Any other value for the 4 low bits unmaps the NVRAM and restores the normal RAM or ROM behavior.

In the fourth page, the last 8 bytes are not normal RAM, but can be used to read and write the time from the realtime clock. So your CPC can know which day and time it is. In the other pages (if available) there is only RAM.

Access to the RTC works this way (assuming the interface is mapped at 6000-7FFF):

OUT &FE82,&6B ' Map page 4 at 6000-7FFF
POKE &7FF8,&40 ' Put the card in RTC read mode (7FF8-7FFF will stop updating)
year = PEEK(&7FFF)
month = PEEK(&7FFE)
day = PEEK(&7FFD)
weekday = PEEK(&7FFC)
hour = PEEK(&7FFB)
minute = PEEK(&7FFA)
second = PEEK(&7FF9)
POKE &7FF8,&00 ' Put the card in running mode (7FF8-7FFF start updating every second again)
OUT &FE82,&00

All values are in BCD format (4 bits for tenths, 4 bits for units)

To set the time:

OUT &FE82,&6B
POKE &7FF8,&80 ' Put the card in RTC write mode
POKE &7FFF,&21 ' for 2021
POKE &7FFE,&02 ' february
' ... and so on ...
POKE &7FF8,&00
OUT &FE82,&00
Valid HTML 4.01 Strict Site fait à La Rache