Skip to content

Commit 04386f9

Browse files
argv exec
1 parent b6d4ee2 commit 04386f9

2 files changed

Lines changed: 54 additions & 11 deletions

File tree

docs/source/os.rst

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,48 @@ ERRNO_OPT
489489
- 85
490490
-
491491
492+
ARGV
493+
----
494+
495+
.. c:function:: int _argv (char *argv, int size)
496+
497+
|
498+
499+
The virtual _argv is called by C initialization to provide argc and argv for main().
500+
It returns an array of zero terminated string indexes followed by the strings.
501+
e.g. ["ABC", "DEF"] is 06 00 0A 00 00 00 41 42 43 00 44 45 46 00
502+
The returned data is guaranteed to be valid.
503+
504+
:Op code: RIA_OP_ARGV 0x08
505+
:C proto: (none)
506+
:returns: Size of argv data
507+
:errno: will not fail
508+
509+
EXEC
510+
----
511+
512+
.. c:function:: int ria_execl (const char *path, ...)
513+
.. c:function:: int ria_execv (const char *path, char * const argv[])
514+
.. c:function:: int _exec (const char *argv, int size)
515+
516+
|
517+
518+
The virtual _exec is called by ria_execl() and ria_execv(). Be aware of the
519+
one difference from the execl() and execv() you may be used to. Because RAM
520+
is precious, the path is only supplied once, not again in argv[0]. The
521+
launched ROM will see argv[0] as the filename.
522+
523+
The data sent by _exec() will be checked for pointer safety and sanity, but
524+
will assume the path points to a loadable ROM file. If API_EINVAL is returned,
525+
the argv buffer is cleared so further attempts to _argv() will return an empty set.
526+
Is the ROM is invalid, the user will be left on the console with an error message.
527+
528+
:Op code: RIA_OP_ARGV 0x09
529+
:C proto: rp6502.h
530+
:returns: Size of argv data
531+
:errno: API_EINVAL
532+
533+
492534
CLOCK
493535
-----
494536
@@ -533,7 +575,7 @@ TZSET
533575
-----
534576
535577
.. c:function:: int void tzset(void);
536-
.. c:function:: int f_tzset (struct _tzset *tz)
578+
.. c:function:: int _tzset (struct _tzset *tz)
537579
538580
.. code-block:: c
539581
@@ -545,8 +587,8 @@ TZSET
545587
char dstname[5]; /* Name when daylight true, e.g. CEST */
546588
};
547589
548-
The virtual f_tzset() is the how tzset() is implemented. Use `help set tz` on the
549-
monitor to learn about configuring your time zone.
590+
The virtual _tzset() is called internally by tzset(). Use `help set tz` on the
591+
console monitor to learn about configuring your time zone.
550592
551593
:Op code: RIA_OP_TZSET 0x0D
552594
:C proto: time.h
@@ -558,7 +600,7 @@ TZQUERY
558600
-------
559601
560602
.. c:function:: struct tm *localtime(const time_t *timep);
561-
.. c:function:: int f_tzquery (uint32_t time, struct _tzquery *dst)
603+
.. c:function:: int _tzquery (uint32_t time, struct _tzquery *dst)
562604
563605
.. code-block:: c
564606
@@ -567,7 +609,7 @@ TZQUERY
567609
int8_t daylight; /* non 0 if daylight savings time active */
568610
};
569611
570-
The virtual f_tzquery() is part of how localtime() is implemented.
612+
The virtual _tzquery() is called internally by localtime().
571613
572614
:Op code: RIA_OP_TZQUERY 0x0E
573615
:C proto: time.h

docs/source/ria.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,21 +693,22 @@ Console Port
693693
The main serial port of the RIA is the console for system. Modern operating
694694
systems provide canonical input and translated output via a configurable
695695
layer such as termios. A full termios is a too heavy for an 8-bit system,
696-
but raw and non-blocking IO options are also provided.
696+
but raw and non-blocking IO options need to be provided.
697697

698698
The well known stdin blocks for canonical input. The console user will be
699699
prompted to edit a line. Once the line is submitted with the enter key,
700700
the stdin read unblocks and returns the line up to a linefeed character.
701701

702702
The well known stdout and stderr blocks and inserts carriage returns
703-
before newlines is one is not present. The full amount of data is always
703+
before newlines if one is not present. The full amount of data is always
704704
sent and writes will block until sent data is fully unloaded into hardware
705705
FIFOs.
706706

707-
This is what a C programmer expects, but is not a good interface for a
708-
multitasking 6502 OS to use. To that end, a non-blocking interface to the
709-
console is provided. Simply open the special filename "CON:". Reads can
710-
return 0 bytes, and writes may send less than the requested amount.
707+
These well know console interfaces are what a C programmer expects, but it is
708+
not a good interface for a multitasking 6502 OS to use. To that end, a
709+
non-blocking interface to the console is provided. Simply open the special
710+
filename "CON:". Reads can return 0 bytes, and writes may send less than the
711+
requested amount.
711712

712713
Going one step further, a non-blocking and raw connection to the console
713714
port is available on special filename "TTY:". There is no canonical input

0 commit comments

Comments
 (0)