Technical Reference Manual
The display used in the Organiser II models CM, XP and LA is a Hitachi LR039 Liquid Crystal Display (LCD) driven by a Hitachi HD44780 LCD controller.
It consists of two lines of 16 characters. Each character is defined by a 5 x 8 dot matrix with the 8th line normally left blank as it is used for the single line cursor.
The character generator in the LCD controller contains 192 displayable characters (ASCII values 32 to 256). There are also 8 user definable characters which are repeated twice in the character set ASCII values 0 to 7 and 8 to 15. These are called UDG 0-7.
The display on the LZ and LZ64 uses the same LCD drivers as on the standard Organiser but is arranged as 4 lines by 20 characters. The HD44780 was replaced by a customised 66780 chip to allow for foreign characters. The characters from 0 to 127 remain the same except for character 92 which is changed to a "\" character. Most characters from 128 to 255 have changed but some are left for compatibility, e.g.. character 254 is left as a space to use as a blank "non-space" character.
The LZ models maintain compatibility with 2-line Organisers by emulating the 2 line screen. Thus, there are two modes of operation: 4-line mode and 2-line compatibility mode. To simplify the writing of 2-line/4-line applications, variables are provided for the address of the screen, the mode, the number of lines and the width of the screen which are valid in either mode.
The system service DP$MSET is provided to switch between modes. Note also that existing bootable applications are automatically put into 2-line mode if they print to the screen.
In 2-line compatibility mode all existing applications should work exactly as though they are running on a 2-line Organiser. The same screen buffer (DPT_TLIN) is used when in this mode.
The LCD controller contains a control register and a data register. These are accessed via the following addresses:
The following variables are used by the display system services:
On the LZ, DP$SAVE and DP$REST use DPT_4SAV, the 4-line save buffer, even in 2-line mode, instead of the previous DPT_SAVE which no longer exists.
The UDG clock uses UDGs 3-7 to display the digits and UDG 1 for the am/pm indicator if in 12 hour mode. The clock is always right justified in a field of 6 characters.
The system service DP$CSET, can print the clock anywhere on the screen and will initalise the updating of the clock every 1/2 second. DP$CSET can also stop the clock by preventing the updating but the UDGs will remain on the screen until they are overwritten by printing.
The clock is updated in the keyboard interrupt routine by calling DP$CPRN. Every 1/2 second UDG 5 is re-defined to achieve the flashing colon and every time the minutes change, all UDGs used for the clock are redefined
Occasionally, the clock will stop flashing, e.g.. when printing. This is because the keyboard interrupts have been disabled momentarily. The clock will not, of course, lose any time since it always gets the time from the system clock.
The following machine code program stores a pound sign in UDG 0 (ASCII characters 0 and 8). The data for the pound sign is read from address DATA.
Note that on LZ machines this task could also be accomplished by using DP$UDG, but this code will still work.
SAVUDG: ; Set LCD address to $40 the address of the first UDG. LDA A,#$40 ;A is LCD address ; Wait for busy low. 1$: TST SCA_LCDCONTROL BMI 1$ ; Store address STA A,SCA_LCDCONTROL ; Now store data LDX #DATA LDA B,#8 2$: LDA A,0,X ; Wait for busy low. 3$: TST SCA_LCDCONTROL BMI 3$ ; Store data. (LCD address auto increments) STA A,SCA_LCDDATA INX DEC B BNE 2$ RTS DATA: FCB 6,9,9,12,8,24,31,0 ;Pattern for pound sign
This section describes the operating system calls for writing to the LCD display.
Displays or removes block or line cursor at given position.
Displays a given string at a given line. If the string doesn't fit, it starts to scroll to the right wrapping around with two spaces in between. Pressing the left and right arrow keys alters the scrolling action (this feature may be disabled). Any other key press terminates.
Prints a given number of a single character.
Outputs a single character.
Control characters ASCII 0 to 7 display the 8 user definable graphics characters.
Certain of the ASCII control characters are intercepted by this routine to control the display as follows:
On LZs, to maintain compatibility, the system service DP$EMIT will translate any characters from $80 to $A0 inclusive into a space character if the machine is running in "2-line compatibility mode".
Saves the current screen state including the cursor position.
Note that this routine should not be called unless alarms are disabled as the alarm software calls this routine as well. This is explained in the diary section. Also the pack sizing routine (PK$SETP) uses these calls when displaying "SIZING PACK B" etc.
Restores a previously saved copy of the screen
If DP$REST is called without previously calling DP$SAVE then anything can and probably will happen.
Waits until the value in dpw_redy has been decremented to 0.
Each keyboard interrupt causes dpw_redy to be decremented by 1 and as such provides a handy 50 millisecond timer. However if interrupts are switched off this routine will still work as it recognises that interrupts are off and decrements dpw_redy once every 50 milliseconds.
Note that this routine behaves as a wait on a timed semaphore. It is used extensively by the LCD driver software to provide scrolling delays.
DP$MSET (LZ only)
Sets the Operating System into 2 or 4 line mode. The following is always carried out:
DP$PVEW (LZ only)
A partial view routine. Works exactly like DP$VIEW but at the current cursor position. Any characters before the cursor will not scroll but the string will be displayed scrolling on the remainder of the line. This routine is used, for example, in CALC on the LZ.
DP$UDG (LZ only)
Defines or reads a UDG. The operating modes are:
Note that interrupts are disabled in DP$UDG.
DP$CSET (LZ only)
Sets the clock-display status. Parameters specify if and where on the screen the clock will appear. The clock is printed when DP$CSET is called and is updated in the keyboard interrupt. The interrupt just re-defines the UDGs and does not write to the screen.
Note that any UDGs previously defined will be overwritten.
DP$CPRN (LZ only)
Redefines the UDGs used for the clock as the current system time.