Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4094 > unrolled thread

In Applesoft, can open-apple key be detected with GET?

Started byMatthew Power <matthewmpower@gmail.com>
First post2018-01-07 13:11 -0800
Last post2018-01-09 22:37 -0600
Articles 11 — 7 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  In Applesoft, can open-apple key be detected with GET? Matthew Power <matthewmpower@gmail.com> - 2018-01-07 13:11 -0800
    Re: In Applesoft, can open-apple key be detected with GET? Du Hast <duhast6377@gmail.com> - 2018-01-07 13:23 -0800
      Re: In Applesoft, can open-apple key be detected with GET? Matthew Power <matthewmpower@gmail.com> - 2018-01-07 14:10 -0800
        Re: In Applesoft, can open-apple key be detected with GET? gids.rs@sasktel.net - 2018-01-08 08:09 -0800
    Re: In Applesoft, can open-apple key be detected with GET? James Davis <JPD.Enterprises@outlook.com> - 2018-01-08 14:23 -0800
      Re: In Applesoft, can open-apple key be detected with GET? James Davis <JPD.Enterprises@outlook.com> - 2018-01-08 14:26 -0800
        Re: In Applesoft, can open-apple key be detected with GET? Matthew Power <matthewmpower@gmail.com> - 2018-01-09 18:25 -0800
      Re: In Applesoft, can open-apple key be detected with GET? Brian Patrie <bpatrie@bellsouth.spamisicky.net> - 2018-01-08 18:09 -0600
        Re: In Applesoft, can open-apple key be detected with GET? James Davis <JPD.Enterprises@outlook.com> - 2018-01-08 18:21 -0800
          Re: In Applesoft, can open-apple key be detected with GET? Tom Porter <laseractiveguy@gmail.com> - 2018-01-09 18:16 -0800
          Re: In Applesoft, can open-apple key be detected with GET? Michael J. Mahon <mjmahon@aol.com> - 2018-01-09 22:37 -0600

#4094 — In Applesoft, can open-apple key be detected with GET?

FromMatthew Power <matthewmpower@gmail.com>
Date2018-01-07 13:11 -0800
SubjectIn Applesoft, can open-apple key be detected with GET?
Message-ID<4d44b35b-8a2d-49cf-95c0-1f57e3747b5c@googlegroups.com>
My short program to detect keys in Applesoft:

 0  PRINT  CHR$ (4)"pr#3"
 100  PRINT "press a key:"
 200  GET K$
 210  IF K$ = "" THEN  GOTO 200
 220  IF K$ = "Q" THEN  GOTO 300 REM  quits
 221  IF K$ =  CHR$ (8) THEN  PRINT "left ";
 222  IF K$ =  CHR$ (21) THEN  PRINT "right ";
 223  IF K$ =  CHR$ (11) THEN  PRINT "up ";
 224  IF K$ =  CHR$ (10) THEN  PRINT "down ";
 225  IF K$ =  CHR$ (27) THEN  PRINT "escape ";
 227  IF K$ =  CHR$ (13) THEN  PRINT "return ";
 228  IF K$ =  CHR$ (9) THEN  PRINT "tab ";
 229  IF K$ =  CHR$ (127) THEN  PRINT "delete ";
 290  GOTO 200
 300  END

The way I found the values for those keys is:

 10 K =  PEEK ( - 16384)
 15  IF K = 13 THEN  GOTO 10
 16 K = K - 128
 20  PRINT K

But I haven't found a way for the open-apple key to respond. Any suggestions?

[toc] | [next] | [standalone]


#4095

FromDu Hast <duhast6377@gmail.com>
Date2018-01-07 13:23 -0800
Message-ID<327bf810-7720-49f3-84bf-f0a2e9c148d7@googlegroups.com>
In reply to#4094
On Sunday, January 7, 2018 at 4:11:32 PM UTC-5, Matthew Power wrote:
> My short program to detect keys in Applesoft:
> 
>  0  PRINT  CHR$ (4)"pr#3"
>  100  PRINT "press a key:"
>  200  GET K$
>  210  IF K$ = "" THEN  GOTO 200
>  220  IF K$ = "Q" THEN  GOTO 300 REM  quits
>  221  IF K$ =  CHR$ (8) THEN  PRINT "left ";
>  222  IF K$ =  CHR$ (21) THEN  PRINT "right ";
>  223  IF K$ =  CHR$ (11) THEN  PRINT "up ";
>  224  IF K$ =  CHR$ (10) THEN  PRINT "down ";
>  225  IF K$ =  CHR$ (27) THEN  PRINT "escape ";
>  227  IF K$ =  CHR$ (13) THEN  PRINT "return ";
>  228  IF K$ =  CHR$ (9) THEN  PRINT "tab ";
>  229  IF K$ =  CHR$ (127) THEN  PRINT "delete ";
>  290  GOTO 200
>  300  END
> 
> The way I found the values for those keys is:
> 
>  10 K =  PEEK ( - 16384)
>  15  IF K = 13 THEN  GOTO 10
>  16 K = K - 128
>  20  PRINT K
> 
> But I haven't found a way for the open-apple key to respond. Any suggestions?

The Open-Apple is the same as joystick button 0.  You could check that location, but it probably can't be handled with get.

[toc] | [prev] | [next] | [standalone]


#4096

FromMatthew Power <matthewmpower@gmail.com>
Date2018-01-07 14:10 -0800
Message-ID<78238db3-3c6e-4c5f-892e-33c024b58da3@googlegroups.com>
In reply to#4095
> The Open-Apple is the same as joystick button 0.  You could check that location, but it probably can't be handled with get.

Thanks for the tip! From your response I added:

205 J = PEEK ( - 16287 )

and 

230 IF J > 127 THEN PRINT "open-apple ";

Works great!

[toc] | [prev] | [next] | [standalone]


#4097

Fromgids.rs@sasktel.net
Date2018-01-08 08:09 -0800
Message-ID<bafc39ea-1119-4bea-9afe-f96754f3cd46@googlegroups.com>
In reply to#4096
On Sunday, January 7, 2018 at 4:10:53 PM UTC-6, Matthew Power wrote:
> > The Open-Apple is the same as joystick button 0.  You could check that location, but it probably can't be handled with get.
> 
> Thanks for the tip! From your response I added:
> 
> 205 J = PEEK ( - 16287 )
> 
> and 
> 
> 230 IF J > 127 THEN PRINT "open-apple ";
> 
> Works great!


You can also use wait, which will act the same as GET.

WAIT -16287,128

[toc] | [prev] | [next] | [standalone]


#4098

FromJames Davis <JPD.Enterprises@outlook.com>
Date2018-01-08 14:23 -0800
Message-ID<e8fdc532-b9a4-4b88-89c8-478dfd72e2da@googlegroups.com>
In reply to#4094
I wonder if there is some way to wire up the (16-pin Game Port) pushbuttons [(0, 1)={KB-key (Open-Apple, Solid-Apple)}] to cause the Keyboard Strobe to set (go to 128)?  Or, can it (and/or the Keyboard register {KBD}) be poked with the high ASCII values representing OA & SA?--For the GET K$ to retrieve.  Better yet, just set K$ to the value and bypass the GET when OA/SA is pressed. 

[toc] | [prev] | [next] | [standalone]


#4099

FromJames Davis <JPD.Enterprises@outlook.com>
Date2018-01-08 14:26 -0800
Message-ID<9460cf47-63d1-4d63-8825-a460e7be8429@googlegroups.com>
In reply to#4098
Mathew, please re-post your finalized program when you are done with it.

[toc] | [prev] | [next] | [standalone]


#4105

FromMatthew Power <matthewmpower@gmail.com>
Date2018-01-09 18:25 -0800
Message-ID<ea90e227-10db-43aa-89a5-0e0ac8f92426@googlegroups.com>
In reply to#4099
> Mathew, please re-post your finalized program when you are done with it.

Well it's a silly little program, as I'm just trying to learn. But as you requested,

 0  PRINT  CHR$ (4)"pr#3"
 1  PRINT "press a key:"
 2  GET K$
 3 J =  PEEK ( - 16287) rem check open-apple
 4  IF K$ = "" THEN  GOTO 2
 5  IF J > 127 THEN  PRINT "open-apple-";
 6  IF K$ = "Q" THEN  GOTO 16 REM  quits
 7  IF K$ =  CHR$ (8) THEN  PRINT "left ";
 8  IF K$ =  CHR$ (21) THEN  PRINT "right ";
 9  IF K$ =  CHR$ (11) THEN  PRINT "up ";
 10  IF K$ =  CHR$ (10) THEN  PRINT "down ";
 11  IF K$ =  CHR$ (27) THEN  PRINT "escape ";
 12  IF K$ =  CHR$ (13) THEN  PRINT "return ";
 13  IF K$ =  CHR$ (9) THEN  PRINT "tab ";
 14  IF K$ =  CHR$ (127) THEN  PRINT "delete ";
 15  GOTO 2
 16  END 

[toc] | [prev] | [next] | [standalone]


#4100

FromBrian Patrie <bpatrie@bellsouth.spamisicky.net>
Date2018-01-08 18:09 -0600
Message-ID<p31180$1hrc$1@gioia.aioe.org>
In reply to#4098
On 2018-01-08 16:23, James Davis wrote:
 > I wonder if there is some way to wire up the (16-pin Game Port)
 > pushbuttons [(0, 1)={KB-key (Open-Apple, Solid-Apple)}] to cause
 > the Keyboard Strobe to set (go to 128)?  Or, can it (and/or the
 > Keyboard register {KBD}) be poked with the high ASCII values
 > representing OA & SA?--For the GET K$ to retrieve.  Better yet,
 > just set K$ to the value and bypass the GET when OA/SA is pressed.

You cannot poke values into the keyboard register.
You can, however monkey with what you get from GET.

  10 PRINT "Press keys to see their values."
  11 PRINT "Type OA-Q to quit."
  20 GET K$:K = ASC(K$+CHR$(0)) + ( PEEK(49249)>127 ) * 128
  21 K$ = CHR$(K) : REM kinda optional
  30 PRINT K,
  40 IF K = 209 OR K = 241 THEN 99 : REM OA-Q
  90 GOTO 20
  99 END

(The +CHR$(0) is to prevent an illegal quantity error,
if the user types ctrl-@.)

[toc] | [prev] | [next] | [standalone]


#4101

FromJames Davis <JPD.Enterprises@outlook.com>
Date2018-01-08 18:21 -0800
Message-ID<f59c5b57-6a2c-49e4-9d43-dcfbad6bc614@googlegroups.com>
In reply to#4100
On Monday, January 8, 2018 at 4:09:40 PM UTC-8, Brian Patrie wrote:
> You cannot poke values into the keyboard register.

Okay.  Anybody want to weigh in on rewiring?

[toc] | [prev] | [next] | [standalone]


#4104

FromTom Porter <laseractiveguy@gmail.com>
Date2018-01-09 18:16 -0800
Message-ID<8f063173-00e0-4142-9114-dac05523120c@googlegroups.com>
In reply to#4101
The difference in the (open/closed apple)keys is actually a very good and useful thing.  In my LoRES and Double LoRES drawing programs, I can use one of those buttons to act as a PEN while using the arrow keys to move the curser.  If APPLE used the Open Apple Key as a regular key, this would be "just about' impossible.

[toc] | [prev] | [next] | [standalone]


#4106

FromMichael J. Mahon <mjmahon@aol.com>
Date2018-01-09 22:37 -0600
Message-ID<v4mdnT_wXIsPBcjHnZ2dnUU7-KXNnZ2d@giganews.com>
In reply to#4101
James Davis <JPD.Enterprises@outlook.com> wrote:
> On Monday, January 8, 2018 at 4:09:40 PM UTC-8, Brian Patrie wrote:
>> You cannot poke values into the keyboard register.
> 
> Okay.  Anybody want to weigh in on rewiring?
> 
> 

That would be my last option, particularly since the strobe logic is
internal to the encoder. 

It's trivial to include open-/closed-Apple polling within a keyboard
polling loop--then you can do any transformation you want in software. 

-- 
-michael - NadaNet 3.1 and AppleCrate II:  http://michaeljmahon.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web