![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Technical Reference ManualBUILT-IN APPLICATIONS
ALARMSThe eight alarms are stored in a fixed length 48 byte area AMT_TAB ($22F9). Each entry contains a date-time in the usual format, with a flag indicating the type of alarm.
A system variable AMB_WRKD is provided on the LZ machines to indicated which days are workdays. An alarm entry is canceled by setting byte 5 to zero. Before setting or modifying any alarms, byte 5 should be cleared and then set last of all. This is to prevent interrupts from checking that entry. Note that although there is no way of manually setting an alarm outside the current week, this limitation need not apply to user programs which manipulate AMT_TAB directly. You can set an alarm to ring at any time between 1900 and end of 1999 (LZ: 2155). The date-time of a repeating alarm is updated each time it rings; an alarm entry does not contain the original date-time. ALARM CHECKING INTERRUPTSBoth the diary and the alarms are scanned approximately every minute by the 50ms maskable interrupts which scan the keyboard. Users wishing to alter the alarm or diary alarm action, see vector BTA_OCI, or the BZ$ALRM service. Every minute an NMI makes a request for alarm checking by setting the flag AMB_DOIT provided the following conditions are met:
The flag AMB_EI is provided specifically so that user programs can disable alarm checking. If all these conditions are met, the alarm is not actually checked immediately: this is left to the next maskable interrupt which rings any pending alarms whenever AMB_DOIT is set. This means that alarms are checked as soon as possible after each minute boundary, but any time-critical activities such as writing to datapacks and other operations can delay alarms by using the SEI instruction. Alarms will never occur while the interrupt mask is set. Also certain activities such as device booting (DV$ calls), storage management (AL$ calls), or modification of the diary or alarms can cause an ALARM to ring late. If interrupts are not required, then an SEI instruction is all that is required to disable alarm checking. If interrupts are required the following code must be used to maintain compatibility with all OS versions: LDA A,AMB_EI
PSH A
TPA ; preserve interrupt mask
SEI
CLR AMB_EI ; prevent NMI setting AMB_DOIT
CLR AMB_DOIT ; in case AMB_DOIT already set
TAP ; restore interrupt mask
... ; user program alarm checking now off
; ...
; the next two lines are optional
INC AMB_EI ; set AMB_DOIT if check required **
INC AMB_DOIT ; on next interrupt **
PUL A
STA A,AMB_EI ; restart normal checking
The two lines ** will cause the next 50 ms interrupt to perform a check without waiting for the next minute boundary. This will minimize any late running of the alarms. The AMB_DOIT flag can also be set to request more frequent checking than once each minute. However, AMB_DOIT must at no time be set non-zero when AMB_EI is zero as this may cause problems with some early OS versions. Note also that AMB_EI should not be set to $FF. The 50 ms interrupt first checks the DIARY then the eight alarms. All alarms are sounded even if they are overdue. The earliest DIARY alarm will sound, then the lowest numbered ALARM alarm. If more than one DIARY or ALARM alarm are due, they will ring in pairs (DIARY,ALARM) each minute. Before a DIARY alarm sounds, the alarm flag (byte 6) in that entry is cleared. Before an ALARM alarm sounds, the repeat time is added on for repeating alarms, and byte 5 is cleared for non-repeating alarms. The system service DP$SAVE is called to save the screen, and the time and diary text or "ALARM" is displayed for one minute or until ON/CLEAR is pressed. The screen is then restored with a call to DP$REST. The ON/CLEAR key is polled directly, so the keyboard buffer is not affected. On CM/XPs, BZ$ALRM makes the ALARM sound, while the DIARY beep is a call to BZ$TONE with D = 200 (proportional to 1/frequency), X=50 (note length). WAKING UP FOR AN ALARMThe Organiser II maintains the system time with a 12 bit external counter while switched off. The machine switches on when the counter overflows every 2048 seconds (34 minutes 8 seconds), updates the system time, and switches off again. The system service BT$SWOF rings any alarms pending, then checks if an alarm is due in the next 34 mins 8 secs. If necessary, BT$SWOF sets the counter to a value greater than zero to switch the machine on early. When the Organiser II switches on, it rings the alarm then remains on until normal switch-off. Users wishing to alter this behavior see vector BTA_SOF and for vector BTA_WRM. SYSTEM VARIABLES
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BYTE | MODELS CM & XP (LA) | MODEL LZ | ||
| RANGE | RANGE | |||
| 0 | 1 - 64 | length of text | 2 - 65 | length of text + 1 |
| 1 | 0 - 99 | year (1900 - 1999) | 0 - 255 | year (1900 - 2155) |
| 2 | 0 - 11 | month | 0 - 11 | month |
| 3 | 0 - 30 | day | 0 - 30 | day |
| 4 | 0 - 23 | hour | 0 - 23 | hour |
| 5 | 0 or 30 | minutes | 0,15,30,45 | minutes |
| 6 | 0 - 60 | if 0 no alarm set else (number of minutes early+1) |
0 - 60 | if 0 no alarm set else (number of minutes early+1) |
| 7... | string | text of diary entry (1-64 chars) | string | text of diary entry (1-64 chars) |
| 1-96 | duration (in quarter hours) | |||
Example (CM/XP):
|
Example (LZ):
|
|||||
|
(alarm set 15 minutes early)
and then the next entry or $00 as terminator. |
(alarm set for 15 minutes early)
and then the next entry or $00 as terminator. |
Bear in mind the following restrictions when manipulating the diary:
The following examples scan through each diary entry:
LDX $2004 ; X points to 1st byte
BRA 2$
1$: ADD B,#7 ; skip length byte date alarm flag
ABX ; and skip over text
2$: LDA B,0,X ; get length byte
BNE 1$ ; until 0 terminator found
ADDR% = PEEKW($2004)
LEN% = PEEKB(ADDR%)
WHILE LEN% <> 0
ADDR% = ADDR% + 7 + LEN%
LEN% = PEEKB(ADDR%)
ENDWH
1989050817150216
ABCDEF
The first field specifies the date of the entry (1989, 05, 08, for 8th May
1989), the time (17 15, for 5:15pm), the duration (02) and the alarm byte
(16, for 15 minutes before - again, 00 would mean "no alarm"). The second
field is the text of the entry. The order of things in the first field, and
the use of zeroes where necessary to keep things the same length (e.g. "02"
for a duration of 2) make the file easy to sort in OPL, or otherwise.The Notepad uses the same editor as is used to edit OPL programs. This editor
can be invoked directly by calling the system service LG$EDIT (see chapter Editor).
The Notepad text is stored in allocator cell 16 (defined as NOTECELL) in exactly the same format as OPL source procedures. On cold boot, the notepad cell is initialized to contain the name "Notepad:" and system variables (see below) are initialized.
The cell is structured as follows:
Each line has a maximum of 255 bytes including the 0 (these bytes are encrypted when not in the editor if a password has been set).
Note that although the notepad name and colon are not editable, if the optional 0 is not included then the first text line including the name has a maximum of 255 bytes. The bytes after the colon can be edited. A line consisting only of the terminating 0 represents a blank line. The notepad can have any number of lines up to the capacity of memory.
If the cell does not have this structure, the editor may display the "PACK READ" error as if a corrupted notepad has been loaded from a datapack or may produce unexpected results.
The notepad is saved onto a pack as a block file of type 87 (defined as BNOTTYP), and has the same structure as a saved OPL procedure with object but instead of the Object Code (OCODE) bytes, notepad header information is stored. Following the header, the file has the same structure as the notepad cell as described above. The OCODE cell is in fact used to hold the header information prior to saving to pack and is zeroed after saving.
The header structure is:
Note that if this structure is generated by the programmer, the password flag
must be set to 0 to signify no password or the program will try to decrypt
the file when it is loaded.
Four system variables that are permanently maintained for the current notepad can be referenced from outside the notepad editor.
This byte contains flags for the editor. The following bits are currently used:
| 7 | true if numbered | may be poked |
| 3 | true if on/clear exits editor | do not poke |
| 2 | true if prompt to be capitalized | may be poked |
| 1 | true if no title required | may be poked |
| 0 | true if changed (used in editor) | may be poked |
The default value for a new notepad is $08 (bit3 set).
Note that if bit3 is cleared then the notepad cannot be exited. This bit is 0 for editing OPL procedures where the menu includes the item EXIT.
This byte is 0 if the current notepad in memory has no password or any non-zero value if a password exists. It must not be poked or the editor may attempt to decrypt unecrypted data or not to decrypt encrypted data etc. with unknown results.
This word contains the current line number in the current notepad. Line 0 is the line containing the notepad name. This defines which line the cursor is on.
This variable may be poked to change the line number but should not be given a value greater than the last line number in the notepad. The maximum line number is 1 less to the number of zero line-delimiters in an unecrypted notepad.
This byte contains the cursor position in the current line in the current notepad.
This variable may be poked to change the cursor position but should not be given a value greater than the length of the current line.
On the LZ entry points to the top-level applications have been included as system services.
They are named as XX$ENTR where XX is the name of the application (e.g. DI$ENTR provides access to the diary functions). Most of these system services take a "function number" to identify which function of the application to run.
Note: function numbers 0, 1 and 2 are standard across the interfaces to the built-in applications ("initialise", "normal entry" and "search"). Values above 2 are application-dependent.
Please note: Using the following calls on a 2-line machine will cause a crash!
The only way to access the built-in applications on CM/XPs is to look up the entry points in the menucell.
Provides an entry point into the ALARM routines.
The available functions are:
Provides an entry point to the calculator exactly like selecting CALC in the top-level menu.
Do not call from OPL, since OPL is not re-entrant unless all its variables are preserved.
Provides an entry point to the PROG application in the top-level menu.
Provides an entrypoint to the NOTEPAD application.
Provides an entry point to the TIME application.
There are two functions available:
Provides an entry point to the UTILS application in the top-level menu.
The world application gives the current time (ignoring day light time saving) and dialing code from the base city for 400 cities and 150 countries.
Provides an entry point to the XFILES application in the top-level menu.
![]() |
![]() |