Newsgroups: comp.sys.apple2
Path: news.uiowa.edu!uunet!europa.chnt.gtegsc.com!news.sprintlink.net!hookup!lll-winken.llnl.gov!enews.sgi.com!decwrl!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson
From: dempson@atlantis.actrix.gen.nz (David Empson)
Subject: Re: Mapping DEL to BS in BASIC
Message-ID: <DApJx8.Ku0@actrix.gen.nz>
Sender: news@actrix.gen.nz (News Administrator)
Organization: Actrix - Internet Services
Date: Sun, 25 Jun 1995 02:51:07 GMT
References: <3shai6$o4m@cello.gina.calstate.edu>
X-Nntp-Posting-Host: atlantis.actrix.gen.nz
Lines: 63

In article <3shai6$o4m@cello.gina.calstate.edu>,
Christopher Sokolov <csokolo@cello.gina.calstate.edu> wrote:
> Does anybody know how to make the DELETE key on an Apple IIe (unenhanced 
> or enhanced) function like the left arrow (backspace) key in Applesoft 
> Basic?

The best way would be to patch the monitor's GETLN routine to
recognise DEL and do a backspace (like the IIgs; not sure about the
IIc).

Two alternatives come to mind:

1. Write your own routine (preferably in machine language) to read
   lines from the keyboard, and use it in your own program.  This is a
   rather complicated task.

2. Use a modified "get character" routine which maps DEL to backspace.
   This would require intercepting the keyboard input vector, calling the
   original routine, and checking the return value to see if it was a DEL.

The following routine seems to work:

0300- D8          CLD
0301- 20 1B FD    JSR $FD1B
0304- C9 FF       CMP #$FF
0306- D0 02       BNE $030A
0308- A9 88       LDA #$88
030A- 60          RTS

You can POKE this routine in from BASIC as follows:

1000 FOR I = 768 TO 778: READ J: POKE I,J: NEXT
1010 DATA 216,32,27,253,201,255,208,2,169,136,96

You then need to attach it to the keyboard input hooks.  Under ProDOS,
the best way to do this is:

1020 PRINT CHR$(4);"IN#A$300"

Any subsequent press of DEL will generate a backspace character
instead.  To disable it, use IN#0 from the command line, or

1100 PRINT CHR$(4);"IN#0"

from inside a program.

Under DOS 3.3, you can connect this routine to the input hooks using:

1020 POKE 56,0: POKE 57,3: CALL 1002

The IN#0 method will restore the original input routine.


This routine will probably only behave itself in 40-column mode.  It
should have no effect on the IIc or IIgs, and is neutral on the II+
(no DEL key anyway).  The only disadvantage is that you won't be able
to press the DEL key even during a GET statement - it will always
return a backspace character, until you do an IN#0 to disable this
routine.
-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand
