Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"esbonio.sphinx.buildDir": "${workspaceFolder}/docs/build",
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
"esbonio.sphinx.srcDir": "${workspaceFolder}/docs/source",
"restructuredtext.linter.doc8.extraArgs": [
"--ignore D001"
],
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Key Features
- **64KB System RAM**
- **64KB Extended RAM**
- **VGA and HD Output**
- **8-Channel Stereo Sound Generator**
- **Yamaha OPL2 FM Sound Generator**
- **Protected Operating System**
- **USB** for Keyboard, Mouse, Gamepads, and Storage
- **Bluetooth LE** for Keyboard, Mouse, and Gamepads
- **WiFi** modem emulation
- **WiFi** Hayes modem emulation
- **Real Time Clock** with DST and NTP


Expand Down
77 changes: 46 additions & 31 deletions docs/source/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,52 @@ CLOCK_GETRES
:errno: EINVAL


TZSET
-----

.. c:function:: int void tzset(void);
.. c:function:: int f_tzset (struct _tzset *tz)

.. code-block:: c

struct _tzset
{
int8_t daylight; /* non 0 if daylight savings time active */
int32_t timezone; /* Number of seconds behind UTC */
char tzname[5]; /* Name of timezone, e.g. CET */
char dstname[5]; /* Name when daylight true, e.g. CEST */
};

The virtual f_tzset() is the how tzset() is implemented. Use `help set tz` on the
monitor to learn about configuring your time zone.

:Op code: RIA_OP_TZSET 0x0D
:C proto: time.h
:returns: 0 on success. -1 on error.
:errno: EINVAL


TZQUERY
-------

.. c:function:: struct tm *localtime(const time_t *timep);
.. c:function:: int f_tzquery (uint32_t time, struct _tzquery *dst)

.. code-block:: c

struct _tzquery
{
int8_t daylight; /* non 0 if daylight savings time active */
};

The virtual f_tzquery() is part of how localtime() is implemented.

:Op code: RIA_OP_TZQUERY 0x0E
:C proto: time.h
:returns: Seconds to add to UTC for localtime.
:errno: will not fail


CLOCK_GETTIME
-------------

Expand Down Expand Up @@ -564,37 +610,6 @@ CLOCK_SETTIME
:a regs: return, clock_id
:errno: EINVAL, EUNKNOWN


CLOCK_GETTIMEZONE
-----------------

.. c:function:: int clock_gettimezone (uint32_t time, clockid_t clock_id, struct _timezone *tz)

.. code-block:: c

struct _timezone
{
int8_t daylight; /* >0 if daylight savings time active */
int32_t timezone; /* Number of seconds behind UTC */
char tzname[5]; /* Name of timezone, e.g. CET */
char dstname[5]; /* Name when daylight true, e.g. CEST */
};

Returns a cc65 _timezone structure for the requested time. Use
`help set tz` on the monitor to learn about configuring your time zone.

*** Experimental *** time zones in cc65 are incomplete probably because no
other 6502 OS supports them.

:Op code: RIA_OP_CLOCK_GETTIMEZONE 0x13
:C proto: None, Experimental
:param time: time_t compatible integer.
:param clock_id: 0 for CLOCK_REALTIME.
:returns: 0 on success. -1 on error.
:a regs: return, clock_id
:errno: EINVAL


OPEN
----

Expand Down
43 changes: 24 additions & 19 deletions docs/source/ria.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,25 +199,6 @@ backwards and reverse data. These adders allow for very fast sequential
access, which typically makes up for the slightly slower random access
compared to 6502 system RAM.

RW0 and RW1 are latching. This is important to remember when other
systems change XRAM. For example, when using read_xram() to load XRAM
from a mass storage device, this will not work as expected:

.. code-block:: C

RIA.addr0 = 0x1000;
read_xram(0x1000, 1, fd);
uint8_t result = RIA.rw0; // wrong

Setting ADDR after the expected XRAM change will latch RW to the
latest value.

.. code-block:: C

read_xram(0x1000, 1, fd);
RIA.addr0 = 0x1000;
uint8_t result = RIA.rw0; // correct

Extended Stack (XSTACK)
-----------------------

Expand Down Expand Up @@ -697,3 +678,27 @@ Volume attenuation is logarithmic.
- 8s
- 24s
- 0/256 (silent)


Yamaha OPL2 FM Sound Generator
==============================

The RIA includes a YM3812 FM Sound Generator (OPL2). It is configured
with extended register device 0 channel 1 address 0x01.

Enable and disable the RIA OPL2 by setting the extended register. The
extended register value is the XRAM start address for the 256 OPL2
registers. The OPL2 registers must begin on a page boundary.

.. code-block:: C

xreg(0, 1, 0x01, xaddr); // enable
xreg(0, 1, 0x01, 0xFFFF); // disable

If, for example, xaddr is 0x4200 then the 256 registers of an OPL2 chip
are mapped into XRAM from 0x4200 to 0x42FF. Consult

Timers, interrupts, and the status register are not supported and were
not widely used. These were in Yamaha OPL chips to assist with cost
reducing consumer devices and rarely used in computers which had their
own timers.