APPLICATIONSDIVERSGAMESLIST ★ FUNCTION KEY LISTER|COMPUTING WITH THE AMSTRAD) ★

FUNCTION KEY LISTER (COMPUTING WITH THE AMSTRAD)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

YOU'VE probably always taken it for granted that when you press the A key on your Amstrad you get the letter A reflected on your screen.

However, as this article shows, it ain't necessarily so. You can arrange things so that pressing the A will give you B, C or whatever. Confusing as this seems, it's actually quite useful.

The point is that each key in the Amstrad has its own unique number, in the range 0 to 79. This number simply labels the key switch - not the letter that happens to be printed on it.

It has to be like this to allow for the keys that are duplicated, such as the digits 0-9. How else could the Amstrad tell which of the two number 5s had been pressed for instance?

Fine, but how does the Amstrad know what to interpret the key press as? Well, it maintains a table to help it keep track - and when you switch on it defaults to the normal state of affairs, where pressing a key with the A marked on it is interpreted as A.

In actual fact our normal A key has the number 69 associated with it and, provided we haven't done anything clever, the Amstrad will look up 69 and see that it's linked with 65.

65? Yes, because that's the Ascii for A - remember that the Amstrad likes numbers, not letters. So our table links the key switch numbers with the Ascii code we want it to be interpreted as.

Why not label it as 65 in the first place, you may ask? Well, getting our characters in this way has three advantages:

  • It caters for the operating system.
  • It allows for duplicate keys.
  • It lets us redefine keys to give us any value between 0 and 251.

The code produced by a particular key when pressed is quite easily altered. If for some reason you wanted the A key to produce the letter B when pressed then:

KEY DEF 69,1,66

would tell the Amstrad to produce the Ascii code 66 when key number 69 is pressed. The 1 indicates that the key is to auto repeat if held down. Zero would disable this feature.

Extra codes can be tagged on to the end of the command to indicate which code is to be produced if Shift or Ctrl is held down at the same time.

The codes 128 to 159 have a special significance. The Amstrad stores 32 strings, one for each of these codes. When one of these special codes is produced it is removed from the keyboard buffer and replaced with the whole string. The keys producing these codes are called function keys.

To set up a function key to produce a string we use KEY. for instance:

KEY 128,"MODE 1"+CHR$(13)

As you can see, any string expression can be used. When the code 128 is encountered it is expanded into the full string.

Any key can be defined to produce the codes using KEY DEF. On power up, or after a reset, the keys on the numeric keypad to the right of the main keyboard produce codes 128 to 140. You'll have to use KEY DEF to redefine some of the other keys on the keyboard to produce the rest of the function key codes.

Although there are 32 strings, the Amstrad only reserves 120 bytes of memory. This will not be enough if all the keys are to be defined, or if long strings are to be used. Fortunately the function key buffer - the memory where the strings are stored - can be any size and anywhere in memory. It can only be relocated from machine code though.

LD DE,address
LD HL,length
CALL &BB15

will place the buffer at address and reserve length bytes for the strings.

With 32 function keys it's difficult to remember which have been defined and which haven't and what the definitions are. Accompanying this article is a short machine code utility to list the key definitions.

Run Program I, a Basic listing which pokes in the machine code. Program 11 is the equivalent assembly listing. Call &A000 to list the definitions.

The routine as it stands will only list keys 128 to 140, the default keys. If you want to list all the definitions then poke &A034 with 160 - the last key number plus 1. As this may produce rather a lot of output you can end at any time by pressing a key.

All the control codes such as carriage return. CHR$(13), are represented by their graphics symbols.
This prevents the display from being corrupted.

Function keys are quite handy when, typing in listings. As a final note, here's probably the most useful:

KEY 129,"CALL &BC02:CALL &BB4E: NODE 1: LIST"+CHR$(13)

It resets the inks, pen and paper, changes to Mode 1 and lists the program in memory, if any.

CWTA

★ PUBLISHER: Computing with the Amstrad
★ YEARS: 1985 , 1986
★ CONFIG: 64K + AMSDOS
★ LANGAGE: ???
★ LICENCE: LISTING
★ AUTHOR: Roland Waddilove

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listings:
  » Function  Key  Lister    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-07-22
DL: 7 fois
TYPE: ZIP
SIZE: 4Ko
NOTE: 40 Cyls
.HFE: NON

  » Function  Key  Lister    (Computing  with  the  Amstrad)    ENGLISH    LISTINGDATE: 2020-07-23
DL: 2 fois
TYPE: PDF
SIZE: 55Ko
NOTE: 1 page/PDFlib v1.6

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Copy Key Utility (Computing With the Amstrad)
» Applications » Speedkey
» Applications » Keysave
» Applications » Key Expander (The Amstrad User)
» Applications » Break Key (CPC Magazin)
» Applications » Keymouse (CPC Amstrad International)

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 223 millisecondes et consultée 26 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.