~rabbits/uxn

Other uses of expansion port (including selecting nonstandard devices)

Details
Message ID
<1675472396.bystand@zzo38computer.org>
DKIM signature
missing
Download raw message
I can suggest some other uses of expansion port.

One thing would be the possibility to count how many pages of memory are
available, which can be: 0x02, and then the emulator writes the 16-bit
number of pages of memory immediately after the command code. This number
of pages does not count page zero (the conventional memory page).

Another suggestion has to do with nonstandard devices. There is no standard
way to select them, even though a few programs might be capable of using
them (either optionally or mandatory, depending on the specific program).
My proposal will be that the expansion record consists of:

* Command code (one byte; probably 0x03)

* Device address (one byte): Should be a nonzero multiple of sixteen. Some
emulators might require that some or all nonstandard devices are only
loaded at specific addresses (probably at least 0xD0, 0xE0, and 0xF0 will
be supported for most extensions).

* UUID (sixteen bytes): Identifies the specific extension specification.
(It does not identify the implementation, which can depend on the emulator,
or user settings, external files, etc.)

* Version (one byte): When the expansion port is called, the emulator will
write into this port, zero if this extension is not implemented (including
if it is not implemented in this specific circumstances, e.g. the device
address is wrong), or if it is implemented, will be a number which is
defined by the specific extension specification.

* Possibly additional data, which is defined by the specific extension
specification, and which the emulator might or might not read from and/or
write to. (Some extensions might not have any additional data.) (If this is
used, it can only be read/written by the emulator directly in response to
the expansion command, and not later in the program. If it contains any
data which the emulator or extension will need to use later, the emulator
must make its own internal copy of it. However, this is not necessarily the
case if it instead contains an address of such data; in that case, the
extension specification must specify how to handle it instead, and whether
or not it must be preserved, although the address itself will still need
to be copied and stored by the emulator/extension.)

Note that, after the device is loaded, the memory used for the expansion
command record can be used by the program for other stuff, if desired; none
of it is "captured" by the extension.

Both of these suggestions should be backward-compatible, if the program
that uses them writes zero into the result area (which might be either
included in the .rom file or written at run time) before calling them;
however, emulators should not depend on this behaviour of the program,
and should explicitly write zero if that feature is not implemented.

Please tell me in case any of this is unclear, or if you think that any
of this is wrong.

There has also been the suggestion that they will not be made official if
they are not used; however, then these command codes might be used for
other (possibly standard, and possibly nonstandard) things if it is not
known what someone is using them for.

Nonstandard devices may sometimes be needed, so the above specification
can be a standard way of selecting nonstandard devices. (Without such a
specification, nonstandard uxn programs can be incompatible with each
other without any indication that this is the case. My proposal would
allow such a thing without a confusion, and allow detecting if it is
implemented or not, and allows writing emulators with multiple nonstandard
features without those nonstandard features interfering with each other.)

-- 
Don't laugh at the moon when it is day time in France.
Reply to thread Export thread (mbox)