EMMA 02

BASIC

  • Home
  • Download
  • Change Log
  • Help
  • Compilation
    • Windows
    • OS X
    • Ubuntu
    • Fedora
    • openSUSE
  • Forums
  • Tape Conversion
  • Machine Code
    • SYSTEM00
    • CDP1801
    • CDP1802
    • CDP1804
    • CDP1805
    • Differences
  • Pseudo Code
    • AMVBAS
    • AM4KBAS
    • CARDTRAN
    • Chip-8, 8X, ETI-660 & Elf
    • FEL-1
    • FPA-1
    • FPL-2
    • FPL-4
    • GPL-2
    • GPL-3
    • GPL-4
    • GPL-A (2K RAM)
    • GPL-A (2K ROM)
    • ST2
    • ST4
    • STK
    • Test-Word
    • Super-chip
  • BASIC
    • General Information
    • COMX BASIC V1.00
    • Floating Point BASIC 2.2
    • Pecom 32 BASIC
    • Pecom 64 BASIC 1.0 & 4.0
    • Quest Super BASIC 1.4
    • Quest Super BASIC 3.0
    • Quest Super BASIC 5.0
    • Quest Super BASIC 6.0
    • RCA BASIC3 V1.1
    • Telmac SBASIC v24.3
    • Error Messages
  • CDP18S020
    • General Information
    • I/O Map
  • Cidelsa
    • General Information
    • I/O Map
    • Memory
    • Video
    • Sound
  • COMX-35
    • General Information
    • F&M
    • Did You Know...?
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Cassette
    • Expansion Box
    • Disk
    • Printers
    • Thermal
    • PL-80
    • 32K RAM
    • 80 Column
    • F&M EPROM
    • F&M Joy Card
    • Super Board
    • COMX BASIC V1.00
  • COMIX-35
  • Cosmac Elf
    • General Information
    • I/O Map
  • Cosmac Elf 2000
    • General Information
    • I/O Map
    • Memory
    • Video
  • Cosmac Vip
    • General Information
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Cassette
    • STK
    • Chip-8 and 8X
    • Test-Word
    • Floating Point BASIC 2.2
  • Cosmac Vip II
    • General Information
    • I/O Map
    • Floating Point BASIC 2.2
  • Cosmicos
    • General Information
    • I/O Map
  • FRED 1
    • General Information
    • I/O Map
    • Cassette
    • CARDTRAN Syntax
  • FRED 1.5
    • General Information
    • I/O Map
    • Cassette
    • FPL-2
    • FPL-4
    • FEL-1
  • HUG1802/ETI-660
    • General Information
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Cassette
    • Chip-8 ETI-660
  • Infinite
    • General Information
    • I/O Map
  • MCDS
    • General Information
    • I/O Map
  • Membership Card
    • General Information
    • I/O Map
  • Microboard
    • General Information
    • I/O Map
  • Microtutor
    • General Information
    • I/O Map
  • Microtutor II
    • General Information
    • I/O Map
  • MS2000
    • General Information
    • I/O Map
  • Netronics Elf II
    • General Information
    • I/O Map
    • Keyboard
  • Oscom Nano
    • General Information
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Casette
  • Pecom 32 and 64
    • General Information
    • Software
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Casette
    • Pecom 32 BASIC
    • Pecom 64 BASIC 1.0 & 4.0
  • Pico/Elf V2
    • General Information
    • I/O Map
  • Quest Super Elf
    • General Information
    • I/O Map
  • RCA Coin Arcade
    • General Information
    • I/O Map
    • Memory
    • GPL-A (2K RAM)
    • GPL-A (2K ROM)
    • GPL-2
    • GPL-3
    • GPL-4
  • RCA Studio II
    • General Information
    • I/O Map
    • Memory
    • Video
    • Keyboard
    • ST2
  • RCA Studio III
    • General Information
    • I/O Map
    • Memory
    • Video
    • Keyboard
  • RCA Studio IV
    • General Information
    • I/O Map
    • Memory
    • Video
    • Keyboard
    • ST4 Syntax
  • Telmac TMC-600
    • General Information
    • Software
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Cassette
    • Telmac SBASIC v24.3
  • Telmac 1800
    • General Information
    • I/O Map
    • Memory
    • Video
    • Keyboard
    • Cassette
  • Telmac 2000
    • General Information
    • I/O Map
    • Memory
    • Video
    • Sound
    • Keyboard
    • Cassette
  • VELF
    • General Information
    • I/O Map
    • BIOS
    • Video
    • Keyboard
  • VIP2K MC
    • General Information
    • I/O Map
    • Memory
    • Video
    • Chip 8
  • Visicom COM-100
    • General Information
    • I/O Map
    • Memory
    • Video
    • Keyboard

 

 

 

 

 

 

 

 

 

 

 

 

KEY

Format: var = KEY

Supported by: Telmac SBASIC v 24.3, Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0

Similar commands:
COMX BASIC V1.00: KEY
Floating Point BASIC 2.2: GOKEY / KEY

This function returns the ASCII code of a key pressed. Its use may be illustrated by the following example.

10 IF KEY = 65 THEN GOTO 30
20 GOTO 10
30 PRINT "KEY A PRESSED"
40 END

When the function KEY is encountered, the keyboard is scanned, and the. ASCII code of the key pressed is returned. If this is equal to 65 (which is the ASCII decimal code for key A), the message "KEY A PRESSED" is printed, and the program is terminated. If any key other than key A is pressed, the program goes round a loop, scanning the keyboard repeatedly.

The above program illustrates the typical situation the function KEY is used. It is most often used in an "IF-statement" located within a loop, such that the keyboard is scanned repeatedly, and certain action will be taken if a specified key is pressed. This enables the pressing of the specified key to control the flow of a program.

Note: the following information may become useful for a more detailed understanding of the KEY function. When a key is pressed, its ASCII code is sent to a register or latch. Functions like KEY (or INPUT) will read the content of this latch, and then clear the latch. If no key is pressed, KEY will return the value 0.