Skip to content

Commit 5d59e5c

Browse files
deploy: ce75d65
1 parent 93c1882 commit 5d59e5c

File tree

9 files changed

+174
-119
lines changed

9 files changed

+174
-119
lines changed

_sources/index.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Key Features
2727
- **64KB System RAM**
2828
- **64KB Extended RAM**
2929
- **VGA and HD Output**
30-
- **8-Channel Stereo Sound Generator**
30+
- **Yamaha OPL2 FM Sound Generator**
3131
- **Protected Operating System**
3232
- **USB** for Keyboard, Mouse, Gamepads, and Storage
3333
- **Bluetooth LE** for Keyboard, Mouse, and Gamepads
34-
- **WiFi** modem emulation
34+
- **WiFi** Hayes modem emulation
3535
- **Real Time Clock** with DST and NTP
3636

3737

_sources/os.rst.txt

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,52 @@ CLOCK_GETRES
531531
:errno: EINVAL
532532
533533
534+
TZSET
535+
-----
536+
537+
.. c:function:: int void tzset(void);
538+
.. c:function:: int f_tzset (struct _tzset *tz)
539+
540+
.. code-block:: c
541+
542+
struct _tzset
543+
{
544+
int8_t daylight; /* non 0 if daylight savings time active */
545+
int32_t timezone; /* Number of seconds behind UTC */
546+
char tzname[5]; /* Name of timezone, e.g. CET */
547+
char dstname[5]; /* Name when daylight true, e.g. CEST */
548+
};
549+
550+
The virtual f_tzset() is the how tzset() is implemented. Use `help set tz` on the
551+
monitor to learn about configuring your time zone.
552+
553+
:Op code: RIA_OP_TZSET 0x0D
554+
:C proto: time.h
555+
:returns: 0 on success. -1 on error.
556+
:errno: EINVAL
557+
558+
559+
TZQUERY
560+
-------
561+
562+
.. c:function:: struct tm *localtime(const time_t *timep);
563+
.. c:function:: int f_tzquery (uint32_t time, struct _tzquery *dst)
564+
565+
.. code-block:: c
566+
567+
struct _tzquery
568+
{
569+
int8_t daylight; /* non 0 if daylight savings time active */
570+
};
571+
572+
The virtual f_tzquery() is part of how localtime() is implemented.
573+
574+
:Op code: RIA_OP_TZQUERY 0x0E
575+
:C proto: time.h
576+
:returns: Seconds to add to UTC for localtime.
577+
:errno: will not fail
578+
579+
534580
CLOCK_GETTIME
535581
-------------
536582
@@ -564,37 +610,6 @@ CLOCK_SETTIME
564610
:a regs: return, clock_id
565611
:errno: EINVAL, EUNKNOWN
566612
567-
568-
CLOCK_GETTIMEZONE
569-
-----------------
570-
571-
.. c:function:: int clock_gettimezone (uint32_t time, clockid_t clock_id, struct _timezone *tz)
572-
573-
.. code-block:: c
574-
575-
struct _timezone
576-
{
577-
int8_t daylight; /* >0 if daylight savings time active */
578-
int32_t timezone; /* Number of seconds behind UTC */
579-
char tzname[5]; /* Name of timezone, e.g. CET */
580-
char dstname[5]; /* Name when daylight true, e.g. CEST */
581-
};
582-
583-
Returns a cc65 _timezone structure for the requested time. Use
584-
`help set tz` on the monitor to learn about configuring your time zone.
585-
586-
*** Experimental *** time zones in cc65 are incomplete probably because no
587-
other 6502 OS supports them.
588-
589-
:Op code: RIA_OP_CLOCK_GETTIMEZONE 0x13
590-
:C proto: None, Experimental
591-
:param time: time_t compatible integer.
592-
:param clock_id: 0 for CLOCK_REALTIME.
593-
:returns: 0 on success. -1 on error.
594-
:a regs: return, clock_id
595-
:errno: EINVAL
596-
597-
598613
OPEN
599614
----
600615

_sources/ria.rst.txt

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,6 @@ backwards and reverse data. These adders allow for very fast sequential
199199
access, which typically makes up for the slightly slower random access
200200
compared to 6502 system RAM.
201201

202-
RW0 and RW1 are latching. This is important to remember when other
203-
systems change XRAM. For example, when using read_xram() to load XRAM
204-
from a mass storage device, this will not work as expected:
205-
206-
.. code-block:: C
207-
208-
RIA.addr0 = 0x1000;
209-
read_xram(0x1000, 1, fd);
210-
uint8_t result = RIA.rw0; // wrong
211-
212-
Setting ADDR after the expected XRAM change will latch RW to the
213-
latest value.
214-
215-
.. code-block:: C
216-
217-
read_xram(0x1000, 1, fd);
218-
RIA.addr0 = 0x1000;
219-
uint8_t result = RIA.rw0; // correct
220-
221202
Extended Stack (XSTACK)
222203
-----------------------
223204

@@ -697,3 +678,27 @@ Volume attenuation is logarithmic.
697678
- 8s
698679
- 24s
699680
- 0/256 (silent)
681+
682+
683+
Yamaha OPL2 FM Sound Generator
684+
==============================
685+
686+
The RIA includes a YM3812 FM Sound Generator (OPL2). It is configured
687+
with extended register device 0 channel 1 address 0x01.
688+
689+
Enable and disable the RIA OPL2 by setting the extended register. The
690+
extended register value is the XRAM start address for the 256 OPL2
691+
registers. The OPL2 registers must begin on a page boundary.
692+
693+
.. code-block:: C
694+
695+
xreg(0, 1, 0x01, xaddr); // enable
696+
xreg(0, 1, 0x01, 0xFFFF); // disable
697+
698+
If, for example, xaddr is 0x4200 then the 256 registers of an OPL2 chip
699+
are mapped into XRAM from 0x4200 to 0x42FF. Consult
700+
701+
Timers, interrupts, and the status register are not supported and were
702+
not widely used. These were in Yamaha OPL chips to assist with cost
703+
reducing consumer devices and rarely used in computers which had their
704+
own timers.

genindex.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ <h2 id="C">C</h2>
6262
<li><a href="os.html#c.clock">clock (C function)</a>
6363
</li>
6464
<li><a href="os.html#c.clock_getres">clock_getres (C function)</a>
65-
</li>
66-
<li><a href="os.html#c.clock_gettime">clock_gettime (C function)</a>
6765
</li>
6866
</ul></td>
6967
<td style="width: 33%; vertical-align: top;"><ul>
70-
<li><a href="os.html#c.clock_gettimezone">clock_gettimezone (C function)</a>
68+
<li><a href="os.html#c.clock_gettime">clock_gettime (C function)</a>
7169
</li>
7270
<li><a href="os.html#c.clock_settime">clock_settime (C function)</a>
7371
</li>
@@ -109,10 +107,10 @@ <h2 id="F">F</h2>
109107
</li>
110108
<li><a href="os.html#c.f_mkdir">f_mkdir (C function)</a>
111109
</li>
112-
</ul></td>
113-
<td style="width: 33%; vertical-align: top;"><ul>
114110
<li><a href="os.html#c.f_opendir">f_opendir (C function)</a>
115111
</li>
112+
</ul></td>
113+
<td style="width: 33%; vertical-align: top;"><ul>
116114
<li><a href="os.html#c.f_readdir">f_readdir (C function)</a>
117115
</li>
118116
<li><a href="os.html#c.f_rewinddir">f_rewinddir (C function)</a>
@@ -124,6 +122,10 @@ <h2 id="F">F</h2>
124122
<li><a href="os.html#c.f_stat">f_stat (C function)</a>
125123
</li>
126124
<li><a href="os.html#c.f_telldir">f_telldir (C function)</a>
125+
</li>
126+
<li><a href="os.html#c.f_tzquery">f_tzquery (C function)</a>
127+
</li>
128+
<li><a href="os.html#c.f_tzset">f_tzset (C function)</a>
127129
</li>
128130
<li><a href="os.html#c.f_utime">f_utime (C function)</a>
129131
</li>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ <h2>Key Features<a class="headerlink" href="#key-features" title="Permalink to t
5757
<li><p><strong>64KB System RAM</strong></p></li>
5858
<li><p><strong>64KB Extended RAM</strong></p></li>
5959
<li><p><strong>VGA and HD Output</strong></p></li>
60-
<li><p><strong>8-Channel Stereo Sound Generator</strong></p></li>
60+
<li><p><strong>Yamaha OPL2 FM Sound Generator</strong></p></li>
6161
<li><p><strong>Protected Operating System</strong></p></li>
6262
<li><p><strong>USB</strong> for Keyboard, Mouse, Gamepads, and Storage</p></li>
6363
<li><p><strong>Bluetooth LE</strong> for Keyboard, Mouse, and Gamepads</p></li>
64-
<li><p><strong>WiFi</strong> modem emulation</p></li>
64+
<li><p><strong>WiFi</strong> Hayes modem emulation</p></li>
6565
<li><p><strong>Real Time Clock</strong> with DST and NTP</p></li>
6666
</ul>
6767
</div>

objects.inv

6 Bytes
Binary file not shown.

os.html

Lines changed: 73 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -695,52 +695,90 @@ <h3>CLOCK_GETRES<a class="headerlink" href="#clock-getres" title="Permalink to t
695695
</dd></dl>
696696

697697
</div>
698-
<div class="section" id="clock-gettime">
699-
<h3>CLOCK_GETTIME<a class="headerlink" href="#clock-gettime" title="Permalink to this headline"></a></h3>
698+
<div class="section" id="tzset">
699+
<h3>TZSET<a class="headerlink" href="#tzset" title="Permalink to this headline"></a></h3>
700700
<dl class="function">
701-
<dt id="c.clock_gettime">
702-
int <code class="sig-name descname">clock_gettime</code><span class="sig-paren">(</span>clockid_t<em> clock_id</em>, struct timespec<em> *tp</em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_gettime" title="Permalink to this definition"></a></dt>
703-
<dd><div class="line-block">
704-
<div class="line"><br /></div>
701+
<dt>
702+
<code class="sig-name descname">int void tzset(void);</code></dt>
703+
<dd></dd></dl>
704+
705+
<dl class="function">
706+
<dt id="c.f_tzset">
707+
int <code class="sig-name descname">f_tzset</code><span class="sig-paren">(</span>struct _tzset<em> *tz</em><span class="sig-paren">)</span><a class="headerlink" href="#c.f_tzset" title="Permalink to this definition"></a></dt>
708+
<dd><div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">_tzset</span>
709+
<span class="p">{</span>
710+
<span class="kt">int8_t</span> <span class="n">daylight</span><span class="p">;</span> <span class="cm">/* non 0 if daylight savings time active */</span>
711+
<span class="kt">int32_t</span> <span class="n">timezone</span><span class="p">;</span> <span class="cm">/* Number of seconds behind UTC */</span>
712+
<span class="kt">char</span> <span class="n">tzname</span><span class="p">[</span><span class="mi">5</span><span class="p">];</span> <span class="cm">/* Name of timezone, e.g. CET */</span>
713+
<span class="kt">char</span> <span class="n">dstname</span><span class="p">[</span><span class="mi">5</span><span class="p">];</span> <span class="cm">/* Name when daylight true, e.g. CEST */</span>
714+
<span class="p">};</span>
715+
</pre></div>
705716
</div>
706-
<p>Obtains the current time.</p>
717+
<p>The virtual f_tzset() is the how tzset() is implemented. Use <cite>help set tz</cite> on the
718+
monitor to learn about configuring your time zone.</p>
707719
<dl class="field-list simple">
708720
<dt class="field-odd">Op code</dt>
709-
<dd class="field-odd"><p>RIA_OP_CLOCK_GETTIME 0x11</p>
721+
<dd class="field-odd"><p>RIA_OP_TZSET 0x0D</p>
710722
</dd>
711723
<dt class="field-even">C proto</dt>
712724
<dd class="field-even"><p>time.h</p>
713725
</dd>
714-
<dt class="field-odd">Parameters</dt>
715-
<dd class="field-odd"><ul class="simple">
716-
<li><p><strong>clock_id</strong> – 0 for CLOCK_REALTIME.</p></li>
717-
</ul>
726+
<dt class="field-odd">Returns</dt>
727+
<dd class="field-odd"><p>0 on success. -1 on error.</p>
718728
</dd>
719-
<dt class="field-even">Returns</dt>
720-
<dd class="field-even"><p>0 on success. -1 on error.</p>
729+
<dt class="field-even">Errno</dt>
730+
<dd class="field-even"><p>EINVAL</p>
721731
</dd>
722-
<dt class="field-odd">A regs</dt>
723-
<dd class="field-odd"><p>return, clock_id</p>
732+
</dl>
733+
</dd></dl>
734+
735+
</div>
736+
<div class="section" id="tzquery">
737+
<h3>TZQUERY<a class="headerlink" href="#tzquery" title="Permalink to this headline"></a></h3>
738+
<dl class="function">
739+
<dt>
740+
<code class="sig-name descname">struct tm *localtime(const time_t *timep);</code></dt>
741+
<dd></dd></dl>
742+
743+
<dl class="function">
744+
<dt id="c.f_tzquery">
745+
int <code class="sig-name descname">f_tzquery</code><span class="sig-paren">(</span>uint32_t<em> time</em>, struct _tzquery<em> *dst</em><span class="sig-paren">)</span><a class="headerlink" href="#c.f_tzquery" title="Permalink to this definition"></a></dt>
746+
<dd><div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">_tzquery</span>
747+
<span class="p">{</span>
748+
<span class="kt">int8_t</span> <span class="n">daylight</span><span class="p">;</span> <span class="cm">/* non 0 if daylight savings time active */</span>
749+
<span class="p">};</span>
750+
</pre></div>
751+
</div>
752+
<p>The virtual f_tzquery() is part of how localtime() is implemented.</p>
753+
<dl class="field-list simple">
754+
<dt class="field-odd">Op code</dt>
755+
<dd class="field-odd"><p>RIA_OP_TZQUERY 0x0E</p>
756+
</dd>
757+
<dt class="field-even">C proto</dt>
758+
<dd class="field-even"><p>time.h</p>
759+
</dd>
760+
<dt class="field-odd">Returns</dt>
761+
<dd class="field-odd"><p>Seconds to add to UTC for localtime.</p>
724762
</dd>
725763
<dt class="field-even">Errno</dt>
726-
<dd class="field-even"><p>EINVAL, EUNKNOWN</p>
764+
<dd class="field-even"><p>will not fail</p>
727765
</dd>
728766
</dl>
729767
</dd></dl>
730768

731769
</div>
732-
<div class="section" id="clock-settime">
733-
<h3>CLOCK_SETTIME<a class="headerlink" href="#clock-settime" title="Permalink to this headline"></a></h3>
770+
<div class="section" id="clock-gettime">
771+
<h3>CLOCK_GETTIME<a class="headerlink" href="#clock-gettime" title="Permalink to this headline"></a></h3>
734772
<dl class="function">
735-
<dt id="c.clock_settime">
736-
int <code class="sig-name descname">clock_settime</code><span class="sig-paren">(</span>clockid_t<em> clock_id</em>, const struct timespec<em> *tp</em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_settime" title="Permalink to this definition"></a></dt>
773+
<dt id="c.clock_gettime">
774+
int <code class="sig-name descname">clock_gettime</code><span class="sig-paren">(</span>clockid_t<em> clock_id</em>, struct timespec<em> *tp</em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_gettime" title="Permalink to this definition"></a></dt>
737775
<dd><div class="line-block">
738776
<div class="line"><br /></div>
739777
</div>
740-
<p>Sets the current time.</p>
778+
<p>Obtains the current time.</p>
741779
<dl class="field-list simple">
742780
<dt class="field-odd">Op code</dt>
743-
<dd class="field-odd"><p>RIA_OP_CLOCK_SETTIME 0x12</p>
781+
<dd class="field-odd"><p>RIA_OP_CLOCK_GETTIME 0x11</p>
744782
</dd>
745783
<dt class="field-even">C proto</dt>
746784
<dd class="field-even"><p>time.h</p>
@@ -763,34 +801,24 @@ <h3>CLOCK_SETTIME<a class="headerlink" href="#clock-settime" title="Permalink to
763801
</dd></dl>
764802

765803
</div>
766-
<div class="section" id="clock-gettimezone">
767-
<h3>CLOCK_GETTIMEZONE<a class="headerlink" href="#clock-gettimezone" title="Permalink to this headline"></a></h3>
804+
<div class="section" id="clock-settime">
805+
<h3>CLOCK_SETTIME<a class="headerlink" href="#clock-settime" title="Permalink to this headline"></a></h3>
768806
<dl class="function">
769-
<dt id="c.clock_gettimezone">
770-
int <code class="sig-name descname">clock_gettimezone</code><span class="sig-paren">(</span>uint32_t<em> time</em>, clockid_t<em> clock_id</em>, struct _timezone<em> *tz</em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_gettimezone" title="Permalink to this definition"></a></dt>
771-
<dd><div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">_timezone</span>
772-
<span class="p">{</span>
773-
<span class="kt">int8_t</span> <span class="n">daylight</span><span class="p">;</span> <span class="cm">/* &gt;0 if daylight savings time active */</span>
774-
<span class="kt">int32_t</span> <span class="n">timezone</span><span class="p">;</span> <span class="cm">/* Number of seconds behind UTC */</span>
775-
<span class="kt">char</span> <span class="n">tzname</span><span class="p">[</span><span class="mi">5</span><span class="p">];</span> <span class="cm">/* Name of timezone, e.g. CET */</span>
776-
<span class="kt">char</span> <span class="n">dstname</span><span class="p">[</span><span class="mi">5</span><span class="p">];</span> <span class="cm">/* Name when daylight true, e.g. CEST */</span>
777-
<span class="p">};</span>
778-
</pre></div>
807+
<dt id="c.clock_settime">
808+
int <code class="sig-name descname">clock_settime</code><span class="sig-paren">(</span>clockid_t<em> clock_id</em>, const struct timespec<em> *tp</em><span class="sig-paren">)</span><a class="headerlink" href="#c.clock_settime" title="Permalink to this definition"></a></dt>
809+
<dd><div class="line-block">
810+
<div class="line"><br /></div>
779811
</div>
780-
<p>Returns a cc65 _timezone structure for the requested time. Use
781-
<cite>help set tz</cite> on the monitor to learn about configuring your time zone.</p>
782-
<p><strong>* Experimental *</strong> time zones in cc65 are incomplete probably because no
783-
other 6502 OS supports them.</p>
812+
<p>Sets the current time.</p>
784813
<dl class="field-list simple">
785814
<dt class="field-odd">Op code</dt>
786-
<dd class="field-odd"><p>RIA_OP_CLOCK_GETTIMEZONE 0x13</p>
815+
<dd class="field-odd"><p>RIA_OP_CLOCK_SETTIME 0x12</p>
787816
</dd>
788817
<dt class="field-even">C proto</dt>
789-
<dd class="field-even"><p>None, Experimental</p>
818+
<dd class="field-even"><p>time.h</p>
790819
</dd>
791820
<dt class="field-odd">Parameters</dt>
792821
<dd class="field-odd"><ul class="simple">
793-
<li><p><strong>time</strong> – time_t compatible integer.</p></li>
794822
<li><p><strong>clock_id</strong> – 0 for CLOCK_REALTIME.</p></li>
795823
</ul>
796824
</dd>
@@ -801,7 +829,7 @@ <h3>CLOCK_GETTIMEZONE<a class="headerlink" href="#clock-gettimezone" title="Perm
801829
<dd class="field-odd"><p>return, clock_id</p>
802830
</dd>
803831
<dt class="field-even">Errno</dt>
804-
<dd class="field-even"><p>EINVAL</p>
832+
<dd class="field-even"><p>EINVAL, EUNKNOWN</p>
805833
</dd>
806834
</dl>
807835
</dd></dl>
@@ -2076,9 +2104,10 @@ <h3>Navigation</h3>
20762104
<li class="toctree-l3"><a class="reference internal" href="#errno-opt">ERRNO_OPT</a></li>
20772105
<li class="toctree-l3"><a class="reference internal" href="#clock">CLOCK</a></li>
20782106
<li class="toctree-l3"><a class="reference internal" href="#clock-getres">CLOCK_GETRES</a></li>
2107+
<li class="toctree-l3"><a class="reference internal" href="#tzset">TZSET</a></li>
2108+
<li class="toctree-l3"><a class="reference internal" href="#tzquery">TZQUERY</a></li>
20792109
<li class="toctree-l3"><a class="reference internal" href="#clock-gettime">CLOCK_GETTIME</a></li>
20802110
<li class="toctree-l3"><a class="reference internal" href="#clock-settime">CLOCK_SETTIME</a></li>
2081-
<li class="toctree-l3"><a class="reference internal" href="#clock-gettimezone">CLOCK_GETTIMEZONE</a></li>
20822111
<li class="toctree-l3"><a class="reference internal" href="#open">OPEN</a></li>
20832112
<li class="toctree-l3"><a class="reference internal" href="#close">CLOSE</a></li>
20842113
<li class="toctree-l3"><a class="reference internal" href="#read">READ</a></li>

0 commit comments

Comments
 (0)