DualClock 1.1.1 - OakAcorn Software - a native RISC OS 5 desktop clock
================================================

INSTALL AND RUN

Transfer DualClock-riscos5.zip,a91 to RISC OS, then extract it there with a
RISC OS-aware archive tool such as SparkFS or SparkPlug. Copy !DualClock
wherever you keep applications and double-click it. No compiler or extra
BASIC library is needed: the tokenised !RunImage is included.

The ZIP contains Acorn/SparkFS filetype metadata. Extracting on Windows
first will normally discard this metadata. Prefer extracting on RISC OS.
The download name ends .zip,a91 for the RISC OS ZIP filetype.

USING THE CLOCK

* The window opens automatically and displays local time from RISC OS.
* The analogue face has hour, minute and red second hands.
* The large digital display shows hours, minutes and seconds.
* The weekday and date are shown below it in your configured territory.
* Click the icon bar clock to reopen or bring the window to the front.
* Closing the window leaves the application on the icon bar.
* Click Menu over the icon or window for Info, Show clock, 24-hour, and Quit.
* Untick 24-hour to use 12-hour time with an AM/PM label.
* Adjust-select a menu item to keep the menu open.

The window has a fixed working size of 640 x 800 OS units (usually
320 x 400 pixels) and can be moved using its title bar. The format choice
is remembered for this running session. It is not saved to disc.
The clock displays the system's time and timezone; it does not set or
synchronise the system clock. A suitable desktop screen mode is needed
for the whole window to fit.

CONTENTS

!DualClock.!Run       Application launcher (Obey, &FEB)
!DualClock.!Boot      Filer icon registration (Obey, &FEB)
!DualClock.!RunImage  Tokenised BBC BASIC V program (BASIC, &FFB)
!DualClock.!Sprites   Native clock sprite (Sprite, &FF9)
!DualClock.Source     Complete readable BASIC source (Text, &FFF)
!DualClock.!Help      Quick help (Text, &FFF)
Build                Rebuild script for Python 3 (standard library only)
ReadMe               This file

If you must copy an already-unpacked folder from another OS, set the file
names/types above on RISC OS before launching. Keep the leading ! on the
application folder and its !Run, !Boot, !RunImage, !Sprites and !Help files.

EDITING ON RISC OS

Shift-double-click !DualClock to open the application directory. Edit the
Source text in your preferred editor, then tokenise it in BBC BASIC:

  TEXTLOAD "<DualClock$Dir>.Source"
  SAVE "<DualClock$Dir>.!RunImage"
  QUIT

Launch !DualClock once before doing this so DualClock$Dir is defined.
These commands overwrite the generated !RunImage with your edited source.
The Source file must retain its final newline. Always edit a copy first.

On a non-RISC OS development computer, Python 3 can regenerate !RunImage,
!Sprites and the archive by running: python3 Build
The small lexer is deliberately limited to the coding conventions and
keywords used by this application; it is not a general BASIC compiler.

IMPLEMENTATION

Written in BBC BASIC V using native Wimp SWIs. No machine code, external
fonts, templates, Toolbox modules or third-party runtime libraries.

Wimp_PollIdle sleeps until the next second instead of busy-polling.
Every refresh takes a new OS_Word 14,3 UTC sample. Territory conversion
provides local hours/minutes/seconds and localised date text, so both
clocks use the same sample and pick up changes to the system time.

Redraw requests use Wimp_RedrawWindow immediately, followed by the complete
Wimp_GetRectangle loop. Timer updates use Wimp_UpdateWindow, including
one opaque copy of the finished off-screen frame. Drawing remains clipped
to the visible window.
Hour and minute hands include the fractional minute/second components.
Message_Quit, normal window open/close events and menu Adjust behaviour
are handled. Runtime errors are reported with a BASIC line number.

REFERENCES

The supplied risc-os-prm-2026.pdf and WIMP programming guide wimp.zip
were used, especially guide chapters 3-8 and 11, and the PRM sections on
Wimp_Initialise, Wimp_PollIdle, Wimp_UpdateWindow and Territory conversion.
The attached basic.html is a linked index to the BASIC manual.

Additional primary reference pages used to fill details:
https://www.riscos.com/support/developers/prm/timedate.html
https://www.riscos.com/support/developers/prm/territory.html
https://www.riscos.com/support/developers/bbcbasic/appendices/minabbreviations.html
https://github.com/LuaDist/zip/blob/master/proginfo/extrafld.txt

VALIDATION AND LIMITATION

The package has been built and its BASIC record boundaries, sprite layout,
archive checksums and filetype metadata checked on the development host.
No RISC OS desktop or emulator was available here, so this version has not
been run on RISC OS. It needs a first launch on your RISC OS 5 machine.

VERSION 1.1 - ANIMATION FLICKER FIX
All graphics and text are composed into a persistent 32-bit sprite before
being copied to the visible Wimp rectangles. The main window has background
colour 255 so the Wimp does not blank it first. Overlap and screen clipping
remain managed by Wimp_RedrawWindow / UpdateWindow / GetRectangle.
The renderer saves and restores the full VDU context, including on errors.
It refreshes colour translation and scaling after palette / mode changes.
Custom scene text is rendered into the same buffer with the native system
font; Info windows and desktop menus remain standard Wimp controls.
The application now requests a 1 MB Wimp slot.

The rendering regression checks execute the actual text and tokenised BASIC
render routines in Matrix Brandy with native SWI/VDU operations intercepted.
They check frame caching, three visible rectangles, a fully obscured window,
scrolled window coordinates, three display scaling/translation cases, and
restoration of screen output after an injected mid-frame error. These checks
verify the rendering protocol; they do not emulate the native display driver.
Please quit the old version before replacing the whole application folder.

PUBLISHER AND LICENCE
Copyright (c) 2026 OakAcorn Software.
The MIT licence covers original code, documentation and artwork, and other
original contributions to the extent of the rights held by the publisher
and contributors. The full licence is in the License file inside the app.
The OakAcorn name and logo identify the publisher. Trademark rights remain
with their respective owners.
