1 Newcastle Microcomputer Support Group ===================================== Device Drivers for Recommended Microcomputers ============================================= Version 2 - February 1987 ========================= 1. Introduction. 2. Implementation and Distribution. 3. Examples. 4. Screen Routines. 5. Line Routines. 6. Keyboard Routines. 7. Miscellaneous Routines. Appendix A : Alphabetic List of Routines. Appendix B : Apricot PC Implementation. Appendix C : IBM PC Implementations. Appendix D : RM Nimbus Implementations. Appendix E : Amstrad PC Implementation. 1. Introduction. ============= This document describes the interfaces to the driver routines used by the Newcastle Microcomputer Support Group. Keyboard, screen and RS232 line drivers are described, as well as other more general routines used when programming MSDOS micros. Other issues like line monitoring and typing are discussed and example programs are provided. The driver code was designed initially to allow programmers to write portable communications programs. However this has now been expanded to provide a portable general interface which is of use to as wide a range of programmers as possible. It is written to conform as closely with ISO Pascal as possible. Some non-standard constructions are inevitable, and since Prospero Pascal is the main implementation of Pascal in use around the University microcomputer community, that is the compiler that we have used. Version 2.14 of ProPascal has been used to generate the libraries of drivers: this allows access from ProFORTRAN as well as ProPascal. Object libraries and relevant example and include files are stored on both NUMAC MTS services in the MTS id MDRV, whence they may be retrieved using the NUMAC TRANSFER Software. The code is available for various different machines, however no guarantees can be made about its provision for any specific machine, or its operation. Machine dependent implementation information may be found in the Appendices. Background information and advice may be found in our annual publication "Recommended Microcomputer Systems", available free of charge from the Newcastle University Computing Laboratory. The code remains Copyright (C) 20th May 1986, to NUMAC Computing Service. Use entirely at your own risk. For further information contact the Newcastle Microcomputer Support Group: Daysh Building, Room D811, Claremont Road, Newcastle Upon Tyne, NE1 7RU (091) 232 9233 ext 289 2. Implementation and Distribution. ================================ Most Pascal compilers now have the ability to 'include' files in the program file. This is done in Prospero Pascal by a compiler directive of the form {$I filename}. Using the following files, the driver interfaces may be included quickly and easily, as well as giving a degree of certainty at compile time that the procedural interface is correct. The constant declarations required are mainly for the screen driving routines. When constant files are included in application programs they should be checked for symbol clashes. MDRV:ISO.CST contains definitions of the ISO character set and definitions of the ISO renditions. MDRV:DRIVERS.CST contains a copy of this file. Some of the type definitions have to be treated with care. Byte and bits16 etc. are conceptually machine dependent: however in practice they are often 0..255 and 0..65535 respectively. Again, be on the lookout for type clashes with existing program code. MDRV:ISO.TYP contains ISO rendition type declarations. MDRV:HARDWARE.TYP contains hardware type declarations. MDRV:STRING.TYP contains packed array of char definitions. MDRV:DRIVERS.TYP contains a combination of the above, thus providing all possible types. Various .EXT files contain Prospero Pascal external declarations for the procedure interfaces. (They have been generated using the program EXT.EXE in MSDOS. This program is freely available in the MTS file MSDS:EXT.EXE.) MDRV:Z.EXT contains miscellaneous routine interfaces. MDRV:ZK.EXT contains keyboard routine interfaces. MDRV:ZL.EXT contains RS232 line routine interfaces. MDRV:ZS.EXT contains screen routine interfaces. MDRV:DRIVERS.EXT contains all the above, giving the full external procedure interface. Once the above information has been included in an application program and the program compiled, the machine dependent driver code needs to be linked in. These object libraries may be found in the following MTS files: MDRV:AMSTRAD.OBJ Amstrad PC. MDRV:APRICOT.OBJ Apricot PC. MDRV:IBM.OBJ IBM PC, XT or AT. MDRV:IBM2.OBJ IBM PC, XT or AT - 2nd serial port. MDRV:NIMAUX.OBJ RM Nimbus with AUX port. MDRV:NIMDCC.OBJ RM Nimbus with DCC port. The above object libraries have been compiled using Prospero Pascal Version 2.14, small model, with options /CR (Compact code and Restricted width arithmetic). They should happily link with Prospero small model programs with any combination of options set. Various decisions have been made about internal buffer sizes and other program options. These decisions have been made so as to be most useful for most people. For those applications with specialist requirements, like larger line buffers, line monitoring and range checking, the Advisory Service should be consulted. The machine dependent object code is linked with an application program using the standard PROLINK utility. The .OBJ files provided are library files which may be selectively scanned so that only code segments which are actually used are extracted from the file: hence the /S option may be used. A typical link command would be: PROLINK yourprog,APRICOT/S,PASLIBS/S 3. Examples. ========= Three example programs are provided. Two are communications based, as this is one of the most difficult areas of programming to get right; the third is our test program for the screen routines. Example 1: MTS file MDRV:ISO6429.PAS contains a fully documented implementation of an ISO6429 terminal emulator. Example 2: The following program shows a very simple terminal emulation, keyboard characters going straight down the line and line characters being displayed. Many simple communications applications do not extend much further than this. This program is available in the MTS file MDRV:SIMPLE.PAS. program TERMINAL(input,output); const {$I DRIVERS.CST} type {$I DRIVERS.TYP} var c : byte; { Character variable } {$I DRIVERS.EXT} begin writeln(' Simple Terminal Emulator'); writeln; writeln(' Ctrl-T to exit...'); ZLINIT; { Initialise drivers } ZKINIT; repeat { Main loop } { Handle character from keyboard } { Must use ZKDATA, ZKGET. A normal Pascal read cannot tell } { if a character has been received and continue if not. } if ZKDATA then begin c:= ZKGET; { The key code could be in the range 0..255 } repeat until ZLRDY; { Wait for line ready } ZLPUT(c) { Send char down line } end; { Handle character from the line } if ZLDATA then begin c := ZLGET; { The character from the line may be in the range 0..255. } { For this simple terminal application, we decide to strip top bits } if c > 127 then c := c - 128; write(chr(c)); { Use normal language based write for screen } end until c = CTRLT; ZLEND; { Deinitialise } ZKEND end. Example 3: MTS file MDRV:SCREEN.PAS contains our screen driver test program. 4. Screen Routines. ================ These screen drivers do basic manipulation of character screens. They incorporate features like X-Y addressing, selective scrolls, clears, insertions, deletions and rendition handling. When using these screen drivers, other methods of driving a given screen may not be available. For instance, escape sequences are commonly used to drive screens, but may not work while using these drivers. The names of all screen procedures and functions start with the two characters ZS in order to prevent name conflicts with other modules and application programs. The total length of any procedure or function name does not exceed SIX characters: this is to prevent name clashes with names truncated to six characters. A standard 25 line screen is represented as a title line at the top with 24 lines below, numbered from 0 at the top to 23 at the bottom. The title line is handled in a slightly different manner from the rest of the screen, and will normally be used for a static title for the application program. The columns are numbered from 0 at the left hand side to 79 at the right hand side. All coordinates are represented as bytes. Specific screen types could have been declared (rowtype, coltype) to provide type checking of the screen coordinates; however the driver code often specifically checks that they are within range. In the future, when larger screens are available, code will be easier to adapt as it has not been restricted by Pascal typing. The procedure interface is shown here, and expanded later. 4.01 ZSINIT Initialises drivers 4.02 ZSEND Deinitialises drivers 4.03 ZSWIN Defines a window area 4.04 ZSPUT Sends a character to the window 4.05 ZSGOXY Positions cursor 4.06 ZSGET Reads character from screen position 4.07 ZSCLR Clears window 4.08 ZSUPDT Updates screen image 4.09 ZSCOL Returns current column 4.10 ZSROW Returns current row 4.11 ZSBELL Rings bell 4.12 ZSERAL Erase to end of line in window 4.13 ZSUPSC Scrolls window up 4.14 ZSDNSC Scrolls window down 4.15 ZSINS Inserts blanks at cursor, in window 4.16 ZSDEL Deletes chars at cursor, in window 4.17 ZSCURS Toggles cursor on/off 4.18 ZSFLSH Flashes the cursor after a timeout 4.19 ZSSETG Sets current graphics rendition 4.20 ZSGSET Returns current graphics rendition 4.21 ZSTITL Displays a title line 4.22 ZSINFO Displays a string10 in the title line 4.01 procedure ZSINIT; ZSINIT -- Performs any screen initialisation required for this implementation. This procedure must be called before any other screen routines are called. Sets the window to be the full data screen, see ZSWIN. Initialises global variables local to the screen drivers. Sets the graphics rendition code to DEFAULTREND. Due to the unusual operating requirements of some screens, the whole screen may be cleared on entry to ZSINIT. 4.02 procedure ZSEND; ZSEND -- Performs any screen de-initialisation required for this implementation e.g. restore default character set, cursor etc. Should be called when the application has no further use for the screen. 4.03 procedure ZSWIN(left, right, top, bottom : byte); ZSWIN -- Sets screen window dimensions, so that primitives only work inside the defined area. Cursor addressing inside the defined window is still absolute (not relative to the window) as this is not a window manager. The top left hand corner of the screen below the title line is coordinate (0, 0). Right should be greater than or equal to left. If left > right then sets left = right. Same for top/bottom. The area outside the current window remains *completely* unchanged when screen driver calls are restricted within the window. If the previous cursor location was outside the new window it will be re-positioned at the top left corner of the window. The window can never be set to include the title line, as it is handled separately. 4.04 procedure ZSPUT(c : byte); ZSPUT -- Sends character to window at the current cursor position and using the current graphics rendition, and increments the column position. If the cursor is at the right hand edge of the screen, it stays where it is. The cursor is not necessarily redisplayed after every character write. This is an optimisation to allow large numbers of characters to be sent to the screen, without having to do cursor management. ZSUPDT is used to finally update the screen. The cursor will always be updated on transmission of a blank. Hence when writing screen applications with these drivers the use of ZSUPDT is crucial, and should be thought about very carefully. ZSPUT is only for printable characters. 4.05 procedure ZSGOXY(x, y : byte); ZSGOXY -- Positions cursor within window at col = x , row = y. If the values would take the cursor outside the current window then leaves the cursor at the edge of the window in the position closest to the location specified. The top left hand corner of the screen is coordinate (0, 0). This routine gives the application an opportunity to discover the size of the screen. By doing a ZSGOXY(255,255), then reading ZSCOL and ZSROW, the maximum screen coordinates can be found. 4.06 function ZSGET(col, row : byte) : byte; ZSGET -- Return character at col, row position. Used by higher level routines to perform character insert delete operations and to support various window primitives. If the screen cannot be 'read' efficiently the drivers maintain a screen map to support this function. The coordinates are the absolute full screen coordinates. The character value returned by this function will be in the range 0..255. The character value will be returned when the coordinates are on-screen, regardless of whether they are within the current window. 4.07 procedure ZSCLR; ZSCLR -- Clears the window to BLANKs and re-position the cursor at the top left corner. The blanks are in DEFAULTREND. If an application requires any other rendition, the blanks have to be specifically written to the screen using ZSPUT and a different rendition. 4.08 procedure ZSUPDT(now : boolean); ZSUPDT -- Update real screen and cursor from screen image. For those systems which cannot maintain their own cursor or own screen image, the real cursor and screen need updating from time to time. In order that this can be performed in an efficient manner all screen updates are performed via this routine. If now is TRUE it will perform the update immediately, if now is FALSE it will increment a counter that acts as a software timer and then update. If the other screen routines keep the real screen up-to-date with the screen image this routine is empty. Alternatively the implementor of these device drivers may have elected to perform all screen writes via this routine. If this route was chosen there may be a large measure of optimisation within this routine: i.e. it could maintain a screen bit map of parts of the screen which need re-writing. This routine should be used in all screen application programs, regardless of whether a particular machine requires screen updating. 4.09 function ZSCOL : byte; ZSCOL -- Returns column value of the current cursor position. Provided as a function to allow access from the application level. 4.10 function ZSROW : byte; ZSROW -- Returns row value of the current cursor position. Provided as a function to allow access from the application level. 4.11 procedure ZSBELL; ZSBELL -- Rings console bell device, or provides some audible cue. 4.12 procedure ZSERAL; ZSERAL -- Deletes to end of line within window: sets all character locations from the current cursor position to the right hand edge of the window to BLANKs (ISO 2/0) in the default rendition. 4.13 procedure ZSUPSC(n : byte); ZSUPSC -- Scrolls window contents up n lines. Scrolls blank lines (default rendition) into the vacated lines. Leaves the cursor location unchanged. 4.14 procedure ZSDNSC(n : byte); ZSDNSC -- Scrolls window contents down n lines. Scrolls blank lines (default rendition) into vacated lines. Leaves cursor position unchanged. 4.15 procedure ZSINS(n : byte); ZSINS -- Inserts n spaces in the current rendition at cursor position. Following characters on the line are pushed along, up to the right hand edge of the window, from where they then disappear. Leaves the cursor position unchanged. Note: The use of current rendition spaces is different to most other calls in this set of drivers. 4.16 procedure ZSDEL(n : byte); ZSDEL -- Deletes n characters at cursor position. Pulls in blanks from the right hand edge of the window. Leaves the cursor position unchanged. Blanks are default rendition. 4.17 procedure ZSCURS(on : boolean); ZSCURS -- Toggles character attribute for cursor support on those systems that do not provide suitable cursor. If cursor display is supported, this routine may be empty or it may be used to turn the available cursor on and off at the demand of the application program. If on is FALSE the cursor is defined to be off. If on is TRUE the cursor is displayed. 4.18 procedure ZSFLSH(flash : boolean; n : bits16); ZSFLSH -- If a machine does cursor management, the cursor can be flashed by ZSFLSH. If flash is false, the cursor is left unchanged. If flash is true, the cursor is flashed with a frequency proportional to n after a longer wait which is also proportional to n. Larger n gives a longer wait and slower flash. 4.19 function ZSSETG(g : highlight) : boolean; ZSSETG -- Sets graphics rendition. Sets current rendition to the ISO graphics rendition specified by the g parameter and returns the value TRUE. If the system cannot support the rendition, current rendition is set to DEFAULTREND and the value false is returned. 4.20 function ZSGSET : highlight; ZSGSET -- Returns current graphics rendition. 4.21 procedure ZSTITL(s : string80); ZSTITL -- Writes a title line if possible. Obeys current rendition. 4.22 procedure ZSINFO(display : boolean; col : byte; s : string10); ZSINFO -- Displays a string10 at the specified column on the title line. The boolean variable indicates whether highlighting of some sort is applied, or blanking. 5. Line Routines. ============== These line drivers do basic manipulation of RS232 communications. They incorporate features like character read/write, ready checks and line speed selection. The names of all line procedures and functions start with the two characters ZL, to prevent name conflicts with other modules and application programs. The total length of any procedure or function name does not exceed SIX characters: this is to prevent name clashes with names truncated to six characters. The procedure interface is shown here, and expanded later. 5.01 ZLINIT Initialises line routines 5.02 ZLEND Deinitialises line routines 5.03 ZLDATA Test for incoming data 5.04 ZLGET Read incoming data byte 5.05 ZLRDY Test for transmitter ready 5.06 ZLPUT Send outgoing data byte 5.07 ZLBRK Send a break condition 5.08 ZLSPD Set the RS232 transmit baud rate 5.09 ZLXON Sends and manages an XON character 5.10 ZLXOFF Sends and manages an XOFF character 5.11 ZLXCTL Sets XON/XOFF flow control off or on. 5.01 procedure ZLINIT; ZLINIT -- Initialises the line communications software. XON/XOFF is disabled initially. 5.02 procedure ZLEND; ZLEND -- Deinitialises the line drivers. 5.03 function ZLDATA : boolean; ZLDATA -- Tests for a character having been received. 5.04 function ZLGET : byte; ZLGET -- Reads a received character. ZLDATA must be true before calling ZLGET. 5.05 function ZLRDY : boolean; ZLRDY -- Checks that the transmitter is ready to send another character. 5.06 procedure ZLPUT(c : byte); ZLPUT -- Sends a character. ZLRDY must be true before ZLPUT is called. 5.07 procedure ZLBRK; ZLBRK -- Puts a break condition on the RS232 transmit line. 5.08 function ZLSPD(s, r : bits16; doit : boolean) : boolean; ZLSPD -- Sets the RS232 baud rate. The baud rate is passed as two parameters, send and receive baud rates. The third parameter doit, is used to test whether it is possible to set these baud rates. The function returns true if the action succeeds. Hence by setting the doit parameter false and making the function call, an application program can determine whether it is possible to set the baud rates before actually attempting to do it. 5.09 procedure ZLXON; ZLXON -- Sends and manages an XON. 5.10 procedure ZLXOFF; ZLXOFF -- Sends and manages an XOFF. 5.11 procedure ZLXCTL(onoff : boolean); ZLXCTL -- Enables or disables XON/XOFF flow control. Default value is off, set by ZLINIT. 6. Keyboard Routines. ================== These keyboard drivers incorporate features like character read, ready checks and keyboard reprogramming. The names of all keyboard procedures and functions start with the two characters ZK, to prevent name conflicts with other modules and application programs. The total length of any procedure or function name does not exceed SIX characters: this is to prevent name clashes with names truncated to six characters. The procedure interface is shown here, and expanded later. 6.01 ZKINIT Initialises keyboard routines 6.02 ZKEND Deinitialises keyboard routines 6.03 ZKDATA Tests for a key press 6.04 ZKGET Read incoming keyboard character 6.05 ZKSETK Reprograms a key or set of keys 6.01 procedure ZKINIT; ZKINIT -- Initialises the keyboard software. 6.02 procedure ZKEND; ZKEND -- Deinitialises the keyboard drivers. If key values have been altered by ZKSETK, this procedure resets them to default values. 6.03 function ZKDATA : boolean; ZKDATA -- Tests for a key having been pressed. 6.04 function ZKGET : byte; ZKGET -- Reads a keyboard character. ZKDATA must be true before calling ZKGET. 6.05 function ZKSETK(ssmpkey, kcode : byte) : boolean; ZKSETK -- Reprograms the ssmpkey to give a new key code. It is assumed that ZKEND resets the whole keyboard to a default MSDOS mode. Due to the complexities of SSMP, this procedure is defined in a slightly unusual manner. The ssmpkey input is linked with a key or a number of keys, depending on the implementation for a given machine, which are then programmed according to the value of kcode: kcode 0 - 31 programs NUL - 31 kcode 32 - 126 programs ESC BLANK - ESC TILDE kcode 127 - 159 programs DEL - 159 kcode 160 - 255 programs BLANK - 255 For example: ZKSETK( KCSRLEFT, CTRLH ); Sets all cursor left keys to CTRLH ZKSETK( KINSSPAC, ord('?')); Sets all insert space keys to ESC ? If you are using this procedure, or indeed any feature of SSMP, then you will benefit from using the following two include files: MDRV:SSMP.CST contains constant definitions for SSMP programs. MDRV:SSMP.TYP contains type definitions for SSMP programs. 7. Miscellaneous Routines. ======================= The following generally useful routines are also provided: 7.01 ZDSABL Disables interrupts 7.02 ZENABL Enables interrupts 7.03 ZAND Logical 16 bit AND 7.04 ZOR Logical 16 bit OR 7.05 ZXOR Logical 16 bit XOR 7.06 ZTIMER Sets a timer going 7.07 ZALARM Indicates the end of a time period 7.08 ZNAME Returns the microcomputer's long name 7.09 ZDESC Returns the microcomputer's short name 7.10 ZLOOP Returns a software looping constant 7.11 ZWAIT Executes a loop and waits for n ms 7.01 procedure ZDSABL; ZDSABL -- Disables interrupts. Use with care on interrupt driven systems. 7.02 procedure ZENABL; ZENABL -- Enables interrupts. Use with care on interrupt driven systems. 7.03 function ZAND( a,b : bits16 ) : bits16; ZAND -- 16 bit logical AND of parameters is returned. 7.04 function ZOR( a,b : bits16 ) : bits16; ZOR -- 16 bit logical OR of parameters is returned. 7.05 function ZXOR( a,b : bits16 ) : bits16; ZXOR -- 16 bit logical XOR of parameters is returned. 7.06 function ZTIMER(count : bits16) : byte; ZTIMER -- Sets a timer running to measure count ms. The end of the count is measured by calling ZALARM. The function returns a handle for the timer operation, so that two or more timers can run at once. The call to ZALARM includes specifying the handle. A call with a zero count parameter will reset all the timers. {rst := ZTIMER(0);} This should be done before using any of the timers. Some systems will only allow time delays in multiples of 50ms. If this is the case, the time period will be reduced to the nearest multiple of 50ms. 7.07 function ZALARM(handle : byte) : boolean; ZALARM -- Tests whether a timer has counted down. The timer handle is passed to the routine. The routine returns false if the timer is counting down and true otherwise. A timer alarm accessed incorrectly without having been set going always returns true. All timers should be initialised with a call of rst := ZTIMER(0); 7.08 procedure ZNAME(var nam : string30); ZNAME -- Returns the brand and name of the microcomputer: long form. 7.09 procedure ZDESC(var nam : string10); ZDESC -- Returns the brand and name of the microcomputer: short form. 7.10 function ZLOOP : bits16; ZLOOP -- Returns a machine specific value for a software timing loop. 7.11 procedure ZWAIT(n : bits16); ZWAIT -- Software loop to wait for a certain number of ms. Appendix A. Alphabetic List of Routines. ============================ ZALARM -- Tests whether a timer has counted down. 7.07 ZAND -- 16 bit logical AND. 7.03 ZDESC -- Returns the microcomputer's name: short form. 7.09 ZDSABL -- Disables interrupts. 7.01 ZENABL -- Enables interrupts. 7.02 ZKDATA -- Tests for a key having been pressed. 6.03 ZKEND -- Deinitialises the keyboard drivers. 6.02 ZKGET -- Reads a keyboard character. 6.04 ZKINIT -- Initialises the keyboard software. 6.01 ZKSETK -- Reprograms keys with SSMP definitions. 6.05 ZLBRK -- RS232 break. 5.07 ZLDATA -- Tests for a character having been received. 5.03 ZLEND -- Deinitialises the line drivers. 5.02 ZLGET -- Reads a received character. 5.04 ZLINIT -- Initialises the RS232 line software. 5.01 ZLOOP -- Returns a value for a software timing loop. 7.10 ZLPUT -- Sends a character. 5.06 ZLRDY -- Tests that ready to send another RS232 character. 5.05 ZLSPD -- Sets the RS232 baud rate. 5.08 ZLXCTL -- Enables or disables XON/XOFF flow control. 5.11 ZLXOFF -- Sends and manages an XOFF. 5.10 ZLXON -- Sends and manages an XON. 5.09 ZNAME -- Returns the microcomputer's name: long form. 7.08 ZOR -- 16 bit logical OR. 7.04 ZSBELL -- Rings console bell device. 4.11 ZSCLR -- Clears the window. 4.07 ZSCOL -- Returns cursor column position. 4.09 ZSCURS -- Toggles cursor. 4.17 ZSDEL -- Deletes characters at cursor. 4.16 ZSDNSC -- Scrolls window contents down. 4.14 ZSEND -- Performs any screen de-initialisation. 4.02 ZSERAL -- Deletes to end of line within window. 4.12 ZSFLSH -- Flashes cursor. 4.18 ZSGET -- Returns character at col,row position. 4.06 ZSGOXY -- Positions cursor within window. 4.05 ZSGSET -- Returns current graphics rendition. 4.20 ZSINFO -- Displays a string10 on the title line. 4.22 ZSINIT -- Performs any screen initialisation. 4.01 ZSINS -- Inserts n spaces at cursor position. 4.15 ZSPUT -- Sends character to window at current cursor position. 4.04 ZSROW -- Returns row value of the current cursor position. 4.10 ZSSETG -- Sets graphics rendition. 4.19 ZSTITL -- Writes a title line if possible. 4.21 ZSUPDT -- Updates real screen and cursor from screen image. 4.08 ZSUPSC -- Scrolls window contents up n lines. 4.13 ZSWIN -- Sets screen window dimensions. 4.03 ZTIMER -- Sets a timer running. 7.06 ZWAIT -- Software loop to wait for a certain number of ms. 7.11 ZXOR -- 16 bit logical XOR. 7.05 Appendix B. Apricot PC Implementation. ========================== B.1 Screen routines. ================ 80 x 25 memory mapped screen. The top line is a title line, and the remaining 24 are addressed by the primitives. Renditions implemented:- Defaultrend, Bold, Underscored, Negative-image, Concealed, Crossed-out. B.2 Line routines. ============== Implemented using Apricot BIOS calls. 4K byte interrupt buffer. 75 through 9600 baud rates available. Transmit and receive handled separately, so split speeds possible. Alternatively a SPEED selection program is available for the Apricot which may be run prior to an application program to select the correct baud rate; this is in the MTS file MSDS:APRSPEED.EXE. B.3 Keyboard routines. ================== Cursor keys programmed to ^H, ^J, ^K, ^L. Uses MSDOS call to read the keyboard. Original values of keys are not restored properly by ZKEND. The keyboard can be reset using the Apricot program KEYS. Calc key is programmed to operate calculator. SSMP keys available: KINTHOST : INTR key, F6 KSUSPEND : F4 KRESTART : F5 KENTER : ENTER key KCSRUP : Cursor up KCSRDOWN : Cursor down KCSRLEFT : Cursor left KCSRRIGHT : Cursor right KNEXTTAB : Tab key (unshifted) KPREVTAB : Tab key (shifted) KERARIGHT : Clear key KINSMODE : Insert key (unshifted) KDELCHAR : Delete key (unshifted) KINSLINE : Insert key (shifted) KDELLINE : Delete key (unshifted) KNEXTFLD : Scroll key (unshifted) KPREVFLD : Scroll key (shifted) KHOMEFLD : Home key KEXIT : Menu and Finish keys KHELP : Help key Appendix C. IBM PC Implementations. ======================= There are two implementations provided: one with line drivers that use the first serial port, and one with line drivers that use the second serial port. These routines work for the whole IBM PC family of machines: this includes the PC, the XT and the AT. C.1 Screen routines. ================ Colour and monochrome display adaptors are both 80 x 25 memory-mapped screens but they are mapped at different addresses. The drivers detect the presence of the different adaptors and write to one only. If both monochrome and colour are present, the monochrome adaptor is selected. The top line is a title line, and the remaining 24 are addressed by the primitives. These screen drivers requires ANSI codes to be enabled when driving the screen. This is achieved by arranging that, at boot time, file CONFIG.SYS contains 'DEVICE=ANSI.SYS', and file ANSI.SYS should be available on the boot disk. Renditions implemented:- Defaultrend, Bold, Underscored, Negative-image, Concealed, Crossed-out; Slow-blink for both monochrome and colour, and also Faint and Italic in colour. C.2 Line routines. ============== Interrupt drivers implemented by replacing the RS232 and timer interrupt service routines with custom code. 2K byte interrupt buffer. 300 through 9600 baud rates available. Split baud rates are not available. A SPEED selection program is available which may be run prior to application programs to select the correct baud rate: see MTS file MSDS:IBMSPEED.EXE for the first serial port, and MTS file MSDS:IBMSPED2.EXE for the second serial port. C.3 Keyboard routines. ================== Cursor keys programmed to ^H, ^J, ^K, ^L, also DEL key produces a real DEL, and F0 through F9 are programmed to be ESC 0 through ESC 9. Uses MSDOS call to read the keyboard. The keyboard configuration is returned to normal after ZKEND. SSMP keys available: KINTHOST : Alt F9 KSUSPEND : Alt F7 KRESTART : Alt F8 KCSRUP : Cursor up KCSRDOWN : Cursor down KCSRLEFT : Cursor left KCSRRIGHT : Cursor right KPREVTAB : Tab key KALASTNS : End key KINSMODE : Ins key KNEXTFLD : Page down and home cursor KPREVFLD : Page up KHOMEFLD : Home KEXIT : Alt F10 Appendix D. RM Nimbus Implementations. ========================== There are two implementations provided: one with line drivers that use the AUX port and one with line drivers that use the DCC port. D.1 Screen routines. ================ Screen is 80 x 25 but it is driven by low-level sub-BIOS calls. The top line is a title line, and the remaining 24 are addressed by the primitives. Renditions implemented:- Defaultrend, Bold, Underscored, Negative-image, Concealed. D.2 Line routines. ============== For the AUX port, no speed selection program is provided, since the baud rate may be changed by running the Nimbus CONFIG program: speeds of 300 through 9600 are available. The DCC line drivers work with DCC Card 2 at a fixed speed of 9600 baud only. Sub-BIOS calls are used for both sets of drivers; a 2K byte interrupt buffer is used. D.3 Keyboard routines. ================== Uses MSDOS call to read the keyboard. The keyboard is programmed with F1 to F10 becoming ESC 1, ESC 2,...ESC 0. DEL key becomes DEL and BS becomes Ctrl H. The keyboard configuration is returned to normal after ZKEND. SSMP keys available: KINTHOST : Alt F9 KSUSPEND : Alt F7 KRESTART : Alt F8 KCSRUP : Cursor up KCSRDOWN : Cursor down KCSRLEFT : Cursor left KCSRRIGHT : Cursor right KPREVTAB : Tab key KALASTNS : End key KINSMODE : Ins key KNEXTFLD : Page down and home cursor KPREVFLD : Page up and home cursor KHOMEFLD : Home KEXIT : Alt F10 Appendix E. Amstrad PC Implementation. ========================== These routines work for both monochrome and colour monitor versions of the Amstrad PC1512. E.1 Screen routines. ================ 80 x 25 memory-mapped screen. The top line is a title line, and the remaining 24 are addressed by the primitives. These screen drivers requires ANSI codes to be enabled when driving the screen. This is achieved by arranging that, at boot time, file CONFIG.SYS contains 'DEVICE=ANSI.SYS', and file ANSI.SYS should be available on the boot disk. Renditions implemented:- Defaultrend (white on black), Faint (magenta on black), Bold (intense white on black), Slow-blink, Concealed, Negative-image (black on white). E.2 Line routines. ============== Interrupt drivers implemented by replacing the RS232 and timer interrupt service routines with custom code. 2K byte interrupt buffer. 300 through 9600 baud rates available. Split baud rates are not available. The Amstrad NVR utility should be used to set the desired line speed. E.3 Keyboard routines. ================== Cursor keys programmed to ^H, ^J, ^K, ^L, also DEL key produces a real DEL, and F0 through F9 are programmed to be ESC 0 through ESC 9. Uses MSDOS call to read the keyboard. The keyboard configuration is returned to normal after ZKEND. SSMP keys available: KINTHOST : Alt F9 KSUSPEND : Alt F7 KRESTART : Alt F8 KCSRUP : Cursor up KCSRDOWN : Cursor down KCSRLEFT : Cursor left KCSRRIGHT : Cursor right KPREVTAB : Tab key KALASTNS : End key KINSMODE : Ins key KNEXTFLD : Page down and home cursor KPREVFLD : Page up KHOMEFLD : Home KEXIT : Alt F10 D. J. Sedgwick and A. M. Lamont 6th July, 1987