Skip to content

Commit f8f890b

Browse files
clock_gettimezone updated
1 parent 50c369e commit f8f890b

File tree

4 files changed

+64
-17
lines changed

4 files changed

+64
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/docs/build
2+
/venv/

.vscode/settings.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"esbonio.sphinx.buildDir" : "${workspaceFolder}/docs/build",
3-
"esbonio.sphinx.confDir" : "${workspaceFolder}/docs/source",
4-
"esbonio.sphinx.srcDir" : "${workspaceFolder}/docs/source",
2+
"esbonio.sphinx.buildDir": "${workspaceFolder}/docs/build",
3+
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
4+
"esbonio.sphinx.srcDir": "${workspaceFolder}/docs/source",
5+
"restructuredtext.linter.doc8.extraArgs": [
6+
"--ignore D001"
7+
],
58
}

docs/source/api.rst

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Functions that move bulk data may come in two flavors. These are any function wi
7979
2.3.1. Bulk XSTACK Operations
8080
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8181

82-
These only work if the count is 256 or less. Bulk data is passed on the XSTACK, which is 256 bytes. A pointer appears in the C prototype to indicate the type and direction of this data. Let's look at some examples.
82+
These only work if the count is 512 or less. Bulk data is passed on the XSTACK, which is 512 bytes. A pointer appears in the C prototype to indicate the type and direction of this data. Let's look at some examples.
8383

8484
.. code-block:: C
8585
@@ -131,9 +131,9 @@ xreg
131131
132132
.. c:function:: int xregn(char device, char channel, unsigned char address, unsigned count, ...);
133133
134-
Use xreg() with cc65 and xregn() with LLVM-MOS. The only difference is that xregn() requires a count of the variadic arguments.
134+
The only difference is that xregn() requires a count of the variadic arguments. Using xreg() avoids making a counting error and is slightly smaller in CC65.
135135

136-
Set extended registers on a PIX device. See the :doc:`ria` and :doc:`vga` documentation for what each register does. Setting extended registers can fail, which you should use for feature detection. EINVAL means the device responded with a negative acknowledgementg. EIO means there was a timeout waiting for ack/nak.
136+
Set extended registers on a PIX device. See the :doc:`ria` and :doc:`vga` documentation for what each register does. Setting extended registers can fail, which you should use for feature detection. EINVAL means the device responded with a negative acknowledgement. EIO means there was a timeout waiting for ack/nak.
137137

138138
:param device: PIX device ID. 0-6
139139
:param channel: PIX channel. 0-15
@@ -149,7 +149,7 @@ phi2
149149
150150
Retrieves the PHI2 setting from the RIA. Applications can use this for adjusting to or rejecting different clock speeds.
151151
152-
:returns: The 6502 clock speed in kHz. 500 <= x <= 8000
152+
:returns: The 6502 clock speed in kHz. Typically 750 <= x <= 8000.
153153
:errno: will not fail
154154
155155
@@ -205,6 +205,13 @@ clock_getres
205205
206206
.. c:function:: int clock_getres(clockid_t clock_id, struct timespec *res)
207207
208+
.. code-block:: c
209+
210+
struct timespec {
211+
uint32_t tv_sec; /* seconds */
212+
int32_t tv_nsec; /* nanoseconds */
213+
};
214+
208215
Copies the clock resolution to `res`.
209216
210217
:param clock_id: 0 for CLOCK_REALTIME.
@@ -242,14 +249,25 @@ clock_settime
242249
clock_gettimezone
243250
-----------------
244251
245-
.. c:function:: int clock_gettimezone(clockid_t clock_id, struct _timezone *tz)
252+
.. c:function:: int clock_gettimezone(uint32_t time, clockid_t clock_id, struct _timezone *tz)
253+
254+
.. code-block:: c
246255
247-
Not implemented. Always fails.
256+
struct _timezone
257+
{
258+
int8_t daylight; /* >0 if daylight savings time active */
259+
int32_t timezone; /* Number of seconds behind UTC */
260+
char tzname[5]; /* Name of timezone, e.g. CET */
261+
char dstname[5]; /* Name when daylight true, e.g. CEST */
262+
};
248263
264+
Populates a CC65 _timezone structure for the requested time. Use `help set tz` on the monitor to learn about configuring your time zone.
265+
266+
:param time: time_t compatible integer.
249267
:param clock_id: 0 for CLOCK_REALTIME.
250-
:returns: -1 always.
268+
:returns: 0 on success. -1 on error.
251269
:a regs: return, clock_id
252-
:errno: ENOSYS
270+
:errno: EINVAL
253271
254272
255273
open

docs/source/hardware.rst

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,47 @@ Schematic
66

77
`Picocomputer 6502 <_static/2023-06-07-rp6502.pdf>`_ (pdf)
88

9-
I use "Picocomputer 6502" to refer to the reference design. Please use a differentiating name if you change the hardware. For example, "Picocomputer VERA" or "Ulf's Dream Computer". Think about what people asking for help should call the device and go with that.
9+
10+
Memory Map
11+
----------
12+
13+
There is no ROM. Nothing in zero page is used or reserved. There isn't a book-sized list to study. The Picocomputer design lets you start with a clean slate for every project. VGA, USB, and WiFi are all accessed using the 32 registers of the RIA.
14+
15+
.. list-table::
16+
:widths: 25 75
17+
:header-rows: 1
18+
19+
* - Address
20+
- Description
21+
* - 0000-FEFF
22+
- RAM, 63.75K
23+
* - FF00-FFCF
24+
- Unassigned
25+
* - FFD0-FFDF
26+
- VIA, see the `WDC datasheet <https://www.westerndesigncenter.com/wdc/w65c22-chip.php>`_
27+
* - FFE0-FFFF
28+
- RIA, see the :doc:`RP6502 datasheet <ria>`
29+
* - 10000-1FFFF
30+
- RAM, 64K for :doc:`RIA <ria>` and :doc:`VGA <vga>`
31+
32+
The unassigned space is available for hardware experimenters. You will need to redesign the address decoder logic hardware to use this address space. It is recommended that additional VIAs be added "down" and other hardware added "up". For example: VIA0 at FFD0, VIA1 at FFC0, SID0 at FF00, and SID1 at FF20.
33+
34+
I use "Picocomputer 6502" to refer to the reference design with the above memory map. Please use a differentiating name if you change the hardware. For example, "Picocomputer VERA" or "Ulf's Dream Computer". Think about what people asking for help should call the device and go with that.
1035

1136
Buying a Picocomputer
1237
---------------------
1338

1439
You will need to place two orders. First, for the Printed Circuit Board. Second, for the electronic components. Some PCB factories will do the soldering for you, but you'll still need to order the ICs and plug them into sockets.
1540

16-
I have circuit boards in a `Tindie store <https://www.tindie.com/stores/rumbledethumps/>`_ that ships to the United States. International shipping is either too slow or too much when compared to getting boards made locally or in China.
41+
I have circuit boards in a `Tindie store <https://www.tindie.com/stores/rumbledethumps/>`_ that ships only to the United States. International shipping is either too slow or too expensive when compared to getting boards made locally or in China.
42+
43+
USA import tariffs are not an issue with this project. Only a few dollars of resistors are made in China. Orders to my store and Mouser ship from the USA so you won't get a surprise bill from the courier.
1744

1845
Step 0. Read This
1946
=================
2047

2148
The boot message does not say COLOR anymore. Do not assume your device will behave exactly the same as an old YouTube video.
2249

23-
USB hub and device support isn't perfect but everyone so far has been able to find working devices. Sometimes swapping hub ports helps.
24-
2550
The three-pin debug connections under the RIA aren't used anymore. This is an artifact of early development.
2651

2752
Most VGA-to-HDMI cables can get power from the Picocomputer. Some will need external power applied. All are zero lag.
@@ -75,7 +100,7 @@ Step 5. Pi Pico Firmware
75100

76101
Download the `UF2 files <https://github.com/picocomputer/rp6502/releases>`_.
77102

78-
To load firmware on a Pi Pico, hold its BOOTSEL button down while plugging it into a computer. The Pi Pico will appear as a storage device. Copy the VGA UF2 file to make a Pico VGA and the RIA UF2 file to make a Pico RIA. It should take less than 15 seconds to copy. The LED turns on when done.
103+
To load firmware on a Pi Pico, hold its BOOTSEL button down while plugging it into a computer. The Pi Pico will appear as a storage device. Copy the VGA UF2 file to make a Pico VGA and the RIA UF2 file to make a Pico RIA. It should take less than 30 seconds to copy. The LED turns on when done.
79104

80105
Acrylic Sandwich Case
81106
---------------------
@@ -132,4 +157,4 @@ The RAM IC is 128k because 2x32k is more expensive. Speed must be \<=70ns for 8M
132157

133158
The WDC W65C02S and W65C22S must not be substituted. Do not attempt to use NMOS chips (without the C in the number). Some older CMOS designs may work but there are no plans to support out-of-production ICs.
134159

135-
Only the Raspberry Pi design of the Pi Pico has been tested. Both original and "H" (header) versions work great. Pin-compatible alternatives may work, check the forums. The 3-pin SWD connection on the Pi Pico RIA is no longer used internally and may be ignored when looking for alternatives.
160+
Only the Raspberry Pi design of the Pi Pico has been tested. Both original and "H" (header) versions work great. Pin-compatible alternatives may work, check the forums. The 3-pin SWD connection on the Pi Pico RIA is no longer used and may be ignored when looking for alternatives.

0 commit comments

Comments
 (0)