home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 5
/
005.d81
/
p_p_s#10
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
154 lines
PEEKs, POKEs, and SYSes -- Part 10
by Jimmy Weiler
======================================
Location:197 Hexadecimal: $00C5
Official Label: LSTX Type: RAM
Useful BASIC commands: PEEK
LSTX contains the number of the key
being pressed. If no key is pressed,
LSTX contains 64.
The keys are not numbered by ascii
value, or keyboard position. Rather
they are numbered by PRIORITY. What's
priority? Simple: the highest number
goes first. If several keys are
pressed, the one with the highest
number is the one that gets into 197.
What's not so simple is knowing which
keys have which numbers.
That's why we're giving you this
chart:
--------------------------------------
{CBM-G} {CBM-N}
{CBM-G} 0 = inst/del 33 = i {CBM-N}
{CBM-G} 1 = return 34 = j {CBM-N}
{CBM-G} 2 = _crsr 35 = 0 {CBM-N}
{CBM-G} 3 = f7/f8 36 = m {CBM-N}
{CBM-G} 4 = f1/f2 37 = k {CBM-N}
{CBM-G} 5 = f3/f4 38 = o {CBM-N}
{CBM-G} 6 = f5/f6 39 = n {CBM-N}
{CBM-G} 7 = ^crsr 40 = + {CBM-N}
{CBM-G} 8 = 3 41 = p {CBM-N}
{CBM-G} 9 = w 42 = l {CBM-N}
{CBM-G}10 = a 43 = - {CBM-N}
{CBM-G}11 = 4 44 = . / > {CBM-N}
{CBM-G}12 = z 45 = : / [ {CBM-N}
{CBM-G}13 = s 46 = @ {CBM-N}
{CBM-G}14 = e 47 = , / < {CBM-N}
{CBM-G}15 = not used 48 = \ {CBM-N}
{CBM-G}16 = 5 49 = * {CBM-N}
{CBM-G}17 = r 50 = ; / ] {CBM-N}
{CBM-G}18 = d 51 = clr / home {CBM-N}
{CBM-G}19 = 6 52 = not used {CBM-N}
{CBM-G}20 = c 53 = = {CBM-N}
{CBM-G}21 = f 54 = ^ {CBM-N}
{CBM-G}22 = t 55 = / {CBM-N}
{CBM-G}23 = x 56 = 1 {CBM-N}
{CBM-G}24 = 7 57 = _ {CBM-N}
{CBM-G}25 = y 58 = not used {CBM-N}
{CBM-G}26 = g 59 = 2 {CBM-N}
{CBM-G}27 = 8 60 = space {CBM-N}
{CBM-G}28 = b 61 = not used {CBM-N}
{CBM-G}29 = h 62 = q {CBM-N}
{CBM-G}30 = u 63 = run {CBM-N}
{CBM-G}31 = v 64 = no key pressed{CBM-N}
{CBM-G}32 = 9 {CBM-N}
{CBM-G} {CBM-N}
--------------------------------------
You can use location 197 as an
alternative to the get statement:
10 x=peek(197):ifx<>39then10
20 poke198,0:k$="n"
is much like
10 get k$: if k$<>"N" and k$<>"n" and
k$<>"{CBM-N}" and k$<>chr$(14) then 10
but only takes about 3/4 as much
memory.
======================================
Location:198 Hexadecimal: $00C6
Official Label: NDX Type: RAM
Useful BASIC commands: PEEK, POKE
NDX tells how many characters are
presently in the type-ahead buffer
(also known as the keyboard buffer).
This is most useful in conjunction
with the BASIC 'GET' statement.
After a page of instructions, you
will often want to wait for a key-
press so you use:
1000 GET K$
But if a key has already been pressed
before the instructions were printed,
then there's already a character
waiting to be "GOT". You want to
throw that character away and have
your GET get a fresh keypress. That's
why you should use:
1000 POKE 198,0: WAIT 198,1: GET K$
This will clear the keyboard buffer
of any spurious keypresses, then
wait for any key (no, not shift, or
ctrl, or commodore) to be pressed,
then assign K$ to the character of the
key pressed.
It takes a little more coding than
a simple GET K$, but the program won't
run on ahead of where you wanted it to
be.
--------------------------------------