





                NMIX-0020 & NMIT-0020 BASIC11E9 LCD & KEYPAD DRIVERS

                                     Nov 2, 1993
                                     R. M. Dumse
                                  New Micros, Inc.


          1. The disk contains the following files:

               README
               HEX
               LCD.ASM
               LCD.BAS
               LCD.LST
               LCD.S19
               LCD.WS2

          (1)  README : This file

          (2)  HEX : The assembly language formated for BASIC  data  state-
          ments.    This  was  created by modifying the LCD.S19 object file
          with a word processor.

          (3) LCD.ASM : The Assembly Language drivers source code is  here.
          Two subroutines are provided.  One which accepts key strokes from
          the key pad and converts them to ASCII characters,  and the other
          which  displays  ASCII  characters  on  the  LCD.   The assembled
          machine code of this file is included in LCD.BAS as  DATA  state-
          ments.

          (4) LCD.BAS : The BASIC program which sets up at the top of BASIC
          memory, loads the machine code at the location, and then, execute
          the machine code.  Following are the detailed explanation of each
          basic instructions.

               Line #         Comments
               -------------------------------------------------------
               40-80          Assembled machine code of drivers.
               90             Read the address offset (AD) of the LCD
                              driver and the size (SZ) of both drivers.
               100            J=address of the end of basic memory
                              less the size needed for the drivers.
               110            K=J-1, where K=new end address of basic
                              and variable memory.
               120            Store K at $E.
               130            Store K at $10.
               140-180        Read each machine code in DATA statements.
                              and store at the location beginning at J.
               190            Install the Keypad driver in table loc # 2.
               200            Install the Keypad driver in table loc # 2.
               210-240        Initialize LCD mode.
               250            End of program.

                                          1







          (5)  LCD.LST  : The Assembly language listing output from the as-
          sembler.  This was obtained with the DOS command line:

               AS11 LCD.ASM -l >> LCD.LST

          (6)  LCD.S19 : The assembled object code in  .S19  format.    The
          result of having assembled the LCD.ASM code.

          (7)  LCD.WS2 : This file in original word processor format.   You
          can ignore this one.


          2. Getting started

          (1) Turn on your BASIC board, download LCD.BAS program,  and then
          type  'RUN'  to  execute  the  program.   Everything will be done
          automatically.

          (2) Keys pressed on the Keypad can be read.  You can read the in-
          coming character by doing

               INPUT #2,N     to read an integer or
               INBYTE #2,C    to read an ASCII character

          The BASIC interpreter waits keys  to  be  pressed.  As  designed,
          there  is  no  return  key.    Therefore,  the  INBYTE  method is
          prefered.   The driver reports the keys as ASCII codes  "0"  -"9"
          and "A" - "J".  (The driver could be modified to translate a par-
          ticular key to a CR.   Additional modifications may be desired to
          create a backspace key.)

          (3) Print statements can be directed to the LCD by doing.

               PRINT #2, xxxxx

          where xxxxx are the normal print statement arguments.    The  LCD
          scrolls  to  the  right,  and  wraps  from top to bottom and back
          again. In this way the entire LCD can be filled.   (For a display
          with more than one display controller, a more elaborate driver is
          needed.)    The  driver  strips  LF's from the stream.  The drive
          detects CR's and returns to home position when they  are  encoun-
          tered.

          3.  Things to be noted

          (1)  Since  the  BASIC DOES keep the memory and program at reset,
          you should not run the program everytime.   Only ONE execution is
          needed  after  NEW  command.    Additional executions will reduce
          available memory,  by adding an additional copy  of  the  drivers
          each time.


                                          2






          (2)  If  you  cause  an  error  by  typing invalid numbers at the
          keypad,  BASIC displays an error message on the LCD and waits for
          the  next  command  from the keypad.   To go back to the on-board
          serial channel, execute a

               POKE($37,0)

          which reset the default device number as 0. (These characters are
          not all available form the keypad so  this  situation  should  be
          avoided.    It will be difficult to cause this execution from the
          keypad.)










































                                          3
