beautypg.com

Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual

Page 62

background image

RPBASIC-52 PROGRAMMING GUIDE

2-43

GET

Syntax:

A = GET

Function:

Gets chara cter from buffer.

Mode:

Run

Use:

A = GET

Cards:

All

D E S C R IP T I ON

GET is similar to INKEY$ in other Basic languages. GET returns the ASCII value of the character rather
than the string. This feature makes it useful when receiving binary information.

To rec eive a contro l-C va lue (3), s et bit 1, a ddress 26H.

DB Y(38 ) = DB Y(38 ) .OR . 1

This disables program breaks when a is received.

GET can extract cha racters from C OM 0 or COM 1. The UI 0 or U I 1 comm and is execute d to get characte rs
from an alterna te serial port.

The AS CII value 0 is a v alid numb er. Unfortunately, this va lue can indica te that there are no c haracters
available. If your applic ation program expects to rece ive ASC II 0's, the following program will wait until if
there are characters in the buffer to ensure a value of 0 is indeed valid.

100

IF COM(0) = 0 THEN 100

110

A = GET

Line 100 loops until there is a character in the buffer. Line 110 extracts the character from the buffer. When
A = 0, zero is the ASCII value.

RELATED

COM , COM $, INPUT , UI 1, UI 0

EXAMPLE

The fo llowin g progr am ta kes ch aracte rs one a t a tim e from the bu ffer and puts the m into expan ded m emo ry.
128K or more of RAM is needed.

100 IF COM(0) = 0 THEN 100
110 A=GET
120 POKEB 1,X,A
130 X=X+1
140 GOTO 100