_ _ ###, ###
[_)s [_)eveloper # # _#
[_)otcommands # # #
###' ###
D3 is a series of open source dot commands, primarily focused at making life easier for those either next developers, or those who use their Next as a complete computer, not a just a games console.
There are currently four tools that are part of D3, broken into three broad categories.
Demonstration Video
Links
System Utilities
- INI – Programatically manipulate simple INI or INI formatted files easily
- EVERY – A tiny routine job scheduler
Unix Ports
- UNTAR – Extract tape archives
FoaK Companions
- CH8SHOW – Preview ROM formatted font files
You can find out more about the tools below, or download them at https://github.com/StalePixels/D3
System Utilities
.INI
.INI is designed to perform a specific tasks with a minimum fuss – manipulate ini files from BASIC without the need to write a whole file handler.
.INI needs to be started with (at least) two arguements.
The first is a path to a INI file to use, the second is the name (commonly known as ‘key’) to retrieve.
The second, optional, parameter (commonly known as ‘value’) is the item to save in the INI file.
The following example would retrieve the current video mode timing – this is a number between 0 and 7, and is covered extensively in the Next’s wonderful manual.
.INI /MACHINES/NEXT/CONFIG.INI timing
And for setting a value, it’s as follows:
.INI /SYS/ENV.INI edge_zx128p3_50 0,0,0,0
In this example it’s resetting the “noted visible screen” to be full frame – this config file entry itself is maintained by Ped7g’s very helpful .DISPLAYEDGE, part of the default NextZXOS system distribution.
Hopefully as you can see, .INI by itself is not of a lot of use, but when used with system config files, or with other apps (e.g., .EVERY, or .DISPLAYEDGE as in the example above) it becomes a building block in a very powerful config system.
Internally, one of the most common uses is to reset parameters in INI files when developing our own apps.
.EVERY
A scheduling tool designed to keep count of events, and trigger periodically.
.EVERY needs to be started with at-least one parameter, the schedule interval – which must be a number greater than one.
You can also pass an optional second parameter, this is the name of the schedule when you wish to maintain more than one.
In the below example we’ll use .EVERY to set the RTC every 10th execution.
.EVERY 10 : IF % REG 127 THEN .NXTP time.nxtel.org 12300
For advanced users, you can run more than one schedule concurrently, but independently of each other.
.EVERY 2 EveryTwo : IF % REG 127 THEN PRINT "Twice"
.EVERY 3 ThreeTimes : IF % REG 127 THEN PRINT "Thrice"
The default schedule is called “default”, and the schedule data is stored in /sys/every.cfg. This is a “simple INI file” and is suitable for manipulation with .INI (in fact, it uses the same code path for both apps)
Internally, the network time example is exactly how it is used – and that function was our motivation behind this tool!
Unix Ports
.UNTAR
A reduced tar extractor. Supports POSIX compliant TAR archives, but only Files (the default) and Directories (type: 5).
Files that include:
- hardlinks (type: 1);
- symlinks (type: 2);
- character or block devices (types 3 & 4 respectively); or
- FIFOs (type: 6)
will have a graceful error message printed, and the extraction will continue.
Internally, since most of our development takes place on MacOS or Linux, TAR archives are the natural way to manage collections of files, and extracting one directly upon the next (being also then validated with Tar’s internal checksum system) a great way to ensure all “Test Data” for an application is correct before we begin testing.
FoaK Companions
.CH8SHOW
We define ROM format fonts as:
- 1bit per pixel
- 8×8 fixed size
- Breadth first
A common file format for a collection 96 of these is a CH8 file – 768bytes long.
Damien Guard maintains the most awesome ZX-Origins collection, and is a great place to get yourself some CH8 files if you ever find the need.
The display will automatically adjust if passed a 128character long font-file, instead of a 96 character one – these are detected by the 1k, instead of usual 768byte, file-length.
Internally, we developed .CH8SHOW as a companion for FoaK – as part of the promised open source support commands that the released app came with.
The 1k (files with UDG extension) exports also work with .CH8SHOW perfectly.