Anonymous user
Nautical bell: Difference between revisions
→{{header|REXX}}: reinstated original whitespace in the REXX section header, added/changed comments and whitespace, corrected calculation of MN, added better indentation and DO-END groups.
Walterpachl (talk | contribs) (add OoREXX) |
(→{{header|REXX}}: reinstated original whitespace in the REXX section header, added/changed comments and whitespace, corrected calculation of MN, added better indentation and DO-END groups.) |
||
Line 842:
If any arguments are specified, that text is used as a prefix to the times shown (once a minute).
<br>Also, the number of bells sounded are shown (if any arguments are specified).
<br>If no arguments are specified, no times are shown.
In all cases, the PC speaker is used to sound the bells (albeit a poorly sounded bell).
This REXX program makes use of
<lang rexx>/*REXX pgm sounds "bells" (using PC speaker) when running (perpetually).*/▼
Some REXXes don't have a '''delay''' BIF, so one is included [[DELAY.REX|here]].
echo= arg()\==0 /*echo time & bells if any args. */▼
signal on halt /*allow a clean way to stop prog.*/▼
Also, some REXXes don't have a '''sound''' BIF, which produces sounds via the PC speaker,
so one is included [[SOUND.REX|here]].
t.1 = '00:30 01:00 01:30 02:00 02:30 03:00 03:30 04:00'
t.2 = '04:30 05:00 05:30 06:00 06:30 07:00 07:30 08:00'
t.3 = '08:30 09:00 09:30 10:00 10:30 11:00 11:30 12:00'
end /* [↑] delay minute fraction*/
/* [↓]
do j=1 for 3 until $\==0; $=wordpos(hhmmc,t.j)
end /*j*/
do k=1 for $; call sound 650,1; call delay 1 +(k//2==0)
end
halt: /*stick a fork in it, we're all done. */</lang>
'''output''' when using the input of: <tt> the time is:
<pre>
the time is: 1:48pm
|