                                  CP/M   V2.2
                             Application Note 02, 2/20/82
                 Reversing the BACKSPACE and RUBOUT Key Functions and
                         Making RUBOUT Identical to BACKSPACE

                         Copyright   1982 by Digital Research
                 CP/M is a registered trademark of Digital Research.
                   DDT and SID are trademarks of Digital Research.
                                Compiled November 1982


          Applicable products and version numbers:  CP/M   V2.1 and V2.2

          Program:  BDOS

               In the following code segment procedures, addresses given are
          hexadecimal  offsets from the base of the CP/M system.  The CCP is
          usually located at 980H but can be located at A00H if a two-sector
          boot is used.

               You can assemble the patch for your size memory system.   The
          cpmbase  equals  the BDOS entry point address at locations 6 and 7
          in the base page of memory minus 806H.  You must change this entry
          point  address  when  you load DDT   or SID   .  Under DDT or SID,
          follow the jump at location 5 until an address  is  found  with  a
          least  significant  digit  of  6.  In  the  following example, the
          cpmbase would be E506H-806H or DD00H.


                  0005  JMP  CD00
                  CD00  JMP  D3A4
                  D3A4  XTHL
                  D3A5  SHLD E452
                  D3A8  XTHL
                  D3A9  JMP  E506


          Procedure to reverse the BACKSPACE and RUBOUT key functions:

               Patch into the SYSGEN or MOVCPM image exactly  as  you  would
          patch  in  a  new  version  of  your BIOS, using the DDT i command
          followed by the DDT r command.  You can use  the  same  offset  as
          your custom BIOS and install the following code:


          cpmbase equ      ?        ;subtrack 806h from address at location 6

                  org      cpmbase + 0A02h

                  cpi      7fh      ;was cpi 08h

                  org      cpmbase + 0A16h

                  cpi      08h      ;was cpi 7fh

               Or, you can install the above procedure directly into  MOVCPM
          if  you have MOVCPM.COM on your system disk.  The patch is applied
          automatically to any size system  that  you  build  using  MOVCPM.
          Make  a  back-up  copy  of MOVCPM.COM before using DDT to make the
          following changes:


                  A>ddt movcpm.com
                  DDT VERS 2.2
                  NEXT  PC
                  2700 0100
                  -l1402
                  1402  CPI  08
                  1404  JNZ  0A16
                  1407  MOV  A,B
                  1408  ORA  A
                  1409  JZ   09EF
                  140C  DCR  B
                  140D  LDA  0B0C
                  1410  STA  0B0A
                  1413  JMP  0A70
                  1416  CPI  7F
                  1418  JNZ  0A26
                  -s1403
                  1403 08 7f
                  1404 C2 .
                  -s1417
                  1417 7f 8
                  1418 C2 .
                  -g0

                  A>save 38 movcpm1.com


               Use the new program MOVCPM1.COM in place of MOVCPM.COM.   The
          BACKSPACE  and  RUBOUT  key  functions  are  reversed for any CP/M
          system generated with MOVCPM1.COM.

          Procedure to make RUBOUT identical to BACKSPACE:

               Before you install this patch, the code at  cpmbase  +  0A1Bh
          should read:

                  mov      a,b
                  ora      a
                  jz       cpmbase + 09EFh
                  mov      a,m
                  dcr      b
                  dcx      h
                  jmp      cpmbase + 0AA9h




               Patch into the SYSGEN or MOVCPM image exactly  as  you  would
          patch  in  a  new  version  of  your BIOS, using the DDT i command
          followed by the DDT r command.  Use the same offset as your custom
          BIOS and install the following code:


                  cpmbase equ      ?
                  ;
                  ;
                          org      cpmbase + 0A1Bh
                  ;
                          mvi      a,8h
                          jmp      cpmbase + 0A07h
                          end


               Or, you can install the above procedure directly into  MOVCPM
          if  you  have  MOVCPM.COM  on  your  system  disk.  The  patch  is
          installed automatically in any size system that  you  build  using
          MOVCPM.  Make  a  back-up  copy  of MOVCPM.COM before using DDT to
          make the following changes.

                    A>ddt movcpm.com
                    DDT VERS 2.2
                    NEXT  PC
                    2700 0100
                    -l141b
                    141B  MOV  A,B
                    141C  ORA  A
                    141D  JZ   09EF
                    1420  MOV  A,M
                    1421  DCR  B
                    . . .

                    -a141b
                    141B mvi a,8
                    141D jmp a07
                    1420 .
                    -g0

                    A>save 38 movcpm1.com


               Use the new program MOVCPM1.COM in place of MOVCPM.COM.   The
          RUBOUT  and  BACKSPACE  key  functions  are  identical in any CP/M
          system generated with MOVCPM1.COM.

               Licensed  users  are  granted  the  right  to  include  these
          modifications in CP/M V2.2 software.
