[Addressed Listing] [Alphabetical Listing] [Error Codes]

GETIN

     Purpose:  Get a character
Call address:  $FFE4 (hex)  65508 (decimal)
Communication registers: A
Preparatory routines:  CHKIN , OPEN
Error returns:  See READST
Stack requirements:  7+
Registers affected:  A (X, Y)

Description:

If the channel is the keyboard, this subroutine removes one character from the keyboard queue and returns it as an ASCII value in the accumulator. If the queue is empty, the value returned in the accumulator will be zero. Characters are put into the queue automatically by an interrupt driven keyboard scan routine which calls the SCNKEY routine. The keyboard buffer can hold up to ten characters. After the buffer is filled, additional characters are ignored until at least one character has been removed from the queue. If the channel is RS-232, then only the A register is used and a single character is returned. See READST to check validity. If the channel is serial, cassette, or screen, call CHRIN routine.

How to Use:

  1. Call this routine using a JSR instruction.
  2. Check for a zero in the accumulator (empty buffer).
  3. Process the data.

EXAMPLE:

       ;WAIT FOR A CHARACTER
  WAIT JSR GETIN
       CMP #0
       BEQ WAIT

[Addressed Listing] [Alphabetical Listing] [Error Codes]